""" 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 """ import hub.helpers.constants as cte from hub.helpers.dictionaries import Dictionaries from hub_api.mockup.properties import * import pandas as pd class Building: """ Building class """ def __init__(self, building_info, results, catalog_archetype): 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 self._total_pv_area = building_info.total_pv_area self._energy_systems_archetype_name = building_info.system_name self._heating_consumption = { cte.YEAR: results['yearly_heating_consumption'], cte.MONTH: results['monthly_heating_consumption'] } print(self._heating_consumption) 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 = { cte.YEAR: pd.DataFrame(results['yearly_lighting_electrical_demand'], columns=['insel meb']), cte.MONTH: pd.DataFrame(results['monthly_lighting_electrical_demand'], columns=['insel meb']) } self._appliances_electrical_demand = { cte.YEAR: pd.DataFrame(results['yearly_appliances_electrical_demand'], columns=['insel meb']), cte.MONTH: pd.DataFrame(results['monthly_appliances_electrical_demand'], columns=['insel meb']) } 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'] } self._catalog_archetype = catalog_archetype @property def function(self): """ Get building function :return: str """ return self._function @property def volume(self): """ Get building volume in m3 :return: float """ return self._volume @property def thermal_zones(self) -> [ThermalZone]: """ Get building thermal zones :return: [ThermalZone] """ 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) -> [Roof]: """ Get building roofs :return: [Roof] """ polygon = Polygon() polygon.area = self._roof_area roof = Roof() roof.solid_polygon = polygon roof.solar_collectors_area_reduction_factor = self._total_pv_area / self._roof_area return [roof] @property def heating_consumption(self): """ Get building heating consumption in J :return: dict """ return self._heating_consumption @property def cooling_consumption(self): """ Get building cooling consumption in J :return: dict """ return self._cooling_consumption @property def domestic_hot_water_consumption(self): """ Get building domestic hot water consumption in J :return: dict """ return self._domestic_hot_water_consumption @property def lighting_electrical_demand(self): """ Get building lighting demand in J :return: dict """ return self._lighting_electrical_demand @property def appliances_electrical_demand(self): """ Get building appliances electrical demand in J :return: dict """ return self._appliances_electrical_demand @property def heating_peak_load(self): """ Get building heating peak load in W :return: dict """ return self._heating_peak_load @property def cooling_peak_load(self): """ Get building cooling peak load in W :return: dict """ return self._cooling_peak_load @property def lighting_peak_load(self): """ Get building lighting peak load in W :return: dict """ return self._lighting_peak_load @property def appliances_peak_load(self): """ Get building appliances peak load in W :return: dict """ return self._appliances_peak_load @property def onsite_electrical_production(self): """ Get building onsite electrical production in J :return: dict """ return self._onsite_electrical_production @property def energy_systems_archetype_name(self): """ Get energy systems archetype name :return: dict """ return self._energy_systems_archetype_name @property def energy_systems(self) -> [EnergySystem]: """ Get building energy systems :return: [EnergySystem] """ _energy_systems = [] for system in self._catalog_archetype.systems: _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] 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