Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/NREL/OpenStudio-HPXML int…
Browse files Browse the repository at this point in the history
…o whole_building_common_spaces

# Conflicts:
#	HPXMLtoOpenStudio/measure.xml
  • Loading branch information
shorowit committed Dec 27, 2024
2 parents c995c2e + 34fce41 commit 57e65fe
Show file tree
Hide file tree
Showing 33 changed files with 195 additions and 114 deletions.
12 changes: 9 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>32bd49ca-09dc-40ec-b676-f01d76e98566</version_id>
<version_modified>2024-12-09T21:40:28Z</version_modified>
<version_id>df4fe828-a827-4cc2-8a4d-9c8daf649202</version_id>
<version_modified>2024-12-20T20:07:27Z</version_modified>
<xml_checksum>2C38F48B</xml_checksum>
<class_name>BuildResidentialHPXML</class_name>
<display_name>HPXML Builder</display_name>
Expand Down Expand Up @@ -7558,11 +7558,17 @@
<usage_type>resource</usage_type>
<checksum>425682E4</checksum>
</file>
<file>
<filename>version.txt</filename>
<filetype>txt</filetype>
<usage_type>resource</usage_type>
<checksum>93016553</checksum>
</file>
<file>
<filename>test_build_residential_hpxml.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>CCBB49E7</checksum>
<checksum>71348C9A</checksum>
</file>
</files>
</measure>
1 change: 1 addition & 0 deletions BuildResidentialHPXML/resources/version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
237a7a19483db8aae3195ccffb40336c
16 changes: 0 additions & 16 deletions BuildResidentialHPXML/tests/test_build_residential_hpxml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -386,22 +386,6 @@ def test_workflows
assert_equal(31, hvac_control.seasons_cooling_end_day)
end

def test_version
found_match = false
measure_xml_path = File.join(File.dirname(__FILE__), '..', 'measure.xml')
File.readlines(measure_xml_path).each do |xml_line|
next unless xml_line.include? '<description>'
next unless xml_line.include? 'https://openstudio-hpxml.readthedocs.io'

found_match = true
if not xml_line.include? Version::OS_HPXML_Version
puts "ERROR: Found incorrect OS-HPXML version. Manually edit the BuildResidentialHPXML/measure.rb and run 'openstudio tasks.rb update_measures' to force the measure.xml to be regenerated."
end
assert(xml_line.include? Version::OS_HPXML_Version)
end
assert(found_match)
end

private

def _set_measure_argument_values(hpxml_file, args)
Expand Down
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ __New Features__

__Bugfixes__
- 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
48 changes: 24 additions & 24 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>e3ceba5c-4250-41a9-a020-9c3a2f473065</version_id>
<version_modified>2024-12-17T21:30:16Z</version_modified>
<version_id>3f088017-16af-4543-ae09-c1bc75d9a84f</version_id>
<version_modified>2024-12-27T21:49:14Z</version_modified>
<xml_checksum>D8922A73</xml_checksum>
<class_name>HPXMLtoOpenStudio</class_name>
<display_name>HPXML to OpenStudio Translator</display_name>
Expand Down Expand Up @@ -189,7 +189,7 @@
<filename>airflow.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>06E4A131</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>543F5DBB</checksum>
<checksum>B01F31C0</checksum>
</file>
<file>
<filename>energyplus.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 Down Expand Up @@ -441,13 +441,13 @@
<filename>misc_loads.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>039B0042</checksum>
<checksum>F66475DC</checksum>
</file>
<file>
<filename>model.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>6B3911CF</checksum>
<checksum>22769ED3</checksum>
</file>
<file>
<filename>output.rb</filename>
Expand Down Expand Up @@ -651,103 +651,103 @@
<filename>test_airflow.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>6BDC58E4</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>27A0085A</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>5300BCE3</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>784CC382</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>5521E2D8</checksum>
<checksum>DE3A1F1F</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
6 changes: 2 additions & 4 deletions HPXMLtoOpenStudio/resources/airflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +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
if hpxml_bldg.building_occupancy.number_of_residents == 0
# Operational calculation w/ zero occupants, zero out energy use
continue
end
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
30 changes: 0 additions & 30 deletions HPXMLtoOpenStudio/resources/defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5744,11 +5744,6 @@ def self.get_televisions_values(cfa, nbeds, n_occ = nil, unit_type = nil)
# @param unit_type [String] Type of dwelling unit (HXPML::ResidentialTypeXXX)
# @return [Double] Annual energy use (kWh/yr)
def self.get_pool_pump_annual_energy(cfa, nbeds, n_occ, unit_type)
if n_occ == 0
# Operational calculation w/ zero occupants, zero out energy use
return 0.0
end

nbeds_eq = Defaults.get_equivalent_nbeds(nbeds, n_occ, unit_type)

return 158.6 / 0.070 * (0.5 + 0.25 * nbeds_eq / 3.0 + 0.25 * cfa / 1920.0)
Expand All @@ -5769,22 +5764,12 @@ def self.get_pool_heater_annual_energy(cfa, nbeds, n_occ, unit_type, type)
load_value = nil
if [HPXML::HeaterTypeElectricResistance, HPXML::HeaterTypeHeatPump].include? type
load_units = HPXML::UnitsKwhPerYear
if n_occ == 0
# Operational calculation w/ zero occupants, zero out energy use
return load_type, 0.0
end

load_value = 8.3 / 0.004 * (0.5 + 0.25 * nbeds_eq / 3.0 + 0.25 * cfa / 1920.0) # kWh/yr
if type == HPXML::HeaterTypeHeatPump
load_value /= 5.0 # Assume seasonal COP of 5.0 per https://www.energy.gov/energysaver/heat-pump-swimming-pool-heaters
end
elsif type == HPXML::HeaterTypeGas
load_units = HPXML::UnitsThermPerYear
if n_occ == 0
# Operational calculation w/ zero occupants, zero out energy use
return load_type, 0.0
end

load_value = 3.0 / 0.014 * (0.5 + 0.25 * nbeds_eq / 3.0 + 0.25 * cfa / 1920.0) # therm/yr
end
return load_units, load_value
Expand All @@ -5798,11 +5783,6 @@ def self.get_pool_heater_annual_energy(cfa, nbeds, n_occ, unit_type, type)
# @param unit_type [String] Type of dwelling unit (HXPML::ResidentialTypeXXX)
# @return [Double] Annual energy use (kWh/yr)
def self.get_permanent_spa_pump_annual_energy(cfa, nbeds, n_occ, unit_type)
if n_occ == 0
# Operational calculation w/ zero occupants, zero out energy use
return 0.0
end

nbeds_eq = Defaults.get_equivalent_nbeds(nbeds, n_occ, unit_type)

return 59.5 / 0.059 * (0.5 + 0.25 * nbeds_eq / 3.0 + 0.25 * cfa / 1920.0) # kWh/yr
Expand All @@ -5823,22 +5803,12 @@ def self.get_permanent_spa_heater_annual_energy(cfa, nbeds, n_occ, unit_type, ty
load_value = nil
if [HPXML::HeaterTypeElectricResistance, HPXML::HeaterTypeHeatPump].include? type
load_units = HPXML::UnitsKwhPerYear
if n_occ == 0
# Operational calculation w/ zero occupants, zero out energy use
return load_type, 0.0
end

load_value = 49.0 / 0.048 * (0.5 + 0.25 * nbeds_eq / 3.0 + 0.25 * cfa / 1920.0) # kWh/yr
if type == HPXML::HeaterTypeHeatPump
load_value /= 5.0 # Assume seasonal COP of 5.0 per https://www.energy.gov/energysaver/heat-pump-swimming-pool-heaters
end
elsif type == HPXML::HeaterTypeGas
load_units = HPXML::UnitsThermPerYear
if n_occ == 0
# Operational calculation w/ zero occupants, zero out energy use
return load_type, 0.0
end

load_value = 0.87 / 0.011 * (0.5 + 0.25 * nbeds_eq / 3.0 + 0.25 * cfa / 1920.0) # therm/yr
end
return load_units, load_value
Expand Down
12 changes: 9 additions & 3 deletions HPXMLtoOpenStudio/resources/hvac.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,10 @@ def self.apply_dehumidifiers(runner, model, spaces, hpxml_bldg, hpxml_header)
# @param schedules_file [SchedulesFile] SchedulesFile wrapper class instance of detailed schedule files
# @return [nil]
def self.apply_ceiling_fans(runner, model, spaces, weather, hpxml_bldg, hpxml_header, schedules_file)
if hpxml_bldg.building_occupancy.number_of_residents == 0
# Operational calculation w/ zero occupants, zero out energy use
return
end
return if hpxml_bldg.ceiling_fans.size == 0

ceiling_fan = hpxml_bldg.ceiling_fans[0]
Expand Down Expand Up @@ -1382,7 +1386,7 @@ def self.apply_setpoints(model, runner, weather, spaces, hpxml_bldg, hpxml_heade
end

if cooling_sch.nil?
clg_wd_setpoints, clg_we_setpoints = get_cooling_setpoints(hvac_control, has_ceiling_fan, year, weather, onoff_thermostat_ddb)
clg_wd_setpoints, clg_we_setpoints = get_cooling_setpoints(hpxml_bldg, hvac_control, has_ceiling_fan, year, weather, onoff_thermostat_ddb)
else
runner.registerWarning("Both '#{SchedulesFile::Columns[:CoolingSetpoint].name}' schedule file and cooling setpoint temperature provided; the latter will be ignored.") if !hvac_control.cooling_setpoint_temp.nil?
end
Expand Down Expand Up @@ -1511,13 +1515,14 @@ def self.get_heating_setpoints(hvac_control, year, offset_db)

# TODO
#
# @param hpxml_bldg [HPXML::Building] HPXML Building object representing an individual dwelling unit
# @param [HPXML::HVACControl] The HPXML HVAC control of interest
# @param has_ceiling_fan [TODO] TODO
# @param year [Integer] the calendar year
# @param weather [WeatherFile] Weather object containing EPW information
# @param offset_db [Double] On-off thermostat deadband (F)
# @return [TODO] TODO
def self.get_cooling_setpoints(hvac_control, has_ceiling_fan, year, weather, offset_db)
def self.get_cooling_setpoints(hpxml_bldg, hvac_control, has_ceiling_fan, year, weather, offset_db)
num_days = Calendar.num_days_in_year(year)

if hvac_control.weekday_cooling_setpoints.nil? || hvac_control.weekend_cooling_setpoints.nil?
Expand All @@ -1543,8 +1548,9 @@ def self.get_cooling_setpoints(hvac_control, has_ceiling_fan, year, weather, off
clg_we_setpoints = hvac_control.weekend_cooling_setpoints.split(',').map { |i| Float(i) }
clg_we_setpoints = [clg_we_setpoints] * num_days
end

# Apply cooling setpoint offset due to ceiling fan?
if has_ceiling_fan
if has_ceiling_fan && hpxml_bldg.building_occupancy.number_of_residents != 0 # If operational calculation w/ zero occupants, exclude ceiling fan setpoint adjustment
clg_ceiling_fan_offset = hvac_control.ceiling_fan_cooling_setpoint_temp_offset
if not clg_ceiling_fan_offset.nil?
months = Defaults.get_ceiling_fan_months(weather)
Expand Down
5 changes: 5 additions & 0 deletions HPXMLtoOpenStudio/resources/misc_loads.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ def self.apply_plug_load(runner, model, plug_load, obj_name, spaces, schedules_f
# @param schedules_file [SchedulesFile] SchedulesFile wrapper class instance of detailed schedule files
# @return [nil]
def self.apply_fuel_loads(runner, model, spaces, hpxml_bldg, hpxml_header, schedules_file)
if hpxml_bldg.building_occupancy.number_of_residents == 0
# Operational calculation w/ zero occupants, zero out energy use
return
end

hpxml_bldg.fuel_loads.each do |fuel_load|
case fuel_load.fuel_load_type
when HPXML::FuelLoadTypeGrill
Expand Down
1 change: 1 addition & 0 deletions HPXMLtoOpenStudio/resources/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ def self.add_schedule_file(model, name:, file_path:, col_num:, rows_to_skip:, nu
sch.setNumberofHoursofData(num_hours)
sch.setMinutesperItem(mins_per_item)
sch.setTranslateFileWithRelativePath(true)
sch.setInterpolatetoTimestep(true)
add_schedule_type_limits(model, schedule: sch, limits: limits)
return sch
end
Expand Down
Loading

0 comments on commit 57e65fe

Please sign in to comment.