-
Notifications
You must be signed in to change notification settings - Fork 208
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
Add native support for measure argument methods in OsLib_HelperMethods #5142
Conversation
…S >= 10.14 supports it, and E+ is 10.15 minimum anyways
…static as it should
* Try to align getPastStepValuesForName on check_upstream_measure_for_arg in what it picks for measure name * getPastStepValuesForMeasure: allow matching on either the WorkflowStep's measureDirName or name, or the WorkflowStepResult's measureName * Scope the test blocks for readability and avoiding side effects (less chances of making a mistake)
…rn defaultValue if value not set
// This function aims to replace OsLib_HelperMethods.createRunVariables | ||
// TODO: should this call validateUserArguments like the ruby counterpart? At least it validates that the defaults are supposed to match etc | ||
if (!validateUserArguments(script_arguments, user_arguments)) { | ||
registerError("Invalid argument values."); | ||
LOG_AND_THROW("Invalid argument values."); | ||
} |
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.
TODO: do we want this? I think we do.
if (arg.hasValue()) { | ||
argument_values[name] = arg.valueAsJSON(); | ||
} else if (arg.hasDefaultValue()) { | ||
// TODO: is this wanted? | ||
argument_values[name] = arg.defaultValueAsJSON(); |
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.
TODO: do we include defaultValue if not value?
// TODO: should we match on any of these three? | ||
if (istringEqual(measureName, step.measureDirName())) { // The directory name, eg `IncreaseWallRValue` | ||
LOG(Trace, "Step matches on measureDirName"); | ||
} else if (auto s_ = step.name(); istringEqual(measureName, *s_)) { // An optional, abritrary one | ||
LOG(Trace, "Step matches on name"); | ||
} else if (auto s_ = stepResult_->measureName(); | ||
istringEqual(measureName, *s_)) { // The xml one, eg `increase_insulation_r_value_for_exterior_walls_by_percentage` | ||
LOG(Trace, "Step matches on Step Result's measureName"); | ||
} else { | ||
continue; | ||
} |
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.
Right now it matches on any. Maybe we shouldn't, maybe we should have three functions.
Maybe we return an array of hashes instead, so user can pick.
} | ||
} | ||
break; |
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.
Breaking at first one found right now. Maybe that's bad.
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, I don't think this method was in the OSLibHelpers @joseph-robertson . It could be useful nonetheless
std::string measure_name = step.measureDirName(); // The directory name, eg `IncreaseWallRValue` | ||
if (auto s_ = step.name()) { // An optional, abritrary one | ||
measure_name = std::move(*s_); | ||
} | ||
// if (auto s_ = stepResult_->measureName()) { // The xml one, eg `increase_insulation_r_value_for_exterior_walls_by_percentage` | ||
// measure_name = std::move(*s_); | ||
// } |
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.
Trying to do it like check_upstream_measure_for_arg
if (auto value = root["value"]) { | ||
step_values[measure_name] = value; | ||
// TODO: check_upstream_measure_for_arg was breaking early, and returning a {:value => value, :measure_name => measure_name} format |
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.
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.
I approve, but I defer to @DavidGoldwasser for whether all expected functionality is here.
…true * Move logic to Variant::isTruish to determine if a variant is trueish (whether that's bool true, str = "true", int != 0, double != 0.0 * Add a OSRunner::prepareForMeasureRun() that takes no arg, protected, and friend OSWorkflow so we can use it without the penatly of instantiating an OSMeasure * In Apply Measure, when __SKIP__, correctly call prepareForMEasureRun before incrementing the step. And do load the BCLMeasure to write the resultInfo like the workflow-gem was doing
CI Results for c6ff09c:
|
Pull request overview
Pull Request Author
src/model/test
)src/energyplus/Test
)src/osversion/VersionTranslator.cpp
)Labels:
IDDChange
APIChange
Pull Request - Ready for CI
so that CI builds your PRReview Checklist
This will not be exhaustively relevant to every PR.