Skip to content

Commit

Permalink
fix(air): Support AirBoundaryConstructions
Browse files Browse the repository at this point in the history
- Allow AirBoundaryConstructions
- Update tests
  • Loading branch information
ed-p-may committed Nov 10, 2024
1 parent 2400584 commit 3872154
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
12 changes: 10 additions & 2 deletions PHX/from_HBJSON/create_assemblies.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@

from honeybee import model
from honeybee.aperture import Aperture
from honeybee_energy.properties.face import FaceEnergyProperties
from honeybee_energy.construction import window, windowshade
from honeybee_energy.construction.opaque import OpaqueConstruction
from honeybee_energy.construction.air import AirBoundaryConstruction
from honeybee_energy.construction.window import WindowConstruction
from honeybee_energy.construction.windowshade import WindowConstructionShade
from honeybee_energy.material.opaque import EnergyMaterial, EnergyMaterialNoMass
Expand Down Expand Up @@ -215,17 +217,23 @@ def build_opaque_assemblies_from_HB_model(_project: project.PhxProject, _hb_mode
--------
* None
"""
DEFAULT_MATERIALS = [
EnergyMaterial(identifier="Air", thickness=0.1, conductivity=1.0, density=100, specific_heat=100)
]

for room in _hb_model.rooms:
for face in room.faces:
hb_const = face.properties.energy.construction # type: OpaqueConstruction
face_prop_energy = getattr(face.properties, "energy") # type: FaceEnergyProperties
hb_const = face_prop_energy.construction # type: OpaqueConstruction | AirBoundaryConstruction

# -- If is an AirBoundary, use the default material
materials = getattr(hb_const, "materials", DEFAULT_MATERIALS)
if not hb_const.identifier in _project.assembly_types:
# -- Create a new Assembly with Layers from the Honeybee-Construction
new_assembly = constructions.PhxConstructionOpaque()
new_assembly.id_num = constructions.PhxConstructionOpaque._count
new_assembly.display_name = hb_const.display_name
new_assembly.layers = [build_layer_from_hb_material(layer) for layer in hb_const.materials]
new_assembly.layers = [build_layer_from_hb_material(layer) for layer in materials]

# -- Add the assembly to the Project
_project.add_assembly_type(new_assembly, hb_const.identifier)
Expand Down
12 changes: 12 additions & 0 deletions PHX/from_HBJSON/create_building.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ def _hb_int_color_to_phx_enum(_hb_face: face.Face) -> ComponentColor:
"Ground": ComponentColor.SURFACE_GROUND_CONTACT,
"Adiabatic": ComponentColor.FLOOR,
},
"AirBoundary": {
"Outdoors": ComponentColor.WINDOW,
"Surface": ComponentColor.WINDOW,
"Ground": ComponentColor.WINDOW,
"Adiabatic": ComponentColor.WINDOW,
},
}
return mapping[str(_hb_face.type)][str(_hb_face.boundary_condition)]

Expand All @@ -110,6 +116,12 @@ def _hb_ext_color_to_phx_enum(_hb_face: face.Face) -> ComponentColor:
"Ground": ComponentColor.SURFACE_GROUND_CONTACT,
"Adiabatic": ComponentColor.FLOOR,
},
"AirBoundary": {
"Outdoors": ComponentColor.WINDOW,
"Surface": ComponentColor.WINDOW,
"Ground": ComponentColor.WINDOW,
"Adiabatic": ComponentColor.WINDOW,
},
}
return mapping[str(_hb_face.type)][str(_hb_face.boundary_condition)]

Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
honeybee-core>=1.58.56
honeybee-energy>=1.109.9
honeybee-ph>=1.28.17
honeybee-core>=1.58.60
honeybee-energy>=1.109.16
honeybee-ph>=1.28.18
pydantic<2.0
PH-units>=1.5.15
rich
Expand Down

0 comments on commit 3872154

Please sign in to comment.