Skip to content

Commit

Permalink
Include reporting measure arguments to trigger vehicle outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
aspeake committed Oct 21, 2024
1 parent 28e1849 commit d17000e
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 30 deletions.
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>319e295c-0876-4df7-9be0-a91c007313b2</version_id>
<version_modified>2024-10-17T23:34:58Z</version_modified>
<version_id>5f76eb19-bda7-4881-9455-1ae69e3fac7b</version_id>
<version_modified>2024-10-21T17:04:36Z</version_modified>
<xml_checksum>D8922A73</xml_checksum>
<class_name>HPXMLtoOpenStudio</class_name>
<display_name>HPXML to OpenStudio Translator</display_name>
Expand Down Expand Up @@ -357,7 +357,7 @@
<filename>hpxml.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>D52C7C21</checksum>
<checksum>EDFD942E</checksum>
</file>
<file>
<filename>hpxml_schema/HPXML.xsd</filename>
Expand Down
24 changes: 23 additions & 1 deletion ReportSimulationOutput/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,17 @@ Generates annual resilience outputs.

<br/>

**Generate Annual Output: Vehicles**

Generates annual vehicle outputs.

- **Name:** ``include_annual_vehicle_outputs``
- **Type:** ``Boolean``

- **Required:** ``false``

<br/>

**Timeseries Reporting Frequency**

The frequency at which to report timeseries output data. Using 'none' will disable timeseries outputs.
Expand Down Expand Up @@ -367,6 +378,17 @@ Generates timeseries resilience outputs.

<br/>

**Generate Timeseries Output: Vehicles**

Generates timeseries vehicle outputs.

- **Name:** ``include_timeseries_vehicle_outputs``
- **Type:** ``Boolean``

- **Required:** ``false``

<br/>

**Generate Timeseries Output: Timestamp Convention**

Determines whether timeseries timestamps use the start-of-period or end-of-period convention. Doesn't apply if the output format is 'csv_dview'.
Expand Down Expand Up @@ -784,6 +806,6 @@ All possible measure outputs are listed below. Actual outputs depend on measure

- ``resilience_battery_hr``

- ``vehicle_electric_vehicle_discharging_mbtu``
- ``vehicle_electric_vehicle_discharging_m_btu``


33 changes: 26 additions & 7 deletions ReportSimulationOutput/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
arg.setDefaultValue(true)
args << arg

arg = OpenStudio::Measure::OSArgument::makeBoolArgument('include_annual_vehicle_outputs', false)
arg.setDisplayName('Generate Annual Output: Vehicles')
arg.setDescription('Generates annual vehicle outputs.')
arg.setDefaultValue(true)
args << arg

timeseries_frequency_chs = OpenStudio::StringVector.new
timeseries_frequency_chs << 'none'
timeseries_frequency_chs << 'timestep'
Expand Down Expand Up @@ -239,6 +245,12 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
arg.setDefaultValue(false)
args << arg

arg = OpenStudio::Measure::OSArgument::makeBoolArgument('include_timeseries_vehicle_outputs', false)
arg.setDisplayName('Generate Timeseries Output: Vehicles')
arg.setDescription('Generates timeseries vehicle outputs.')
arg.setDefaultValue(false)
args << arg

timestamp_chs = OpenStudio::StringVector.new
timestamp_chs << 'start'
timestamp_chs << 'end'
Expand Down Expand Up @@ -533,10 +545,12 @@ def energyPlusOutputRequests(runner, user_arguments)
end

# Vehicle outputs
if args[:include_timeseries_end_use_consumptions]
@vehicles.values.each do |vehicle_data|
vehicle_data.variables.each do |_sys_id, varkey, var|
@vehicles.values.each do |vehicle_data|
vehicle_data.variables.each do |_sys_id, varkey, var|
if args[:include_annual_vehicle_outputs]
result << OpenStudio::IdfObject.load("Output:Variable,#{varkey},#{var},runperiod;").get
end
if args[:include_timeseries_vehicle_outputs]
result << OpenStudio::IdfObject.load("Output:Variable,#{varkey},#{var},#{args[:timeseries_frequency]};").get
end
end
Expand Down Expand Up @@ -765,6 +779,7 @@ def get_outputs(runner, args)
# Remove EV battery discharging
@model.getElectricLoadCenterStorageLiIonNMCBatterys.each do |elcs|
next unless elcs.additionalProperties.getFeatureAsBoolean('is_ev').get

fuel.annual_output += get_report_variable_data_annual([elcs.name.to_s.upcase], ['Electric Storage Discharge Energy']) if fuel_type == FT::Elec
end

Expand All @@ -781,6 +796,7 @@ def get_outputs(runner, args)
# Remove timeseries EV battery discharging
@model.getElectricLoadCenterStorageLiIonNMCBatterys.each do |elcs|
next unless elcs.additionalProperties.getFeatureAsBoolean('is_ev').get

ev_discharge_timeseries_output = get_report_variable_data_timeseries([elcs.name.to_s.upcase], ['Electric Storage Discharge Energy'], UnitConversions.convert(1.0, 'J', fuel.timeseries_units), 0, args[:timeseries_frequency])
fuel.timeseries_output = fuel.timeseries_output.zip(ev_discharge_timeseries_output).map { |x, y| x + y }
end
Expand Down Expand Up @@ -1666,10 +1682,12 @@ def report_runperiod_output_results(runner, outputs, args, annual_output_path)
end

# Vehicles
@vehicles.each do |_type, vehicles_data|
results_out << ["#{vehicles_data.name} (#{vehicles_data.annual_units})", vehicles_data.annual_output.to_f.round(n_digits)]
if args[:include_annual_vehicle_outputs]
@vehicles.each do |_type, vehicles_data|
results_out << ["#{vehicles_data.name} (#{vehicles_data.annual_units})", vehicles_data.annual_output.to_f.round(n_digits)]
end
results_out << [line_break]
end
results_out << [line_break]

# Sizing data
if args[:include_annual_hvac_summary]
Expand Down Expand Up @@ -1842,7 +1860,7 @@ def report_timeseries_output_results(runner, outputs, timeseries_output_path, ar
else
resilience_data = []
end
if args[:include_timeseries_end_use_consumptions]
if args[:include_timeseries_vehicle_outputs]
vehicles_data = @vehicles.values.select { |x| x.timeseries_output.sum(0.0) != 0 }.map { |x| [x.name, x.timeseries_units] + x.timeseries_output.map { |v| v.round(n_digits) } }
else
vehicles_data = []
Expand Down Expand Up @@ -2859,6 +2877,7 @@ def setup_timeseries_includes(emissions, args)
end
if args[:include_timeseries_fuel_consumptions]
args[:include_timeseries_end_use_consumptions] = true
args[:include_timeseries_vehicle_outputs] = true
end
if args[:include_timeseries_system_use_consumptions]
args[:include_timeseries_end_use_consumptions] = true
Expand Down
54 changes: 46 additions & 8 deletions ReportSimulationOutput/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>report_simulation_output</name>
<uid>df9d170c-c21a-4130-866d-0d46b06073fd</uid>
<version_id>231cadf6-e649-4e59-99bd-f3ff073a700f</version_id>
<version_modified>2024-10-17T23:35:00Z</version_modified>
<version_id>f41d6d5f-673e-4686-9270-edee5eca7903</version_id>
<version_modified>2024-10-21T17:04:38Z</version_modified>
<xml_checksum>9BF1E6AC</xml_checksum>
<class_name>ReportSimulationOutput</class_name>
<display_name>HPXML Simulation Output Report</display_name>
Expand Down Expand Up @@ -323,6 +323,25 @@
</choice>
</choices>
</argument>
<argument>
<name>include_annual_vehicle_outputs</name>
<display_name>Generate Annual Output: Vehicles</display_name>
<description>Generates annual vehicle outputs.</description>
<type>Boolean</type>
<required>false</required>
<model_dependent>false</model_dependent>
<default_value>true</default_value>
<choices>
<choice>
<value>true</value>
<display_name>true</display_name>
</choice>
<choice>
<value>false</value>
<display_name>false</display_name>
</choice>
</choices>
</argument>
<argument>
<name>timeseries_frequency</name>
<display_name>Timeseries Reporting Frequency</display_name>
Expand Down Expand Up @@ -639,6 +658,25 @@
</choice>
</choices>
</argument>
<argument>
<name>include_timeseries_vehicle_outputs</name>
<display_name>Generate Timeseries Output: Vehicles</display_name>
<description>Generates timeseries vehicle outputs.</description>
<type>Boolean</type>
<required>false</required>
<model_dependent>false</model_dependent>
<default_value>false</default_value>
<choices>
<choice>
<value>true</value>
<display_name>true</display_name>
</choice>
<choice>
<value>false</value>
<display_name>false</display_name>
</choice>
</choices>
</argument>
<argument>
<name>timeseries_timestamp_convention</name>
<display_name>Generate Timeseries Output: Timestamp Convention</display_name>
Expand Down Expand Up @@ -1886,9 +1924,9 @@
<model_dependent>false</model_dependent>
</output>
<output>
<name>vehicle_electric_vehicle_discharging_mbtu</name>
<display_name>vehicle_electric_vehicle_discharging_mbtu</display_name>
<short_name>vehicle_electric_vehicle_discharging_mbtu</short_name>
<name>vehicle_electric_vehicle_discharging_m_btu</name>
<display_name>vehicle_electric_vehicle_discharging_m_btu</display_name>
<short_name>vehicle_electric_vehicle_discharging_m_btu</short_name>
<type>Double</type>
<model_dependent>false</model_dependent>
</output>
Expand Down Expand Up @@ -1919,7 +1957,7 @@
<filename>README.md</filename>
<filetype>md</filetype>
<usage_type>readme</usage_type>
<checksum>2A081F48</checksum>
<checksum>17EEAA25</checksum>
</file>
<file>
<filename>README.md.erb</filename>
Expand All @@ -1936,13 +1974,13 @@
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>F20C9ED3</checksum>
<checksum>916B5825</checksum>
</file>
<file>
<filename>test_report_sim_output.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>80B15911</checksum>
<checksum>9278BCB1</checksum>
</file>
</files>
</measure>
34 changes: 23 additions & 11 deletions ReportSimulationOutput/tests/test_report_sim_output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def teardown
"End Use: #{FT::Elec}: #{EUT::CeilingFan} (MBtu)",
"End Use: #{FT::Elec}: #{EUT::Television} (MBtu)",
"End Use: #{FT::Elec}: #{EUT::PlugLoads} (MBtu)",
"End Use: #{FT::Elec}: #{EUT::Vehicle} (MBtu)",
"End Use: #{FT::Elec}: #{EUT::WellPump} (MBtu)",
"End Use: #{FT::Elec}: #{EUT::PoolHeater} (MBtu)",
"End Use: #{FT::Elec}: #{EUT::PoolPump} (MBtu)",
Expand Down Expand Up @@ -202,6 +201,7 @@ def teardown
"Hot Water: #{HWT::Fixtures} (gal)",
"Hot Water: #{HWT::DistributionWaste} (gal)",
'Resilience: Battery (hr)',
"Vehicle: #{VT::VehicleDischarging} (MBtu)",
'HVAC Capacity: Cooling (Btu/h)',
'HVAC Capacity: Heating (Btu/h)',
'HVAC Capacity: Heat Pump Backup (Btu/h)',
Expand Down Expand Up @@ -291,6 +291,10 @@ def teardown
'Resilience: Battery'
]

BaseHPXMLTimeseriesColsVehicles = [
"Vehicle: #{VT::VehicleDischarging}"
]

BaseHPXMLTimeseriesColsTotalLoads = [
"Load: #{LT::Heating}",
"Load: #{LT::Cooling}",
Expand Down Expand Up @@ -462,7 +466,6 @@ def emission_annual_cols
"Emissions: #{scenario}: #{FT::Elec}: #{EUT::CeilingFan} (lb)",
"Emissions: #{scenario}: #{FT::Elec}: #{EUT::Television} (lb)",
"Emissions: #{scenario}: #{FT::Elec}: #{EUT::PlugLoads} (lb)",
"Emissions: #{scenario}: #{FT::Elec}: #{EUT::Vehicle} (lb)",
"Emissions: #{scenario}: #{FT::Elec}: #{EUT::WellPump} (lb)",
"Emissions: #{scenario}: #{FT::Elec}: #{EUT::PoolHeater} (lb)",
"Emissions: #{scenario}: #{FT::Elec}: #{EUT::PoolPump} (lb)",
Expand Down Expand Up @@ -606,7 +609,8 @@ def test_annual_only
'include_timeseries_zone_temperatures' => false,
'include_timeseries_airflows' => false,
'include_timeseries_weather' => false,
'include_timeseries_resilience' => false }
'include_timeseries_resilience' => false,
'include_timeseries_vehicle_outputs' => false }
annual_csv, timeseries_csv = _test_measure(args_hash)
assert(File.exist?(annual_csv))
assert(!File.exist?(timeseries_csv))
Expand Down Expand Up @@ -641,7 +645,8 @@ def test_annual_only2
'include_timeseries_zone_temperatures' => true,
'include_timeseries_airflows' => true,
'include_timeseries_weather' => true,
'include_timeseries_resilience' => true }
'include_timeseries_resilience' => true,
'include_timeseries_vehicle_outputs' => true }
annual_csv, timeseries_csv = _test_measure(args_hash)
assert(File.exist?(annual_csv))
assert(!File.exist?(timeseries_csv))
Expand All @@ -668,7 +673,8 @@ def test_annual_disabled_outputs
'include_annual_component_loads' => false,
'include_annual_hot_water_uses' => false,
'include_annual_hvac_summary' => false,
'include_annual_resilience' => false }
'include_annual_resilience' => false,
'include_annual_vehicle_outputs' => false }
annual_csv, timeseries_csv = _test_measure(args_hash)
assert(File.exist?(annual_csv))
assert(!File.exist?(timeseries_csv))
Expand Down Expand Up @@ -1040,7 +1046,8 @@ def test_timeseries_hourly_ALL
'include_timeseries_zone_temperatures' => true,
'include_timeseries_airflows' => true,
'include_timeseries_weather' => true,
'include_timeseries_resilience' => true }
'include_timeseries_resilience' => true,
'include_timeseries_vehicle_outputs' => true }
annual_csv, timeseries_csv = _test_measure(args_hash)
assert(File.exist?(annual_csv))
assert(File.exist?(timeseries_csv))
Expand All @@ -1050,7 +1057,8 @@ def test_timeseries_hourly_ALL
emission_fuels_timeseries_cols +
emission_end_uses_timeseries_cols +
pv_battery_timeseries_cols +
BaseHPXMLTimeseriesColsResilience
BaseHPXMLTimeseriesColsResilience +
BaseHPXMLTimeseriesColsVehicles
actual_timeseries_cols = File.readlines(timeseries_csv)[0].strip.split(',')
assert_equal(expected_timeseries_cols.sort, actual_timeseries_cols.sort)
timeseries_rows = CSV.read(timeseries_csv)
Expand Down Expand Up @@ -1083,7 +1091,8 @@ def test_timeseries_daily_ALL
'include_timeseries_zone_temperatures' => true,
'include_timeseries_airflows' => true,
'include_timeseries_weather' => true,
'include_timeseries_resilience' => true }
'include_timeseries_resilience' => true,
'include_timeseries_vehicle_outputs' => true }
annual_csv, timeseries_csv = _test_measure(args_hash)
assert(File.exist?(annual_csv))
assert(File.exist?(timeseries_csv))
Expand All @@ -1093,7 +1102,8 @@ def test_timeseries_daily_ALL
emission_fuels_timeseries_cols +
emission_end_uses_timeseries_cols +
pv_battery_timeseries_cols +
BaseHPXMLTimeseriesColsResilience
BaseHPXMLTimeseriesColsResilience +
BaseHPXMLTimeseriesColsVehicles
actual_timeseries_cols = File.readlines(timeseries_csv)[0].strip.split(',')
assert_equal(expected_timeseries_cols.sort, actual_timeseries_cols.sort)
timeseries_rows = CSV.read(timeseries_csv)
Expand Down Expand Up @@ -1122,7 +1132,8 @@ def test_timeseries_monthly_ALL
'include_timeseries_zone_temperatures' => true,
'include_timeseries_airflows' => true,
'include_timeseries_weather' => true,
'include_timeseries_resilience' => true }
'include_timeseries_resilience' => true,
'include_timeseries_vehicle_outputs' => true }
annual_csv, timeseries_csv = _test_measure(args_hash)
assert(File.exist?(annual_csv))
assert(File.exist?(timeseries_csv))
Expand All @@ -1132,7 +1143,8 @@ def test_timeseries_monthly_ALL
emission_fuels_timeseries_cols +
emission_end_uses_timeseries_cols +
pv_battery_timeseries_cols +
BaseHPXMLTimeseriesColsResilience
BaseHPXMLTimeseriesColsResilience +
BaseHPXMLTimeseriesColsVehicles
actual_timeseries_cols = File.readlines(timeseries_csv)[0].strip.split(',')
assert_equal(expected_timeseries_cols.sort, actual_timeseries_cols.sort)
timeseries_rows = CSV.read(timeseries_csv)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
"include_annual_hot_water_uses": true,
"include_annual_hvac_summary": true,
"include_annual_resilience": true,
"include_annual_vehicle_outputs": true,
"timeseries_frequency": "none",
"include_timeseries_total_consumptions": false,
"include_timeseries_fuel_consumptions": false,
Expand All @@ -132,6 +133,7 @@
"include_timeseries_airflows": false,
"include_timeseries_weather": false,
"include_timeseries_resilience": false,
"include_timeseries_vehicle_outputs": false,
"timeseries_timestamp_convention": "start",
"add_timeseries_dst_column": false,
"add_timeseries_utc_column": false,
Expand Down
Loading

0 comments on commit d17000e

Please sign in to comment.