""" Energy System rule-based sizing SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2023 Concordia CERC group Project Coder Saeed Ranjbar saeed.ranjbar@concordia.ca """ import hub.helpers.constants as cte class SystemSizing: """ The energy system sizing class """ def __init__(self, buildings): self.buildings = buildings def hvac_sizing(self): for building in self.buildings: peak_heating_demand = building.heating_peak_load[cte.YEAR][0] / 3600 peak_cooling_demand = building.cooling_peak_load[cte.YEAR][0] / 3600 if peak_heating_demand > peak_cooling_demand: sizing_demand = peak_heating_demand for system in building.energy_systems: if 'Heating' in system.demand_types: for generation in system.generation_systems: if generation.system_type == 'Heat Pump': if generation.source_medium == cte.AIR: generation.source_temperature = building.external_temperature generation.nominal_heat_output = 0.6 * sizing_demand / 1000 if generation.energy_storage_systems is not None: for storage in generation.energy_storage_systems: if storage.type_energy_stored == 'thermal': storage.volume = building.heating_peak_load[cte.YEAR][0] / (cte.WATER_HEAT_CAPACITY*cte.WATER_DENSITY * 20) elif generation.system_type == 'Boiler': generation.nominal_heat_output = 0.4 * sizing_demand / 1000 else: sizing_demand = peak_cooling_demand for system in building.energy_systems: if 'Cooling' in system.demand_types: for generation in system.generation_systems: if generation.system_type == 'Heat Pump': generation.nominal_heat_output = sizing_demand / 1000 def montreal_custom(self): for building in self.buildings: energy_systems = building.energy_systems for energy_system in energy_systems: demand_types = energy_system.demand_types generation_systems = energy_system.generation_systems if cte.HEATING in demand_types: if len(generation_systems) == 1: for generation in generation_systems: generation.nominal_heat_output = building.heating_peak_load[cte.YEAR][0] / 3600 else: for generation in generation_systems: generation.nominal_heat_output = building.heating_peak_load[cte.YEAR][0] / (len(generation_systems) * 3600) elif cte.COOLING in demand_types: if len(generation_systems) == 1: for generation in generation_systems: generation.nominal_cooling_output = building.cooling_peak_load[cte.YEAR][0] / 3600 else: for generation in generation_systems: generation.nominal_heat_output = building.cooling_peak_load[cte.YEAR][0] / (len(generation_systems) * 3600)