Skip to content

Commit

Permalink
Backport bugfix.
Browse files Browse the repository at this point in the history
  • Loading branch information
shorowit committed Oct 31, 2023
1 parent a689e46 commit 9272388
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
12 changes: 6 additions & 6 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>c439cd82-9520-4e6e-89cf-61ea76592449</version_id>
<version_modified>2023-10-27T22:33:29Z</version_modified>
<version_id>0f2bf881-49f1-441b-bf63-6f7efd235d8c</version_id>
<version_modified>2023-10-31T03:21:41Z</version_modified>
<xml_checksum>D8922A73</xml_checksum>
<class_name>HPXMLtoOpenStudio</class_name>
<display_name>HPXML to OpenStudio Translator</display_name>
Expand Down Expand Up @@ -244,7 +244,7 @@
<filename>hotwater_appliances.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>0C686A51</checksum>
<checksum>9EF701EF</checksum>
</file>
<file>
<filename>hpxml.rb</filename>
Expand All @@ -256,7 +256,7 @@
<filename>hpxml_defaults.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>7A3FF103</checksum>
<checksum>1B6E9987</checksum>
</file>
<file>
<filename>hpxml_schema/HPXML.xsd</filename>
Expand Down Expand Up @@ -508,7 +508,7 @@
<filename>test_defaults.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>99BB85F5</checksum>
<checksum>7BDEFB8D</checksum>
</file>
<file>
<filename>test_enclosure.rb</filename>
Expand All @@ -526,7 +526,7 @@
<filename>test_hotwater_appliance.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>EAC36405</checksum>
<checksum>799D4258</checksum>
</file>
<file>
<filename>test_hvac.rb</filename>
Expand Down
16 changes: 12 additions & 4 deletions HPXMLtoOpenStudio/resources/hotwater_appliances.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,18 @@ def self.apply(model, runner, hpxml, weather, spaces, hot_water_distribution,
fixtures = hpxml.water_fixtures.select { |wf| [HPXML::WaterFixtureTypeShowerhead, HPXML::WaterFixtureTypeFaucet].include? wf.water_fixture_type }
if fixtures.size > 0
if fixtures.any? { |wf| wf.count.nil? }
showerheads = fixtures.select{ |wf| wf.water_fixture_type == HPXML::WaterFixtureTypeShowerhead }
frac_low_flow_showerheads = showerheads.select{ |wf| wf.low_flow }.size / Float(showerheads.size)
faucets = fixtures.select{ |wf| wf.water_fixture_type == HPXML::WaterFixtureTypeFaucet }
frac_low_flow_faucets = faucets.select{ |wf| wf.low_flow }.size / Float(faucets.size)
showerheads = fixtures.select { |wf| wf.water_fixture_type == HPXML::WaterFixtureTypeShowerhead }
if showerheads.size > 0
frac_low_flow_showerheads = showerheads.select { |wf| wf.low_flow }.size / Float(showerheads.size)
else
frac_low_flow_showerheads = 0.0
end
faucets = fixtures.select { |wf| wf.water_fixture_type == HPXML::WaterFixtureTypeFaucet }
if faucets.size > 0
frac_low_flow_faucets = faucets.select { |wf| wf.low_flow }.size / Float(faucets.size)
else
frac_low_flow_faucets = 0.0
end
frac_low_flow_fixtures = 0.4 * frac_low_flow_showerheads + 0.6 * frac_low_flow_faucets
else
num_wfs = fixtures.map { |wf| wf.count }.sum
Expand Down

0 comments on commit 9272388

Please sign in to comment.