2023-07-31 13:32:28 -04:00
|
|
|
"""
|
|
|
|
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
|
|
|
|
"""
|
|
|
|
|
2023-08-01 16:40:49 -04:00
|
|
|
import hub.helpers.constants as cte
|
2023-08-02 15:47:09 -04:00
|
|
|
from hub.helpers.dictionaries import Dictionaries
|
|
|
|
|
|
|
|
|
2023-07-31 16:55:39 -04:00
|
|
|
from hub_api.mockup.properties import *
|
2023-08-02 15:47:09 -04:00
|
|
|
import pandas as pd
|
2023-07-31 13:32:28 -04:00
|
|
|
|
|
|
|
|
|
|
|
class Building:
|
|
|
|
"""
|
|
|
|
Building class
|
|
|
|
"""
|
2023-07-31 16:56:37 -04:00
|
|
|
def __init__(self, building_info, results, catalog_archetype):
|
2023-07-31 14:48:17 -04:00
|
|
|
self._function = building_info.function
|
|
|
|
self._area = building_info.area
|
|
|
|
self._volume = building_info.volume
|
|
|
|
self._total_heating_area = building_info.total_heating_area
|
|
|
|
self._wall_area = building_info.wall_area
|
|
|
|
self._windows_area = building_info.windows_area
|
|
|
|
self._roof_area = building_info.roof_area
|
2023-07-31 14:51:23 -04:00
|
|
|
self._total_pv_area = building_info.total_pv_area
|
2023-08-01 16:40:49 -04:00
|
|
|
self._energy_systems_archetype_name = building_info.system_name
|
|
|
|
self._heating_consumption = {
|
|
|
|
cte.YEAR: results['yearly_heating_consumption'],
|
|
|
|
cte.MONTH: results['monthly_heating_consumption']
|
|
|
|
}
|
2023-08-02 15:47:09 -04:00
|
|
|
print(self._heating_consumption)
|
2023-08-01 16:40:49 -04:00
|
|
|
self._cooling_consumption = {
|
|
|
|
cte.YEAR: results['yearly_cooling_consumption'],
|
|
|
|
cte.MONTH: results['monthly_cooling_consumption']
|
|
|
|
}
|
|
|
|
self._domestic_hot_water_consumption = {
|
|
|
|
cte.YEAR: results['yearly_domestic_hot_water_consumption'],
|
|
|
|
cte.MONTH: results['monthly_domestic_hot_water_consumption']
|
|
|
|
}
|
|
|
|
self._lighting_electrical_demand = {
|
2023-08-02 15:47:09 -04:00
|
|
|
cte.YEAR: pd.DataFrame(results['yearly_lighting_electrical_demand'], columns=['insel meb']),
|
|
|
|
cte.MONTH: pd.DataFrame(results['monthly_lighting_electrical_demand'], columns=['insel meb'])
|
2023-08-01 16:40:49 -04:00
|
|
|
}
|
|
|
|
self._appliances_electrical_demand = {
|
2023-08-02 15:47:09 -04:00
|
|
|
cte.YEAR: pd.DataFrame(results['yearly_appliances_electrical_demand'], columns=['insel meb']),
|
|
|
|
cte.MONTH: pd.DataFrame(results['monthly_appliances_electrical_demand'], columns=['insel meb'])
|
2023-08-01 16:40:49 -04:00
|
|
|
}
|
|
|
|
self._heating_peak_load = {
|
|
|
|
cte.YEAR: results['yearly_heating_peak_load'],
|
|
|
|
cte.MONTH: results['monthly_heating_peak_load']
|
|
|
|
}
|
|
|
|
self._cooling_peak_load = {
|
|
|
|
cte.YEAR: results['yearly_cooling_peak_load'],
|
|
|
|
cte.MONTH: results['monthly_cooling_peak_load']
|
|
|
|
}
|
|
|
|
self._lighting_peak_load = {
|
|
|
|
cte.YEAR: results['yearly_lighting_peak_load'],
|
|
|
|
cte.MONTH: results['monthly_lighting_peak_load']
|
|
|
|
}
|
|
|
|
self._appliances_peak_load = {
|
|
|
|
cte.YEAR: results['yearly_appliances_peak_load'],
|
|
|
|
cte.MONTH: results['monthly_appliances_peak_load']
|
|
|
|
}
|
|
|
|
self._onsite_electrical_production = {
|
|
|
|
cte.YEAR: results['yearly_on_site_electrical_production'],
|
|
|
|
cte.MONTH: results['monthly_on_site_electrical_production']
|
|
|
|
}
|
2023-07-31 14:42:13 -04:00
|
|
|
self._catalog_archetype = catalog_archetype
|
2023-07-31 13:32:28 -04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def function(self):
|
2023-08-08 15:59:06 -04:00
|
|
|
"""
|
|
|
|
Get building function
|
|
|
|
:return: str
|
|
|
|
"""
|
2023-07-31 13:32:28 -04:00
|
|
|
return self._function
|
|
|
|
|
|
|
|
@property
|
|
|
|
def volume(self):
|
2023-08-08 15:59:06 -04:00
|
|
|
"""
|
|
|
|
Get building volume in m3
|
|
|
|
:return: float
|
|
|
|
"""
|
2023-07-31 13:32:28 -04:00
|
|
|
return self._volume
|
|
|
|
|
|
|
|
@property
|
2023-08-08 15:59:06 -04:00
|
|
|
def thermal_zones(self) -> [ThermalZone]:
|
|
|
|
"""
|
|
|
|
Get building thermal zones
|
|
|
|
:return: [ThermalZone]
|
|
|
|
"""
|
2023-07-31 13:32:28 -04:00
|
|
|
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
|
2023-08-08 15:59:06 -04:00
|
|
|
def roofs(self) -> [Roof]:
|
|
|
|
"""
|
|
|
|
Get building roofs
|
|
|
|
:return: [Roof]
|
|
|
|
"""
|
2023-07-31 13:32:28 -04:00
|
|
|
polygon = Polygon()
|
|
|
|
polygon.area = self._roof_area
|
|
|
|
roof = Roof()
|
|
|
|
roof.solid_polygon = polygon
|
2023-07-31 14:51:23 -04:00
|
|
|
roof.solar_collectors_area_reduction_factor = self._total_pv_area / self._roof_area
|
2023-07-31 13:32:28 -04:00
|
|
|
return [roof]
|
|
|
|
|
|
|
|
@property
|
|
|
|
def heating_consumption(self):
|
2023-08-08 15:59:06 -04:00
|
|
|
"""
|
|
|
|
Get building heating consumption in J
|
|
|
|
:return: dict
|
|
|
|
"""
|
2023-07-31 13:32:28 -04:00
|
|
|
return self._heating_consumption
|
|
|
|
|
|
|
|
@property
|
|
|
|
def cooling_consumption(self):
|
2023-08-08 15:59:06 -04:00
|
|
|
"""
|
|
|
|
Get building cooling consumption in J
|
|
|
|
:return: dict
|
|
|
|
"""
|
2023-07-31 13:32:28 -04:00
|
|
|
return self._cooling_consumption
|
|
|
|
|
|
|
|
@property
|
|
|
|
def domestic_hot_water_consumption(self):
|
2023-08-08 15:59:06 -04:00
|
|
|
"""
|
|
|
|
Get building domestic hot water consumption in J
|
|
|
|
:return: dict
|
|
|
|
"""
|
2023-07-31 13:32:28 -04:00
|
|
|
return self._domestic_hot_water_consumption
|
|
|
|
|
|
|
|
@property
|
|
|
|
def lighting_electrical_demand(self):
|
2023-08-08 15:59:06 -04:00
|
|
|
"""
|
|
|
|
Get building lighting demand in J
|
|
|
|
:return: dict
|
|
|
|
"""
|
2023-07-31 13:32:28 -04:00
|
|
|
return self._lighting_electrical_demand
|
|
|
|
|
|
|
|
@property
|
|
|
|
def appliances_electrical_demand(self):
|
2023-08-08 15:59:06 -04:00
|
|
|
"""
|
|
|
|
Get building appliances electrical demand in J
|
|
|
|
:return: dict
|
|
|
|
"""
|
2023-07-31 13:32:28 -04:00
|
|
|
return self._appliances_electrical_demand
|
|
|
|
|
|
|
|
@property
|
|
|
|
def heating_peak_load(self):
|
2023-08-08 15:59:06 -04:00
|
|
|
"""
|
|
|
|
Get building heating peak load in W
|
|
|
|
:return: dict
|
|
|
|
"""
|
2023-07-31 13:32:28 -04:00
|
|
|
return self._heating_peak_load
|
|
|
|
|
|
|
|
@property
|
|
|
|
def cooling_peak_load(self):
|
2023-08-08 15:59:06 -04:00
|
|
|
"""
|
|
|
|
Get building cooling peak load in W
|
|
|
|
:return: dict
|
|
|
|
"""
|
2023-07-31 13:32:28 -04:00
|
|
|
return self._cooling_peak_load
|
|
|
|
|
2023-08-01 16:40:49 -04:00
|
|
|
@property
|
|
|
|
def lighting_peak_load(self):
|
|
|
|
return self._lighting_peak_load
|
|
|
|
|
|
|
|
@property
|
|
|
|
def appliances_peak_load(self):
|
|
|
|
return self._appliances_peak_load
|
|
|
|
|
2023-07-31 13:32:28 -04:00
|
|
|
@property
|
|
|
|
def onsite_electrical_production(self):
|
2023-08-08 15:59:06 -04:00
|
|
|
"""
|
|
|
|
Get building onsite electrical production in J
|
|
|
|
:return: dict
|
|
|
|
"""
|
2023-07-31 13:32:28 -04:00
|
|
|
return self._onsite_electrical_production
|
|
|
|
|
2023-08-01 16:40:49 -04:00
|
|
|
@property
|
|
|
|
def energy_systems_archetype_name(self):
|
|
|
|
return self._energy_systems_archetype_name
|
|
|
|
|
2023-07-31 13:32:28 -04:00
|
|
|
@property
|
2023-08-08 15:59:06 -04:00
|
|
|
def energy_systems(self) -> [EnergySystem]:
|
|
|
|
"""
|
|
|
|
Get building energy systems
|
|
|
|
:return: [EnergySystem]
|
|
|
|
"""
|
2023-07-31 13:32:28 -04:00
|
|
|
_energy_systems = []
|
2023-07-31 14:42:13 -04:00
|
|
|
|
|
|
|
for system in self._catalog_archetype.systems:
|
2023-08-02 15:47:09 -04:00
|
|
|
_hub_demand_types = []
|
|
|
|
for demand_type in system.demand_types:
|
|
|
|
# todo: generalize this when we have more catalogs
|
|
|
|
_hub_demand_types.append(Dictionaries().montreal_demand_type_to_hub_energy_demand_type[demand_type])
|
|
|
|
demands = _hub_demand_types
|
|
|
|
fuel_type = Dictionaries().montreal_custom_fuel_to_hub_fuel[system.generation_system.fuel_type]
|
2023-07-31 13:32:28 -04:00
|
|
|
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
|