Skip to content

Commit

Permalink
Merge commit 'b98d3c4ffbf7ae1cd1e812c5e74ffd552f98378d' into adp_bf_m…
Browse files Browse the repository at this point in the history
…ethod_design_shr
  • Loading branch information
shorowit committed Sep 18, 2024
2 parents 0e358ed + b98d3c4 commit 7275dc8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
17 changes: 8 additions & 9 deletions resources/hpxml-measures/HPXMLtoOpenStudio/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ def run(model, runner, user_arguments)

# Create OpenStudio unit model(s)
hpxml_osm_map = {}
hpxml.buildings.each_with_index do |hpxml_bldg, i|
hpxml.buildings.each do |hpxml_bldg|
# Create the model for this single unit
# If we're running a whole SFA/MF building, all the unit models will be merged later
if hpxml.buildings.size > 1
unit_model = OpenStudio::Model::Model.new
create_unit_model(hpxml, hpxml_bldg, runner, unit_model, epw_path, weather, hpxml_sch_map[hpxml_bldg], i + 1)
create_unit_model(hpxml, hpxml_bldg, runner, unit_model, epw_path, weather, hpxml_sch_map[hpxml_bldg])
hpxml_osm_map[hpxml_bldg] = unit_model
else
create_unit_model(hpxml, hpxml_bldg, runner, model, epw_path, weather, hpxml_sch_map[hpxml_bldg], i + 1)
create_unit_model(hpxml, hpxml_bldg, runner, model, epw_path, weather, hpxml_sch_map[hpxml_bldg])
hpxml_osm_map[hpxml_bldg] = model
end
end
Expand Down Expand Up @@ -313,11 +313,9 @@ def process_defaults_schedules_emissions_files(runner, weather, hpxml, args)
# @param epw_path [String] Path to the EPW weather file
# @param weather [WeatherFile] Weather object containing EPW information
# @param schedules_file [SchedulesFile] SchedulesFile wrapper class instance of detailed schedule files
# @param unit_num [Integer] index number corresponding to an HPXML Building object
# @return [nil]
def create_unit_model(hpxml, hpxml_bldg, runner, model, epw_path, weather, schedules_file, unit_num)
# Init
init(hpxml_bldg, hpxml.header)
def create_unit_model(hpxml, hpxml_bldg, runner, model, epw_path, weather, schedules_file)
init(model, hpxml_bldg, hpxml.header)
SimControls.apply(model, hpxml.header)
Location.apply(model, weather, hpxml_bldg, hpxml.header, epw_path)

Expand All @@ -339,7 +337,7 @@ def create_unit_model(hpxml, hpxml_bldg, runner, model, epw_path, weather, sched
Geometry.apply_thermal_mass(model, spaces, hpxml_bldg, hpxml.header)
Geometry.set_zone_volumes(spaces, hpxml_bldg, hpxml.header)
Geometry.explode_surfaces(model, hpxml_bldg)
Geometry.apply_building_unit(model, unit_num)
Geometry.apply_building_unit(model, hpxml, hpxml_bldg)

# HVAC
airloop_map = HVAC.apply_hvac_systems(runner, model, weather, spaces, hpxml_bldg, hpxml.header, schedules_file, hvac_days)
Expand Down Expand Up @@ -372,10 +370,11 @@ def create_unit_model(hpxml, hpxml_bldg, runner, model, epw_path, weather, sched

# Miscellaneous logic that needs to occur upfront.
#
# @param model [OpenStudio::Model::Model] OpenStudio Model object
# @param hpxml_bldg [HPXML::Building] HPXML Building object representing an individual dwelling unit
# @param hpxml_header [HPXML::Header] HPXML Header object (one per HPXML file)
# @return [nil]
def init(hpxml_bldg, hpxml_header)
def init(model, hpxml_bldg, hpxml_header)
# Here we turn off OS error-checking so that any invalid values provided
# to OS SDK methods are passed along to EnergyPlus and produce errors. If
# we didn't go this, we'd end up with successful EnergyPlus simulations that
Expand Down
8 changes: 4 additions & 4 deletions resources/hpxml-measures/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>018b949d-04e1-4633-ba2f-2fe5a2e8b6f3</version_id>
<version_modified>2024-09-18T03:30:05Z</version_modified>
<version_id>c141dc91-0590-46cf-8114-81b5f68856fc</version_id>
<version_modified>2024-09-18T03:39:09Z</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>BC5E34DB</checksum>
<checksum>65C907FB</checksum>
</file>
<file>
<filename>airflow.rb</filename>
Expand Down Expand Up @@ -339,7 +339,7 @@
<filename>geometry.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>095FE2B7</checksum>
<checksum>1DE39C4E</checksum>
</file>
<file>
<filename>hotwater_appliances.rb</filename>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1993,10 +1993,13 @@ def self.create_or_get_space(model, spaces, location, hpxml_bldg)
# Store the HPXML Building object unit number for use in reporting measure.
#
# @param model [OpenStudio::Model::Model] OpenStudio Model object
# @param unit_number [Integer] index number corresponding to an HPXML Building object
# @param hpxml [HPXML] HPXML object
# @param hpxml_bldg [HPXML::Building] HPXML Building object representing an individual dwelling unit
# @return [nil]
def self.apply_building_unit(model, unit_num)
return if unit_num.nil?
def self.apply_building_unit(model, hpxml, hpxml_bldg)
return if hpxml.buildings.size == 1

unit_num = hpxml.buildings.index(hpxml_bldg) + 1

unit = OpenStudio::Model::BuildingUnit.new(model)
unit.additionalProperties.setFeature('unit_num', unit_num)
Expand Down

0 comments on commit 7275dc8

Please sign in to comment.