-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(foundations): Add support for Foundation objects, export to WUFI
- Add new PH Foundation types - Add WUFI-Passive export support - Add new tests
- Loading branch information
Showing
14 changed files
with
735 additions
and
414 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# -*- coding: utf-8 -*- | ||
# -*- Python Version: 3.7 -*- | ||
|
||
"""Functions to build PHX-Foundations from HBPH source objects.""" | ||
|
||
from typing import Dict | ||
from honeybee_ph.foundations import PhFoundation | ||
|
||
from PHX.model.enums.foundations import FoundationType | ||
from PHX.model import ground | ||
|
||
def create_phx_foundation_from_hbph(_hbph_foundation: PhFoundation) -> ground.PhxFoundation: | ||
"""Return a new PhxFoundation object with attributes based on a source HBPH-Foundation. | ||
Arguments: | ||
---------- | ||
* | ||
Returns: | ||
-------- | ||
* (PhxFoundation) | ||
""" | ||
|
||
phx_foundation_type_map: Dict[str, ground.PhxFoundationTypes] = { | ||
"PhHeatedBasement": ground.PhxHeatedBasement, | ||
"PhUnheatedBasement": ground.PhxUnHeatedBasement, | ||
"PhSlabOnGrade": ground.PhxSlabOnGrade, | ||
"PhVentedCrawlspace": ground.PhxVentedCrawlspace, | ||
"PhFoundation": ground.PhxFoundation, | ||
} | ||
new_phx_foundation = phx_foundation_type_map[_hbph_foundation.__class__.__name__]() | ||
new_phx_foundation.display_name = _hbph_foundation.display_name | ||
new_phx_foundation.foundation_type_num = FoundationType(_hbph_foundation.foundation_type.number) | ||
|
||
|
||
# -- Pull out all the PH attributes and set the PHX ones to match. | ||
for attr_name in vars(_hbph_foundation).keys(): | ||
if str(attr_name).startswith("_"): | ||
attr_name = attr_name[1:] | ||
|
||
try: | ||
# try and set any Enums by number first... | ||
setattr(new_phx_foundation, attr_name, getattr(_hbph_foundation, attr_name).number) | ||
except AttributeError: | ||
# ... then just set copy over any non-Enum values | ||
try: | ||
setattr(new_phx_foundation, attr_name, getattr(_hbph_foundation, attr_name)) | ||
except KeyError: | ||
raise | ||
except Exception as e: | ||
msg = f"\n\tError setting attribute '{attr_name}' on '{new_phx_foundation.__class__.__name__}'?" | ||
raise Exception(msg) | ||
|
||
return new_phx_foundation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- coding: utf-8 -*- | ||
# -*- Python Version: 3.7 -*- | ||
|
||
"""Valid 'types' for Foundation Options and Types""" | ||
|
||
from enum import Enum | ||
|
||
|
||
class CalculationSetting(Enum): | ||
USER_DEFINED = 6 | ||
|
||
class FoundationType(Enum): | ||
HEATED_BASEMENT = 1 | ||
UNHEATED_BASEMENT = 2 | ||
SLAB_ON_GRADE = 3 | ||
VENTED_CRAWLSPACE = 4 | ||
NONE = 5 | ||
|
||
class PerimeterInsulationPosition(Enum): | ||
UNDEFINED = 1 | ||
HORIZONTAL = 2 | ||
VERTICAL = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.