From fe0a2613da7cdcdc21e366a75a81f2cadb1c337a Mon Sep 17 00:00:00 2001 From: PH Tools Date: Fri, 26 May 2023 13:01:21 +0200 Subject: [PATCH] feat(non-combustible): Add Non-Combustible Mat flag --- honeybee_ph/bldg_segment.py | 6 +++++- tests/test_honeybee_ph/test_bldg_segment.py | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/honeybee_ph/bldg_segment.py b/honeybee_ph/bldg_segment.py index 9e64cec..c75c79c 100644 --- a/honeybee_ph/bldg_segment.py +++ b/honeybee_ph/bldg_segment.py @@ -70,6 +70,7 @@ def __init__(self): self.phi_certification = phi.PhiCertification() self.set_points = SetPoints() self.mech_room_temp = 20.0 + self.non_combustible_materials = False self.thermal_bridges = {} # type: Dict[str, thermal_bridge.PhThermalBridge] def add_new_thermal_bridge(self, tb): @@ -91,10 +92,11 @@ def to_dict(self): d["phi_certification"] = self.phi_certification.to_dict() d["set_points"] = self.set_points.to_dict() d["mech_room_temp"] = self.mech_room_temp + d["non_combustible_materials"] = self.non_combustible_materials d["thermal_bridges"] = {} for tb in self.thermal_bridges.values(): d["thermal_bridges"][str(tb.identifier)] = tb.to_dict() - d['user_data'] = self.user_data + d["user_data"] = self.user_data return d @classmethod @@ -121,6 +123,7 @@ def from_dict(cls, _dict): ) obj.set_points = SetPoints.from_dict(_dict.get("set_points", {})) obj.mech_room_temp = _dict["mech_room_temp"] + obj.non_combustible_materials = _dict.get("non_combustible_materials", False) for tb_dict in _dict["thermal_bridges"].values(): tb_obj = thermal_bridge.PhThermalBridge.from_dict(tb_dict) obj.thermal_bridges[tb_obj.identifier] = tb_obj @@ -142,6 +145,7 @@ def __copy__(self): new_obj.phi_certification = self.phi_certification.duplicate() new_obj.set_points = self.set_points.duplicate() new_obj.mech_room_temp = self.mech_room_temp + new_obj.non_combustible_materials = self.non_combustible_materials new_obj.thermal_bridges = {} for tb_k, tb_v in self.thermal_bridges.items(): new_obj.thermal_bridges[tb_k] = tb_v.duplicate() diff --git a/tests/test_honeybee_ph/test_bldg_segment.py b/tests/test_honeybee_ph/test_bldg_segment.py index d7312be..4dfc15c 100644 --- a/tests/test_honeybee_ph/test_bldg_segment.py +++ b/tests/test_honeybee_ph/test_bldg_segment.py @@ -48,6 +48,7 @@ def test_bdg_segment_round_trip_w_tbs(): assert o2.to_dict() == o1.to_dict() + def test_bdg_segment_round_trip_w_user_data(): o1 = BldgSegment() @@ -80,6 +81,7 @@ def test_bdg_segment_w_tbs_duplicate(): assert o1.to_dict() == o2.to_dict() + def test_bdg_segment_w_user_data_duplicate(): o1 = BldgSegment()