Implemented enriching city with energy systems

This commit is contained in:
Peter Yefi 2021-10-21 13:50:02 +00:00
parent 567fde0012
commit e0924cf45f
2 changed files with 61 additions and 1 deletions

View File

@ -2,6 +2,7 @@
EnergySystem module
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
Contributor Peter Yefi peteryefi@gmail.com
"""
from city_model_structure.city_object import CityObject
@ -16,7 +17,29 @@ class EnergySystem(CityObject):
def __init__(self, name, lod, surfaces, city_lower_corner):
super().__init__(name, lod, surfaces, city_lower_corner)
self._heat_pump = None
self._type = 'energy_system'
@property
def heat_pump(self) -> HeatPump:
"""
Heat pump energy system
:return:
"""
return self._heat_pump
@heat_pump.setter
def heat_pump(self, value):
"""
Set heat pumm for energy system
:param value: HeatPump
"""
if self._heat_pump is None:
self._heat_pump = value
@property
def type(self) -> str:
"""
Type of city object
:return: str
"""
return self._type

View File

@ -7,6 +7,9 @@ Contributor Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
import pandas as pd
from typing import Dict
from typing import List
from city_model_structure.energy_systems.heat_pump import HeatPump
from city_model_structure.energy_system import EnergySystem
class XlsxHeatPumpParameters:
@ -49,7 +52,7 @@ class XlsxHeatPumpParameters:
# temp is the key for the values of pf,pa,qw data
while i < 25:
cooling_data[sheet][cooling_df.iloc[i][0]] = cooling_df.iloc[i + 1:i + 4, 2:8].values.tolist()
heating_data[sheet][heating_df.iloc[i][0]] = cooling_df.iloc[i + 1:i + 4, 2:8].values.tolist()
heating_data[sheet][heating_df.iloc[i][0]] = heating_df.iloc[i + 1:i + 4, 2:8].values.tolist()
i = i + 5
# extract the last cooling data
cooling_data[sheet][cooling_df.iloc[i][0]] = cooling_df.iloc[i + 1:i + 4, 2:8]
@ -59,4 +62,38 @@ class XlsxHeatPumpParameters:
"""
Enriches the city with information from file
"""
heap_pump_data = self._read_file()
for (k_cool, v_cool), (k_heat, v_heat) in \
zip(heap_pump_data["cooling"].items(), heap_pump_data["heating"].items()):
heat_pump = HeatPump()
heat_pump.model = k_cool
h_data = self._extract_heat_pump_data(v_heat)
c_data = self._extract_heat_pump_data(v_cool)
heat_pump.cooling_pf = c_data[0]
heat_pump.cooling_pa = c_data[1]
heat_pump.cooling_qw = c_data[2]
heat_pump.heating_pf = h_data[0]
heat_pump.heating_pa = h_data[1]
heat_pump.heating_qw = h_data[2]
energy_system = EnergySystem('{} capacity heat pump'.format(heat_pump.model), 0, [], None)
energy_system.heat_pump = heat_pump
self._city.add_city_object(energy_system)
return self._city
def _extract_heat_pump_data(self, heat_pump_capacity_data) -> [List, List, List]:
"""
Fetches a list of metric based data for heat pump for various temperature,
eg. cooling capacity data for 12 capacity heat pump
for 6,7,8,9,10 and 11 degree celsius
:param heat_pump_capacity_data: the heat pump capacity data from the
which the metric specific data is fetched: {List}
:return: List
"""
pf_data = []
pa_data = []
qw_data = []
for _, metric_data in heat_pump_capacity_data.items():
pf_data.append(metric_data[0])
pa_data.append(metric_data[1])
qw_data.append(metric_data[2])
return [pf_data, pa_data, qw_data]