Closed mdahlhausen closed 4 months ago
Another method:
- getAbsoluteAzimuthForSurface(surface, model)
(/openstudio-extension-gem/lib/openstudio/extension/core/os_lib_geometry.rb)
Methods to move to C++
OsLib_HelperMethods.createRunVariables
is called https://github.com/NREL/openstudio-common-measures-gem/blob/5be24c8e8e7b28be5b1cb57b5757858d54ec3fcf/lib/measures/generic_qaqc/measure.rb#L172
OsLib_HelperMethods.checkDoubleAndIntegerArguments
(this should be rolled into createRunVariables) is called here https://github.com/NREL/openstudio-common-measures-gem/blob/5be24c8e8e7b28be5b1cb57b5757858d54ec3fcf/lib/measures/tariff_selection_time_and_date_dependant/measure.rb#L171C15-L171C65
OsLib_HelperMethods.populateChoiceArgFromModelObjects
(this should be rolled into createRunVariables) is called here https://github.com/NREL/openstudio-aedg-gem/blob/a5457e245591c99ba5e027779f1b0b3f9f6c0fa1/lib/measures/AedgK12InteriorFinishes/measure.rb#L53
OsLib_HelperMethods.checkChoiceArgFromModelObjects
(this should be rolled into createRunVariables) is called here https://github.com/NREL/openstudio-aedg-gem/blob/a5457e245591c99ba5e027779f1b0b3f9f6c0fa1/lib/measures/AedgK12InteriorFinishes/measure.rb#L81C24-L81C74
OsLib_HelperMethods.checkOptionalChoiceArgFromModelObjects
(this should be rolled into createRunVariables) is called here https://github.com/NREL/openstudio-aedg-gem/blob/a5457e245591c99ba5e027779f1b0b3f9f6c0fa1/lib/measures/AedgK12HvacFanCoilDoas/measure.rb#L84
OsLib_HelperMethods.check_upstream_measure_for_arg
is called https://github.com/NREL/openstudio-common-measures-gem/blob/5be24c8e8e7b28be5b1cb57b5757858d54ec3fcf/lib/measures/generic_qaqc/measure.rb#L249
Perhaps we could create an overloaded runner.validateUserArguments(script_arguments, user_arguments, model)
method (note the model
is new) that checks, for any user argument that has a handle (i.e., a UUID), whether that handle exists in model
.
Would this cover some of the functionality of the OsLib_HelperMethods.checkXXX
methods above?
populateChoiceArgFromModelObjects
. How about we do it this way:
static OSArgument makeChoiceArgument(
const std::string& name,
const std::map<std::string, std::string>& choices_to_display_values_map,
bool required = true, bool modelDependent = false);
That way you could do something like
choices_to_display_values_map = (
model.getInteriorPartitionSurfaces
.reject{|s| s.construction.empty?}
.map(&:construction).map(&:get)
.map{|c| [c.handle.to_s, c.nameString]}.to_h
)
choices_to_display_values_map[model.getBuilding.handle.to_s] = "*All Interior Partition Surfaces*"
object = OpenStudio::Measure::OSArgument.makeChoiceArgument('object', choices_to_display_values_map, true, true)
I think it's way more flexible that way.
Enhancement Request
There are several methods in
OsLib_HelperMethods
in the extension gem that should be native to theMeasure
orMeasure::OSArgument
objects in OpenStudio.Detailed Description
These are the specific methods that could be implemented in OpenStudio:
Possible Implementation
To be clear, I DO NOT think these methods should be adopted as is. Some are already partially or mostly addressed (checkDoubleAndIntegerArguments with #4551). @DavidGoldwasser - can you analyze which methods should live in OpenStudio, and which are best left to code in the measure, then comment below? @eringold may have thoughts as well.