-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BuildResidentialHPXML: make conditional arguments optional #1867
base: master
Are you sure you want to change the base?
Conversation
…n up hpxml_inputs.json.
…o optional-build-args
…o the other window area arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Will wait on ResStock testing before merging.
Should all optional arguments that use the OS-HPXML default when not provided have a default argument value set? For example, The implication of not doing this, as I'm noticing in ResStock, is that to allow "auto" I'd need to check for presence of "OS-HPXML default" in the argument description vs. checking that a default argument value is set. Edit: Including a default argument value for every argument with description "OS-HPXML default" probably wouldn't work. For example, it makes sense to have the |
Do arguments |
…L into optional-build-args
… default is used.
…n be comma-separated.
begin | ||
value = Float(value) | ||
if value % 1 == 0 | ||
args[name] = Integer(value) | ||
else | ||
args[name] = value | ||
end | ||
rescue | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bad idea. You should only be converting to integer/float for arguments that we've declared as integer/float, not simply converting anytime it's possible. I assume this is the reason that you then had to change a bunch of code so that it converts back to string.
You'll need to refactor the code so that you have access to the original desired argument type and use it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, should this really be in meta_measure.rb? Do you anticipate using this anywhere else than the BuildResHPXML measure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put it here because I found that ResStock needs to use it (with delete_auto = false
).
@@ -624,3 +624,38 @@ def is_integer? | |||
return true | |||
end | |||
end | |||
|
|||
# TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do this now (and anywhere else you added TODOs).
begin | ||
value = Float(value) | ||
if value % 1 == 0 | ||
args[name] = Integer(value) | ||
else | ||
args[name] = value | ||
end | ||
rescue | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, should this really be in meta_measure.rb? Do you anticipate using this anywhere else than the BuildResHPXML measure?
"cooling_system_cooling_capacity": 24000.0, | ||
"cooling_system_cooling_capacity": "24000.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, really? This might be a deal breaker. This is totally confusing and no one will be able to keep track of when they need a number vs a string. I didn't realize OpenStudio was going to require this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can update OpenStudio so that it allows this?
BuildResidentialHPXML/measure.rb
Outdated
# these were previously required arguments with default values set (i.e., arg.setDefaultValue(xxx)) | ||
args[:floor_over_foundation_assembly_r] = 28.1 if args[:floor_over_foundation_assembly_r].nil? | ||
args[:floor_over_garage_assembly_r] = 28.1 if args[:floor_over_garage_assembly_r].nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was really hoping we wouldn't need these (totally arbitrary) defaults. Why?
But if for some reason we do need them, this is definitely a step back from what we had before. Previously, at least a user opening the measure in the OS App or PAT would see the default value. Now they happen completely behind the scenes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some, yes, are totally arbitrary. I can fix/refactor those.
Others, for example heat pump backup fuel, are not. We can report the default value in the argument description (there's already precedent for this) and set it in its respective set_xxx
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does heat pump backup fuel need a default?
Pull Request Description
Change any required arguments that are ignored based on other arguments, to optional.
Remove
setDefaultValue
from all OpenStudio arguments. Required arguments must now pass a value.Create a
make_argument
wrapper for passing in argument name, type, required, etc and determining/creating appropriate OpenStudio arguments automatically:Create
convertArgumentValues
method called from beginning ofrun
method:Checklist
Not all may apply:
Schematron validator (EPvalidator.xml
) has been updatedSample files have been added/updated (openstudio tasks.rb update_hpxmls
)HPXMLtoOpenStudio/tests/test*.rb
and/orworkflow/tests/test*.rb
)Documentation has been updatedopenstudio tasks.rb update_measures
has been run