Skip to content

Commit

Permalink
Merge pull request #1899 from NREL/whole-mf-bldg-zero-occupants
Browse files Browse the repository at this point in the history
Fixes whole MF building bug when zero occupants in one unit
  • Loading branch information
shorowit authored Dec 20, 2024
2 parents c38762e + a6fbda7 commit d53251a
Show file tree
Hide file tree
Showing 34 changed files with 498 additions and 740 deletions.
3 changes: 2 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
__New Features__

__Bugfixes__
- Bugfix for when detailed schedules are used with higher resolution (e.g., 10-min data) than the simulation timestep (e.g., 60-min).
- Fixes zero occupants specified for one unit in a whole MF building from being treated like zero occupants for every unit.
- Fixes using detailed schedules with higher resolution (e.g., 10-min data) than the simulation timestep (e.g., 60-min).

## OpenStudio-HPXML v1.9.1

Expand Down
14 changes: 0 additions & 14 deletions HPXMLtoOpenStudio/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -407,20 +407,6 @@ def init(model, hpxml_bldg, hpxml_header)
if hpxml_header.apply_ashrae140_assumptions.nil?
hpxml_header.apply_ashrae140_assumptions = false
end

if not hpxml_bldg.building_occupancy.number_of_residents.nil?
# If zero occupants, ensure end uses of interest are zeroed out
if (hpxml_bldg.building_occupancy.number_of_residents == 0) && (not hpxml_header.apply_ashrae140_assumptions)
hpxml_header.unavailable_periods.add(column_name: 'Vacancy',
begin_month: hpxml_header.sim_begin_month,
begin_day: hpxml_header.sim_begin_day,
begin_hour: 0,
end_month: hpxml_header.sim_end_month,
end_day: hpxml_header.sim_end_day,
end_hour: 24,
natvent_availability: HPXML::ScheduleUnavailable)
end
end
end
end

Expand Down
60 changes: 27 additions & 33 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>46857481-52a7-45eb-8b03-355d10898dac</version_id>
<version_modified>2024-12-13T01:05:41Z</version_modified>
<version_id>771dde81-1742-4c4a-90f5-ca41ad0afad4</version_id>
<version_modified>2024-12-20T19:16:39Z</version_modified>
<xml_checksum>D8922A73</xml_checksum>
<class_name>HPXMLtoOpenStudio</class_name>
<display_name>HPXML to OpenStudio Translator</display_name>
Expand Down Expand Up @@ -183,13 +183,13 @@
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>D7F18DFB</checksum>
<checksum>CA101CA3</checksum>
</file>
<file>
<filename>airflow.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>C329DF48</checksum>
<checksum>14A94278</checksum>
</file>
<file>
<filename>battery.rb</filename>
Expand Down Expand Up @@ -327,7 +327,7 @@
<filename>defaults.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>CCB18256</checksum>
<checksum>F2AE9AD3</checksum>
</file>
<file>
<filename>energyplus.rb</filename>
Expand All @@ -351,7 +351,7 @@
<filename>hotwater_appliances.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>5F7B3A25</checksum>
<checksum>0B205523</checksum>
</file>
<file>
<filename>hpxml.rb</filename>
Expand Down Expand Up @@ -387,7 +387,7 @@
<filename>hvac.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>0F2DDAA0</checksum>
<checksum>759FC93A</checksum>
</file>
<file>
<filename>hvac_sizing.rb</filename>
Expand All @@ -399,13 +399,13 @@
<filename>internal_gains.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>94B4EA05</checksum>
<checksum>206BE2B6</checksum>
</file>
<file>
<filename>lighting.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>9B17C563</checksum>
<checksum>7B7F6D4C</checksum>
</file>
<file>
<filename>location.rb</filename>
Expand Down Expand Up @@ -441,7 +441,7 @@
<filename>misc_loads.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>DF088D8A</checksum>
<checksum>F66475DC</checksum>
</file>
<file>
<filename>model.rb</filename>
Expand Down Expand Up @@ -647,113 +647,107 @@
<usage_type>resource</usage_type>
<checksum>93120E27</checksum>
</file>
<file>
<filename>in.schedules.csv</filename>
<filetype>csv</filetype>
<usage_type>test</usage_type>
<checksum>C0FA4D6F</checksum>
</file>
<file>
<filename>test_airflow.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>DA1297B3</checksum>
<checksum>AF85CB1C</checksum>
</file>
<file>
<filename>test_battery.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>3DF46EDF</checksum>
<checksum>E8640271</checksum>
</file>
<file>
<filename>test_defaults.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>1004443C</checksum>
<checksum>D57EF59F</checksum>
</file>
<file>
<filename>test_enclosure.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>A5253262</checksum>
<checksum>2DA78F4F</checksum>
</file>
<file>
<filename>test_generator.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>67DD47BA</checksum>
<checksum>F540F8F8</checksum>
</file>
<file>
<filename>test_hotwater_appliance.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>A1E1E023</checksum>
<checksum>B02084FA</checksum>
</file>
<file>
<filename>test_hvac.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>994A2553</checksum>
<checksum>7954392A</checksum>
</file>
<file>
<filename>test_hvac_sizing.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>E1BC3865</checksum>
<checksum>E018D108</checksum>
</file>
<file>
<filename>test_lighting.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>9F945097</checksum>
<checksum>8CC5D6BC</checksum>
</file>
<file>
<filename>test_location.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>1BABD0AE</checksum>
<checksum>733BB792</checksum>
</file>
<file>
<filename>test_miscloads.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>974B3838</checksum>
<checksum>4E0D3190</checksum>
</file>
<file>
<filename>test_pv.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>EC9BA2EB</checksum>
<checksum>48F8F1FF</checksum>
</file>
<file>
<filename>test_schedules.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>62B8CE90</checksum>
<checksum>BDA04315</checksum>
</file>
<file>
<filename>test_simcontrols.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>914A44BF</checksum>
<checksum>B15BFB90</checksum>
</file>
<file>
<filename>test_validation.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>95476C6B</checksum>
<checksum>86EC5703</checksum>
</file>
<file>
<filename>test_water_heater.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>A293B678</checksum>
<checksum>60CD4A1F</checksum>
</file>
<file>
<filename>test_weather.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>7DCA4233</checksum>
<checksum>AD9AB5EC</checksum>
</file>
<file>
<filename>util.rb</filename>
Expand Down
22 changes: 16 additions & 6 deletions HPXMLtoOpenStudio/resources/airflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ def self.apply(runner, model, weather, spaces, hpxml_bldg, hpxml_header, schedul
elsif f.used_for_seasonal_cooling_load_reduction
vent_fans[:whf] << f
elsif f.used_for_local_ventilation
next if hpxml_bldg.building_occupancy.number_of_residents == 0 # Operational calculation w/ zero occupants, zero out energy use

if f.fan_location == HPXML::LocationKitchen
vent_fans[:kitchen] << f
elsif f.fan_location == HPXML::LocationBath
Expand Down Expand Up @@ -588,12 +590,19 @@ def self.apply_natural_ventilation_and_whole_house_fan(runner, model, spaces, hp
vent_program.addLine(' Set Qwhf = WHF_Flow*Adj')
vent_program.addLine(" Set #{cond_to_zone_flow_rate_actuator.name} = WHF_Flow*Adj") unless whf_zone.nil?
vent_program.addLine(' Set WHF_W = 0')
vent_fans[:whf].each do |vent_whf|
vent_program.addLine(" Set WHF_W = WHF_W + #{vent_whf.fan_power} * #{whf_avail_sensors[vent_whf.id].name}")
if hpxml_bldg.building_occupancy.number_of_residents != 0 # If operational calculation w/ zero occupants, zero out whole house fan
vent_fans[:whf].each do |vent_whf|
vent_program.addLine(" Set WHF_W = WHF_W + #{vent_whf.fan_power} * #{whf_avail_sensors[vent_whf.id].name}")
end
end
vent_program.addLine(" Set #{whf_elec_actuator.name} = WHF_W*Adj")
vent_program.addLine(' ElseIf (NVavail > 0)') # Natural ventilation
vent_program.addLine(" Set NVArea = #{UnitConversions.convert(area, 'ft^2', 'cm^2')}")
if hpxml_bldg.building_occupancy.number_of_residents == 0
# Operational calculation w/ zero occupants, zero out natural ventilation
vent_program.addLine(' Set NVArea = 0')
else
vent_program.addLine(" Set NVArea = #{UnitConversions.convert(area, 'ft^2', 'cm^2')}")
end
vent_program.addLine(" Set Cs = #{UnitConversions.convert(c_s, 'ft^2/(s^2*R)', 'L^2/(s^2*cm^4*K)')}")
vent_program.addLine(" Set Cw = #{c_w * 0.01}")
vent_program.addLine(' Set Tdiff = Tin-Tout')
Expand Down Expand Up @@ -2298,6 +2307,7 @@ def self.apply_infiltration_adjustment_to_conditioned(runner, model, spaces, hpx
clothes_dryer_in_cond_space = hpxml_bldg.clothes_dryers.empty? ? true : HPXML::conditioned_locations_this_unit.include?(hpxml_bldg.clothes_dryers[0].location)
vented_dryers = hpxml_bldg.clothes_dryers.select { |cd| cd.is_vented && cd.vented_flow_rate.to_f > 0 }
vented_dryers.each_with_index do |vented_dryer, index|
next if hpxml_bldg.building_occupancy.number_of_residents == 0 # Operational calculation w/ zero occupants, zero out energy use
next unless clothes_dryer_in_cond_space

# Infiltration impact
Expand Down Expand Up @@ -2915,11 +2925,11 @@ def self.get_mech_vent_qtot_cfm(nbeds, cfa)
# @param is_balanced [TODO] TODO
# @param frac_imbal [TODO] TODO
# @param a_ext [TODO] TODO
# @param bldg_type [TODO] TODO
# @param unit_type [String] Type of dwelling unit (HXPML::ResidentialTypeXXX)
# @param eri_version [String] Version of the ANSI/RESNET/ICC 301 Standard to use for equations/assumptions
# @param hours_in_operation [TODO] TODO
# @return [TODO] TODO
def self.get_mech_vent_qfan_cfm(q_tot, q_inf, is_balanced, frac_imbal, a_ext, bldg_type, eri_version, hours_in_operation)
def self.get_mech_vent_qfan_cfm(q_tot, q_inf, is_balanced, frac_imbal, a_ext, unit_type, eri_version, hours_in_operation)
q_inf_eff = q_inf * a_ext
if Constants::ERIVersions.index(eri_version) >= Constants::ERIVersions.index('2022')
if frac_imbal == 0
Expand All @@ -2940,7 +2950,7 @@ def self.get_mech_vent_qfan_cfm(q_tot, q_inf, is_balanced, frac_imbal, a_ext, bl
end
q_fan = q_tot - phi * q_inf_eff
else
if [HPXML::ResidentialTypeApartment, HPXML::ResidentialTypeSFA].include? bldg_type
if [HPXML::ResidentialTypeApartment, HPXML::ResidentialTypeSFA].include? unit_type
# No infiltration credit for attached/multifamily
return q_tot
end
Expand Down
Loading

0 comments on commit d53251a

Please sign in to comment.