35 lines
1.8 KiB
Python
35 lines
1.8 KiB
Python
from hub.city_model_structure.building import Building
|
|
from hub.city_model_structure.city import City
|
|
import hub.helpers.constants as cte
|
|
|
|
class RetrofitFactory:
|
|
def __init__(self, retrofit_type, city):
|
|
self._retrofit_type = retrofit_type
|
|
self._city = city
|
|
|
|
def apply_retrofit(self, wall_u_value=None, roof_u_value=None, ground_u_value=None):
|
|
for building in self._city.buildings:
|
|
self._apply_retrofit_to_building(building, wall_u_value, roof_u_value, ground_u_value)
|
|
|
|
def _apply_retrofit_to_building(self, building: Building, wall_u_value, roof_u_value, ground_u_value):
|
|
# for internal_zone in building.internal_zones:
|
|
# print(internal_zone.id)
|
|
|
|
for thermal_zone in building.thermal_zones_from_internal_zones:
|
|
for thermal_boundary in thermal_zone.thermal_boundaries:
|
|
if wall_u_value and thermal_boundary.type == cte.WALL:
|
|
print(thermal_boundary.u_value)
|
|
thermal_boundary.u_value = wall_u_value
|
|
print(thermal_boundary.u_value)
|
|
elif roof_u_value and thermal_boundary.type == cte.ROOF:
|
|
print("roof", thermal_boundary.u_value)
|
|
thermal_boundary.u_value = roof_u_value
|
|
print("roof", thermal_boundary.u_value)
|
|
elif ground_u_value and thermal_boundary.type == cte.GROUND:
|
|
thermal_boundary.u_value = ground_u_value
|
|
print("ground", thermal_boundary.u_value)
|
|
|
|
def enrich(self):
|
|
# This method can be expanded to include different retrofit strategies
|
|
if self._retrofit_type == 'basic':
|
|
self.apply_retrofit(wall_u_value=0.85, roof_u_value=0.95, ground_u_value=0.95) |