Skip to content

Commit 8df6436

Browse files
committed
Changes based on review comments. And a little cleanup.
1 parent 603a1ad commit 8df6436

File tree

9 files changed

+46
-61
lines changed

9 files changed

+46
-61
lines changed

Changelog.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ __New Features__
99
- Adds stochastic schedule generation for electric vehicle charging (using `Vehicles`).
1010
- Removes generation of stochastic schedules for building components not present in the HPXML file.
1111
- Output updates:
12+
- **Breaking change**: Adds generator electricity produced to *total* fuel/energy use; previously it was only included in *net* values.
1213
- Adds new outputs for *net* peak electricity (summer/winter/annual); same as *total* peak electricity outputs but subtracts power produced by PV.
13-
- Adds generator electricity produced to *total* fuel/energy use; previously it was only included in *net* values.
1414

1515
__Bugfixes__
1616
- Fixes zero occupants specified for one unit in a whole MF building from being treated like zero occupants for every unit.

HPXMLtoOpenStudio/measure.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<schema_version>3.1</schema_version>
44
<name>hpxm_lto_openstudio</name>
55
<uid>b1543b30-9465-45ff-ba04-1d1f85e763bc</uid>
6-
<version_id>ec599fe4-42f2-4208-8bec-8dce59988805</version_id>
7-
<version_modified>2025-02-14T15:38:41Z</version_modified>
6+
<version_id>5ca1d59c-7e04-4173-a237-344775b19e8b</version_id>
7+
<version_modified>2025-02-17T23:51:11Z</version_modified>
88
<xml_checksum>D8922A73</xml_checksum>
99
<class_name>HPXMLtoOpenStudio</class_name>
1010
<display_name>HPXML to OpenStudio Translator</display_name>
@@ -453,7 +453,7 @@
453453
<filename>output.rb</filename>
454454
<filetype>rb</filetype>
455455
<usage_type>resource</usage_type>
456-
<checksum>909EEE86</checksum>
456+
<checksum>2824DDC1</checksum>
457457
</file>
458458
<file>
459459
<filename>psychrometrics.rb</filename>

HPXMLtoOpenStudio/resources/output.rb

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
# Collection of methods related to output reporting or writing output files.
44
module Outputs
5+
MeterCustomElectricityTotal = 'Electricity:Total'
6+
MeterCustomElectricityNet = 'Electricity:Net'
7+
MeterCustomElectricityPV = 'Electricity:PV'
8+
59
# Add EMS programs for output reporting. In the case where a whole SFA/MF building is
610
# being simulated, these programs are added to the whole building (merged) model, not
711
# the individual dwelling unit models.
@@ -1238,8 +1242,8 @@ def self.create_custom_meters(model)
12381242
end
12391243

12401244
# Create Total/Net meters
1241-
{ 'Electricity:Total' => total_key_vars,
1242-
'Electricity:Net' => net_key_vars }.each do |meter_name, key_vars|
1245+
{ MeterCustomElectricityTotal => total_key_vars,
1246+
MeterCustomElectricityNet => net_key_vars }.each do |meter_name, key_vars|
12431247
if key_vars.empty?
12441248
# Avoid OpenStudio warnings if nothing to decrement
12451249
meter = OpenStudio::Model::MeterCustom.new(model)
@@ -1257,7 +1261,7 @@ def self.create_custom_meters(model)
12571261
# Create PV meter
12581262
if not pv_key_vars.empty?
12591263
meter = OpenStudio::Model::MeterCustom.new(model)
1260-
meter.setName('Electricity:PV')
1264+
meter.setName(MeterCustomElectricityPV)
12611265
meter.setFuelType(EPlus::FuelTypeElectricity)
12621266
pv_key_vars.uniq.each do |key_var|
12631267
meter.addKeyVarGroup(key_var[0], key_var[1])

ReportSimulationOutput/measure.rb

+16-34
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ def get_outputs(runner, args)
10301030
if fuel_type == FT::Elec
10311031
te_types = [total_or_net]
10321032
else
1033-
te_types = [TE::Total, TE::Net]
1033+
te_types = [TE::Total]
10341034
end
10351035

10361036
te_types.each do |te_type|
@@ -1218,7 +1218,7 @@ def sanitize_name(name)
12181218
end
12191219

12201220
key_values.each do |key_value|
1221-
@output_variables[[output_variable_name, key_value]] = OutputVariable.new
1221+
@output_variables[[output_variable_name, key_value]] = OutputVariableOrMeter.new
12221222
@output_variables[[output_variable_name, key_value]].name = "#{output_variable_name}: #{key_value.split.map(&:capitalize).join(' ')}"
12231223
@output_variables[[output_variable_name, key_value]].timeseries_units = units
12241224
@output_variables[[output_variable_name, key_value]].timeseries_output = get_report_variable_data_timeseries([key_value], [output_variable_name], 1, 0, args[:timeseries_frequency])
@@ -1234,7 +1234,7 @@ def sanitize_name(name)
12341234
next
12351235
end
12361236

1237-
@output_meters[output_meter_name] = OutputMeter.new
1237+
@output_meters[output_meter_name] = OutputVariableOrMeter.new
12381238
@output_meters[output_meter_name].name = output_meter_name
12391239
@output_meters[output_meter_name].timeseries_units = units
12401240
@output_meters[output_meter_name].timeseries_output = get_report_meter_data_timeseries([output_meter_name], 1, 0, args[:timeseries_frequency])
@@ -2303,7 +2303,7 @@ def initialize
23032303
# TODO
23042304
class Fuel < BaseOutput
23052305
# @param meter [TODO] TODO
2306-
def initialize(meter: [])
2306+
def initialize(meter:)
23072307
super()
23082308
@meter = meter
23092309
@timeseries_output_by_system = {}
@@ -2316,7 +2316,7 @@ class EndUse < BaseOutput
23162316
# @param outputs [TODO] TODO
23172317
# @param is_negative [TODO] TODO
23182318
# @param is_storage [TODO] TODO
2319-
def initialize(outputs: [], is_negative: false, is_storage: false)
2319+
def initialize(outputs:, is_negative: false, is_storage: false)
23202320
super()
23212321
@variables = outputs.select { |o| !o[2].include?(':') }
23222322
@meters = outputs.select { |o| o[2].include?(':') }
@@ -2350,7 +2350,7 @@ def initialize()
23502350
# TODO
23512351
class HotWater < BaseOutput
23522352
# @param outputs [TODO] TODO
2353-
def initialize(outputs: [])
2353+
def initialize(outputs:)
23542354
super()
23552355
@variables = outputs.select { |o| !o[2].include?(':') }
23562356
@meters = outputs.select { |o| o[2].include?(':') }
@@ -2363,7 +2363,7 @@ def initialize(outputs: [])
23632363
# TODO
23642364
class Resilience < BaseOutput
23652365
# @param variables [TODO] TODO
2366-
def initialize(variables: [])
2366+
def initialize(variables:)
23672367
super()
23682368
@variables = variables
23692369
end
@@ -2418,16 +2418,6 @@ def initialize(ems_variable:)
24182418
attr_accessor(:ems_variable)
24192419
end
24202420

2421-
# TODO
2422-
class IdealLoad < BaseOutput
2423-
# @param variables [TODO] TODO
2424-
def initialize(variables: [])
2425-
super()
2426-
@variables = variables
2427-
end
2428-
attr_accessor(:variables)
2429-
end
2430-
24312421
# TODO
24322422
class PeakLoad < BaseOutput
24332423
# @param ems_variable [TODO] TODO
@@ -2473,15 +2463,7 @@ def initialize(variable:, variable_units:, timeseries_units:)
24732463
end
24742464

24752465
# TODO
2476-
class OutputVariable < BaseOutput
2477-
def initialize
2478-
super()
2479-
end
2480-
attr_accessor()
2481-
end
2482-
2483-
# TODO
2484-
class OutputMeter < BaseOutput
2466+
class OutputVariableOrMeter < BaseOutput
24852467
def initialize
24862468
super()
24872469
end
@@ -2626,8 +2608,8 @@ def get_timeseries_units_from_fuel_type(fuel_type)
26262608
# Fuels
26272609

26282610
@fuels = {}
2629-
@fuels[[FT::Elec, TE::Total]] = Fuel.new(meter: 'Electricity:Total'.upcase)
2630-
@fuels[[FT::Elec, TE::Net]] = Fuel.new(meter: 'Electricity:Net'.upcase)
2611+
@fuels[[FT::Elec, TE::Total]] = Fuel.new(meter: Outputs::MeterCustomElectricityTotal.upcase)
2612+
@fuels[[FT::Elec, TE::Net]] = Fuel.new(meter: Outputs::MeterCustomElectricityNet.upcase)
26312613
@fuels[[FT::Gas, TE::Total]] = Fuel.new(meter: "#{EPlus::FuelTypeNaturalGas}:Facility")
26322614
@fuels[[FT::Oil, TE::Total]] = Fuel.new(meter: "#{EPlus::FuelTypeOil}:Facility")
26332615
@fuels[[FT::Propane, TE::Total]] = Fuel.new(meter: "#{EPlus::FuelTypePropane}:Facility")
@@ -2698,12 +2680,12 @@ def get_timeseries_units_from_fuel_type(fuel_type)
26982680

26992681
# Peak Fuels
27002682
@peak_fuels = {}
2701-
@peak_fuels[[FT::Elec, TE::Total, PFT::Winter]] = PeakFuel.new(report: 'Peak Electricity Total', meter: 'Electricity:Total')
2702-
@peak_fuels[[FT::Elec, TE::Total, PFT::Summer]] = PeakFuel.new(report: 'Peak Electricity Total', meter: 'Electricity:Total')
2703-
@peak_fuels[[FT::Elec, TE::Total, PFT::Annual]] = PeakFuel.new(report: 'Peak Electricity Total', meter: 'Electricity:Total')
2704-
@peak_fuels[[FT::Elec, TE::Net, PFT::Winter]] = PeakFuel.new(report: 'Peak Electricity Net', meter: 'Electricity:Net')
2705-
@peak_fuels[[FT::Elec, TE::Net, PFT::Summer]] = PeakFuel.new(report: 'Peak Electricity Net', meter: 'Electricity:Net')
2706-
@peak_fuels[[FT::Elec, TE::Net, PFT::Annual]] = PeakFuel.new(report: 'Peak Electricity Net', meter: 'Electricity:Net')
2683+
@peak_fuels[[FT::Elec, TE::Total, PFT::Winter]] = PeakFuel.new(report: 'Peak Electricity Total', meter: Outputs::MeterCustomElectricityTotal)
2684+
@peak_fuels[[FT::Elec, TE::Total, PFT::Summer]] = PeakFuel.new(report: 'Peak Electricity Total', meter: Outputs::MeterCustomElectricityTotal)
2685+
@peak_fuels[[FT::Elec, TE::Total, PFT::Annual]] = PeakFuel.new(report: 'Peak Electricity Total', meter: Outputs::MeterCustomElectricityTotal)
2686+
@peak_fuels[[FT::Elec, TE::Net, PFT::Winter]] = PeakFuel.new(report: 'Peak Electricity Net', meter: Outputs::MeterCustomElectricityNet)
2687+
@peak_fuels[[FT::Elec, TE::Net, PFT::Summer]] = PeakFuel.new(report: 'Peak Electricity Net', meter: Outputs::MeterCustomElectricityNet)
2688+
@peak_fuels[[FT::Elec, TE::Net, PFT::Annual]] = PeakFuel.new(report: 'Peak Electricity Net', meter: Outputs::MeterCustomElectricityNet)
27072689

27082690
@peak_fuels.each do |key, peak_fuel|
27092691
fuel_type, total_or_net, peak_fuel_type = key

ReportSimulationOutput/measure.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<schema_version>3.1</schema_version>
44
<name>report_simulation_output</name>
55
<uid>df9d170c-c21a-4130-866d-0d46b06073fd</uid>
6-
<version_id>ec811fcb-e75a-4dca-bf29-66bef99bbcbf</version_id>
7-
<version_modified>2025-02-14T21:46:27Z</version_modified>
6+
<version_id>39eb4395-122f-406c-bdac-4b2d47c51b6c</version_id>
7+
<version_modified>2025-02-17T23:51:15Z</version_modified>
88
<xml_checksum>9BF1E6AC</xml_checksum>
99
<class_name>ReportSimulationOutput</class_name>
1010
<display_name>HPXML Simulation Output Report</display_name>
@@ -1972,7 +1972,7 @@
19721972
<filename>measure.rb</filename>
19731973
<filetype>rb</filetype>
19741974
<usage_type>script</usage_type>
1975-
<checksum>46B0A3F1</checksum>
1975+
<checksum>9A940C81</checksum>
19761976
</file>
19771977
<file>
19781978
<filename>test_report_sim_output.rb</filename>

ReportUtilityBills/measure.rb

+9-9
Original file line numberDiff line numberDiff line change
@@ -693,19 +693,19 @@ def get_utility_bills(fuels, utility_rates, utility_bills, utility_bill_scenario
693693
end
694694
end
695695

696-
# Initialize the Fuel objects with meter and units.
696+
# Initialize the Fuel objects with meter and fuel units.
697697
#
698698
# @return [Hash] Fuel type, is_production => Fuel object
699699
def setup_fuel_outputs()
700700
fuels = {}
701-
fuels[[FT::Elec, false]] = Fuel.new(meter: 'ELECTRICITY:TOTAL', units: UtilityBills.get_fuel_units(HPXML::FuelTypeElectricity))
702-
fuels[[FT::Elec, true]] = Fuel.new(meter: 'ELECTRICITY:PV', units: UtilityBills.get_fuel_units(HPXML::FuelTypeElectricity))
703-
fuels[[FT::Gas, false]] = Fuel.new(meter: "#{EPlus::FuelTypeNaturalGas}:Facility", units: UtilityBills.get_fuel_units(HPXML::FuelTypeNaturalGas))
704-
fuels[[FT::Oil, false]] = Fuel.new(meter: "#{EPlus::FuelTypeOil}:Facility", units: UtilityBills.get_fuel_units(HPXML::FuelTypeOil))
705-
fuels[[FT::Propane, false]] = Fuel.new(meter: "#{EPlus::FuelTypePropane}:Facility", units: UtilityBills.get_fuel_units(HPXML::FuelTypePropane))
706-
fuels[[FT::WoodCord, false]] = Fuel.new(meter: "#{EPlus::FuelTypeWoodCord}:Facility", units: UtilityBills.get_fuel_units(HPXML::FuelTypeWoodCord))
707-
fuels[[FT::WoodPellets, false]] = Fuel.new(meter: "#{EPlus::FuelTypeWoodPellets}:Facility", units: UtilityBills.get_fuel_units(HPXML::FuelTypeWoodPellets))
708-
fuels[[FT::Coal, false]] = Fuel.new(meter: "#{EPlus::FuelTypeCoal}:Facility", units: UtilityBills.get_fuel_units(HPXML::FuelTypeCoal))
701+
fuels[[FT::Elec, false]] = Fuel.new(meter: Outputs::MeterCustomElectricityTotal.upcase, fuel: HPXML::FuelTypeElectricity)
702+
fuels[[FT::Elec, true]] = Fuel.new(meter: Outputs::MeterCustomElectricityPV.upcase, fuel: HPXML::FuelTypeElectricity)
703+
fuels[[FT::Gas, false]] = Fuel.new(meter: "#{EPlus::FuelTypeNaturalGas}:Facility", fuel: HPXML::FuelTypeNaturalGas)
704+
fuels[[FT::Oil, false]] = Fuel.new(meter: "#{EPlus::FuelTypeOil}:Facility", fuel: HPXML::FuelTypeOil)
705+
fuels[[FT::Propane, false]] = Fuel.new(meter: "#{EPlus::FuelTypePropane}:Facility", fuel: HPXML::FuelTypePropane)
706+
fuels[[FT::WoodCord, false]] = Fuel.new(meter: "#{EPlus::FuelTypeWoodCord}:Facility", fuel: HPXML::FuelTypeWoodCord)
707+
fuels[[FT::WoodPellets, false]] = Fuel.new(meter: "#{EPlus::FuelTypeWoodPellets}:Facility", fuel: HPXML::FuelTypeWoodPellets)
708+
fuels[[FT::Coal, false]] = Fuel.new(meter: "#{EPlus::FuelTypeCoal}:Facility", fuel: HPXML::FuelTypeCoal)
709709
return fuels
710710
end
711711

ReportUtilityBills/measure.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<schema_version>3.1</schema_version>
44
<name>report_utility_bills</name>
55
<uid>ca88a425-e59a-4bc4-af51-c7e7d1e960fe</uid>
6-
<version_id>abdfdae9-e81b-4c19-b67d-6d64c34562a5</version_id>
7-
<version_modified>2025-02-14T15:38:48Z</version_modified>
6+
<version_id>4c6ffc6f-5918-4eaa-a027-01b24f95f1a1</version_id>
7+
<version_modified>2025-02-17T23:51:16Z</version_modified>
88
<xml_checksum>15BF4E57</xml_checksum>
99
<class_name>ReportUtilityBills</class_name>
1010
<display_name>Utility Bills Report</display_name>
@@ -180,7 +180,7 @@
180180
<filename>measure.rb</filename>
181181
<filetype>rb</filetype>
182182
<usage_type>script</usage_type>
183-
<checksum>1A6E211B</checksum>
183+
<checksum>BBA464A6</checksum>
184184
</file>
185185
<file>
186186
<filename>detailed_rates/README.md</filename>
@@ -318,7 +318,7 @@
318318
<filename>util.rb</filename>
319319
<filetype>rb</filetype>
320320
<usage_type>resource</usage_type>
321-
<checksum>1F8963FA</checksum>
321+
<checksum>BF9C0E6C</checksum>
322322
</file>
323323
<file>
324324
<filename>Contains Demand Charges.json</filename>

ReportUtilityBills/resources/util.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
# Object that stores collections of EnergyPlus meter names, units, and timeseries data.
44
class Fuel
55
# @param meter [String] EnergyPlus meter name
6-
# @param units [String] fuel units (HPXML::FuelTypeXXX)
7-
def initialize(meter:, units:)
6+
# @param fuel [String] fuel type (HPXML::FuelTypeXXX)
7+
def initialize(meter:, fuel:)
88
@meter = meter
99
@timeseries = []
10-
@units = units
10+
@units = UtilityBills.get_fuel_units(fuel)
1111
end
1212
attr_accessor(:meter, :timeseries, :units)
1313
end

docs/source/workflow_outputs.rst

-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ Peak Building Electricity
336336
~~~~~~~~~~~~~~~~~~~~~~~~~
337337

338338
Peak building electricity outputs are listed below.
339-
FIXME Values include any home battery charging/discharging and EV charging.
340339

341340
================================== =============================================================
342341
Type Notes

0 commit comments

Comments
 (0)