Skip to content

Commit

Permalink
Stub generic makeArgument method.
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-robertson committed Oct 31, 2024
1 parent 5075a60 commit c07ebb2
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 65 deletions.
84 changes: 25 additions & 59 deletions BuildResidentialHPXML/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,58 +40,31 @@ def modeler_description
def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
docs_base_url = "https://openstudio-hpxml.readthedocs.io/en/v#{Version::OS_HPXML_Version}/workflow_inputs.html"

args = OpenStudio::Measure::OSArgumentVector.new

arg = OpenStudio::Measure::OSArgument.makeStringArgument('hpxml_path', true)
arg.setDisplayName('HPXML File Path')
arg.setDescription('Absolute/relative path of the HPXML file.')
args << arg

arg = OpenStudio::Measure::OSArgument.makeStringArgument('existing_hpxml_path', false)
arg.setDisplayName('Existing HPXML File Path')
arg.setDescription('Absolute/relative path of the existing HPXML file. If not provided, a new HPXML file with one Building element is created. If provided, a new Building element will be appended to this HPXML file (e.g., to create a multifamily HPXML file describing multiple dwelling units).')
args << arg

arg = OpenStudio::Measure::OSArgument::makeBoolArgument('whole_sfa_or_mf_building_sim', false)
arg.setDisplayName('Whole SFA/MF Building Simulation?')
arg.setDescription('If the HPXML file represents a single family-attached/multifamily building with multiple dwelling units defined, specifies whether to run the HPXML file as a single whole building model.')
args << arg

arg = OpenStudio::Measure::OSArgument.makeStringArgument('software_info_program_used', false)
arg.setDisplayName('Software Info: Program Used')
arg.setDescription('The name of the software program used.')
args << arg

arg = OpenStudio::Measure::OSArgument.makeStringArgument('software_info_program_version', false)
arg.setDisplayName('Software Info: Program Version')
arg.setDescription('The version of the software program used.')
args << arg

arg = OpenStudio::Measure::OSArgument.makeStringArgument('schedules_filepaths', false)
arg.setDisplayName('Schedules: CSV File Paths')
arg.setDescription('Absolute/relative paths of csv files containing user-specified detailed schedules. If multiple files, use a comma-separated list.')
args << arg

arg = OpenStudio::Measure::OSArgument.makeStringArgument('schedules_unavailable_period_types', false)
arg.setDisplayName('Schedules: Unavailable Period Types')
arg.setDescription("Specifies the unavailable period types. Possible types are column names defined in unavailable_periods.csv: #{Schedule.unavailable_period_types.join(', ')}. If multiple periods, use a comma-separated list.")
args << arg

arg = OpenStudio::Measure::OSArgument.makeStringArgument('schedules_unavailable_period_dates', false)
arg.setDisplayName('Schedules: Unavailable Period Dates')
arg.setDescription('Specifies the unavailable period date ranges. Enter a date range like "Dec 15 - Jan 15". Optionally, can enter hour of the day like "Dec 15 2 - Jan 15 20" (start hour can be 0 through 23 and end hour can be 1 through 24). If multiple periods, use a comma-separated list.')
args << arg
def makeArgument(name, type, required, display_name, units, default_value, choices, description)
if choices.nil?
arg = OpenStudio::Measure::OSArgument.send(type, name, required)
else
arg = OpenStudio::Measure::OSArgument.send(type, name, choices, required)
end
arg.setDisplayName(display_name)
arg.setDescription(description)
arg.setUnits(units) if !units.nil?
arg.setDefaultValue(default_value) if !default_value.nil?
return arg
end

arg = OpenStudio::Measure::OSArgument.makeStringArgument('schedules_unavailable_period_window_natvent_availabilities', false)
arg.setDisplayName('Schedules: Unavailable Period Window Natural Ventilation Availabilities')
arg.setDescription("The availability of the natural ventilation schedule during unavailable periods. Valid choices are: #{[HPXML::ScheduleRegular, HPXML::ScheduleAvailable, HPXML::ScheduleUnavailable].join(', ')}. If multiple periods, use a comma-separated list. If not provided, the OS-HPXML default (see <a href='#{docs_base_url}#hpxml-unavailable-periods'>HPXML Unavailable Periods</a>) is used.")
args << arg
args = OpenStudio::Measure::OSArgumentVector.new

arg = OpenStudio::Measure::OSArgument::makeIntegerArgument('simulation_control_timestep', false)
arg.setDisplayName('Simulation Control: Timestep')
arg.setUnits('min')
arg.setDescription("Value must be a divisor of 60. If not provided, the OS-HPXML default (see <a href='#{docs_base_url}#hpxml-simulation-control'>HPXML Simulation Control</a>) is used.")
args << arg
args << makeArgument('hpxml_path', Argument::String, true, 'HPXML File Path', nil, nil, nil, 'Absolute/relative path of the HPXML file.')
args << makeArgument('existing_hpxml_path', Argument::String, false, 'Existing HPXML File Path', nil, nil, nil, 'Absolute/relative path of the existing HPXML file. If not provided, a new HPXML file with one Building element is created. If provided, a new Building element will be appended to this HPXML file (e.g., to create a multifamily HPXML file describing multiple dwelling units).')
args << makeArgument('whole_sfa_or_mf_building_sim', Argument::Boolean, false, 'Whole SFA/MF Building Simulation?', nil, nil, nil, 'If the HPXML file represents a single family-attached/multifamily building with multiple dwelling units defined, specifies whether to run the HPXML file as a single whole building model.')
args << makeArgument('software_info_program_used', Argument::String, false, 'Software Info: Program Used', nil, nil, nil, 'The name of the software program used.')
args << makeArgument('software_info_program_version', Argument::String, false, 'Software Info: Program Version', nil, nil, nil, 'The version of the software program used.')
args << makeArgument('schedules_filepaths', Argument::String, false, 'Schedules: CSV File Paths', nil, nil, nil, 'Absolute/relative paths of csv files containing user-specified detailed schedules. If multiple files, use a comma-separated list.')
args << makeArgument('schedules_unavailable_period_types', Argument::String, false, 'Schedules: Unavailable Period Types', nil, nil, nil, "Specifies the unavailable period types. Possible types are column names defined in unavailable_periods.csv: #{Schedule.unavailable_period_types.join(', ')}. If multiple periods, use a comma-separated list.")
args << makeArgument('schedules_unavailable_period_dates', Argument::String, false, 'Schedules: Unavailable Period Dates', nil, nil, nil, 'Specifies the unavailable period date ranges. Enter a date range like "Dec 15 - Jan 15". Optionally, can enter hour of the day like "Dec 15 2 - Jan 15 20" (start hour can be 0 through 23 and end hour can be 1 through 24). If multiple periods, use a comma-separated list.')
args << makeArgument('schedules_unavailable_period_window_natvent_availabilities', Argument::String, false, 'Schedules: Unavailable Period Window Natural Ventilation Availabilities', nil, nil, nil, "The availability of the natural ventilation schedule during unavailable periods. Valid choices are: #{[HPXML::ScheduleRegular, HPXML::ScheduleAvailable, HPXML::ScheduleUnavailable].join(', ')}. If multiple periods, use a comma-separated list. If not provided, the OS-HPXML default (see <a href='#{docs_base_url}#hpxml-unavailable-periods'>HPXML Unavailable Periods</a>) is used.")
args << makeArgument('simulation_control_timestep', Argument::Integer, false, 'Simulation Control: Timestep', 'min', nil, nil, "Value must be a divisor of 60. If not provided, the OS-HPXML default (see <a href='#{docs_base_url}#hpxml-simulation-control'>HPXML Simulation Control</a>) is used.")

arg = OpenStudio::Measure::OSArgument::makeStringArgument('simulation_control_run_period', false)
arg.setDisplayName('Simulation Control: Run Period')
Expand Down Expand Up @@ -122,16 +95,9 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
defrost_model_type_choices = OpenStudio::StringVector.new
defrost_model_type_choices << HPXML::AdvancedResearchDefrostModelTypeStandard
defrost_model_type_choices << HPXML::AdvancedResearchDefrostModelTypeAdvanced
arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('simulation_control_defrost_model_type', defrost_model_type_choices, false)
arg.setDisplayName('Simulation Control: Defrost Model Type')
arg.setDescription("Research feature to select the type of defrost model. Use #{HPXML::AdvancedResearchDefrostModelTypeStandard} for default E+ defrost setting. Use #{HPXML::AdvancedResearchDefrostModelTypeAdvanced} for an improved model that better accounts for load and energy use during defrost; using #{HPXML::AdvancedResearchDefrostModelTypeAdvanced} may impact simulation runtime. If not provided, the OS-HPXML default (see <a href='#{docs_base_url}#hpxml-simulation-control'>HPXML Simulation Control</a>) is used.")
args << arg

arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('simulation_control_onoff_thermostat_deadband', false)
arg.setDisplayName('Simulation Control: HVAC On-Off Thermostat Deadband')
arg.setDescription('Research feature to model on-off thermostat deadband and start-up degradation for single or two speed AC/ASHP systems, and realistic time-based staging for two speed AC/ASHP systems. Currently only supported with 1 min timestep.')
arg.setUnits('deg-F')
args << arg
args << makeArgument('simulation_control_defrost_model_type', Argument::Choice, false, 'Simulation Control: Defrost Model Type', nil, nil, defrost_model_type_choices, "Research feature to select the type of defrost model. Use #{HPXML::AdvancedResearchDefrostModelTypeStandard} for default E+ defrost setting. Use #{HPXML::AdvancedResearchDefrostModelTypeAdvanced} for an improved model that better accounts for load and energy use during defrost; using #{HPXML::AdvancedResearchDefrostModelTypeAdvanced} may impact simulation runtime. If not provided, the OS-HPXML default (see <a href='#{docs_base_url}#hpxml-simulation-control'>HPXML Simulation Control</a>) is used.")
args << makeArgument('simulation_control_onoff_thermostat_deadband', Argument::Double, false, 'Simulation Control: HVAC On-Off Thermostat Deadband', 'deg-F', nil, nil, 'Research feature to model on-off thermostat deadband and start-up degradation for single or two speed AC/ASHP systems, and realistic time-based staging for two speed AC/ASHP systems. Currently only supported with 1 min timestep.')

arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('simulation_control_heat_pump_backup_heating_capacity_increment', false)
arg.setDisplayName('Simulation Control: Heat Pump Backup Heating Capacity Increment')
Expand Down
6 changes: 3 additions & 3 deletions BuildResidentialHPXML/measure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<schema_version>3.1</schema_version>
<name>build_residential_hpxml</name>
<uid>a13a8983-2b01-4930-8af2-42030b6e4233</uid>
<version_id>c547df04-6517-484e-9bc0-ebf7ad6e42c3</version_id>
<version_modified>2024-10-30T23:22:16Z</version_modified>
<version_id>07faa47e-1423-4895-bf4a-a63c28380892</version_id>
<version_modified>2024-10-31T15:35:26Z</version_modified>
<xml_checksum>2C38F48B</xml_checksum>
<class_name>BuildResidentialHPXML</class_name>
<display_name>HPXML Builder</display_name>
Expand Down Expand Up @@ -7504,7 +7504,7 @@
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>13F97DC9</checksum>
<checksum>3205AB56</checksum>
</file>
<file>
<filename>constants.rb</filename>
Expand Down
6 changes: 3 additions & 3 deletions HPXMLtoOpenStudio/measure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<schema_version>3.1</schema_version>
<name>hpxm_lto_openstudio</name>
<uid>b1543b30-9465-45ff-ba04-1d1f85e763bc</uid>
<version_id>2aac8715-c3f4-44d4-ad81-030059bc7e7e</version_id>
<version_modified>2024-10-30T17:45:14Z</version_modified>
<version_id>c6148c68-9bd3-464d-98a2-ad891fe4b2d1</version_id>
<version_modified>2024-10-31T15:35:29Z</version_modified>
<xml_checksum>D8922A73</xml_checksum>
<class_name>HPXMLtoOpenStudio</class_name>
<display_name>HPXML to OpenStudio Translator</display_name>
Expand Down Expand Up @@ -207,7 +207,7 @@
<filename>constants.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>22E067E1</checksum>
<checksum>84BDFCE4</checksum>
</file>
<file>
<filename>constructions.rb</filename>
Expand Down
9 changes: 9 additions & 0 deletions HPXMLtoOpenStudio/resources/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,15 @@ module Constants
'WY' => 'Wyoming' }
end

# TODO
module Argument
Choice = 'makeChoiceArgument'
String = 'makeStringArgument'
Double = 'makeDoubleArgument'
Integer = 'makeIntegerArgument'
Boolean = 'makeBoolArgument'
end

# Total Energy (Constants for output reporting)
module TE
Total = 'Total'
Expand Down

0 comments on commit c07ebb2

Please sign in to comment.