New classes to integrate Saeeds work: heat_pump.py and the imports
This commit is contained in:
parent
ba72bd9043
commit
a41a7ef801
22
city_model_structure/EnergySystem.py
Normal file
22
city_model_structure/EnergySystem.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
"""
|
||||
EnergySystem module
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
|
||||
from city_model_structure.city_object import CityObject
|
||||
from city_model_structure.energy_systems.heat_pump import HeatPump
|
||||
|
||||
|
||||
class EnergySystem(CityObject):
|
||||
"""
|
||||
EnergySystem(CityObject) class
|
||||
"""
|
||||
def __init__(self, name, lod, surfaces, city_lower_corner):
|
||||
super().__init__(name, lod, surfaces, city_lower_corner)
|
||||
self._heat_pump = None
|
||||
|
||||
@property
|
||||
def heat_pump(self) -> HeatPump:
|
||||
return self._heat_pump
|
||||
|
|
@ -12,39 +12,35 @@ class HeatPump:
|
|||
HeatPump class
|
||||
"""
|
||||
def __init__(self):
|
||||
self._seasonal_mean_cop = None
|
||||
self._seasonal_mean_coverage_factor = None
|
||||
self._model = None
|
||||
self._cooling_pf = None
|
||||
self._cooling_pa = None
|
||||
self._cooling_qw = None
|
||||
self._heating_pf = None
|
||||
self._heating_pa = None
|
||||
self._heating_qw = None
|
||||
|
||||
@property
|
||||
def seasonal_mean_cop(self) -> Union[None, float]:
|
||||
def model(self):
|
||||
"""
|
||||
Get seasonal mean COP (-)
|
||||
:return: None or float
|
||||
Get model name
|
||||
:return: str
|
||||
"""
|
||||
return self._seasonal_mean_cop
|
||||
|
||||
@seasonal_mean_cop.setter
|
||||
def seasonal_mean_cop(self, value):
|
||||
"""
|
||||
Set seasonal mean COP (-)
|
||||
:param value: float
|
||||
"""
|
||||
if value is not None:
|
||||
self._seasonal_mean_cop = float(value)
|
||||
return self._model
|
||||
|
||||
@property
|
||||
def seasonal_mean_coverage_factor(self) -> Union[None, float]:
|
||||
def cooling_pf(self):
|
||||
"""
|
||||
Get percentage of demand covered by the hp (-)
|
||||
:return: None or float
|
||||
Get cooling capacity in kW
|
||||
:return: [[float]]
|
||||
"""
|
||||
return self._seasonal_mean_coverage_factor
|
||||
return self._cooling_pf
|
||||
|
||||
@seasonal_mean_coverage_factor.setter
|
||||
def seasonal_mean_coverage_factor(self, value):
|
||||
@cooling_pf.setter
|
||||
def cooling_pf(self, value):
|
||||
"""
|
||||
Set percentage of demand covered by the hp (-)
|
||||
:return: float
|
||||
Set cooling capacity in kW
|
||||
:param value: [[float]]
|
||||
"""
|
||||
if value is not None:
|
||||
self._seasonal_mean_coverage_factor = float(value)
|
||||
if self._cooling_pf is None:
|
||||
self._cooling_pf = value
|
||||
|
|
BIN
data/energy_systems/heat_pumps/Air Source.xlsx
Normal file
BIN
data/energy_systems/heat_pumps/Air Source.xlsx
Normal file
Binary file not shown.
26
imports/energy_systems/xlsx_heat_pump_parameters.py
Normal file
26
imports/energy_systems/xlsx_heat_pump_parameters.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
"""
|
||||
XlsxHeatPumpParameters import the heat pump information
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2020 Project Author
|
||||
Contributor Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
|
||||
|
||||
class XlsxHeatPumpParameters:
|
||||
"""
|
||||
XlsxHeatPumpParameters class
|
||||
"""
|
||||
def __init__(self, city, base_path):
|
||||
self._city = city
|
||||
self._base_path = (base_path / 'heat_pumps/Air source.xlsx')
|
||||
|
||||
def _read_file(self):
|
||||
"""
|
||||
reads xlsx file containing the heat pump information
|
||||
"""
|
||||
|
||||
def enrich_city(self):
|
||||
"""
|
||||
Enriches the city with information from file
|
||||
"""
|
||||
return self._city
|
33
imports/energy_systems_factory.py
Normal file
33
imports/energy_systems_factory.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
"""
|
||||
EnergySystemsFactory retrieve the energy system module for the given region
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2020 Project Author Pilar Monsalvete pilar.monsalvete@concordi.ca
|
||||
"""
|
||||
from pathlib import Path
|
||||
from imports.energy_systems.xlsx_heat_pump_parameters import XlsxHeatPumpParameters
|
||||
|
||||
|
||||
class EnergySystemsFactory:
|
||||
"""
|
||||
EnergySystemsFactory class
|
||||
"""
|
||||
def __init__(self, handler, city, base_path=None):
|
||||
if base_path is None:
|
||||
base_path = Path(Path(__file__).parent.parent / 'data/energy_systems')
|
||||
self._handler = '_' + handler.lower().replace(' ', '_')
|
||||
self._city = city
|
||||
self._base_path = base_path
|
||||
|
||||
def _xlsxheatpump(self):
|
||||
"""
|
||||
Enrich the city by using xlsx heat pump information
|
||||
"""
|
||||
XlsxHeatPumpParameters(self._city, self._base_path).enrich_city()
|
||||
|
||||
def enrich(self):
|
||||
"""
|
||||
Enrich the city given to the class using the class given handler
|
||||
:return: None
|
||||
"""
|
||||
getattr(self, self._handler, lambda: None)()
|
||||
|
55
imports/usage/ashrae_usage_parameters.py
Normal file
55
imports/usage/ashrae_usage_parameters.py
Normal file
|
@ -0,0 +1,55 @@
|
|||
"""
|
||||
AshraeUsageParameters model the usage properties
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
import sys
|
||||
|
||||
from imports.geometry.helpers.geometry_helper import GeometryHelper as gh
|
||||
from city_model_structure.building_demand.usage_zone import UsageZone
|
||||
|
||||
|
||||
class AshraeUsageParameters:
|
||||
"""
|
||||
AshraeUsageParameters class
|
||||
"""
|
||||
def __init__(self, city, base_path):
|
||||
super().__init__(base_path, 'ashrae_archetypes.xml')
|
||||
self._city = city
|
||||
self._usage_archetypes = None
|
||||
|
||||
def enrich_buildings(self):
|
||||
"""
|
||||
Returns the city with the usage parameters assigned to the buildings
|
||||
:return:
|
||||
"""
|
||||
city = self._city
|
||||
for building in city.buildings:
|
||||
archetype = self._search_archetype(building.function)
|
||||
if archetype is None:
|
||||
sys.stderr.write(f'Building {building.name} has unknown archetype for building function:'
|
||||
f' {building.function}, that assigns building usage as '
|
||||
f'{gh.usage_from_function(building.function)}\n')
|
||||
continue
|
||||
# todo: what to do with mix-usage usage from gml?
|
||||
mix_usage = False
|
||||
if not mix_usage:
|
||||
# just one usage_zone
|
||||
for thermal_zone in building.thermal_zones:
|
||||
usage_zone = UsageZone()
|
||||
usage_zone.volume = thermal_zone.volume
|
||||
self._assign_values(usage_zone, archetype)
|
||||
thermal_zone.usage_zones = [usage_zone]
|
||||
|
||||
def _search_archetype(self, building_usage):
|
||||
for building_archetype in self._usage_archetypes:
|
||||
if building_archetype.usage == building_usage:
|
||||
return building_archetype
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def _assign_values(usage_zone, archetype):
|
||||
usage_zone.usage = archetype.usage
|
||||
usage_zone.occupancy_density = archetype.occupancy_density
|
||||
# todo: should I use this value: self._min_air_change??
|
||||
usage_zone.minimum_ventilation_rate = archetype.minimum_ventilation_rate
|
|
@ -3,11 +3,12 @@ UsageFactory retrieve the specific usage module for the given region
|
|||
This factory can only be called after calling the construction factory so the thermal zones are created.
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
Contributors Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
from pathlib import Path
|
||||
from imports.usage.hft_usage_parameters import HftUsageParameters
|
||||
from imports.usage.ca_usage_parameters import CaUsageParameters
|
||||
|
||||
from imports.usage.ashrae_usage_parameters import AshraeUsageParameters
|
||||
# todo: handle missing lambda and rise error.
|
||||
|
||||
|
||||
|
@ -38,6 +39,12 @@ class UsageFactory:
|
|||
"""
|
||||
return CaUsageParameters(self._city, self._base_path).enrich_buildings()
|
||||
|
||||
def _ashrae(self):
|
||||
"""
|
||||
Enrich the city by using ASHRAE information
|
||||
"""
|
||||
AshraeUsageParameters(self._city, self._base_path).enrich_buildings()
|
||||
|
||||
def enrich(self):
|
||||
"""
|
||||
Enrich the city given to the class using the usage factory given handler
|
||||
|
|
Loading…
Reference in New Issue
Block a user