Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
8def8ece2d
|
@ -207,7 +207,7 @@ class ThermalZone:
|
|||
@property
|
||||
def usage_zones(self) -> List[UsageZone]:
|
||||
"""
|
||||
Get thermal zone usages zones
|
||||
Get thermal zone usage zones
|
||||
:return: [UsageZone]
|
||||
"""
|
||||
return self._usage_zones
|
||||
|
@ -215,7 +215,7 @@ class ThermalZone:
|
|||
@usage_zones.setter
|
||||
def usage_zones(self, values):
|
||||
"""
|
||||
Set thermal zone usages zones
|
||||
Set thermal zone usage zones
|
||||
:param values: [UsageZone]
|
||||
:return: None
|
||||
"""
|
||||
|
|
|
@ -52,7 +52,7 @@ class UsageZone:
|
|||
@property
|
||||
def internal_gains(self) -> List[InternalGains]:
|
||||
"""
|
||||
Get usages zone internal gains
|
||||
Get usage zone internal gains
|
||||
:return: [InternalGains]
|
||||
"""
|
||||
return self._internal_gains
|
||||
|
@ -60,7 +60,7 @@ class UsageZone:
|
|||
@internal_gains.setter
|
||||
def internal_gains(self, value):
|
||||
"""
|
||||
Set usages zone internal gains
|
||||
Set usage zone internal gains
|
||||
:param value: [InternalGains]
|
||||
:return: None
|
||||
"""
|
||||
|
@ -69,7 +69,7 @@ class UsageZone:
|
|||
@property
|
||||
def heating_setpoint(self):
|
||||
"""
|
||||
Get usages zone heating set point in celsius grads
|
||||
Get usage zone heating set point in celsius grads
|
||||
:return: float
|
||||
"""
|
||||
return self._heating_setpoint
|
||||
|
@ -77,7 +77,7 @@ class UsageZone:
|
|||
@heating_setpoint.setter
|
||||
def heating_setpoint(self, value):
|
||||
"""
|
||||
Set usages zone heating set point in celsius grads
|
||||
Set usage zone heating set point in celsius grads
|
||||
:param value: float
|
||||
:return: None
|
||||
"""
|
||||
|
@ -86,7 +86,7 @@ class UsageZone:
|
|||
@property
|
||||
def heating_setback(self):
|
||||
"""
|
||||
Get usages zone heating setback in celsius grads
|
||||
Get usage zone heating setback in celsius grads
|
||||
:return: float
|
||||
"""
|
||||
return self._heating_setback
|
||||
|
@ -94,7 +94,7 @@ class UsageZone:
|
|||
@heating_setback.setter
|
||||
def heating_setback(self, value):
|
||||
"""
|
||||
Set usages zone heating setback in celsius grads
|
||||
Set usage zone heating setback in celsius grads
|
||||
:param value: float
|
||||
:return: None
|
||||
"""
|
||||
|
@ -103,7 +103,7 @@ class UsageZone:
|
|||
@property
|
||||
def cooling_setpoint(self):
|
||||
"""
|
||||
Get usages zone cooling setpoint in celsius grads
|
||||
Get usage zone cooling setpoint in celsius grads
|
||||
:return: float
|
||||
"""
|
||||
return self._cooling_setpoint
|
||||
|
@ -111,7 +111,7 @@ class UsageZone:
|
|||
@cooling_setpoint.setter
|
||||
def cooling_setpoint(self, value):
|
||||
"""
|
||||
Set usages zone cooling setpoint in celsius grads
|
||||
Set usage zone cooling setpoint in celsius grads
|
||||
:param value: float
|
||||
:return: None
|
||||
"""
|
||||
|
@ -120,7 +120,7 @@ class UsageZone:
|
|||
@property
|
||||
def hours_day(self):
|
||||
"""
|
||||
Get usages zone usages hours per day
|
||||
Get usage zone usage hours per day
|
||||
:return: float
|
||||
"""
|
||||
return self._hours_day
|
||||
|
@ -128,7 +128,7 @@ class UsageZone:
|
|||
@hours_day.setter
|
||||
def hours_day(self, value):
|
||||
"""
|
||||
Set usages zone usages hours per day
|
||||
Set usage zone usage hours per day
|
||||
:param value: float
|
||||
:return: float
|
||||
"""
|
||||
|
@ -137,7 +137,7 @@ class UsageZone:
|
|||
@property
|
||||
def days_year(self):
|
||||
"""
|
||||
Get usages zone usages days per year
|
||||
Get usage zone usage days per year
|
||||
:return: float
|
||||
"""
|
||||
return self._days_year
|
||||
|
@ -145,7 +145,7 @@ class UsageZone:
|
|||
@days_year.setter
|
||||
def days_year(self, value):
|
||||
"""
|
||||
Set usages zone usages days per year
|
||||
Set usage zone usage days per year
|
||||
:param value: float
|
||||
:return: None
|
||||
"""
|
||||
|
@ -154,7 +154,7 @@ class UsageZone:
|
|||
@property
|
||||
def mechanical_air_change(self):
|
||||
"""
|
||||
Set usages zone mechanical air change in air change per hour (ACH)
|
||||
Set usage zone mechanical air change in air change per hour (ACH)
|
||||
:return: float
|
||||
"""
|
||||
return self._mechanical_air_change
|
||||
|
@ -162,7 +162,7 @@ class UsageZone:
|
|||
@mechanical_air_change.setter
|
||||
def mechanical_air_change(self, value):
|
||||
"""
|
||||
Get usages zone mechanical air change in air change per hour (ACH)
|
||||
Get usage zone mechanical air change in air change per hour (ACH)
|
||||
:param value: float
|
||||
:return: None
|
||||
"""
|
||||
|
@ -171,7 +171,7 @@ class UsageZone:
|
|||
@property
|
||||
def usage(self):
|
||||
"""
|
||||
Get usages zone usages
|
||||
Get usage zone usage
|
||||
:return: str
|
||||
"""
|
||||
return self._usage
|
||||
|
@ -179,7 +179,7 @@ class UsageZone:
|
|||
@usage.setter
|
||||
def usage(self, value):
|
||||
"""
|
||||
Get usages zone usages
|
||||
Get usage zone usage
|
||||
:param value: str
|
||||
:return: None
|
||||
"""
|
||||
|
|
|
@ -120,7 +120,7 @@ class Building(CityObject):
|
|||
@property
|
||||
def usage_zones(self) -> List[UsageZone]:
|
||||
"""
|
||||
Get city object usages zones
|
||||
Get city object usage zones
|
||||
:return: [UsageZone]
|
||||
"""
|
||||
return self._usage_zones
|
||||
|
@ -128,7 +128,7 @@ class Building(CityObject):
|
|||
@usage_zones.setter
|
||||
def usage_zones(self, values):
|
||||
"""
|
||||
Set city objects usages zones
|
||||
Set city objects usage zones
|
||||
:param values: [UsageZones]
|
||||
:return: None
|
||||
"""
|
||||
|
|
|
@ -44,6 +44,7 @@ class City:
|
|||
self._buildings_clusters = None
|
||||
self._parts_consisting_buildings = None
|
||||
self._city_objects_clusters = None
|
||||
self._city_objects = None
|
||||
|
||||
def _get_location(self) -> Location:
|
||||
if self._location is None:
|
||||
|
@ -97,7 +98,15 @@ class City:
|
|||
City objects belonging to the city
|
||||
:return: None or [CityObject]
|
||||
"""
|
||||
return self.buildings
|
||||
if self._city_objects is None:
|
||||
if self.city_objects_clusters is None:
|
||||
self._city_objects = []
|
||||
else:
|
||||
self._city_objects = self.city_objects_clusters
|
||||
if self.buildings is not None:
|
||||
for building in self.buildings:
|
||||
self._city_objects.append(building)
|
||||
return self._city_objects
|
||||
|
||||
@property
|
||||
def buildings(self) -> Union[List[Building], None]:
|
||||
|
@ -171,7 +180,6 @@ class City:
|
|||
else:
|
||||
raise NotImplementedError(new_city_object.type)
|
||||
|
||||
|
||||
def remove_city_object(self, city_object):
|
||||
"""
|
||||
Remove a CityObject from the city
|
||||
|
@ -313,6 +321,12 @@ class City:
|
|||
City objects clusters belonging to the city
|
||||
:return: None or [CityObjectsCluster]
|
||||
"""
|
||||
if self.buildings_clusters is None:
|
||||
self._city_objects_clusters = []
|
||||
else:
|
||||
self._city_objects_clusters = self.buildings_clusters
|
||||
if self.parts_consisting_buildings is not None:
|
||||
self._city_objects_clusters.append(self.parts_consisting_buildings)
|
||||
return self._city_objects_clusters
|
||||
|
||||
def add_city_objects_cluster(self, new_city_objects_cluster):
|
||||
|
@ -321,7 +335,6 @@ class City:
|
|||
:param new_city_objects_cluster:CityObjectsCluster
|
||||
:return: None
|
||||
"""
|
||||
print(new_city_objects_cluster.type)
|
||||
if new_city_objects_cluster.type == 'buildings':
|
||||
if self._buildings_clusters is None:
|
||||
self._buildings_clusters = []
|
||||
|
|
|
@ -5,9 +5,12 @@ Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.mons
|
|||
"""
|
||||
|
||||
from abc import ABC
|
||||
from typing import List
|
||||
from city_model_structure.attributes.sensor import Sensor
|
||||
from city_model_structure.city_object import CityObject
|
||||
|
||||
|
||||
class CityObjectsCluster(ABC):
|
||||
class CityObjectsCluster(ABC, CityObject):
|
||||
"""
|
||||
CityObjectsCluster(ABC) class
|
||||
"""
|
||||
|
@ -15,6 +18,9 @@ class CityObjectsCluster(ABC):
|
|||
self._name = name
|
||||
self._cluster_type = cluster_type
|
||||
self._city_objects = city_objects
|
||||
self._sensors = []
|
||||
self._lod = ''
|
||||
super(ABC, self).__init__(name, self._lod, None, None)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
@ -34,3 +40,19 @@ class CityObjectsCluster(ABC):
|
|||
else:
|
||||
self._city_objects.append(city_object)
|
||||
return self._city_objects
|
||||
|
||||
@property
|
||||
def sensors(self) -> List[Sensor]:
|
||||
"""
|
||||
Sensor list belonging to the city objects cluster
|
||||
:return: [Sensor]
|
||||
"""
|
||||
return self._sensors
|
||||
|
||||
@sensors.setter
|
||||
def sensors(self, value):
|
||||
"""
|
||||
Sensor list belonging to the city objects cluster
|
||||
:param value: [Sensor]
|
||||
"""
|
||||
self._sensors = value
|
||||
|
|
|
@ -166,7 +166,7 @@ class EnergyAde:
|
|||
def _building_geometry(self, building, building_dic, city):
|
||||
|
||||
building_dic['bldg:Building']['bldg:function'] = building.function
|
||||
building_dic['bldg:Building']['bldg:usages'] = ', '.join([u.usage for u in building.usage_zones])
|
||||
building_dic['bldg:Building']['bldg:usage'] = ', '.join([u.usage for u in building.usage_zones])
|
||||
building_dic['bldg:Building']['bldg:yearOfConstruction'] = building.year_of_construction
|
||||
building_dic['bldg:Building']['bldg:roofType'] = building.roof_type
|
||||
building_dic['bldg:Building']['bldg:measuredHeight'] = {
|
||||
|
|
|
@ -116,7 +116,7 @@ class Idf:
|
|||
def _add_heating_system(self, building):
|
||||
for usage_zone in building.usage_zones:
|
||||
thermostat_name = f'Thermostat {building.name}'
|
||||
# todo: this will fail for more than one usages zone
|
||||
# todo: this will fail for more than one usage zone
|
||||
static_thermostat = self._idf.newidfobject(self._THERMOSTAT,
|
||||
Name=thermostat_name,
|
||||
Constant_Heating_Setpoint=usage_zone.heating_setpoint,
|
||||
|
|
|
@ -5,8 +5,8 @@ Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
|
|||
"""
|
||||
import sys
|
||||
|
||||
from imports.constructions.nrel_physics_interface import NrelPhysicsInterface
|
||||
from imports.constructions.helpers.construction_helper import ConstructionHelper
|
||||
from imports.construction.nrel_physics_interface import NrelPhysicsInterface
|
||||
from imports.construction.helpers.construction_helper import ConstructionHelper
|
||||
|
||||
|
||||
class CaPhysicsParameters(NrelPhysicsInterface):
|
|
@ -4,7 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|||
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
|
||||
"""
|
||||
from typing import List
|
||||
from imports.constructions.data_classes.nrel_thermal_boundary_archetype import NrelThermalBoundaryArchetype
|
||||
from imports.construction.data_classes.nrel_thermal_boundary_archetype import NrelThermalBoundaryArchetype
|
||||
|
||||
|
||||
class NrelBuildingArchetype:
|
|
@ -5,8 +5,8 @@ Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
|
|||
"""
|
||||
from typing import List
|
||||
|
||||
from imports.constructions.data_classes.nrel_layer_archetype import NrelLayerArchetype
|
||||
from imports.constructions.data_classes.nrel_thermal_opening_archetype import NrelThermalOpeningArchetype
|
||||
from imports.construction.data_classes.nrel_layer_archetype import NrelLayerArchetype
|
||||
from imports.construction.data_classes.nrel_thermal_opening_archetype import NrelThermalOpeningArchetype
|
||||
|
||||
|
||||
class NrelThermalBoundaryArchetype:
|
|
@ -6,10 +6,10 @@ Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
|
|||
"""
|
||||
import xmltodict
|
||||
|
||||
from imports.constructions.data_classes.nrel_building_achetype import NrelBuildingArchetype as nba
|
||||
from imports.constructions.data_classes.nrel_thermal_boundary_archetype import NrelThermalBoundaryArchetype as ntba
|
||||
from imports.constructions.data_classes.nrel_thermal_opening_archetype import NrelThermalOpeningArchetype as ntoa
|
||||
from imports.constructions.data_classes.nrel_layer_archetype import NrelLayerArchetype as nla
|
||||
from imports.construction.data_classes.nrel_building_achetype import NrelBuildingArchetype as nba
|
||||
from imports.construction.data_classes.nrel_thermal_boundary_archetype import NrelThermalBoundaryArchetype as ntba
|
||||
from imports.construction.data_classes.nrel_thermal_opening_archetype import NrelThermalOpeningArchetype as ntoa
|
||||
from imports.construction.data_classes.nrel_layer_archetype import NrelLayerArchetype as nla
|
||||
|
||||
|
||||
class NrelPhysicsInterface:
|
||||
|
@ -59,7 +59,7 @@ class NrelPhysicsInterface:
|
|||
raise Exception(f'infiltration rate for ventilation when system on units = {units}, expected ACH')
|
||||
|
||||
thermal_boundary_archetypes = []
|
||||
for construction in archetype['constructions']['construction']:
|
||||
for construction in archetype['construction']['construction']:
|
||||
construction_type = construction['@type']
|
||||
construction_id = construction['@id']
|
||||
|
|
@ -6,8 +6,8 @@ Contributors Pilar Monsalvete pilar_monsalvete@yahoo.es
|
|||
"""
|
||||
import sys
|
||||
|
||||
from imports.constructions.nrel_physics_interface import NrelPhysicsInterface
|
||||
from imports.constructions.helpers.construction_helper import ConstructionHelper
|
||||
from imports.construction.nrel_physics_interface import NrelPhysicsInterface
|
||||
from imports.construction.helpers.construction_helper import ConstructionHelper
|
||||
from city_model_structure.attributes.layer import Layer
|
||||
from city_model_structure.attributes.material import Material
|
||||
|
|
@ -3,8 +3,8 @@ ConstructionFactory (before PhysicsFactory) retrieve the specific construction m
|
|||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
"""
|
||||
from imports.constructions.us_physics_parameters import UsPhysicsParameters
|
||||
from imports.constructions.ca_physics_parameters import CaPhysicsParameters
|
||||
from imports.construction.us_physics_parameters import UsPhysicsParameters
|
||||
from imports.construction.ca_physics_parameters import CaPhysicsParameters
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ class GeometryHelper:
|
|||
'large office': 'large office'
|
||||
}
|
||||
|
||||
# usages
|
||||
# usage
|
||||
fuction_to_usage = {
|
||||
'full service restaurant': 'restaurant',
|
||||
'highrise apartment': 'residential',
|
||||
|
@ -288,7 +288,7 @@ class GeometryHelper:
|
|||
@staticmethod
|
||||
def usage_from_function(building_function):
|
||||
"""
|
||||
Get the internal usages for the given internal building function
|
||||
Get the internal usage for the given internal building function
|
||||
:param building_function: str
|
||||
:return: str
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Schedules retrieve the specific usages schedules module for the given standard
|
||||
Schedules retrieve the specific usage schedules module for the given standard
|
||||
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
|
||||
|
|
|
@ -24,7 +24,7 @@ class SchedulesHelper:
|
|||
@staticmethod
|
||||
def comnet_from_usage(usage):
|
||||
"""
|
||||
Get Comnet usages from the given internal usages key
|
||||
Get Comnet usage from the given internal usage key
|
||||
:param usage: str
|
||||
:return: str
|
||||
"""
|
||||
|
|
|
@ -14,8 +14,6 @@ class ConcordiaEnergyConsumption(ConcordiaFileReport):
|
|||
super().__init__(city, end_point, base_path, 'concordia_energy_db.json')
|
||||
for city_object in city.city_objects:
|
||||
self._assign_sensor_to_object(city_object)
|
||||
for city_object_cluster in city.city_objects_cluster:
|
||||
self._assign_sensor_to_object(city_object_cluster)
|
||||
|
||||
def _assign_sensor_to_object(self, obj):
|
||||
for i in range(len(self._city_object)):
|
||||
|
@ -25,7 +23,7 @@ class ConcordiaEnergyConsumption(ConcordiaFileReport):
|
|||
building_energy_consumption = pd.concat(building_measures, keys=building_headers, axis=1)
|
||||
sensor = ConcordiaEnergySensor(self._sensors[i])
|
||||
sensor_exist = False
|
||||
for j in range(len(object.sensors)):
|
||||
for j in range(len(obj.sensors)):
|
||||
if obj.sensors[j].name is sensor.name:
|
||||
obj.sensors[j].add_period(building_energy_consumption)
|
||||
sensor_exist = True
|
||||
|
|
|
@ -10,10 +10,12 @@ from pathlib import Path
|
|||
import pandas as pd
|
||||
from city_model_structure.attributes.concordia_energy_sensor import ConcordiaEnergySensor
|
||||
|
||||
|
||||
class ConcordiaFileReport:
|
||||
def __init__(self, city, end_point, base_path, db_file):
|
||||
|
||||
self._city_object = []
|
||||
self._city_objects_cluster = []
|
||||
self._sensors = []
|
||||
self._sensor_point = {}
|
||||
self._city = city
|
||||
|
|
|
@ -13,19 +13,21 @@ class ConcordiaGasFlow(ConcordiaFileReport):
|
|||
def __init__(self, city, end_point, base_path):
|
||||
super().__init__(city, end_point, base_path, 'concordia_gas_flow_db.json')
|
||||
for city_object in city.city_objects:
|
||||
for i in range(len(self._city_object)):
|
||||
if self._city_object[i] == city_object.name and self._sensors[i] in self._sensor_point:
|
||||
building_measures = [self._measures["Date time"], self._measures[self._sensor_point[self._sensors[i]]]]
|
||||
building_headers = ["Date time", "Gas Flow Cumulative Monthly"]
|
||||
building_gas_flow = pd.concat(building_measures, keys=building_headers, axis=1)
|
||||
sensor = ConcordiaGasFlowSensor(self._sensors[i])
|
||||
sensor_exist = False
|
||||
for j in range(len(city_object.sensors)):
|
||||
if city_object.sensors[j].name is sensor.name:
|
||||
city_object.sensors[j].add_period(building_gas_flow)
|
||||
sensor_exist = True
|
||||
break
|
||||
if not sensor_exist:
|
||||
sensor.add_period(building_gas_flow)
|
||||
city_object.sensors.append(sensor)
|
||||
self._assign_sensor_to_object(city_object)
|
||||
|
||||
def _assign_sensor_to_object(self, obj):
|
||||
for i in range(len(self._city_object)):
|
||||
if self._city_object[i] == obj.name and self._sensors[i] in self._sensor_point:
|
||||
building_measures = [self._measures["Date time"], self._measures[self._sensor_point[self._sensors[i]]]]
|
||||
building_headers = ["Date time", "Gas Flow Cumulative Monthly"]
|
||||
building_energy_consumption = pd.concat(building_measures, keys=building_headers, axis=1)
|
||||
sensor = ConcordiaGasFlowSensor(self._sensors[i])
|
||||
sensor_exist = False
|
||||
for j in range(len(obj.sensors)):
|
||||
if obj.sensors[j].name is sensor.name:
|
||||
obj.sensors[j].add_period(building_energy_consumption)
|
||||
sensor_exist = True
|
||||
break
|
||||
if not sensor_exist:
|
||||
sensor.add_period(building_energy_consumption)
|
||||
obj.sensors.append(sensor)
|
||||
|
|
|
@ -13,19 +13,21 @@ class ConcordiaTemperature(ConcordiaFileReport):
|
|||
def __init__(self, city, end_point, base_path):
|
||||
super().__init__(city, end_point, base_path, 'concordia_temperature_db.json')
|
||||
for city_object in city.city_objects:
|
||||
for i in range(len(self._city_object)):
|
||||
if self._city_object[i] == city_object.name and self._sensors[i] in self._sensor_point:
|
||||
building_measures = [self._measures["Date time"], self._measures[self._sensor_point[self._sensors[i]]]]
|
||||
building_headers = ["Date time", "Temperature"]
|
||||
building_temperature = pd.concat(building_measures, keys=building_headers, axis=1)
|
||||
sensor = ConcordiaTemperatureSensor(self._sensors[i])
|
||||
sensor_exist = False
|
||||
for j in range(len(city_object.sensors)):
|
||||
if city_object.sensors[j].name is sensor.name:
|
||||
city_object.sensors[j].add_period(building_temperature)
|
||||
sensor_exist = True
|
||||
break
|
||||
if not sensor_exist:
|
||||
sensor.add_period(building_temperature)
|
||||
city_object.sensors.append(sensor)
|
||||
self._assign_sensor_to_object(city_object)
|
||||
|
||||
def _assign_sensor_to_object(self, obj):
|
||||
for i in range(len(self._city_object)):
|
||||
if self._city_object[i] == obj.name and self._sensors[i] in self._sensor_point:
|
||||
building_measures = [self._measures["Date time"], self._measures[self._sensor_point[self._sensors[i]]]]
|
||||
building_headers = ["Date time", "Temperature"]
|
||||
building_energy_consumption = pd.concat(building_measures, keys=building_headers, axis=1)
|
||||
sensor = ConcordiaTemperatureSensor(self._sensors[i])
|
||||
sensor_exist = False
|
||||
for j in range(len(obj.sensors)):
|
||||
if obj.sensors[j].name is sensor.name:
|
||||
obj.sensors[j].add_period(building_energy_consumption)
|
||||
sensor_exist = True
|
||||
break
|
||||
if not sensor_exist:
|
||||
sensor.add_period(building_energy_consumption)
|
||||
obj.sensors.append(sensor)
|
||||
|
|
|
@ -31,7 +31,7 @@ class SensorsFactory:
|
|||
|
||||
def enrich(self):
|
||||
"""
|
||||
Enrich the city with the usages information
|
||||
Enrich the city with the usage information
|
||||
:return: None
|
||||
"""
|
||||
getattr(self, self._handler, lambda: None)()
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"""
|
||||
HftUsageZoneArchetype stores usages information by building archetypes
|
||||
HftUsageZoneArchetype stores usage information by building archetypes
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
|
||||
"""
|
||||
from typing import List
|
||||
from imports.usages.data_classes.hft_internal_gains_archetype import HftInternalGainsArchetype
|
||||
from imports.usage.data_classes.hft_internal_gains_archetype import HftInternalGainsArchetype
|
||||
|
||||
|
||||
class HftUsageZoneArchetype:
|
||||
|
@ -34,7 +34,7 @@ class HftUsageZoneArchetype:
|
|||
@property
|
||||
def internal_gains(self) -> List[HftInternalGainsArchetype]:
|
||||
"""
|
||||
Get usages zone internal gains
|
||||
Get usage zone internal gains
|
||||
:return: [InternalGains]
|
||||
"""
|
||||
return self._internal_gains
|
||||
|
@ -42,7 +42,7 @@ class HftUsageZoneArchetype:
|
|||
@property
|
||||
def heating_setpoint(self):
|
||||
"""
|
||||
Get usages zone heating set point in celsius grads
|
||||
Get usage zone heating set point in celsius grads
|
||||
:return: float
|
||||
"""
|
||||
return self._heating_setpoint
|
||||
|
@ -50,7 +50,7 @@ class HftUsageZoneArchetype:
|
|||
@property
|
||||
def heating_setback(self):
|
||||
"""
|
||||
Get usages zone heating setback in celsius grads
|
||||
Get usage zone heating setback in celsius grads
|
||||
:return: float
|
||||
"""
|
||||
return self._heating_setback
|
||||
|
@ -58,7 +58,7 @@ class HftUsageZoneArchetype:
|
|||
@property
|
||||
def cooling_setpoint(self):
|
||||
"""
|
||||
Get usages zone cooling setpoint in celsius grads
|
||||
Get usage zone cooling setpoint in celsius grads
|
||||
:return: float
|
||||
"""
|
||||
return self._cooling_setpoint
|
||||
|
@ -66,7 +66,7 @@ class HftUsageZoneArchetype:
|
|||
@property
|
||||
def hours_day(self):
|
||||
"""
|
||||
Get usages zone usages hours per day
|
||||
Get usage zone usage hours per day
|
||||
:return: float
|
||||
"""
|
||||
return self._hours_day
|
||||
|
@ -74,7 +74,7 @@ class HftUsageZoneArchetype:
|
|||
@property
|
||||
def days_year(self):
|
||||
"""
|
||||
Get usages zone usages days per year
|
||||
Get usage zone usage days per year
|
||||
:return: float
|
||||
"""
|
||||
return self._days_year
|
||||
|
@ -82,7 +82,7 @@ class HftUsageZoneArchetype:
|
|||
@property
|
||||
def mechanical_air_change(self):
|
||||
"""
|
||||
Set usages zone mechanical air change in air change per hour (ACH)
|
||||
Set usage zone mechanical air change in air change per hour (ACH)
|
||||
:return: float
|
||||
"""
|
||||
return self._mechanical_air_change
|
||||
|
@ -90,7 +90,7 @@ class HftUsageZoneArchetype:
|
|||
@property
|
||||
def usage(self):
|
||||
"""
|
||||
Get usages zone usages
|
||||
Get usage zone usage
|
||||
:return: str
|
||||
"""
|
||||
return self._usage
|
|
@ -23,12 +23,12 @@ class UsageHelper:
|
|||
@staticmethod
|
||||
def hft_from_usage(usage):
|
||||
"""
|
||||
Get HfT usages from the given internal usages key
|
||||
Get HfT usage from the given internal usage key
|
||||
:param usage: str
|
||||
:return: str
|
||||
"""
|
||||
try:
|
||||
return UsageHelper.usage_to_hft[usage]
|
||||
except KeyError:
|
||||
sys.stderr.write('Error: keyword not found. Returned default HfT usages "residential"\n')
|
||||
sys.stderr.write('Error: keyword not found. Returned default HfT usage "residential"\n')
|
||||
return UsageHelper.hft_default_value
|
|
@ -1,12 +1,12 @@
|
|||
"""
|
||||
Hft-based interface, it reads format defined within the CERC team based on that one used in SimStadt and developed by
|
||||
the IAF team at hft-Stuttgart and enriches the city with usages parameters
|
||||
the IAF team at hft-Stuttgart and enriches the city with usage parameters
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
import xmltodict
|
||||
from imports.usages.data_classes.hft_usage_zone_archetype import HftUsageZoneArchetype as huza
|
||||
from imports.usages.data_classes.hft_internal_gains_archetype import HftInternalGainsArchetype as higa
|
||||
from imports.usage.data_classes.hft_usage_zone_archetype import HftUsageZoneArchetype as huza
|
||||
from imports.usage.data_classes.hft_internal_gains_archetype import HftInternalGainsArchetype as higa
|
||||
|
||||
|
||||
class HftUsageInterface:
|
|
@ -1,12 +1,12 @@
|
|||
"""
|
||||
HftUsageParameters model the usages properties
|
||||
HftUsageParameters 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 imports.usages.hft_usage_interface import HftUsageInterface
|
||||
from imports.usage.hft_usage_interface import HftUsageInterface
|
||||
from city_model_structure.attributes.usage_zone import UsageZone
|
||||
from city_model_structure.attributes.internal_gains import InternalGains
|
||||
|
||||
|
@ -25,7 +25,7 @@ class HftUsageParameters(HftUsageInterface):
|
|||
|
||||
def enrich_buildings(self):
|
||||
"""
|
||||
Returns the city with the usages parameters assigned to the buildings
|
||||
Returns the city with the usage parameters assigned to the buildings
|
||||
:return:
|
||||
"""
|
||||
city = self._city
|
||||
|
@ -33,10 +33,10 @@ class HftUsageParameters(HftUsageInterface):
|
|||
archetype = self._search_archetype(gh.usage_from_function(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 usages as '
|
||||
f' {building.function}, that assigns building usage as '
|
||||
f'{gh.usage_from_function(building.function)}\n')
|
||||
continue
|
||||
# todo: what to do with mix-usages usages from gml?
|
||||
# todo: what to do with mix-usage usage from gml?
|
||||
mix_usage = False
|
||||
if not mix_usage:
|
||||
# just one usage_zone
|
|
@ -1,10 +1,10 @@
|
|||
"""
|
||||
UsageFactory retrieve the specific usages module for the given region
|
||||
UsageFactory retrieve the specific usage module for the given region
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
"""
|
||||
from pathlib import Path
|
||||
from imports.usages.hft_usage_parameters import HftUsageParameters
|
||||
from imports.usage.hft_usage_parameters import HftUsageParameters
|
||||
|
||||
|
||||
class UsageFactory:
|
||||
|
@ -24,7 +24,7 @@ class UsageFactory:
|
|||
|
||||
def enrich(self):
|
||||
"""
|
||||
Enrich the city with the usages information
|
||||
Enrich the city with the usage information
|
||||
:return: None
|
||||
"""
|
||||
getattr(self, self._handler, lambda: None)()
|
||||
|
|
|
@ -39,7 +39,7 @@ class WeatherFactory:
|
|||
|
||||
def enrich(self):
|
||||
"""
|
||||
Enrich the city with the usages information
|
||||
Enrich the city with the usage information
|
||||
:return: None
|
||||
"""
|
||||
getattr(self, self._handler, lambda: None)()
|
||||
|
|
|
@ -8,7 +8,7 @@ from unittest import TestCase
|
|||
import pandas as pd
|
||||
from city_model_structure.city import City
|
||||
from city_model_structure.building import Building
|
||||
from city_model_structure.city_object import CityObject
|
||||
from city_model_structure.buildings_cluster import BuildingsCluster
|
||||
from imports.sensors_factory import SensorsFactory
|
||||
|
||||
|
||||
|
@ -39,23 +39,18 @@ class TestSensorsFactory(TestCase):
|
|||
city = City(lower_corner, upper_corner, srs_name)
|
||||
buildings.append(Building("EV", lod, surfaces, year_of_construction, function, lower_corner))
|
||||
buildings.append(Building("GM", lod, surfaces, year_of_construction, function, lower_corner))
|
||||
buildings.append(Building("MB", lod, surfaces, year_of_construction, function, lower_corner))
|
||||
for building in buildings:
|
||||
city.add_city_object(building)
|
||||
buildings_cluster = BuildingsCluster("GM_MB_EV", buildings)
|
||||
city.add_city_objects_cluster(buildings_cluster)
|
||||
return city
|
||||
#virtual_building = CityObject("GM_MB_EV", lod, surfaces, lower_corner)
|
||||
#virtual_building.type = 'Virtual'
|
||||
#city.add_city_object(virtual_building)
|
||||
|
||||
def test_city_with_sensors(self):
|
||||
SensorsFactory('cec', self._city, self._end_point).enrich()
|
||||
SensorsFactory('cgf', self._city, self._end_point).enrich()
|
||||
SensorsFactory('ct', self._city, self._end_point).enrich()
|
||||
for city_object in self._city.city_objects:
|
||||
print(city_object.name, len(city_object.sensors))
|
||||
for sensor in city_object.sensors:
|
||||
# force update last row
|
||||
update = pd.DataFrame([['2020-01-19 23:55:00', '12345.0']], columns=["Date time", "Energy consumption"])
|
||||
update = update.astype({"Date time": 'datetime64', "Energy consumption": 'float64'})
|
||||
sensor.add_period(update)
|
||||
|
||||
row = sensor.measures.loc[sensor.measures["Date time"] == '2020-01-19 23:55:00']['Energy consumption'].iloc[0]
|
||||
self.assertTrue(f'{row}' == '12345.0')
|
||||
print(sensor.name)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
TestUsageFactory test and validate the city model structure usages parameters
|
||||
TestUsageFactory test and validate the city model structure usage parameters
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
|
@ -31,7 +31,7 @@ class TestUsageFactory(TestCase):
|
|||
|
||||
def test_city_with_usage(self):
|
||||
"""
|
||||
Enrich the city with the usages information and verify it
|
||||
Enrich the city with the usage information and verify it
|
||||
:return: None
|
||||
"""
|
||||
file = 'pluto_building.gml'
|
||||
|
@ -44,14 +44,14 @@ class TestUsageFactory(TestCase):
|
|||
for building in city.buildings:
|
||||
self.assertIsNotNone(building.usage_zones, 'usage_zones not created')
|
||||
for usage_zone in building.usage_zones:
|
||||
self.assertIsNotNone(usage_zone.usage, 'usages is none')
|
||||
self.assertIsNotNone(usage_zone.internal_gains, 'usages is none')
|
||||
self.assertIsNotNone(usage_zone.cooling_setpoint, 'usages is none')
|
||||
self.assertIsNotNone(usage_zone.heating_setback, 'usages is none')
|
||||
self.assertIsNotNone(usage_zone.heating_setpoint, 'usages is none')
|
||||
self.assertIsNotNone(usage_zone.occupancy_density, 'usages is none')
|
||||
self.assertIsNotNone(usage_zone.hours_day, 'usages is none')
|
||||
self.assertIsNotNone(usage_zone.days_year, 'usages is none')
|
||||
self.assertIsNotNone(usage_zone.dhw_average_volume_pers_day, 'usages is none')
|
||||
self.assertIsNotNone(usage_zone.dhw_preparation_temperature, 'usages is none')
|
||||
self.assertIsNotNone(usage_zone.electrical_app_average_consumption_sqm_year, 'usages is none')
|
||||
self.assertIsNotNone(usage_zone.usage, 'usage is none')
|
||||
self.assertIsNotNone(usage_zone.internal_gains, 'usage is none')
|
||||
self.assertIsNotNone(usage_zone.cooling_setpoint, 'usage is none')
|
||||
self.assertIsNotNone(usage_zone.heating_setback, 'usage is none')
|
||||
self.assertIsNotNone(usage_zone.heating_setpoint, 'usage is none')
|
||||
self.assertIsNotNone(usage_zone.occupancy_density, 'usage is none')
|
||||
self.assertIsNotNone(usage_zone.hours_day, 'usage is none')
|
||||
self.assertIsNotNone(usage_zone.days_year, 'usage is none')
|
||||
self.assertIsNotNone(usage_zone.dhw_average_volume_pers_day, 'usage is none')
|
||||
self.assertIsNotNone(usage_zone.dhw_preparation_temperature, 'usage is none')
|
||||
self.assertIsNotNone(usage_zone.electrical_app_average_consumption_sqm_year, 'usage is none')
|
||||
|
|
Loading…
Reference in New Issue
Block a user