api_v1.4/hub_api/mockup/building.py

132 lines
4.0 KiB
Python
Raw Normal View History

"""
Mockup Building module
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2023 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
from properties import *
class Building:
"""
Building class
"""
def __init__(self,
function,
volume,
area,
total_heating_area,
wall_area,
windows_area,
roof_area,
solar_collectors_area_reduction_factor,
heating_consumption,
cooling_consumption,
domestic_hot_water_consumption,
lighting_electrical_demand,
appliances_electrical_demand,
heating_peak_load,
cooling_peak_load,
onsite_electrical_production,
catalog_energy_systems):
self._function = function
self._area = area
self._volume = volume
self._total_heating_area = total_heating_area
self._wall_area = wall_area
self._windows_area = windows_area
self._roof_area = roof_area
self._solar_collectors_area_reduction_factor = solar_collectors_area_reduction_factor
self._heating_consumption = heating_consumption
self._cooling_consumption = cooling_consumption
self._domestic_hot_water_consumption = domestic_hot_water_consumption
self._lighting_electrical_demand = lighting_electrical_demand
self._appliances_electrical_demand = appliances_electrical_demand
self._heating_peak_load = heating_peak_load
self._cooling_peak_load = cooling_peak_load
self._onsite_electrical_production = onsite_electrical_production
self._catalog_energy_systems = catalog_energy_systems
@property
def function(self):
return self._function
@property
def volume(self):
return self._volume
@property
def thermal_zones(self):
ground = ThermalBoundary()
ground.type = 'Ground'
ground.opaque_area = self._area
roof = ThermalBoundary()
roof.type = 'Roof'
roof.opaque_area = self._roof_area
wall = ThermalBoundary()
wall.type = 'Wall'
wall.opaque_area = self._wall_area
wall.window_ratio = self._windows_area / (self._windows_area + self._wall_area)
thermal_zone = ThermalZone()
thermal_zone.total_floor_area = self._total_heating_area
thermal_zone.thermal_boundaries = [roof, wall, ground]
return [thermal_zone]
@property
def roofs(self):
polygon = Polygon()
polygon.area = self._roof_area
roof = Roof()
roof.solid_polygon = polygon
roof.solar_collectors_area_reduction_factor = self._solar_collectors_area_reduction_factor
return [roof]
@property
def heating_consumption(self):
return self._heating_consumption
@property
def cooling_consumption(self):
return self._cooling_consumption
@property
def domestic_hot_water_consumption(self):
return self._domestic_hot_water_consumption
@property
def lighting_electrical_demand(self):
return self._lighting_electrical_demand
@property
def appliances_electrical_demand(self):
return self._appliances_electrical_demand
@property
def heating_peak_load(self):
return self._heating_peak_load
@property
def cooling_peak_load(self):
return self._cooling_peak_load
@property
def onsite_electrical_production(self):
return self._onsite_electrical_production
@property
def energy_systems(self):
_energy_systems = []
for value in self._catalog_energy_systems:
demands = value[0]
fuel_type = value[1]
generic_generation_system = GenericGenerationSystem()
generic_generation_system.fuel_type = fuel_type
generation_system = GenerationSystem()
generation_system.generic_generation_system = generic_generation_system
energy_system = EnergySystem()
energy_system.generation_system = generation_system
energy_system.demand_types = demands
_energy_systems.append(energy_system)
return _energy_systems