Skip to content

Commit

Permalink
Initial progress.
Browse files Browse the repository at this point in the history
  • Loading branch information
shorowit committed Nov 26, 2024
1 parent 97682d9 commit 1f884e2
Show file tree
Hide file tree
Showing 13 changed files with 455 additions and 92 deletions.
13 changes: 12 additions & 1 deletion HPXMLtoOpenStudio/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ def run(model, runner, user_arguments)
# Write updated HPXML object (w/ defaults) to file for inspection
XMLHelper.write_file(hpxml.to_doc, args[:hpxml_defaults_path])

# When modeling whole SFA/MF buildings, remove shared systems upfront
# from the HPXML object; handle them at the end once the full model
# has been created.
shared_systems_map = {}
if hpxml.header.whole_sfa_or_mf_building_sim
shared_systems_map = hpxml.delete_shared_systems_serving_multiple_dwelling_units()
end

# Create OpenStudio unit model(s)
hpxml_osm_map = {}
hpxml.buildings.each do |hpxml_bldg|
Expand All @@ -141,9 +149,12 @@ def run(model, runner, user_arguments)
end
end

# Merge unit models into final model
if hpxml.buildings.size > 1
# Merge unit models into final model
Model.merge_unit_models(model, hpxml_osm_map)

# Apply shared systems
HVAC.apply_shared_systems(runner, model, hpxml, hpxml_osm_map, shared_systems_map)
end

# Create EnergyPlus outputs
Expand Down
18 changes: 9 additions & 9 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>324abf52-e522-49dd-ac49-360bad8eb1ba</version_id>
<version_modified>2024-11-21T20:15:41Z</version_modified>
<version_id>05d1c691-8e2f-4b24-ac72-37ed91ce927f</version_id>
<version_modified>2024-11-26T18:31:43Z</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,7 +183,7 @@
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>D7F18DFB</checksum>
<checksum>7A8113DC</checksum>
</file>
<file>
<filename>airflow.rb</filename>
Expand Down Expand Up @@ -327,7 +327,7 @@
<filename>defaults.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>515B05C5</checksum>
<checksum>12FBBBA9</checksum>
</file>
<file>
<filename>energyplus.rb</filename>
Expand Down Expand Up @@ -357,7 +357,7 @@
<filename>hpxml.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>5173207E</checksum>
<checksum>68D7F8FA</checksum>
</file>
<file>
<filename>hpxml_schema/HPXML.xsd</filename>
Expand All @@ -375,7 +375,7 @@
<filename>hpxml_schematron/EPvalidator.xml</filename>
<filetype>xml</filetype>
<usage_type>resource</usage_type>
<checksum>71347401</checksum>
<checksum>3F51B0F0</checksum>
</file>
<file>
<filename>hpxml_schematron/iso-schematron.xsd</filename>
Expand All @@ -387,13 +387,13 @@
<filename>hvac.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>0DF759D2</checksum>
<checksum>FD4CC52B</checksum>
</file>
<file>
<filename>hvac_sizing.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>8A5C303C</checksum>
<checksum>13130390</checksum>
</file>
<file>
<filename>internal_gains.rb</filename>
Expand Down Expand Up @@ -447,7 +447,7 @@
<filename>model.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>ED1985F0</checksum>
<checksum>6909951F</checksum>
</file>
<file>
<filename>output.rb</filename>
Expand Down
37 changes: 33 additions & 4 deletions HPXMLtoOpenStudio/resources/defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def self.apply(runner, hpxml, hpxml_bldg, weather, schedules_file: nil, convert_
end

# Check for presence of fuels once
has_fuel = hpxml_bldg.has_fuels(hpxml.to_doc)
has_fuel = hpxml_bldg.has_fuels()

add_zones_spaces_if_needed(hpxml_bldg, unit_num)

Expand Down Expand Up @@ -72,7 +72,7 @@ def self.apply(runner, hpxml, hpxml_bldg, weather, schedules_file: nil, convert_
apply_doors(hpxml_bldg)
apply_partition_wall_mass(hpxml_bldg)
apply_furniture_mass(hpxml_bldg)
apply_hvac(runner, hpxml_bldg, weather, convert_shared_systems, unit_num)
apply_hvac(runner, hpxml.header, hpxml_bldg, weather, convert_shared_systems, unit_num)
apply_hvac_control(hpxml_bldg, schedules_file, eri_version)
apply_hvac_distribution(hpxml_bldg)
apply_infiltration(hpxml_bldg)
Expand Down Expand Up @@ -237,6 +237,13 @@ def self.apply_header(hpxml_header, hpxml_bldg, weather)
unavailable_period.natvent_availability_isdefaulted = true
end
end

if hpxml_header.shared_boiler_operation.nil?
if hpxml_bldg.heating_systems.select { |htg| htg.heating_system_type == HPXML::HVACTypeBoiler && htg.is_shared_system_serving_multiple_dwelling_units }.size > 0
hpxml_header.shared_boiler_operation = HPXML::SharedBoilerOperationSequenced
hpxml_header.shared_boiler_operation_isdefaulted = true
end
end
end

# Assigns default values for omitted optional inputs in the HPXML::BuildingHeader object
Expand Down Expand Up @@ -1832,14 +1839,15 @@ def self.apply_furniture_mass(hpxml_bldg)
# HPXML::CoolingSystem, and HPXML::HeatPump objects
#
# @param runner [OpenStudio::Measure::OSRunner] Object typically used to display warnings
# @param hpxml_header [HPXML::Header] HPXML Header object (one per HPXML file)
# @param hpxml_bldg [HPXML::Building] HPXML Building object representing an individual dwelling unit
# @param weather [WeatherFile] Weather object containing EPW information
# @param convert_shared_systems [Boolean] Whether to convert shared systems to equivalent in-unit systems per ANSI 301
# @param unit_num [Integer] Dwelling unit number
# @return [nil]
def self.apply_hvac(runner, hpxml_bldg, weather, convert_shared_systems, unit_num)
def self.apply_hvac(runner, hpxml_header, hpxml_bldg, weather, convert_shared_systems, unit_num)
if convert_shared_systems
HVAC.apply_shared_systems(hpxml_bldg)
HVAC.convert_shared_systems_to_in_unit_systems(hpxml_bldg, hpxml_header)
end

# Convert negative values (e.g., -1) to nil as appropriate
Expand Down Expand Up @@ -2501,6 +2509,27 @@ def self.apply_hvac_control(hpxml_bldg, schedules_file, eri_version)
# @param hpxml_bldg [HPXML::Building] HPXML Building object representing an individual dwelling unit
# @return [nil]
def self.apply_hvac_distribution(hpxml_bldg)
# Hydronic distribution
hpxml_bldg.hvac_distributions.each do |hvac_distribution|
next unless hvac_distribution.hvac_systems.any? { |h| h.is_a?(HPXML::HeatingSystem) && h.heating_system_type == HPXML::HVACTypeBoiler }

# Supply/return loop temperatures
default_delta_t = 20.0 # deg-F
if hvac_distribution.hydronic_supply_temp.nil?
if not hvac_distribution.hydronic_return_temp.nil?
hvac_distribution.hydronic_supply_temp = hvac_distribution.hydronic_return_temp + default_delta_t # deg-F
else
hvac_distribution.hydronic_supply_temp = 180.0 # deg-F
end
hvac_distribution.hydronic_supply_temp_isdefaulted = true
end
if hvac_distribution.hydronic_return_temp.nil?
hvac_distribution.hydronic_return_temp = hvac_distribution.hydronic_supply_temp - default_delta_t # deg-F
hvac_distribution.hydronic_return_temp_isdefaulted = true
end
end

# Air distribution
ncfl_ag = hpxml_bldg.building_construction.number_of_conditioned_floors_above_grade
ncfl = hpxml_bldg.building_construction.number_of_conditioned_floors

Expand Down
Loading

0 comments on commit 1f884e2

Please sign in to comment.