Skip to content

Commit

Permalink
fix(window display_name): Fix window component display_names
Browse files Browse the repository at this point in the history
  • Loading branch information
ed-p-may committed Oct 4, 2022
1 parent 09a8ff8 commit 9f43aa5
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 10 deletions.
2 changes: 2 additions & 0 deletions PHX/from_HBJSON/create_assemblies.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def build_phx_window_type_from_hb_win_construction(_hb_win_const: window.WindowC
# -- Glass ----------------------------------------------------------------
if ph_params.ph_glazing:
# -- Use Detailed PH-Params
phx_window_type.glazing_type_display_name = ph_params.ph_glazing.display_name
phx_window_type.u_value_glass = ph_params.ph_glazing.u_factor
phx_window_type.glass_g_value = ph_params.ph_glazing.g_value
else:
Expand All @@ -146,6 +147,7 @@ def build_phx_window_type_from_hb_win_construction(_hb_win_const: window.WindowC
# -- Frames ---------------------------------------------------------------
if ph_params.ph_frame:
# -- Use Detailed PH-Params
phx_window_type.frame_type_display_name = ph_params.ph_frame.display_name
phx_window_type.frame_top.u_value = ph_params.ph_frame.top.u_factor
phx_window_type.frame_top.width = ph_params.ph_frame.top.width
phx_window_type.frame_top.psi_glazing = ph_params.ph_frame.top.psi_glazing
Expand Down
18 changes: 18 additions & 0 deletions PHX/model/constructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ class PhxConstructionWindow:
_count: ClassVar[int] = 0
id_num: int = field(init=False, default=0)
display_name: str = ""
_glazing_type_display_name: str = ""
_frame_type_display_name: str = ""

use_detailed_uw: bool = True
use_detailed_frame: bool = True
Expand All @@ -100,3 +102,19 @@ class PhxConstructionWindow:
def __post_init__(self) -> None:
self.__class__._count += 1
self.id_num = self.__class__._count

@property
def glazing_type_display_name(self) -> str:
return self._glazing_type_display_name or self.display_name

@glazing_type_display_name.setter
def glazing_type_display_name(self, _in:str) -> None:
self._glazing_type_display_name = _in

@property
def frame_type_display_name(self) -> str:
return self._frame_type_display_name or self.display_name

@frame_type_display_name.setter
def frame_type_display_name(self, _in: str) -> None:
self._frame_type_display_name = _in
4 changes: 2 additions & 2 deletions PHX/to_PHPP/phpp_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,10 @@ def write_project_window_surfaces(self, phx_project: project.PhxProject) -> None
host_polygon.display_name
)
phpp_id_frame = self.components.frames.get_frame_phpp_id_by_name(
phx_aperture.window_type.display_name
phx_aperture.window_type.frame_type_display_name
)
phpp_id_glazing = self.components.glazings.get_glazing_phpp_id_by_name(
phx_aperture.window_type.display_name
phx_aperture.window_type.glazing_type_display_name
)

phpp_windows.append(
Expand Down
2 changes: 1 addition & 1 deletion PHX/to_PHPP/phpp_model/component_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def create_xl_items(self, _sheet_name: str, _row_num: int) -> List[xl_data.XlIte
create_range = partial(self._create_range, _row_num=_row_num)
XLItemCompo = partial(xl_data.XlItem, _sheet_name)
xl_item_list: List[xl_data.XlItem] = [
XLItemCompo(create_range('description'), self.phx_construction.display_name),
XLItemCompo(create_range('description'), self.phx_construction.frame_type_display_name),
XLItemCompo(create_range('u_value_left'), self.phx_construction.frame_left.u_value, "W/M2K", self._get_target_unit("u_value_left")),
XLItemCompo(create_range('u_value_right'), self.phx_construction.frame_right.u_value, "W/M2K", self._get_target_unit("u_value_right")),
XLItemCompo(create_range('u_value_bottom'), self.phx_construction.frame_bottom.u_value, "W/M2K", self._get_target_unit("u_value_bottom")),
Expand Down
2 changes: 1 addition & 1 deletion PHX/to_PHPP/phpp_model/component_glazing.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def create_xl_items(self, _sheet_name: str, _row_num: int) -> List[xl_data.XlIte
create_range = partial(self._create_range, _row_num=_row_num)
XLItemCompo = partial(xl_data.XlItem, _sheet_name)
xl_item_list: List[xl_data.XlItem] = [
XLItemCompo(create_range("description"), self.phx_construction.display_name),
XLItemCompo(create_range("description"), self.phx_construction.glazing_type_display_name),
XLItemCompo(create_range("g_value"), self.phx_construction.glass_g_value),
XLItemCompo(
create_range("u_value"),
Expand Down
4 changes: 2 additions & 2 deletions PHX/to_PHPP/phpp_model/windows_rows.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def create_xl_items(self, _sheet_name: str, _row_num: int) -> List[xl_data.XlIte
XLItemWindows(create_range("quantity"), 1),
XLItemWindows(create_range("description"), self.phx_polygon.display_name),
XLItemWindows(create_range("host"), self.phpp_host_surface_id_name),
XLItemWindows(create_range("glazing_id"), self.phpp_id_frame),
XLItemWindows(create_range("frame_id"), self.phpp_id_glazing),
XLItemWindows(create_range("glazing_id"), self.phpp_id_glazing),
XLItemWindows(create_range("frame_id"), self.phpp_id_frame),
XLItemWindows(create_range("width"), self.phx_polygon.width, "M", self._get_target_unit("width")),
XLItemWindows(create_range("height"), self.phx_polygon.height, "M", self._get_target_unit("height")),

Expand Down
8 changes: 4 additions & 4 deletions _testing_to_PHPP.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# "/Users/em/Dropbox/bldgtyp-00/00_PH_Tools/PHX/tests/_source_hbjson/Default_Model_Single_Zone.hbjson"
# )
SOURCE_FILE = pathlib.Path(
"/Users/em/Dropbox/bldgtyp-00/00_PH_Tools/PHX/sample/hbjson/220926_Penziner.hbjson"
"/Users/em/Dropbox/bldgtyp-00/00_PH_Tools/PHX/sample/hbjson/221004_Penziner.hbjson"
)

if __name__ == '__main__':
Expand Down Expand Up @@ -47,14 +47,14 @@

with phpp_conn.xl.in_silent_mode():
# phpp_conn.xl.unprotect_all_sheets()
phpp_conn.write_certification_config(phx_project)
# phpp_conn.write_certification_config(phx_project)
# phpp_conn.write_climate_data(phx_project)
# phpp_conn.write_project_constructions(phx_project)
# phpp_conn.write_project_tfa(phx_project)
# phpp_conn.write_project_opaque_surfaces(phx_project)
# phpp_conn.write_project_thermal_bridges(phx_project)
# phpp_conn.write_project_window_components(phx_project)
# phpp_conn.write_project_window_surfaces(phx_project)
phpp_conn.write_project_window_components(phx_project)
phpp_conn.write_project_window_surfaces(phx_project)
# phpp_conn.write_project_window_shading(phx_project)
# phpp_conn.write_project_ventilation_components(phx_project)
# phpp_conn.write_project_ventilators(phx_project)
Expand Down

0 comments on commit 9f43aa5

Please sign in to comment.