Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whole building MF Common Spaces #1850

Draft
wants to merge 36 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
57e268c
same as adjacency first cut
yzhou601 Oct 4, 2024
8edc860
Merge branch 'master' of https://github.com/NREL/OpenStudio-HPXML int…
yzhou601 Oct 4, 2024
37aac01
update measures
yzhou601 Oct 4, 2024
db9794d
simplify implementation with additional properties
yzhou601 Oct 4, 2024
4ea65c6
oops
yzhou601 Oct 4, 2024
e0979da
skipped creating duplicate surfaces, addressed default and hvac sizing
yzhou601 Oct 11, 2024
5ee2c83
Merge branch 'master' of https://github.com/NREL/OpenStudio-HPXML int…
yzhou601 Oct 11, 2024
c96242e
bugfix, name change
yzhou601 Oct 12, 2024
edd9aee
Merge branch 'master' of https://github.com/NREL/OpenStudio-HPXML int…
yzhou601 Oct 21, 2024
ad4c8a0
change to only use sameas in one element instead of both elements
yzhou601 Oct 22, 2024
c31f15d
bugfix and some cleanups
yzhou601 Oct 22, 2024
bb5e641
simplify EPvalidator.xml
yzhou601 Oct 22, 2024
c1f0dd3
update measures
yzhou601 Oct 22, 2024
11f013f
Merge branch 'master' of https://github.com/NREL/OpenStudio-HPXML int…
yzhou601 Oct 22, 2024
a1126ef
simplified the approach further more: store adjacent surface id in sp…
yzhou601 Oct 23, 2024
6c065d6
Add test file to include unconditioned common spaces and shared surfaces
yzhou601 Oct 24, 2024
6cad724
Merge branch 'master' of https://github.com/NREL/OpenStudio-HPXML int…
yzhou601 Oct 24, 2024
4f0e0dd
Oops, forgot to add the generated test file
yzhou601 Oct 24, 2024
774b737
more fix
yzhou601 Oct 24, 2024
a8a6c50
test validations
yzhou601 Oct 24, 2024
388025e
fixed util.rb, relax the unused schedule check for common spaces(may …
yzhou601 Oct 24, 2024
60feccc
Latest results.
Oct 24, 2024
45a9415
Merge branch 'master' of https://github.com/NREL/OpenStudio-HPXML int…
yzhou601 Nov 15, 2024
0e2fe3d
fix foundation wall attachment, reconfigure test files to include attics
yzhou601 Nov 19, 2024
cf686cc
Merge branch 'master' of https://github.com/NREL/OpenStudio-HPXML int…
yzhou601 Nov 19, 2024
c250a6a
Merge branch 'whole_building_common_spaces' of https://github.com/NRE…
yzhou601 Nov 19, 2024
5d6080a
fix ci
yzhou601 Nov 19, 2024
0872523
change the approach to create surfaces at unit models to avoid compon…
yzhou601 Nov 21, 2024
136c569
Latest results.
Nov 21, 2024
faf101c
fix typos
yzhou601 Nov 21, 2024
97682d9
Merge branch 'whole_building_common_spaces' of https://github.com/NRE…
yzhou601 Nov 21, 2024
19ecece
Merge branch 'master' of https://github.com/NREL/OpenStudio-HPXML int…
shorowit Nov 27, 2024
944bd45
Merge branch 'master' of https://github.com/NREL/OpenStudio-HPXML int…
shorowit Dec 16, 2024
3f6a380
Merge branch 'whole-mf-bldg-zero-occupants' of https://github.com/NRE…
shorowit Dec 17, 2024
c995c2e
Latest results.
Dec 17, 2024
57e65fe
Merge branch 'master' of https://github.com/NREL/OpenStudio-HPXML int…
shorowit Dec 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions HPXMLtoOpenStudio/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,23 @@ def run(model, runner, user_arguments)

# Create OpenStudio unit model(s)
hpxml_osm_map = {}
common_surface_id_map = {}
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])
create_unit_model(hpxml, hpxml_bldg, runner, unit_model, epw_path, weather, hpxml_sch_map[hpxml_bldg], common_surface_id_map)
hpxml_osm_map[hpxml_bldg] = unit_model
else
create_unit_model(hpxml, hpxml_bldg, runner, model, epw_path, weather, hpxml_sch_map[hpxml_bldg])
create_unit_model(hpxml, hpxml_bldg, runner, model, epw_path, weather, hpxml_sch_map[hpxml_bldg], nil)
hpxml_osm_map[hpxml_bldg] = model
end
end

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

# Create EnergyPlus outputs
Expand Down Expand Up @@ -314,7 +315,7 @@ def process_defaults_schedules_emissions_files(runner, weather, hpxml, args)
# @param weather [WeatherFile] Weather object containing EPW information
# @param schedules_file [SchedulesFile] SchedulesFile wrapper class instance of detailed schedule files
# @return [nil]
def create_unit_model(hpxml, hpxml_bldg, runner, model, epw_path, weather, schedules_file)
def create_unit_model(hpxml, hpxml_bldg, runner, model, epw_path, weather, schedules_file, common_surface_id_map)
init(model, hpxml_bldg, hpxml.header)
SimControls.apply(model, hpxml.header)
Location.apply(model, weather, hpxml_bldg, hpxml.header, epw_path)
Expand All @@ -326,10 +327,10 @@ def create_unit_model(hpxml, hpxml_bldg, runner, model, epw_path, weather, sched

# Geometry & Enclosure
Geometry.apply_roofs(runner, model, spaces, hpxml_bldg, hpxml.header)
Geometry.apply_walls(runner, model, spaces, hpxml_bldg, hpxml.header)
Geometry.apply_rim_joists(runner, model, spaces, hpxml_bldg)
Geometry.apply_floors(runner, model, spaces, hpxml_bldg, hpxml.header)
Geometry.apply_foundation_walls_slabs(runner, model, spaces, weather, hpxml_bldg, hpxml.header, schedules_file)
Geometry.apply_walls(runner, model, spaces, hpxml_bldg, hpxml.header, common_surface_id_map)
Geometry.apply_rim_joists(runner, model, spaces, hpxml_bldg, common_surface_id_map)
Geometry.apply_floors(runner, model, spaces, hpxml_bldg, hpxml.header, common_surface_id_map)
Geometry.apply_foundation_walls_slabs(runner, model, spaces, weather, hpxml_bldg, hpxml.header, schedules_file, common_surface_id_map)
Geometry.apply_windows(model, spaces, hpxml_bldg, hpxml.header)
Geometry.apply_doors(model, spaces, hpxml_bldg)
Geometry.apply_skylights(model, spaces, hpxml_bldg, hpxml.header)
Expand Down
14 changes: 7 additions & 7 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>2ecbdcc0-d0e3-4c8f-b8f8-a839e9bdbee1</version_id>
<version_modified>2024-10-04T17:02:56Z</version_modified>
<version_id>d81e4aaa-3c8f-450e-84f9-b2aab461ebb2</version_id>
<version_modified>2024-10-04T21:15:24Z</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>E1E63AE7</checksum>
<checksum>1D9A5E79</checksum>
</file>
<file>
<filename>airflow.rb</filename>
Expand Down Expand Up @@ -345,7 +345,7 @@
<filename>geometry.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>7E3D612D</checksum>
<checksum>83A8258E</checksum>
</file>
<file>
<filename>hotwater_appliances.rb</filename>
Expand All @@ -357,7 +357,7 @@
<filename>hpxml.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>278B0E8F</checksum>
<checksum>C25F839C</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>9A5ABED7</checksum>
<checksum>00C7FBC2</checksum>
</file>
<file>
<filename>hpxml_schematron/iso-schematron.xsd</filename>
Expand Down Expand Up @@ -447,7 +447,7 @@
<filename>model.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>6933774F</checksum>
<checksum>46B2B024</checksum>
</file>
<file>
<filename>output.rb</filename>
Expand Down
38 changes: 26 additions & 12 deletions HPXMLtoOpenStudio/resources/geometry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ def self.apply_roofs(runner, model, spaces, hpxml_bldg, hpxml_header)
# @param spaces [Hash] Map of HPXML locations => OpenStudio Space objects
# @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)
# @param common_surface_id_map [Hash] map of HPXML id and OpenStudio surface handle
# @return [nil]
def self.apply_walls(runner, model, spaces, hpxml_bldg, hpxml_header)
def self.apply_walls(runner, model, spaces, hpxml_bldg, hpxml_header, common_surface_id_map)
default_azimuths = Defaults.get_azimuths(hpxml_bldg)
_walls_top, foundation_top = get_foundation_and_walls_top(hpxml_bldg)

Expand Down Expand Up @@ -171,7 +172,7 @@ def self.apply_walls(runner, model, spaces, hpxml_bldg, hpxml_header)
end
surface.setSurfaceType(EPlus::SurfaceTypeWall)
set_surface_interior(model, spaces, surface, wall, hpxml_bldg)
set_surface_exterior(model, spaces, surface, wall, hpxml_bldg)
set_surface_exterior(model, spaces, surface, wall, hpxml_bldg, common_surface_id_map)
if wall.is_interior
surface.setSunExposure(EPlus::SurfaceSunExposureNo)
surface.setWindExposure(EPlus::SurfaceWindExposureNo)
Expand Down Expand Up @@ -214,8 +215,9 @@ def self.apply_walls(runner, model, spaces, hpxml_bldg, hpxml_header)
# @param model [OpenStudio::Model::Model] OpenStudio Model object
# @param spaces [Hash] Map of HPXML locations => OpenStudio Space objects
# @param hpxml_bldg [HPXML::Building] HPXML Building object representing an individual dwelling unit
# @param common_surface_id_map [Hash] map of HPXML id and OpenStudio surface handle
# @return [nil]
def self.apply_rim_joists(runner, model, spaces, hpxml_bldg)
def self.apply_rim_joists(runner, model, spaces, hpxml_bldg, common_surface_id_map)
default_azimuths = Defaults.get_azimuths(hpxml_bldg)
_walls_top, foundation_top = get_foundation_and_walls_top(hpxml_bldg)

Expand Down Expand Up @@ -251,7 +253,7 @@ def self.apply_rim_joists(runner, model, spaces, hpxml_bldg)
end
surface.setSurfaceType(EPlus::SurfaceTypeWall)
set_surface_interior(model, spaces, surface, rim_joist, hpxml_bldg)
set_surface_exterior(model, spaces, surface, rim_joist, hpxml_bldg)
set_surface_exterior(model, spaces, surface, rim_joist, hpxml_bldg, common_surface_id_map)
if rim_joist.is_interior
surface.setSunExposure(EPlus::SurfaceSunExposureNo)
surface.setWindExposure(EPlus::SurfaceWindExposureNo)
Expand Down Expand Up @@ -297,8 +299,9 @@ def self.apply_rim_joists(runner, model, spaces, hpxml_bldg)
# @param spaces [Hash] Map of HPXML locations => OpenStudio Space objects
# @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)
# @param common_surface_id_map [Hash] map of HPXML id and OpenStudio surface handle
# @return [nil]
def self.apply_floors(runner, model, spaces, hpxml_bldg, hpxml_header)
def self.apply_floors(runner, model, spaces, hpxml_bldg, hpxml_header, common_surface_id_map)
default_azimuths = Defaults.get_azimuths(hpxml_bldg)
walls_top, foundation_top = get_foundation_and_walls_top(hpxml_bldg)

Expand All @@ -325,7 +328,7 @@ def self.apply_floors(runner, model, spaces, hpxml_bldg, hpxml_header)
end
surface.additionalProperties.setFeature('Tilt', 0.0)
set_surface_interior(model, spaces, surface, floor, hpxml_bldg)
set_surface_exterior(model, spaces, surface, floor, hpxml_bldg)
set_surface_exterior(model, spaces, surface, floor, hpxml_bldg, common_surface_id_map)
surface.setName(floor.id)
if floor.is_interior
surface.setSunExposure(EPlus::SurfaceSunExposureNo)
Expand Down Expand Up @@ -390,8 +393,9 @@ def self.apply_floors(runner, model, spaces, hpxml_bldg, hpxml_header)
# @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)
# @param schedules_file [SchedulesFile] SchedulesFile wrapper class instance of detailed schedule files
# @param common_surface_id_map [Hash] map of HPXML id and OpenStudio surface handle
# @return [nil]
def self.apply_foundation_walls_slabs(runner, model, spaces, weather, hpxml_bldg, hpxml_header, schedules_file)
def self.apply_foundation_walls_slabs(runner, model, spaces, weather, hpxml_bldg, hpxml_header, schedules_file, common_surface_id_map)
default_azimuths = Defaults.get_azimuths(hpxml_bldg)

foundation_types = hpxml_bldg.slabs.map { |s| s.interior_adjacent_to }.uniq
Expand Down Expand Up @@ -470,7 +474,7 @@ def self.apply_foundation_walls_slabs(runner, model, spaces, weather, hpxml_bldg
surface.setName(fnd_wall.id)
surface.setSurfaceType(EPlus::SurfaceTypeWall)
set_surface_interior(model, spaces, surface, fnd_wall, hpxml_bldg)
set_surface_exterior(model, spaces, surface, fnd_wall, hpxml_bldg)
set_surface_exterior(model, spaces, surface, fnd_wall, hpxml_bldg, common_surface_id_map)
surface.setSunExposure(EPlus::SurfaceSunExposureNo)
surface.setWindExposure(EPlus::SurfaceWindExposureNo)

Expand Down Expand Up @@ -544,7 +548,7 @@ def self.apply_foundation_wall(runner, model, spaces, hpxml_bldg, foundation_wal
surface.setName(foundation_wall.id)
surface.setSurfaceType(EPlus::SurfaceTypeWall)
set_surface_interior(model, spaces, surface, foundation_wall, hpxml_bldg)
set_surface_exterior(model, spaces, surface, foundation_wall, hpxml_bldg)
set_surface_exterior(model, spaces, surface, foundation_wall, hpxml_bldg, nil)

assembly_r = foundation_wall.insulation_assembly_r_value
mat_int_finish = Material.InteriorFinishMaterial(foundation_wall.interior_finish_type, foundation_wall.interior_finish_thickness)
Expand Down Expand Up @@ -934,7 +938,7 @@ def self.apply_skylights(model, spaces, hpxml_bldg, hpxml_header)
surface.setName("surface #{skylight.id} shaft")
surface.setSurfaceType(EPlus::SurfaceTypeWall)
set_surface_interior(model, spaces, surface, skylight.floor, hpxml_bldg)
set_surface_exterior(model, spaces, surface, skylight.floor, hpxml_bldg)
set_surface_exterior(model, spaces, surface, skylight.floor, hpxml_bldg, nil)
surface.setSunExposure(EPlus::SurfaceSunExposureNo)
surface.setWindExposure(EPlus::SurfaceWindExposureNo)

Expand Down Expand Up @@ -971,6 +975,7 @@ def self.apply_conditioned_floor_area(model, spaces, hpxml_bldg)
sum_cfa = 0.0
hpxml_bldg.floors.each do |floor|
next unless floor.is_floor
# FIXME: If the hpxml Building that represents an unconditioned space (without HVACPlant), does the hpxml_bldg.building_construction.conditioned_floor_area accounts to the total cfa? Is E+ reporting the correct total cfa? (Need to double-check)
next unless [HPXML::LocationConditionedSpace, HPXML::LocationBasementConditioned].include?(floor.interior_adjacent_to) ||
[HPXML::LocationConditionedSpace, HPXML::LocationBasementConditioned].include?(floor.exterior_adjacent_to)

Expand Down Expand Up @@ -1718,9 +1723,18 @@ def self.set_surface_interior(model, spaces, surface, hpxml_surface, hpxml_bldg)
# @param surface [OpenStudio::Model::Surface] an OpenStudio::Model::Surface object
# @param hpxml_surface [HPXML::Wall or HPXML::Roof or HPXML::RimJoist or HPXML::FoundationWall or HPXML::Slab] any HPXML surface
# @return [nil]
def self.set_surface_exterior(model, spaces, surface, hpxml_surface, hpxml_bldg)
def self.set_surface_exterior(model, spaces, surface, hpxml_surface, hpxml_bldg, common_surface_id_map)
exterior_adjacent_to = hpxml_surface.exterior_adjacent_to
is_adiabatic = hpxml_surface.is_adiabatic
if not hpxml_surface.sameas_id.nil?
if common_surface_id_map.nil?
fail "unexpected surface sameas attribute assigned: #{surface.sameas_id}."
else
# Store surface id and OS surface object mapping, process later
common_surface_id_map[hpxml_surface.id] = surface.handle
shorowit marked this conversation as resolved.
Show resolved Hide resolved
return
end
end
if [HPXML::LocationOutside, HPXML::LocationManufacturedHomeUnderBelly].include? exterior_adjacent_to
surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors)
elsif exterior_adjacent_to == HPXML::LocationGround
Expand Down Expand Up @@ -1752,7 +1766,7 @@ def self.set_subsurface_exterior(surface, spaces, model, hpxml_surface, hpxml_bl
if hpxml_surface.exterior_adjacent_to == HPXML::LocationGround
surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors)
else
set_surface_exterior(model, spaces, surface, hpxml_surface, hpxml_bldg)
set_surface_exterior(model, spaces, surface, hpxml_surface, hpxml_bldg, nil)
end
end

Expand Down
Loading