Skip to content

Commit

Permalink
Merge pull request #1905 from NREL/airflow_rb_doc
Browse files Browse the repository at this point in the history
Document airflow.rb
  • Loading branch information
shorowit authored Jan 3, 2025
2 parents f8d5ccb + 749cd8a commit 2efcd6b
Show file tree
Hide file tree
Showing 22 changed files with 761 additions and 843 deletions.
78 changes: 39 additions & 39 deletions BuildResidentialHPXML/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3547,7 +3547,7 @@ def run(model, runner, user_arguments)
return false
end

Model.reset(model, runner)
Model.reset(runner, model)

Version.check_openstudio_version()

Expand Down Expand Up @@ -4084,20 +4084,20 @@ def self.create_geometry_envelope(runner, model, args)

case args[:geometry_unit_type]
when HPXML::ResidentialTypeSFD
success = Geometry.create_single_family_detached(runner: runner, model: model, **args)
success = Geometry.create_single_family_detached(runner, model, **args)
when HPXML::ResidentialTypeSFA
success = Geometry.create_single_family_attached(model: model, **args)
success = Geometry.create_single_family_attached(model, **args)
when HPXML::ResidentialTypeApartment
success = Geometry.create_apartment(model: model, **args)
success = Geometry.create_apartment(model, **args)
when HPXML::ResidentialTypeManufactured
success = Geometry.create_single_family_detached(runner: runner, model: model, **args)
success = Geometry.create_single_family_detached(runner, model, **args)
end
return false if not success

success = Geometry.create_doors(runner: runner, model: model, **args)
success = Geometry.create_doors(runner, model, **args)
return false if not success

success = Geometry.create_windows_and_skylights(runner: runner, model: model, **args)
success = Geometry.create_windows_and_skylights(runner, model, **args)
return false if not success

return true
Expand Down Expand Up @@ -4664,7 +4664,7 @@ def self.set_neighbor_buildings(hpxml_bldg, args)
distance, neighbor_height = data
next if distance == 0

azimuth = Geometry.get_azimuth_from_facade(facade: facade, orientation: args[:geometry_unit_orientation])
azimuth = Geometry.get_azimuth_from_facade(facade, args[:geometry_unit_orientation])

if (distance > 0) && (not neighbor_height.nil?)
height = neighbor_height
Expand Down Expand Up @@ -4846,17 +4846,17 @@ def self.set_roofs(hpxml_bldg, args, sorted_surfaces)
next if surface.outsideBoundaryCondition != EPlus::BoundaryConditionOutdoors
next if surface.surfaceType != EPlus::SurfaceTypeRoofCeiling

interior_adjacent_to = Geometry.get_adjacent_to(surface: surface)
interior_adjacent_to = Geometry.get_surface_adjacent_to(surface)
next if [HPXML::LocationOtherHousingUnit].include? interior_adjacent_to

if args[:geometry_attic_type] == HPXML::AtticTypeFlatRoof
azimuth = nil
else
azimuth = Geometry.get_surface_azimuth(surface: surface, orientation: args[:geometry_unit_orientation])
azimuth = Geometry.get_surface_azimuth(surface, args[:geometry_unit_orientation])
end

hpxml_bldg.roofs.add(id: "Roof#{hpxml_bldg.roofs.size + 1}",
interior_adjacent_to: Geometry.get_adjacent_to(surface: surface),
interior_adjacent_to: Geometry.get_surface_adjacent_to(surface),
azimuth: azimuth,
area: UnitConversions.convert(surface.grossArea, 'm^2', 'ft^2'),
roof_type: args[:roof_material_type],
Expand Down Expand Up @@ -4889,9 +4889,9 @@ def self.set_rim_joists(hpxml_bldg, model, args, sorted_surfaces)
sorted_surfaces.each do |surface|
next if surface.surfaceType != EPlus::SurfaceTypeWall
next unless [EPlus::BoundaryConditionOutdoors, EPlus::BoundaryConditionAdiabatic].include? surface.outsideBoundaryCondition
next unless Geometry.surface_is_rim_joist(surface: surface, height: args[:geometry_rim_joist_height])
next unless Geometry.surface_is_rim_joist(surface, args[:geometry_rim_joist_height])

interior_adjacent_to = Geometry.get_adjacent_to(surface: surface)
interior_adjacent_to = Geometry.get_surface_adjacent_to(surface)
next unless [HPXML::LocationBasementConditioned,
HPXML::LocationBasementUnconditioned,
HPXML::LocationCrawlspaceUnvented,
Expand All @@ -4900,7 +4900,7 @@ def self.set_rim_joists(hpxml_bldg, model, args, sorted_surfaces)

exterior_adjacent_to = HPXML::LocationOutside
if surface.outsideBoundaryCondition == EPlus::BoundaryConditionAdiabatic # can be adjacent to foundation space
adjacent_surface = Geometry.get_adiabatic_adjacent_surface(model: model, surface: surface)
adjacent_surface = Geometry.get_adiabatic_adjacent_surface(model, surface)
if adjacent_surface.nil? # adjacent to a space that is not explicitly in the model
unless [HPXML::ResidentialTypeSFD].include?(args[:geometry_unit_type])
exterior_adjacent_to = interior_adjacent_to
Expand All @@ -4909,7 +4909,7 @@ def self.set_rim_joists(hpxml_bldg, model, args, sorted_surfaces)
end
end
else # adjacent to a space that is explicitly in the model
exterior_adjacent_to = Geometry.get_adjacent_to(surface: adjacent_surface)
exterior_adjacent_to = Geometry.get_surface_adjacent_to(adjacent_surface)
end
end

Expand All @@ -4923,7 +4923,7 @@ def self.set_rim_joists(hpxml_bldg, model, args, sorted_surfaces)
insulation_assembly_r_value = args[:rim_joist_assembly_r]
end

azimuth = Geometry.get_surface_azimuth(surface: surface, orientation: args[:geometry_unit_orientation])
azimuth = Geometry.get_surface_azimuth(surface, args[:geometry_unit_orientation])

hpxml_bldg.rim_joists.add(id: "RimJoist#{hpxml_bldg.rim_joists.size + 1}",
exterior_adjacent_to: exterior_adjacent_to,
Expand Down Expand Up @@ -4951,23 +4951,23 @@ def self.set_rim_joists(hpxml_bldg, model, args, sorted_surfaces)
def self.set_walls(hpxml_bldg, model, args, sorted_surfaces)
sorted_surfaces.each do |surface|
next if surface.surfaceType != EPlus::SurfaceTypeWall
next if Geometry.surface_is_rim_joist(surface: surface, height: args[:geometry_rim_joist_height])
next if Geometry.surface_is_rim_joist(surface, args[:geometry_rim_joist_height])

interior_adjacent_to = Geometry.get_adjacent_to(surface: surface)
interior_adjacent_to = Geometry.get_surface_adjacent_to(surface)
next unless [HPXML::LocationConditionedSpace, HPXML::LocationAtticUnvented, HPXML::LocationAtticVented, HPXML::LocationGarage].include? interior_adjacent_to

exterior_adjacent_to = HPXML::LocationOutside
if surface.adjacentSurface.is_initialized
exterior_adjacent_to = Geometry.get_adjacent_to(surface: surface.adjacentSurface.get)
exterior_adjacent_to = Geometry.get_surface_adjacent_to(surface.adjacentSurface.get)
elsif surface.outsideBoundaryCondition == EPlus::BoundaryConditionAdiabatic # can be adjacent to conditioned space, attic
adjacent_surface = Geometry.get_adiabatic_adjacent_surface(model: model, surface: surface)
adjacent_surface = Geometry.get_adiabatic_adjacent_surface(model, surface)
if adjacent_surface.nil? # adjacent to a space that is not explicitly in the model
exterior_adjacent_to = interior_adjacent_to
if exterior_adjacent_to == HPXML::LocationConditionedSpace # conditioned space adjacent to conditioned space
exterior_adjacent_to = HPXML::LocationOtherHousingUnit
end
else # adjacent to a space that is explicitly in the model
exterior_adjacent_to = Geometry.get_adjacent_to(surface: adjacent_surface)
exterior_adjacent_to = Geometry.get_surface_adjacent_to(adjacent_surface)
end
end

Expand All @@ -4992,7 +4992,7 @@ def self.set_walls(hpxml_bldg, model, args, sorted_surfaces)
end
end

azimuth = Geometry.get_surface_azimuth(surface: surface, orientation: args[:geometry_unit_orientation])
azimuth = Geometry.get_surface_azimuth(surface, args[:geometry_unit_orientation])

hpxml_bldg.walls.add(id: "Wall#{hpxml_bldg.walls.size + 1}",
exterior_adjacent_to: exterior_adjacent_to,
Expand Down Expand Up @@ -5046,9 +5046,9 @@ def self.set_foundation_walls(hpxml_bldg, model, args, sorted_surfaces)
sorted_surfaces.each do |surface|
next if surface.surfaceType != EPlus::SurfaceTypeWall
next unless [EPlus::BoundaryConditionFoundation, EPlus::BoundaryConditionAdiabatic].include? surface.outsideBoundaryCondition
next if Geometry.surface_is_rim_joist(surface: surface, height: args[:geometry_rim_joist_height])
next if Geometry.surface_is_rim_joist(surface, args[:geometry_rim_joist_height])

interior_adjacent_to = Geometry.get_adjacent_to(surface: surface)
interior_adjacent_to = Geometry.get_surface_adjacent_to(surface)
next unless [HPXML::LocationBasementConditioned,
HPXML::LocationBasementUnconditioned,
HPXML::LocationCrawlspaceUnvented,
Expand All @@ -5057,7 +5057,7 @@ def self.set_foundation_walls(hpxml_bldg, model, args, sorted_surfaces)

exterior_adjacent_to = HPXML::LocationGround
if surface.outsideBoundaryCondition == EPlus::BoundaryConditionAdiabatic # can be adjacent to foundation space
adjacent_surface = Geometry.get_adiabatic_adjacent_surface(model: model, surface: surface)
adjacent_surface = Geometry.get_adiabatic_adjacent_surface(model, surface)
if adjacent_surface.nil? # adjacent to a space that is not explicitly in the model
unless [HPXML::ResidentialTypeSFD].include?(args[:geometry_unit_type])
exterior_adjacent_to = interior_adjacent_to
Expand All @@ -5066,7 +5066,7 @@ def self.set_foundation_walls(hpxml_bldg, model, args, sorted_surfaces)
end
end
else # adjacent to a space that is explicitly in the model
exterior_adjacent_to = Geometry.get_adjacent_to(surface: adjacent_surface)
exterior_adjacent_to = Geometry.get_surface_adjacent_to(adjacent_surface)
end
end

Expand Down Expand Up @@ -5097,7 +5097,7 @@ def self.set_foundation_walls(hpxml_bldg, model, args, sorted_surfaces)
end
end

azimuth = Geometry.get_surface_azimuth(surface: surface, orientation: args[:geometry_unit_orientation])
azimuth = Geometry.get_surface_azimuth(surface, args[:geometry_unit_orientation])

hpxml_bldg.foundation_walls.add(id: "FoundationWall#{hpxml_bldg.foundation_walls.size + 1}",
exterior_adjacent_to: exterior_adjacent_to,
Expand Down Expand Up @@ -5143,12 +5143,12 @@ def self.set_floors(hpxml_bldg, args, sorted_surfaces)
next if surface.outsideBoundaryCondition == EPlus::BoundaryConditionFoundation
next unless [EPlus::SurfaceTypeFloor, EPlus::SurfaceTypeRoofCeiling].include? surface.surfaceType

interior_adjacent_to = Geometry.get_adjacent_to(surface: surface)
interior_adjacent_to = Geometry.get_surface_adjacent_to(surface)
next unless [HPXML::LocationConditionedSpace, HPXML::LocationGarage].include? interior_adjacent_to

exterior_adjacent_to = HPXML::LocationOutside
if surface.adjacentSurface.is_initialized
exterior_adjacent_to = Geometry.get_adjacent_to(surface: surface.adjacentSurface.get)
exterior_adjacent_to = Geometry.get_surface_adjacent_to(surface.adjacentSurface.get)
elsif surface.outsideBoundaryCondition == EPlus::BoundaryConditionAdiabatic
exterior_adjacent_to = HPXML::LocationOtherHousingUnit
if surface.surfaceType == EPlus::SurfaceTypeFloor
Expand Down Expand Up @@ -5218,7 +5218,7 @@ def self.set_slabs(hpxml_bldg, model, args, sorted_surfaces)
next unless [EPlus::BoundaryConditionFoundation].include? surface.outsideBoundaryCondition
next if surface.surfaceType != EPlus::SurfaceTypeFloor

interior_adjacent_to = Geometry.get_adjacent_to(surface: surface)
interior_adjacent_to = Geometry.get_surface_adjacent_to(surface)
next if [HPXML::LocationOutside, HPXML::LocationOtherHousingUnit].include? interior_adjacent_to

has_foundation_walls = false
Expand All @@ -5229,7 +5229,7 @@ def self.set_slabs(hpxml_bldg, model, args, sorted_surfaces)
HPXML::LocationBasementConditioned].include? interior_adjacent_to
has_foundation_walls = true
end
exposed_perimeter = Geometry.calculate_exposed_perimeter(model: model, ground_floor_surfaces: [surface], has_foundation_walls: has_foundation_walls).round(1)
exposed_perimeter = Geometry.calculate_exposed_perimeter(model, ground_floor_surfaces: [surface], has_foundation_walls: has_foundation_walls).round(1)
next if exposed_perimeter == 0

if has_foundation_walls
Expand Down Expand Up @@ -5289,8 +5289,8 @@ def self.set_windows(hpxml_bldg, model, args, sorted_subsurfaces)

surface = sub_surface.surface.get

sub_surface_height = Geometry.get_surface_height(surface: sub_surface)
sub_surface_facade = Geometry.get_facade_for_surface(surface: sub_surface)
sub_surface_height = Geometry.get_surface_height(sub_surface)
sub_surface_facade = Geometry.get_surface_facade(sub_surface)

if (sub_surface_facade == Constants::FacadeFront) && ((args[:overhangs_front_depth] > 0) || args[:overhangs_front_distance_to_top_of_window] > 0)
overhangs_depth = args[:overhangs_front_depth]
Expand All @@ -5312,7 +5312,7 @@ def self.set_windows(hpxml_bldg, model, args, sorted_subsurfaces)
# Get max z coordinate of eaves
eaves_z = args[:geometry_average_ceiling_height] * args[:geometry_unit_num_floors_above_grade] + args[:geometry_rim_joist_height]
if args[:geometry_attic_type] == HPXML::AtticTypeConditioned
eaves_z += Geometry.get_conditioned_attic_height(spaces: model.getSpaces)
eaves_z += Geometry.get_conditioned_attic_height(model.getSpaces)
end
if args[:geometry_foundation_type] == HPXML::FoundationTypeAmbient
eaves_z += args[:geometry_foundation_height]
Expand All @@ -5326,7 +5326,7 @@ def self.set_windows(hpxml_bldg, model, args, sorted_subsurfaces)
overhangs_distance_to_bottom_of_window = (overhangs_distance_to_top_of_window + sub_surface_height).round(1)
end

azimuth = Geometry.get_azimuth_from_facade(facade: sub_surface_facade, orientation: args[:geometry_unit_orientation])
azimuth = Geometry.get_azimuth_from_facade(sub_surface_facade, args[:geometry_unit_orientation])

wall_idref = @surface_ids[surface.name.to_s]
next if wall_idref.nil?
Expand Down Expand Up @@ -5375,8 +5375,8 @@ def self.set_skylights(hpxml_bldg, args, sorted_subsurfaces)

surface = sub_surface.surface.get

sub_surface_facade = Geometry.get_facade_for_surface(surface: sub_surface)
azimuth = Geometry.get_azimuth_from_facade(facade: sub_surface_facade, orientation: args[:geometry_unit_orientation])
sub_surface_facade = Geometry.get_surface_facade(sub_surface)
azimuth = Geometry.get_azimuth_from_facade(sub_surface_facade, args[:geometry_unit_orientation])

roof_idref = @surface_ids[surface.name.to_s]
next if roof_idref.nil?
Expand Down Expand Up @@ -5416,10 +5416,10 @@ def self.set_doors(hpxml_bldg, model, args, sorted_subsurfaces)

surface = sub_surface.surface.get

interior_adjacent_to = Geometry.get_adjacent_to(surface: surface)
interior_adjacent_to = Geometry.get_surface_adjacent_to(surface)

if [HPXML::LocationOtherHousingUnit].include?(interior_adjacent_to)
adjacent_surface = Geometry.get_adiabatic_adjacent_surface(model: model, surface: surface)
adjacent_surface = Geometry.get_adiabatic_adjacent_surface(model, surface)
next if adjacent_surface.nil?
end

Expand Down
8 changes: 4 additions & 4 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>df4fe828-a827-4cc2-8a4d-9c8daf649202</version_id>
<version_modified>2024-12-20T20:07:27Z</version_modified>
<version_id>9020722b-d574-4332-96a0-10d947d437fc</version_id>
<version_modified>2025-01-02T23:48:53Z</version_modified>
<xml_checksum>2C38F48B</xml_checksum>
<class_name>BuildResidentialHPXML</class_name>
<display_name>HPXML Builder</display_name>
Expand Down Expand Up @@ -7544,7 +7544,7 @@
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>612549F4</checksum>
<checksum>DF604C07</checksum>
</file>
<file>
<filename>constants.rb</filename>
Expand All @@ -7556,7 +7556,7 @@
<filename>geometry.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>425682E4</checksum>
<checksum>170EAEAB</checksum>
</file>
<file>
<filename>version.txt</filename>
Expand Down
Loading

0 comments on commit 2efcd6b

Please sign in to comment.