1- # -*- coding: utf-8 -*-
21# -*- Python Version: 3.10 -*-
32
43"""Controller for managing the PHPP Connection."""
54
6- from typing import Dict , List
75
86from PHX .model import building , certification , components , project
97from PHX .model .hvac .collection import NoDeviceFoundError
@@ -146,7 +144,7 @@ def get_phpp_version(
146144 "1-PE-FACTORS" : "EN" ,
147145 }
148146 language = None
149- for search_string in language_search_data . keys () :
147+ for search_string in language_search_data :
150148 if search_string in str (data [- 1 ]).upper ().strip ():
151149 language = language_search_data [search_string ]
152150 language = language .strip ().replace (" " , "_" ).replace ("." , "_" )
@@ -163,17 +161,11 @@ def get_phpp_version(
163161 def is_easyPh (self ) -> bool :
164162 """Return True if the active PHPP file is an 'easyPH' file."""
165163 name = self .shape .EASY_PH .name .upper ()
166- if name in self .xl .get_upper_case_worksheet_names ():
167- print ("PHPP is easyPH" )
168- return True
169- else :
170- return False
164+ return name in self .xl .get_upper_case_worksheet_names ()
171165
172166 def phpp_version_equals_phx_phi_cert_version (self , _phx_variant : project .PhxVariant ) -> bool :
173167 """Return True if the PHX PHI Certification Version and the PHPP Version match."""
174- if not int (_phx_variant .phi_certification_major_version ) == int (self .version .number_major ):
175- return False
176- return True
168+ return int (_phx_variant .phi_certification_major_version ) == int (self .version .number_major )
177169
178170 def write_certification_config (self , phx_project : project .PhxProject ) -> None :
179171 if self .easyPh :
@@ -309,7 +301,7 @@ def write_climate_data(self, phx_project: project.PhxProject) -> None:
309301 def write_project_constructions (self , phx_project : project .PhxProject ) -> None :
310302 """Write all of the opaque constructions to the PHPP 'U-Values' worksheet."""
311303
312- construction_blocks : List [uvalues_constructor .ConstructorBlock ] = []
304+ construction_blocks : list [uvalues_constructor .ConstructorBlock ] = []
313305 for phx_construction in phx_project .assembly_types .values ():
314306 construction_blocks .append (
315307 uvalues_constructor .ConstructorBlock (shape = self .shape .UVALUES , phx_construction = phx_construction )
@@ -321,8 +313,8 @@ def write_project_constructions(self, phx_project: project.PhxProject) -> None:
321313 def write_project_window_components (self , phx_project : project .PhxProject ) -> None :
322314 """Write all of the frame and glass constructions from a PhxProject to the PHPP 'Components' worksheet."""
323315
324- glazing_component_rows : List [component_glazing .GlazingRow ] = []
325- frame_component_rows : List [component_frame .FrameRow ] = []
316+ glazing_component_rows : list [component_glazing .GlazingRow ] = []
317+ frame_component_rows : list [component_frame .FrameRow ] = []
326318 for phx_construction in phx_project .window_types .values ():
327319 glazing_component_rows .append (
328320 component_glazing .GlazingRow (shape = self .shape .COMPONENTS , phx_construction = phx_construction )
@@ -337,7 +329,7 @@ def write_project_window_components(self, phx_project: project.PhxProject) -> No
337329 def write_project_ventilation_components (self , phx_project : project .PhxProject ) -> None :
338330 """Write all of the ventilators from a PhxProject to the PHPP 'Components' worksheet."""
339331
340- phpp_ventilator_rows : List [component_vent .VentilatorRow ] = []
332+ phpp_ventilator_rows : list [component_vent .VentilatorRow ] = []
341333 for phx_variant in phx_project .variants :
342334 for mech_collection in phx_variant .mech_collections :
343335 for phx_ventilator in mech_collection .ventilation_devices :
@@ -365,7 +357,7 @@ def write_project_tfa(self, phx_project: project.PhxProject) -> None:
365357 def write_project_opaque_surfaces (self , phx_project : project .PhxProject ) -> None :
366358 """Write all of the opaque surfaces from a PhxProject to the PHPP 'Areas' worksheet."""
367359
368- surfaces : List [areas_surface .SurfaceRow ] = []
360+ surfaces : list [areas_surface .SurfaceRow ] = []
369361 for phx_variant in phx_project .variants :
370362 for opaque_component in phx_variant .building .opaque_components :
371363 for phx_polygon in opaque_component .polygons :
@@ -382,11 +374,7 @@ def write_project_opaque_surfaces(self, phx_project: project.PhxProject) -> None
382374 )
383375
384376 if len (surfaces ) >= 100 :
385- print (
386- f"Warning: { len (surfaces )} surfaces found in the model. Ensure that you have "
387- "added enough rows to the 'Areas' worksheet to handle that many surfaces. "
388- "By default the PHPP can only have 100 surfaces input."
389- )
377+ pass
390378
391379 phpp_surfaces_rows_sorted = sorted (surfaces , key = lambda x : x .phx_polygon .display_name .lower ())
392380 self .areas .write_surfaces (phpp_surfaces_rows_sorted )
@@ -395,18 +383,14 @@ def write_project_opaque_surfaces(self, phx_project: project.PhxProject) -> None
395383 def write_project_thermal_bridges (self , phx_project : project .PhxProject ) -> None :
396384 """Write all of the thermal-bridge elements of a PhxProject to the PHPP 'Areas' worksheet."""
397385
398- thermal_bridges : List [areas_thermal_bridges .ThermalBridgeRow ] = []
386+ thermal_bridges : list [areas_thermal_bridges .ThermalBridgeRow ] = []
399387 for variant in phx_project .variants :
400388 for zone in variant .zones :
401389 for phx_tb in zone .thermal_bridges :
402390 thermal_bridges .append (areas_thermal_bridges .ThermalBridgeRow (self .shape .AREAS , phx_tb ))
403391
404392 if len (thermal_bridges ) >= 100 :
405- print (
406- f"Warning: { len (thermal_bridges )} thermal bridges found in the model. Ensure that you have "
407- "added enough rows to the 'Areas' worksheet to handle that many thermal bridges. "
408- "By default the PHPP can only have 100 thermal bridges input."
409- )
393+ pass
410394
411395 self .areas .write_thermal_bridges (thermal_bridges )
412396 return None
@@ -428,7 +412,7 @@ def write_project_window_surfaces(self, phx_project: project.PhxProject) -> None
428412 window_type_phpp_ids = self .variants .get_window_type_phpp_ids ()
429413
430414 # -- Write in the window-data
431- phpp_windows : List [windows_rows .WindowRow ] = []
415+ phpp_windows : list [windows_rows .WindowRow ] = []
432416 for phx_variant in phx_project .variants :
433417 for phx_component in phx_variant .building .opaque_components :
434418 for phx_aperture in phx_component .apertures :
@@ -460,19 +444,15 @@ def write_project_window_surfaces(self, phx_project: project.PhxProject) -> None
460444 )
461445
462446 if len (phpp_windows ) >= 150 :
463- print (
464- f"Warning: { len (phpp_windows )} windows found in the model. Ensure that you have "
465- "added enough rows to the 'Windows' worksheet to handle that many windows. "
466- "By default the PHPP can only have 150 windows input."
467- )
447+ pass
468448
469449 phpp_windows_rows_sorted = sorted (phpp_windows , key = lambda x : x .phx_polygon .display_name .lower ())
470450 self .windows .write_windows (phpp_windows_rows_sorted )
471451 return None
472452
473453 def write_project_window_shading (self , phx_project : project .PhxProject ) -> None :
474454 def _get_ap_element_from_dict (
475- _window_name : str , _dict : Dict [str , components .PhxApertureElement ]
455+ _window_name : str , _dict : dict [str , components .PhxApertureElement ]
476456 ) -> components .PhxApertureElement :
477457 """When reading from excel, it MIGHT come in as a float. This means
478458 that any windows with a numerical name (ie: '106', '205', etc) will get
@@ -499,7 +479,7 @@ def _get_ap_element_from_dict(
499479 window_names = self .windows .get_all_window_names ()
500480
501481 # Get all the PHX Aperture objects
502- phx_aperture_dict : Dict [str , components .PhxApertureElement ] = {}
482+ phx_aperture_dict : dict [str , components .PhxApertureElement ] = {}
503483 for phx_variant in phx_project .variants :
504484 for phx_component in phx_variant .building .opaque_components :
505485 for phx_aperture in phx_component .apertures :
@@ -512,7 +492,7 @@ def _get_ap_element_from_dict(
512492 )
513493
514494 # Write out all the data to the Shading Worksheet
515- phpp_shading_rows : List [shading_rows .ShadingRow ] = []
495+ phpp_shading_rows : list [shading_rows .ShadingRow ] = []
516496 for phx_aperture_element in phx_aperture_elements_in_order :
517497 phpp_shading_rows .append (
518498 shading_rows .ShadingRow (
@@ -534,7 +514,7 @@ def write_project_ventilators(self, phx_project: project.PhxProject) -> None:
534514 if self .easyPh :
535515 return None
536516
537- phpp_vent_unit_rows : List [vent_units .VentUnitRow ] = []
517+ phpp_vent_unit_rows : list [vent_units .VentUnitRow ] = []
538518 for phx_variant in phx_project .variants :
539519 for mech_collection in phx_variant .mech_collections :
540520 for phx_ventilator in mech_collection .ventilation_devices :
@@ -556,7 +536,7 @@ def write_project_spaces(self, phx_project: project.PhxProject) -> None:
556536 if self .easyPh :
557537 return None
558538
559- phpp_vent_rooms : List [vent_space .VentSpaceRow ] = []
539+ phpp_vent_rooms : list [vent_space .VentSpaceRow ] = []
560540 for phx_variant in phx_project .variants :
561541 for zone in phx_variant .building .zones :
562542 for room in zone .spaces :
@@ -586,11 +566,7 @@ def write_project_spaces(self, phx_project: project.PhxProject) -> None:
586566 phpp_vent_rooms .append (phpp_rm )
587567
588568 if len (phpp_vent_rooms ) >= 30 :
589- print (
590- f"Warning: { len (phpp_vent_rooms )} spaces found in the model. Ensure that you have "
591- "added enough rows to the 'Additional Vent' worksheet to handle that many spaces. "
592- "By default the PHPP can only have 30 spaces input."
593- )
569+ pass
594570
595571 self .addnl_vent .write_spaces (phpp_vent_rooms )
596572 return None
@@ -600,7 +576,7 @@ def write_project_ventilation_type(self, phx_project: project.PhxProject) -> Non
600576 if self .easyPh :
601577 return None
602578
603- for variant in phx_project .variants :
579+ for _variant in phx_project .variants :
604580 self .ventilation .write_ventilation_type (
605581 # TODO: Get the actual type from the model someplace?
606582 # TODO: How to combine Variants?
@@ -664,11 +640,7 @@ def write_project_hot_water(self, phx_project: project.PhxProject) -> None:
664640 # -- Tanks
665641 # Use only the first 2 tanks for PHPP
666642 if len (mech_collection .dhw_tank_devices ) > 2 :
667- print (
668- f"Warning: PHPP only allows 2 tanks."
669- f"{ len (mech_collection .dhw_tank_devices )} tank"
670- f'found in the Variant "{ variant .name } "'
671- )
643+ pass
672644
673645 tank_inputs = []
674646 for i , phx_dhw_tank in enumerate (mech_collection .dhw_tank_devices [:2 ], start = 1 ):
@@ -685,12 +657,7 @@ def write_project_hot_water(self, phx_project: project.PhxProject) -> None:
685657 branch_piping_inputs = []
686658 branch_pipe_groups = mech_collection .dhw_distribution_piping_segments_by_diam
687659 if len (branch_pipe_groups ) > 5 :
688- print (
689- "Warning: PHPP only allows 5 groups of DHW branch piping. "
690- f"{ len (branch_pipe_groups )} piping groups "
691- f'found in the Variant "{ variant .name } ". '
692- "Using only then first 5 piping groups."
693- )
660+ pass
694661
695662 for i , phx_branch_piping in enumerate (branch_pipe_groups [:5 ]):
696663 branch_piping_inputs .append (
@@ -707,12 +674,7 @@ def write_project_hot_water(self, phx_project: project.PhxProject) -> None:
707674 recirc_piping_inputs = []
708675 recirc_pipe_groups = mech_collection .dhw_recirc_piping_segments_by_diam
709676 if len (recirc_pipe_groups ) > 5 :
710- print (
711- "Warning: PHPP only allows 5 groups of DHW Recirc. piping. "
712- f"{ len (recirc_pipe_groups )} piping groups "
713- f'found in the Variant "{ variant .name } ". '
714- "Using only then first 5 piping groups."
715- )
677+ pass
716678
717679 for i , phx_recirc_piping in enumerate (recirc_pipe_groups [:5 ]):
718680 recirc_piping_inputs .append (
@@ -772,10 +734,6 @@ def activate_variant_assemblies(self) -> None:
772734 # -- and add each one to the Variants assembly-layers section
773735 for i , assembly_name in enumerate (self .u_values .get_used_constructor_names (), start = 0 ):
774736 if i > 25 :
775- print (
776- "WARNING: The Variants worksheet can only handle 26 different assemblies."
777- "You will have to set up the assembly-layer Variants links manually."
778- )
779737 continue
780738 self .variants .write_assembly_layer (assembly_name , i )
781739
0 commit comments