Skip to content

Commit

Permalink
feat(phius): Add Phius 2021 options. Update HB dependency versions
Browse files Browse the repository at this point in the history
- Add new '2021' options to the Phius Certification
- Change default WUFI output to '2021 CORE'
- Update the Honeybee version to 1.6
  • Loading branch information
ed-p-may committed Mar 6, 2023
1 parent f581d91 commit 28627d1
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 45 deletions.
4 changes: 3 additions & 1 deletion honeybee_energy_ph/construction/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""HBPH Window Objects"""

try:
from typing import Any
from typing import Any, List
except ImportError:
pass # Python 2.7

Expand Down Expand Up @@ -82,6 +82,8 @@ def __init__(self, _identifier):

@property
def elements(self):
# type: () -> List[PhWindowFrameElement]
"""Return all four frame elements in clockwise order from top (t, r, b, l)."""
return [self.top, self.right, self.bottom, self.left]

def to_dict(self):
Expand Down
120 changes: 78 additions & 42 deletions honeybee_ph/phius.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@
# -----------------------------------------------------------------------------


class PhiusBuildingCertificationProgram(enumerables.CustomEnum):
allowed = [
"1-Default",
"2-PHIUS 2015",
"3-PHIUS 2018",
"4-Italian",
"5-PHIUS 2018 CORE",
"6-PHIUS 2018 ZERO",
"7-PHIUS 2021 CORE",
"8-PHIUS 2021 ZERO",
]

def __init__(self, _value=1):
# type: (Union[str, int]) -> None
super(PhiusBuildingCertificationProgram, self).__init__(_value)


class PhiusBuildingCategoryType(enumerables.CustomEnum):
allowed = [
"1-RESIDENTIAL BUILDING",
Expand Down Expand Up @@ -70,17 +87,19 @@ def __init__(self, _value=1):
# type: (Union[str, int]) -> None
super(PhiusBuildingType, self).__init__(_value)


# -----------------------------------------------------------------------------


class PhiusCertification(_base._Base):
def __init__(self):
super(PhiusCertification, self).__init__()
self.certification_criteria = 3
self.localization_selection_type = 2

self._building_category_type = PhiusBuildingCategoryType(
"1-RESIDENTIAL BUILDING")
self._certification_program = PhiusBuildingCertificationProgram(
"7-PHIUS 2021 CORE"
)
self._building_category_type = PhiusBuildingCategoryType("1-RESIDENTIAL BUILDING")
self._building_use_type = PhiusBuildingUseType("1-RESIDENTIAL")
self._building_status = PhiusBuildingStatus("1-IN_PLANNING")
self._building_type = PhiusBuildingType("1-NEW_CONSTRUCTION")
Expand All @@ -97,8 +116,20 @@ def __init__(self):
self.int_gains_use_school_defaults = False
self.int_gains_dhw_marginal_perf_ratio = None

@property
def certification_program(self):
# type: () -> PhiusBuildingCertificationProgram
return self._certification_program

@certification_program.setter
def certification_program(self, _input):
# type: (Optional[Union[str, int]]) -> None
if _input:
self._certification_program = PhiusBuildingCertificationProgram(_input)

@property
def building_category_type(self):
# type: () -> PhiusBuildingCategoryType
return self._building_category_type

@building_category_type.setter
Expand All @@ -109,6 +140,7 @@ def building_category_type(self, _input):

@property
def building_use_type(self):
# type: () -> PhiusBuildingUseType
return self._building_use_type

@building_use_type.setter
Expand All @@ -119,6 +151,7 @@ def building_use_type(self, _input):

@property
def building_status(self):
# type: () -> PhiusBuildingStatus
return self._building_status

@building_status.setter
Expand All @@ -129,6 +162,7 @@ def building_status(self, _input):

@property
def building_type(self):
# type: () -> PhiusBuildingType
return self._building_type

@building_type.setter
Expand All @@ -150,25 +184,25 @@ def to_dict(self):
# type: () -> dict
d = {}

d['certification_criteria'] = self.certification_criteria
d['localization_selection_type'] = self.localization_selection_type
d["localization_selection_type"] = self.localization_selection_type

d['building_category_type'] = self.building_category_type.to_dict()
d['building_use_type'] = self.building_use_type.to_dict()
d['building_status'] = self.building_status.to_dict()
d['building_type'] = self.building_type.to_dict()
d["certification_program"] = self.certification_program.to_dict()
d["building_category_type"] = self.building_category_type.to_dict()
d["building_use_type"] = self.building_use_type.to_dict()
d["building_status"] = self.building_status.to_dict()
d["building_type"] = self.building_type.to_dict()

d['PHIUS2021_heating_demand'] = self.PHIUS2021_heating_demand
d['PHIUS2021_cooling_demand'] = self.PHIUS2021_cooling_demand
d['PHIUS2021_heating_load'] = self.PHIUS2021_heating_load
d['PHIUS2021_cooling_load'] = self.PHIUS2021_cooling_load
d["PHIUS2021_heating_demand"] = self.PHIUS2021_heating_demand
d["PHIUS2021_cooling_demand"] = self.PHIUS2021_cooling_demand
d["PHIUS2021_heating_load"] = self.PHIUS2021_heating_load
d["PHIUS2021_cooling_load"] = self.PHIUS2021_cooling_load

d['int_gains_evap_per_person'] = self.int_gains_evap_per_person
d['int_gains_flush_heat_loss'] = self.int_gains_flush_heat_loss
d['int_gains_num_toilets'] = self.int_gains_num_toilets
d['int_gains_toilet_room_util_pat'] = self.int_gains_toilet_room_util_pat
d['int_gains_use_school_defaults'] = self.int_gains_use_school_defaults
d['int_gains_dhw_marginal_perf_ratio'] = self.int_gains_dhw_marginal_perf_ratio
d["int_gains_evap_per_person"] = self.int_gains_evap_per_person
d["int_gains_flush_heat_loss"] = self.int_gains_flush_heat_loss
d["int_gains_num_toilets"] = self.int_gains_num_toilets
d["int_gains_toilet_room_util_pat"] = self.int_gains_toilet_room_util_pat
d["int_gains_use_school_defaults"] = self.int_gains_use_school_defaults
d["int_gains_dhw_marginal_perf_ratio"] = self.int_gains_dhw_marginal_perf_ratio

return d

Expand All @@ -177,33 +211,35 @@ def from_dict(cls, _dict):
# type: (dict) -> PhiusCertification
obj = cls()

obj.certification_criteria = _dict.get('certification_criteria')
obj.localization_selection_type = _dict.get(
'localization_selection_type')
obj.localization_selection_type = _dict.get("localization_selection_type")

obj._certification_program = PhiusBuildingCertificationProgram.from_dict(
_dict.get("certification_program", {})
)
obj._building_category_type = PhiusBuildingCategoryType.from_dict(
_dict.get('building_category_type', {}))
_dict.get("building_category_type", {})
)
obj._building_use_type = PhiusBuildingUseType.from_dict(
_dict.get('building_use_type', {}))
_dict.get("building_use_type", {})
)
obj._building_status = PhiusBuildingStatus.from_dict(
_dict.get('building_status', {}))
obj._building_type = PhiusBuildingType.from_dict(
_dict.get('building_type', {}))

obj.PHIUS2021_heating_demand = _dict.get('PHIUS2021_heating_demand')
obj.PHIUS2021_cooling_demand = _dict.get('PHIUS2021_cooling_demand')
obj.PHIUS2021_heating_load = _dict.get('PHIUS2021_heating_load')
obj.PHIUS2021_cooling_load = _dict.get('PHIUS2021_cooling_load')

obj.int_gains_evap_per_person = _dict.get('int_gains_evap_per_person')
obj.int_gains_flush_heat_loss = _dict.get('int_gains_flush_heat_loss')
obj.int_gains_num_toilets = _dict.get('int_gains_num_toilets')
obj.int_gains_toilet_room_util_pat = _dict.get(
'int_gains_toilet_room_util_pat')
obj.int_gains_use_school_defaults = _dict.get(
'int_gains_use_school_defaults')
_dict.get("building_status", {})
)
obj._building_type = PhiusBuildingType.from_dict(_dict.get("building_type", {}))

obj.PHIUS2021_heating_demand = _dict.get("PHIUS2021_heating_demand")
obj.PHIUS2021_cooling_demand = _dict.get("PHIUS2021_cooling_demand")
obj.PHIUS2021_heating_load = _dict.get("PHIUS2021_heating_load")
obj.PHIUS2021_cooling_load = _dict.get("PHIUS2021_cooling_load")

obj.int_gains_evap_per_person = _dict.get("int_gains_evap_per_person")
obj.int_gains_flush_heat_loss = _dict.get("int_gains_flush_heat_loss")
obj.int_gains_num_toilets = _dict.get("int_gains_num_toilets")
obj.int_gains_toilet_room_util_pat = _dict.get("int_gains_toilet_room_util_pat")
obj.int_gains_use_school_defaults = _dict.get("int_gains_use_school_defaults")
obj.int_gains_dhw_marginal_perf_ratio = _dict.get(
'int_gains_dhw_marginal_perf_ratio')
"int_gains_dhw_marginal_perf_ratio"
)

return obj

Expand All @@ -212,9 +248,9 @@ def __copy__(self):
obj = PhiusCertification()

obj.set_base_attrs_from_source(self)
obj.certification_criteria = self.certification_criteria
obj.localization_selection_type = self.localization_selection_type

obj._certification_program = self._certification_program
obj._building_category_type = self._building_category_type
obj._building_use_type = self._building_use_type
obj._building_status = self._building_status
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
honeybee-core>=1.54.33
honeybee-energy>=1.99.8
honeybee-core>=1.54.34
honeybee-energy>=1.99.10
ladybug-rhino>=1.39.10
PH-units

0 comments on commit 28627d1

Please sign in to comment.