Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 82 additions & 62 deletions PHX/PHPP/phpp_app.py

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions PHX/PHPP/sheet_io/io_addnl_vent.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,24 +358,24 @@ def __init__(self, _xl: xl_app.XLConnection, _shape: shape_model.AddnlVent) -> N
self.vent_units = VentUnits(self.xl, self.shape)
self.vent_ducts = VentDucts(self.xl, self.shape)

def write_spaces(self, _spaces: List[vent_space.VentSpaceRow]) -> None:
async def write_spaces(self, _spaces: List[vent_space.VentSpaceRow]) -> None:
if not self.spaces.section_first_entry_row:
self.spaces.section_first_entry_row = (
self.spaces.find_section_first_entry_row()
)

for i, space in enumerate(_spaces, start=self.spaces.section_first_entry_row):
for item in space.create_xl_items(self.shape.name, _row_num=i):
self.xl.write_xl_item(item)
await self.xl.write_xl_item(item)

def write_vent_units(self, _vent_units: List[vent_units.VentUnitRow]) -> None:
async def write_vent_units(self, _vent_units: List[vent_units.VentUnitRow]) -> None:
for i, vent_unit in enumerate(
_vent_units, start=self.vent_units.section_first_entry_row
):
for item in vent_unit.create_xl_items(self.shape.name, _row_num=i):
self.xl.write_xl_item(item)
await self.xl.write_xl_item(item)

def write_vent_ducts(self, _vent_ducts: List) -> None:
async def write_vent_ducts(self, _vent_ducts: List) -> None:
if not self.vent_ducts.section_first_entry_row:
self.vent_ducts.section_first_entry_row = (
self.vent_ducts.find_section_first_entry_row()
Expand All @@ -385,9 +385,9 @@ def write_vent_ducts(self, _vent_ducts: List) -> None:
_vent_ducts, start=self.vent_ducts.section_first_entry_row
):
for item in vent_duct.create_xl_items(self.shape.name, _row_num=i):
self.xl.write_xl_item(item)
await self.xl.write_xl_item(item)

def activate_variants(
async def activate_variants(
self, variants_worksheet_name: str, vent_unit_range: str
) -> None:
"""Link the Vent unit to the Variants worksheet."""
Expand All @@ -396,7 +396,7 @@ def activate_variants(
start_row = self.vent_units.find_section_first_entry_row()
end_row = self.vent_units.find_section_last_entry_row()
for i in range(start_row, end_row + 1):
self.xl.write_xl_item(
await self.xl.write_xl_item(
xl_data.XlItem(
self.shape.name,
f"{self.shape.units.inputs.unit_selected.column}{i}",
Expand Down
28 changes: 15 additions & 13 deletions PHX/PHPP/sheet_io/io_areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,21 +318,21 @@ def __init__(self, _xl: xl_app.XLConnection, _shape: shape_model.Areas) -> None:
self.surfaces = Surfaces(self.xl, self.shape, self.group_type_exposures)
self.thermal_bridges = ThermalBridges(self.xl, self.shape)

def write_thermal_bridges(
async def write_thermal_bridges(
self, _tbs: List[areas_thermal_bridges.ThermalBridgeRow]
) -> None:
"""Write all of the the thermal bridge data to the PHPP Areas worksheet."""

for i, tb in enumerate(_tbs, start=self.thermal_bridges.section_first_entry_row):
for item in tb.create_xl_items(self.shape.name, _row_num=i):
self.xl.write_xl_item(item)
await self.xl.write_xl_item(item)

def write_surfaces(self, _surfaces: List[areas_surface.SurfaceRow]) -> None:
async def write_surfaces(self, _surfaces: List[areas_surface.SurfaceRow]) -> None:
"""Write all of the the surface data to the PHPP Areas worksheet."""
start = self.surfaces.section_first_entry_row
for i, surface in enumerate(_surfaces, start=start):
for item in surface.create_xl_items(self.shape.name, _row_num=i):
self.xl.write_xl_item(item)
await self.xl.write_xl_item(item)

def _create_input_location_object(
self, _phpp_model_obj: areas_data.AreasInput
Expand All @@ -349,12 +349,12 @@ def _create_input_location_object(
_input_row_offset=phpp_obj_shape.input_row_offset,
)

def write_item(self, _phpp_model_obj: areas_data.AreasInput) -> None:
async def write_item(self, _phpp_model_obj: areas_data.AreasInput) -> None:
"""Write the VerificationInputItem item out to the PHPP Areas Worksheet."""
input_object = self._create_input_location_object(_phpp_model_obj)
input_row = input_object.find_input_row()
xl_item = _phpp_model_obj.create_xl_item(self.shape.name, input_row)
self.xl.write_xl_item(xl_item)
await self.xl.write_xl_item(xl_item)

def get_group_type_exposures(self) -> Dict[int, str]:
"""Return the group type exposures dictionary from the PHPP Areas worksheet."""
Expand Down Expand Up @@ -425,26 +425,28 @@ def get_total_horizontal_window_area(self) -> Unit:
value = self.xl.get_single_data_item(self.shape.name, f"{item.column}{item.row}")
return Unit(float(value or 0.0), str(item.unit))

def set_surface_row_construction(
async def set_surface_row_construction(
self, _row_num: int, _phpp_constriction_id: str
) -> None:
"""Set the construction-id for the surface row in the PHPP Areas worksheet."""
col = self.shape.surface_rows.inputs.assembly_id.column
item = xl_data.XlItem(self.shape.name, f"{col}{_row_num}", _phpp_constriction_id)
self.xl.write_xl_item(item)
item = xl_data.XlItem(
self.shape.name, f"{col}{_row_num}", _phpp_constriction_id
)
await self.xl.write_xl_item(item)

def set_surface_row_solar_absorptivity(
async def set_surface_row_solar_absorptivity(
self, _row_num: int, _absorptivity: float = 0.75
) -> None:
"""Set the solar absorptivity for the surface row in the PHPP Areas worksheet."""
col = self.shape.surface_rows.inputs.absorptivity.column
item = xl_data.XlItem(self.shape.name, f"{col}{_row_num}", _absorptivity)
self.xl.write_xl_item(item)
await self.xl.write_xl_item(item)

def set_surface_row_emissivity(
async def set_surface_row_emissivity(
self, _row_num: int, _emissivity: float = 0.90
) -> None:
"""Set the emissivity for the surface row in the PHPP Areas worksheet."""
col = self.shape.surface_rows.inputs.emissivity.column
item = xl_data.XlItem(self.shape.name, f"{col}{_row_num}", _emissivity)
self.xl.write_xl_item(item)
await self.xl.write_xl_item(item)
10 changes: 6 additions & 4 deletions PHX/PHPP/sheet_io/io_climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ def get_start_rows(self) -> List[int]:
# TODO: make this find the right starting rows.
return [self.shape.ud_block.start_row]

def write_climate_block(self, _climate_entry: climate_entry.ClimateDataBlock) -> None:
async def write_climate_block(
self, _climate_entry: climate_entry.ClimateDataBlock
) -> None:
if not self.weather_data_start_rows:
self.weather_data_start_rows = self.get_start_rows()

Expand All @@ -32,14 +34,14 @@ def write_climate_block(self, _climate_entry: climate_entry.ClimateDataBlock) ->
start_row = self.weather_data_start_rows[0]

for item in _climate_entry.create_xl_items(self.shape.name, start_row):
self.xl.write_xl_item(item)
await self.xl.write_xl_item(item)

def write_active_climate(
async def write_active_climate(
self, _active_climate: climate_entry.ClimateSettings
) -> None:
start_row = 9
for item in _active_climate.create_xl_items(self.shape.name, start_row):
self.xl.write_xl_item(item)
await self.xl.write_xl_item(item)

def read_active_country(self) -> str:
return str(
Expand Down
26 changes: 14 additions & 12 deletions PHX/PHPP/sheet_io/io_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,9 @@ def first_empty_frame_row_num(self) -> int:
"""Return the row number of the first empty row in the Frames section."""
return self.frames.find_first_empty_row()

def write_single_glazing(self, _row_num: int, _glazing_row: GlazingRow) -> str:
async def write_single_glazing(
self, _row_num: int, _glazing_row: GlazingRow
) -> str:
"""Write a single GlazingRow object to the PHPP "Components" worksheet.

Return:
Expand All @@ -512,34 +514,34 @@ def write_single_glazing(self, _row_num: int, _glazing_row: GlazingRow) -> str:
"""

for item in _glazing_row.create_xl_items(self.shape.name, _row_num=_row_num):
self.xl.write_xl_item(item)
await self.xl.write_xl_item(item)
return self.glazings.get_glazing_phpp_id_by_row_num(_row_num)

def write_glazings(self, _glazing_rows: List[GlazingRow]) -> None:
async def write_glazings(self, _glazing_rows: List[GlazingRow]) -> None:
"""Write a list of GlazingRow objects to the PHPP "Components" worksheet."""
for i, glazing_row in enumerate(
_glazing_rows, start=self.glazings.section_first_entry_row
):
self.write_single_glazing(i, glazing_row)
await self.write_single_glazing(i, glazing_row)

def write_single_frame(self, _row_num: int, _frame_row: FrameRow) -> str:
async def write_single_frame(self, _row_num: int, _frame_row: FrameRow) -> str:
"""Write a single FrameRow object to the PHPP "Components" worksheet.

Return:
------
* (str): The PHPP ID-name of the frame component written to the PHPP.
"""
for item in _frame_row.create_xl_items(self.shape.name, _row_num=_row_num):
self.xl.write_xl_item(item)
await self.xl.write_xl_item(item)
return self.frames.get_frame_phpp_id_by_row_num(_row_num)

def write_frames(self, _frame_row: List[FrameRow]) -> None:
async def write_frames(self, _frame_row: List[FrameRow]) -> None:
"""Write a list of FrameRow objects to the PHPP "Components" worksheet."""
start = self.frames.section_first_entry_row
for i, frame_row in enumerate(_frame_row, start=start):
self.write_single_frame(i, frame_row)
await self.write_single_frame(i, frame_row)

def write_single_ventilator(
async def write_single_ventilator(
self, _row_num: int, _ventilator_row: VentilatorRow
) -> str:
"""Write a single VentilatorRow object to the PHPP "Components" worksheet.
Expand All @@ -549,11 +551,11 @@ def write_single_ventilator(
* (str): The PHPP ID-name of the ventilator component written to the PHPP.
"""
for item in _ventilator_row.create_xl_items(self.shape.name, _row_num=_row_num):
self.xl.write_xl_item(item)
await self.xl.write_xl_item(item)
return self.ventilators.get_ventilator_phpp_id_by_row_num(_row_num)

def write_ventilators(self, _ventilator_row: List[VentilatorRow]) -> None:
async def write_ventilators(self, _ventilator_row: List[VentilatorRow]) -> None:
"""Write a list of VentilatorRow objects to the PHPP "Components" worksheet."""
start = self.ventilators.section_first_entry_row
for i, ventilator_row in enumerate(_ventilator_row, start):
self.write_single_ventilator(i, ventilator_row)
await self.write_single_ventilator(i, ventilator_row)
4 changes: 2 additions & 2 deletions PHX/PHPP/sheet_io/io_elec_non_res.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ def _get_target_unit(self, _field_name: str) -> str:
"Return the right target unit for the PHPP item writing (IP | SI)"
return getattr(self.shape.lighting_rows.inputs, _field_name).unit

def set_lighting_power_density(
async def set_lighting_power_density(
self, _row_num: int, _power_density: float, _unit: str = "W/M2"
) -> None:
"""Set the lighting power density for the given row number."""
_range = f"{self.shape.lighting_rows.inputs.installed_power.column}{_row_num}"
self.xl.write_xl_item(
await self.xl.write_xl_item(
xl_data.XlItem(
sheet_name=self.shape.name,
xl_range=_range,
Expand Down
10 changes: 5 additions & 5 deletions PHX/PHPP/sheet_io/io_electricity.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, _xl: xl_app.XLConnection, shape: shape_model.Electricity) ->
self.shape = shape
self.device_map = elec_equip.get_device_type_map()

def _turn_off_all_equipment(self) -> None:
async def _turn_off_all_equipment(self) -> None:
"""Sets all the 'used' values to 0 to reset the sheet before writing new equipment."""
for item in self.shape.input_rows:
# Some items cannot be turned off....
Expand All @@ -35,21 +35,21 @@ def _turn_off_all_equipment(self) -> None:
if item[0] in excluded:
continue

self.xl.write_xl_item(
await self.xl.write_xl_item(
xl_data.XlItem(
self.shape.name, f"{self.shape.input_columns.used}{item[1].data}", 0
)
)

def write_equipment(
async def write_equipment(
self, _equipment_inputs: List[electricity_item.ElectricityItemXLWriter]
) -> None:
"""Write a list of equipment-input objects to the Worksheet."""
self._turn_off_all_equipment()
await self._turn_off_all_equipment()

for equip_input in _equipment_inputs:
for item in equip_input.create_xl_items(self.shape):
self.xl.write_xl_item(item)
await self.xl.write_xl_item(item)

def build_phx_device_from_phpp(
self, _reader: electricity_item.ReaderDataItem
Expand Down
12 changes: 6 additions & 6 deletions PHX/PHPP/sheet_io/io_hot_water.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,33 +233,33 @@ def __init__(self, _xl: xl_app.XLConnection, _shape: shape_model.Dhw):
self.tanks = Tanks(self.xl, self.shape)
self.dhw_piping = DHWPiping(self.xl, self.shape)

def write_tanks(self, _phpp_hw_tanks: List[hot_water_tank.TankInput]) -> None:
async def write_tanks(self, _phpp_hw_tanks: List[hot_water_tank.TankInput]) -> None:
"""Write the tank data to the spreadsheet."""
for phpp_Tank_input in _phpp_hw_tanks:
for item in phpp_Tank_input.create_xl_items(
self.shape.name, self.tanks.tank_1.entry_row_start
):
self.xl.write_xl_item(item)
await self.xl.write_xl_item(item)

def write_branch_piping(
async def write_branch_piping(
self, _phpp_branch_piping: List[hot_water_piping.BranchPipingInput]
) -> None:
"""Write the branch piping data to the spreadsheet."""
for pipe_inputs in _phpp_branch_piping:
for item in pipe_inputs.create_xl_items(
self.shape.name, self.dhw_piping.branch_piping.header_row
):
self.xl.write_xl_item(item)
await self.xl.write_xl_item(item)

def write_recirc_piping(
async def write_recirc_piping(
self, _phpp_recirc_piping: List[hot_water_piping.BranchPipingInput]
) -> None:
"""Write the recirc piping data to the spreadsheet."""
for pipe_inputs in _phpp_recirc_piping:
for item in pipe_inputs.create_xl_items(
self.shape.name, self.dhw_piping.recirc_piping.header_row
):
self.xl.write_xl_item(item)
await self.xl.write_xl_item(item)

def get_all_tank_device_data(self) -> List[TankData]:
"""Get all the tank data from the PHPP worksheet."""
Expand Down
4 changes: 2 additions & 2 deletions PHX/PHPP/sheet_io/io_shading.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ def find_entry_block_end(self, _start_row: int = 1, _read_length: int = 100) ->
f"marker on the '{self.shape.name}' sheet, column {self.shape.shading_rows_end.locator_col_entry}?"
)

def write_shading(self, _shading_rows: List[shading_rows.ShadingRow]) -> None:
async def write_shading(self, _shading_rows: List[shading_rows.ShadingRow]) -> None:
"""Write a list of ShadingRow objects to the Shading worksheet."""

for i, shading_row in enumerate(_shading_rows, start=self.entry_row_start):
for item in shading_row.create_xl_items(self.shape.name, _row_num=i):
self.xl.write_xl_item(item)
await self.xl.write_xl_item(item)
Loading