Remove unneeded files and wrong unittest, partial usage factory test correction
This commit is contained in:
parent
b2453b0d27
commit
5281b63de2
|
@ -1,45 +0,0 @@
|
|||
"""
|
||||
Energy Sensor module
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
"""
|
||||
|
||||
import pandas as pd
|
||||
from city_model_structure.iot.sensor import Sensor
|
||||
|
||||
|
||||
class ConcordiaEnergySensor(Sensor):
|
||||
"""
|
||||
Concordia energy sensor.
|
||||
"""
|
||||
|
||||
def __init__(self, name):
|
||||
super().__init__()
|
||||
self._name = name
|
||||
self._interval = 5
|
||||
self._interval_units = 'minutes'
|
||||
self._type = 'ConcordiaEnergySensor'
|
||||
self._units = 'kW'
|
||||
self._measures = pd.DataFrame(columns=["Date time", "Energy consumption"])
|
||||
|
||||
@property
|
||||
def measures(self) -> pd.DataFrame:
|
||||
"""
|
||||
Get sensor measures [yyyy-mm-dd, hh:mm:ss kW]
|
||||
:return: DataFrame["Date time", "Energy consumption"]
|
||||
"""
|
||||
return self._measures
|
||||
|
||||
@measures.deleter
|
||||
def measures(self):
|
||||
"""
|
||||
Delete sensor measures
|
||||
"""
|
||||
self._measures.drop = None
|
||||
|
||||
def add_period(self, measures):
|
||||
"""
|
||||
Add or update a period measures to the dataframe
|
||||
"""
|
||||
measures = self._measures.append(measures, ignore_index=True)
|
||||
self._measures = measures.drop_duplicates('Date time', keep='last')
|
|
@ -1,45 +0,0 @@
|
|||
"""
|
||||
Gas Flow Sensor module
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
|
||||
import pandas as pd
|
||||
from city_model_structure.iot.sensor import Sensor
|
||||
|
||||
|
||||
class ConcordiaGasFlowSensor(Sensor):
|
||||
"""
|
||||
Concordia gas flow sensor.
|
||||
"""
|
||||
|
||||
def __init__(self, name):
|
||||
super().__init__()
|
||||
self._name = name
|
||||
self._interval = 5
|
||||
self._interval_units = 'minutes'
|
||||
self._type = 'ConcordiaGasFlowSensor'
|
||||
self._units = 'm3'
|
||||
self._measures = pd.DataFrame(columns=["Date time", "Gas Flow Cumulative Monthly"])
|
||||
|
||||
@property
|
||||
def measures(self) -> pd.DataFrame:
|
||||
"""
|
||||
Get sensor measures [yyyy-mm-dd, hh:mm:ss m3]
|
||||
:return: DataFrame["Date time", "Gas Flow Cumulative Monthly"]
|
||||
"""
|
||||
return self._measures
|
||||
|
||||
@measures.deleter
|
||||
def measures(self):
|
||||
"""
|
||||
Delete sensor measures
|
||||
"""
|
||||
self._measures.drop = None
|
||||
|
||||
def add_period(self, measures):
|
||||
"""
|
||||
Add or update a period measures to the dataframe
|
||||
"""
|
||||
measures = self._measures.append(measures, ignore_index=True)
|
||||
self._measures = measures.drop_duplicates('Date time', keep='last')
|
|
@ -1,45 +0,0 @@
|
|||
"""
|
||||
Temperature Sensor module
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
|
||||
import pandas as pd
|
||||
from city_model_structure.iot.sensor import Sensor
|
||||
|
||||
|
||||
class ConcordiaTemperatureSensor(Sensor):
|
||||
"""
|
||||
Concordia temperature sensor.
|
||||
"""
|
||||
|
||||
def __init__(self, name):
|
||||
super().__init__()
|
||||
self._name = name
|
||||
self._interval = 5
|
||||
self._interval_units = 'minutes'
|
||||
self._type = 'ConcordiaTemperatureSensor'
|
||||
self._units = 'Celsius'
|
||||
self._measures = pd.DataFrame(columns=["Date time", "Temperature"])
|
||||
|
||||
@property
|
||||
def measures(self) -> pd.DataFrame:
|
||||
"""
|
||||
Get sensor measures [yyyy-mm-dd, hh:mm:ss Celsius]
|
||||
:return: DataFrame["Date time", "Temperature"]
|
||||
"""
|
||||
return self._measures
|
||||
|
||||
@measures.deleter
|
||||
def measures(self):
|
||||
"""
|
||||
Delete sensor measures
|
||||
"""
|
||||
self._measures.drop = None
|
||||
|
||||
def add_period(self, measures):
|
||||
"""
|
||||
Add or update a period measures to the dataframe
|
||||
"""
|
||||
measures = self._measures.append(measures, ignore_index=True)
|
||||
self._measures = measures.drop_duplicates('Date time', keep='last')
|
|
@ -1,58 +0,0 @@
|
|||
"""
|
||||
TestSensorsFactory test and validate the city model structure schedules
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2021 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
"""
|
||||
from pathlib import Path
|
||||
from unittest import TestCase
|
||||
from city_model_structure.building import Building
|
||||
from city_model_structure.buildings_cluster import BuildingsCluster
|
||||
from city_model_structure.city import City
|
||||
from imports.sensors_factory import SensorsFactory
|
||||
|
||||
|
||||
class TestSensorsFactory(TestCase):
|
||||
"""
|
||||
TestSchedulesFactory TestCase
|
||||
"""
|
||||
|
||||
def setUp(self) -> None:
|
||||
"""
|
||||
Configure test environment
|
||||
:return:
|
||||
"""
|
||||
self._city = TestSensorsFactory._mockup_city()
|
||||
self._end_point = (Path(__file__).parent /
|
||||
'tests_data/EV-GM energy demand weekly report_01-26-20_04-30.csv').resolve()
|
||||
|
||||
@staticmethod
|
||||
def _mockup_city():
|
||||
lower_corner = [0, 0, 0]
|
||||
upper_corner = [10, 10, 10]
|
||||
srs_name = 'Mockup_city'
|
||||
buildings = []
|
||||
lod = 2
|
||||
surfaces = []
|
||||
year_of_construction = 2021
|
||||
function = "office"
|
||||
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
|
||||
|
||||
def test_city_with_sensors(self):
|
||||
"""
|
||||
Load concordia sensors and verify it
|
||||
"""
|
||||
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:
|
||||
print(sensor.name)
|
|
@ -72,7 +72,7 @@ class TestUsageFactory(TestCase):
|
|||
def _check_usage_zone(self, usage_zone):
|
||||
self.assertIsNotNone(usage_zone.usage, 'usage is none')
|
||||
self.assertIsNotNone(usage_zone.percentage, 'usage percentage is none')
|
||||
self.assertIsNotNone(usage_zone.get_internal_gains, 'internal gains is none')
|
||||
self.assertIsNotNone(usage_zone.internal_gains, 'internal gains is none')
|
||||
self.assertIsNotNone(usage_zone.hours_day, 'hours per day is none')
|
||||
self.assertIsNotNone(usage_zone.days_year, 'days per year is none')
|
||||
self.assertIsNotNone(usage_zone.thermal_control, 'thermal control is none')
|
||||
|
|
Loading…
Reference in New Issue
Block a user