Skip to content

Commit

Permalink
Merge branch 'ev_batteries' of https://github.com/NREL/OpenStudio-HPXML
Browse files Browse the repository at this point in the history
… into ev_schedules

# Conflicts:
#	BuildResidentialHPXML/measure.xml
#	BuildResidentialScheduleFile/measure.xml
#	HPXMLtoOpenStudio/measure.xml
  • Loading branch information
shorowit committed Dec 11, 2024
2 parents 57e820f + e0b8da9 commit bcd352f
Show file tree
Hide file tree
Showing 60 changed files with 11,950 additions and 10,805 deletions.
2 changes: 1 addition & 1 deletion BuildResidentialHPXML/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ The number of bathrooms in the unit. If not provided, the OS-HPXML default (see

**Geometry: Unit Number of Occupants**

The number of occupants in the unit. If not provided, an *asset* calculation is performed assuming standard occupancy, in which various end use defaults (e.g., plug loads, appliances, and hot water usage) are calculated based on Number of Bedrooms and Conditioned Floor Area per ANSI/RESNET/ICC 301-2019. If provided, an *operational* calculation is instead performed in which the end use defaults are adjusted using the relationship between Number of Bedrooms and Number of Occupants from RECS 2015.
The number of occupants in the unit. If not provided, an *asset* calculation is performed assuming standard occupancy, in which various end use defaults (e.g., plug loads, appliances, and hot water usage) are calculated based on Number of Bedrooms and Conditioned Floor Area per ANSI/RESNET/ICC 301. If provided, an *operational* calculation is instead performed in which the end use defaults to reflect real-world data (where possible).

- **Name:** ``geometry_unit_num_occupants``
- **Type:** ``Double``
Expand Down
198 changes: 109 additions & 89 deletions BuildResidentialHPXML/measure.rb

Large diffs are not rendered by default.

14 changes: 7 additions & 7 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>4dd3d69b-5ca9-42e0-b9fa-ab64665f8bb2</version_id>
<version_modified>2024-12-10T20:26:14Z</version_modified>
<version_id>10e1324b-856d-4fbb-83e1-77bdf073f7e0</version_id>
<version_modified>2024-12-11T04:08:06Z</version_modified>
<xml_checksum>2C38F48B</xml_checksum>
<class_name>BuildResidentialHPXML</class_name>
<display_name>HPXML Builder</display_name>
Expand Down Expand Up @@ -878,7 +878,7 @@
<argument>
<name>geometry_unit_num_occupants</name>
<display_name>Geometry: Unit Number of Occupants</display_name>
<description>The number of occupants in the unit. If not provided, an *asset* calculation is performed assuming standard occupancy, in which various end use defaults (e.g., plug loads, appliances, and hot water usage) are calculated based on Number of Bedrooms and Conditioned Floor Area per ANSI/RESNET/ICC 301-2019. If provided, an *operational* calculation is instead performed in which the end use defaults are adjusted using the relationship between Number of Bedrooms and Number of Occupants from RECS 2015.</description>
<description>The number of occupants in the unit. If not provided, an *asset* calculation is performed assuming standard occupancy, in which various end use defaults (e.g., plug loads, appliances, and hot water usage) are calculated based on Number of Bedrooms and Conditioned Floor Area per ANSI/RESNET/ICC 301. If provided, an *operational* calculation is instead performed in which the end use defaults to reflect real-world data (where possible).</description>
<type>Double</type>
<units>#</units>
<required>false</required>
Expand Down Expand Up @@ -7654,7 +7654,7 @@
<filename>README.md</filename>
<filetype>md</filetype>
<usage_type>readme</usage_type>
<checksum>77EE8A63</checksum>
<checksum>14C8C894</checksum>
</file>
<file>
<filename>README.md.erb</filename>
Expand All @@ -7671,7 +7671,7 @@
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>497277AC</checksum>
<checksum>1FA66639</checksum>
</file>
<file>
<filename>constants.rb</filename>
Expand All @@ -7683,13 +7683,13 @@
<filename>geometry.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>E50F00EB</checksum>
<checksum>425682E4</checksum>
</file>
<file>
<filename>test_build_residential_hpxml.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>91B56440</checksum>
<checksum>C3A7B090</checksum>
</file>
</files>
</measure>
102 changes: 58 additions & 44 deletions BuildResidentialHPXML/resources/geometry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ def self.create_single_family_detached(runner:,
# make polygons
polygon_floor = make_polygon(roof_nw_point, roof_ne_point, roof_se_point, roof_sw_point)
side_type = nil
if roof_type == Constants::RoofTypeGable
case roof_type
when Constants::RoofTypeGable
if length >= width
roof_w_point = OpenStudio::Point3d.new(0, width / 2.0, z + attic_height)
roof_e_point = OpenStudio::Point3d.new(length, width / 2.0, z + attic_height)
Expand All @@ -285,7 +286,7 @@ def self.create_single_family_detached(runner:,
polygon_e_wall = make_polygon(roof_e_point, roof_ne_point, roof_nw_point)
end
side_type = EPlus::SurfaceTypeWall
elsif roof_type == Constants::RoofTypeHip
when Constants::RoofTypeHip
if length >= width
roof_w_point = OpenStudio::Point3d.new(width / 2.0, width / 2.0, z + attic_height)
roof_e_point = OpenStudio::Point3d.new(length - width / 2.0, width / 2.0, z + attic_height)
Expand Down Expand Up @@ -330,7 +331,8 @@ def self.create_single_family_detached(runner:,
surface_e_wall.setSpace(attic_space)

# set these to the attic zone
if (attic_type == HPXML::AtticTypeVented) || (attic_type == HPXML::AtticTypeUnvented)
case attic_type
when HPXML::AtticTypeVented, HPXML::AtticTypeUnvented
# create attic zone
attic_zone = OpenStudio::Model::ThermalZone.new(model)
attic_space.setThermalZone(attic_zone)
Expand All @@ -340,7 +342,7 @@ def self.create_single_family_detached(runner:,
attic_space_name = HPXML::LocationAtticUnvented
end
attic_zone.setName(attic_space_name)
elsif attic_type == HPXML::AtticTypeConditioned
when HPXML::AtticTypeConditioned
attic_space.setThermalZone(conditioned_zone)
attic_space_name = HPXML::LocationConditionedSpace
end
Expand Down Expand Up @@ -379,20 +381,23 @@ def self.create_single_family_detached(runner:,
foundation_space = OpenStudio::Model::Space::fromFloorPrint(foundation_polygon, foundation_height, model)
foundation_space = foundation_space.get
assign_indexes(model: model, footprint_polygon: foundation_polygon, space: foundation_space)
if foundation_type == HPXML::FoundationTypeCrawlspaceVented
case foundation_type
when HPXML::FoundationTypeCrawlspaceVented
foundation_space_name = HPXML::LocationCrawlspaceVented
elsif foundation_type == HPXML::FoundationTypeCrawlspaceUnvented
when HPXML::FoundationTypeCrawlspaceUnvented
foundation_space_name = HPXML::LocationCrawlspaceUnvented
elsif foundation_type == HPXML::FoundationTypeCrawlspaceConditioned
when HPXML::FoundationTypeCrawlspaceConditioned
foundation_space_name = HPXML::LocationCrawlspaceConditioned
elsif foundation_type == HPXML::FoundationTypeBasementUnconditioned
when HPXML::FoundationTypeBasementUnconditioned
foundation_space_name = HPXML::LocationBasementUnconditioned
elsif foundation_type == HPXML::FoundationTypeBasementConditioned
when HPXML::FoundationTypeBasementConditioned
foundation_space_name = HPXML::LocationBasementConditioned
elsif foundation_type == HPXML::FoundationTypeAmbient
when HPXML::FoundationTypeAmbient
foundation_space_name = HPXML::LocationOutside
elsif foundation_type.start_with?(HPXML::FoundationTypeBellyAndWing)
foundation_space_name = HPXML::LocationManufacturedHomeUnderBelly
else
if foundation_type.start_with? HPXML::FoundationTypeBellyAndWing
foundation_space_name = HPXML::LocationManufacturedHomeUnderBelly
end
end
foundation_zone.setName(foundation_space_name)
foundation_space.setName(foundation_space_name)
Expand Down Expand Up @@ -814,17 +819,18 @@ def self.create_single_family_attached(model:,
# create foundation zone
foundation_zone = OpenStudio::Model::ThermalZone.new(model)

if foundation_type == HPXML::FoundationTypeCrawlspaceVented
case foundation_type
when HPXML::FoundationTypeCrawlspaceVented
foundation_space_name = HPXML::LocationCrawlspaceVented
elsif foundation_type == HPXML::FoundationTypeCrawlspaceUnvented
when HPXML::FoundationTypeCrawlspaceUnvented
foundation_space_name = HPXML::LocationCrawlspaceUnvented
elsif foundation_type == HPXML::FoundationTypeCrawlspaceConditioned
when HPXML::FoundationTypeCrawlspaceConditioned
foundation_space_name = HPXML::LocationCrawlspaceConditioned
elsif foundation_type == HPXML::FoundationTypeBasementUnconditioned
when HPXML::FoundationTypeBasementUnconditioned
foundation_space_name = HPXML::LocationBasementUnconditioned
elsif foundation_type == HPXML::FoundationTypeBasementConditioned
when HPXML::FoundationTypeBasementConditioned
foundation_space_name = HPXML::LocationBasementConditioned
elsif foundation_type == HPXML::FoundationTypeAmbient
when HPXML::FoundationTypeAmbient
foundation_space_name = HPXML::LocationOutside
end
foundation_zone.setName(foundation_space_name)
Expand Down Expand Up @@ -889,7 +895,8 @@ def self.create_single_family_attached(model:,
attic_space = get_attic_space(model: model, x: x, y: y, average_ceiling_height: average_ceiling_height, num_floors: num_floors, roof_pitch: roof_pitch, roof_type: roof_type, rim_joist_height: rim_joist_height)

# set these to the attic zone
if (attic_type == HPXML::AtticTypeVented) || (attic_type == HPXML::AtticTypeUnvented)
case attic_type
when HPXML::AtticTypeVented, HPXML::AtticTypeUnvented
# create attic zone
attic_zone = OpenStudio::Model::ThermalZone.new(model)
attic_space.setThermalZone(attic_zone)
Expand Down Expand Up @@ -1106,17 +1113,18 @@ def self.create_apartment(model:,
# create foundation zone
foundation_zone = OpenStudio::Model::ThermalZone.new(model)

if foundation_type == HPXML::FoundationTypeCrawlspaceVented
case foundation_type
when HPXML::FoundationTypeCrawlspaceVented
foundation_space_name = HPXML::LocationCrawlspaceVented
elsif foundation_type == HPXML::FoundationTypeCrawlspaceUnvented
when HPXML::FoundationTypeCrawlspaceUnvented
foundation_space_name = HPXML::LocationCrawlspaceUnvented
elsif foundation_type == HPXML::FoundationTypeCrawlspaceConditioned
when HPXML::FoundationTypeCrawlspaceConditioned
foundation_space_name = HPXML::LocationCrawlspaceConditioned
elsif foundation_type == HPXML::FoundationTypeBasementUnconditioned
when HPXML::FoundationTypeBasementUnconditioned
foundation_space_name = HPXML::LocationBasementUnconditioned
elsif foundation_type == HPXML::FoundationTypeBasementConditioned
when HPXML::FoundationTypeBasementConditioned
foundation_space_name = HPXML::LocationBasementConditioned
elsif foundation_type == HPXML::FoundationTypeAmbient
when HPXML::FoundationTypeAmbient
foundation_space_name = HPXML::LocationOutside
end
foundation_zone.setName(foundation_space_name)
Expand Down Expand Up @@ -1179,7 +1187,8 @@ def self.create_apartment(model:,
attic_space = get_attic_space(model: model, x: x, y: y, average_ceiling_height: average_ceiling_height, num_floors: num_floors, roof_pitch: roof_pitch, roof_type: roof_type, rim_joist_height: rim_joist_height)

# set these to the attic zone
if (attic_type == HPXML::AtticTypeVented) || (attic_type == HPXML::AtticTypeUnvented)
case attic_type
when HPXML::AtticTypeVented, HPXML::AtticTypeUnvented
# create attic zone
attic_zone = OpenStudio::Model::ThermalZone.new(model)
attic_space.setThermalZone(attic_zone)
Expand Down Expand Up @@ -1326,16 +1335,17 @@ def self.create_doors(runner:,

# Convert to 3D geometry; assign to surface
door_polygon = OpenStudio::Point3dVector.new
if facade == Constants::FacadeFront
case facade
when Constants::FacadeFront
multx = 1
multy = 0
elsif facade == Constants::FacadeBack
when Constants::FacadeBack
multx = -1
multy = 0
elsif facade == Constants::FacadeLeft
when Constants::FacadeLeft
multx = 0
multy = -1
elsif facade == Constants::FacadeRight
when Constants::FacadeRight
multx = 0
multy = 1
end
Expand Down Expand Up @@ -1602,19 +1612,20 @@ def self.create_windows_and_skylights(runner:,
leftx = skylight_bottom_left.x
lefty = skylight_bottom_left.y
bottomz = skylight_bottom_left.z
if (facade == Constants::FacadeFront) || (facade == Constants::FacadeNone)
case facade
when Constants::FacadeFront, Constants::FacadeNone
skylight_top_left = OpenStudio::Point3d.new(leftx, lefty + Math.cos(surface.tilt) * skylight_length, bottomz + Math.sin(surface.tilt) * skylight_length)
skylight_top_right = OpenStudio::Point3d.new(leftx + skylight_width, lefty + Math.cos(surface.tilt) * skylight_length, bottomz + Math.sin(surface.tilt) * skylight_length)
skylight_bottom_right = OpenStudio::Point3d.new(leftx + skylight_width, lefty, bottomz)
elsif facade == Constants::FacadeBack
when Constants::FacadeBack
skylight_top_left = OpenStudio::Point3d.new(leftx, lefty - Math.cos(surface.tilt) * skylight_length, bottomz + Math.sin(surface.tilt) * skylight_length)
skylight_top_right = OpenStudio::Point3d.new(leftx - skylight_width, lefty - Math.cos(surface.tilt) * skylight_length, bottomz + Math.sin(surface.tilt) * skylight_length)
skylight_bottom_right = OpenStudio::Point3d.new(leftx - skylight_width, lefty, bottomz)
elsif facade == Constants::FacadeLeft
when Constants::FacadeLeft
skylight_top_left = OpenStudio::Point3d.new(leftx + Math.cos(surface.tilt) * skylight_length, lefty, bottomz + Math.sin(surface.tilt) * skylight_length)
skylight_top_right = OpenStudio::Point3d.new(leftx + Math.cos(surface.tilt) * skylight_length, lefty - skylight_width, bottomz + Math.sin(surface.tilt) * skylight_length)
skylight_bottom_right = OpenStudio::Point3d.new(leftx, lefty - skylight_width, bottomz)
elsif facade == Constants::FacadeRight
when Constants::FacadeRight
skylight_top_left = OpenStudio::Point3d.new(leftx - Math.cos(surface.tilt) * skylight_length, lefty, bottomz + Math.sin(surface.tilt) * skylight_length)
skylight_top_right = OpenStudio::Point3d.new(leftx - Math.cos(surface.tilt) * skylight_length, lefty + skylight_width, bottomz + Math.sin(surface.tilt) * skylight_length)
skylight_bottom_right = OpenStudio::Point3d.new(leftx, lefty + skylight_width, bottomz)
Expand Down Expand Up @@ -1802,13 +1813,14 @@ def self.get_facade_for_surface(surface:)
# @return [Double] the absolute azimuth based on relative azimuth of the facade and building orientation
def self.get_azimuth_from_facade(facade:,
orientation:)
if facade == Constants::FacadeFront
case facade
when Constants::FacadeFront
return get_abs_azimuth(relative_azimuth: 0, building_orientation: orientation)
elsif facade == Constants::FacadeBack
when Constants::FacadeBack
return get_abs_azimuth(relative_azimuth: 180, building_orientation: orientation)
elsif facade == Constants::FacadeLeft
when Constants::FacadeLeft
return get_abs_azimuth(relative_azimuth: 90, building_orientation: orientation)
elsif facade == Constants::FacadeRight
when Constants::FacadeRight
return get_abs_azimuth(relative_azimuth: 270, building_orientation: orientation)
else
fail 'Unexpected facade.'
Expand Down Expand Up @@ -2290,16 +2302,17 @@ def self.add_window_to_wall(surface:,

# Convert to 3D geometry; assign to surface
window_polygon = OpenStudio::Point3dVector.new
if facade == Constants::FacadeFront
case facade
when Constants::FacadeFront
multx = 1
multy = 0
elsif facade == Constants::FacadeBack
when Constants::FacadeBack
multx = -1
multy = 0
elsif facade == Constants::FacadeLeft
when Constants::FacadeLeft
multx = 0
multy = -1
elsif facade == Constants::FacadeRight
when Constants::FacadeRight
multx = 0
multy = 1
end
Expand Down Expand Up @@ -2458,15 +2471,16 @@ def self.get_attic_space(model:,
attic_height = (y_tot / 2.0) * roof_pitch + rim_joist_height # Roof always has same orientation

side_type = nil
if roof_type == Constants::RoofTypeGable
case roof_type
when Constants::RoofTypeGable
roof_w_point = OpenStudio::Point3d.new(0, y_peak, average_ceiling_height * num_floors + attic_height)
roof_e_point = OpenStudio::Point3d.new(x, y_peak, average_ceiling_height * num_floors + attic_height)
polygon_w_roof = make_polygon(roof_w_point, roof_e_point, ne_point, nw_point)
polygon_e_roof = make_polygon(roof_e_point, roof_w_point, sw_point, se_point)
polygon_s_wall = make_polygon(roof_w_point, nw_point, sw_point)
polygon_n_wall = make_polygon(roof_e_point, se_point, ne_point)
side_type = EPlus::SurfaceTypeWall
elsif roof_type == Constants::RoofTypeHip
when Constants::RoofTypeHip
if y > 0
if x <= (y + y_rear)
roof_n_point = OpenStudio::Point3d.new(x / 2.0, y_rear - x / 2.0, average_ceiling_height * num_floors + attic_height)
Expand Down
Loading

0 comments on commit bcd352f

Please sign in to comment.