From 387215482caa3dbc2623e99eae3a385dfc9d902e Mon Sep 17 00:00:00 2001 From: PH Tools Date: Sun, 10 Nov 2024 16:27:47 -0500 Subject: [PATCH] fix(air): Support AirBoundaryConstructions - Allow AirBoundaryConstructions - Update tests --- PHX/from_HBJSON/create_assemblies.py | 12 ++++++++++-- PHX/from_HBJSON/create_building.py | 12 ++++++++++++ requirements.txt | 6 +++--- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/PHX/from_HBJSON/create_assemblies.py b/PHX/from_HBJSON/create_assemblies.py index 4bd60e4..b5a344c 100644 --- a/PHX/from_HBJSON/create_assemblies.py +++ b/PHX/from_HBJSON/create_assemblies.py @@ -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 @@ -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) diff --git a/PHX/from_HBJSON/create_building.py b/PHX/from_HBJSON/create_building.py index 0efab46..c67c354 100644 --- a/PHX/from_HBJSON/create_building.py +++ b/PHX/from_HBJSON/create_building.py @@ -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)] @@ -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)] diff --git a/requirements.txt b/requirements.txt index 2316c30..cf4604f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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