changes to add new sensors of other types

This commit is contained in:
Pilar 2021-06-02 11:24:58 -04:00
parent 2f0da19293
commit 360003276a
8 changed files with 111 additions and 13 deletions

View File

@ -25,7 +25,7 @@ class ConcordiaEnergySensor(Sensor):
@property
def measures(self) -> pd.DataFrame:
"""
Sensor measures [yyyy-mm-dd, hh:mm:ss kWh]
Sensor measures [yyyy-mm-dd, hh:mm:ss kW]
:return: DataFrame["Date time", "Energy consumption"]
"""
return self._measures

View File

@ -0,0 +1,42 @@
"""
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
"""
from city_model_structure.attributes.sensor import Sensor
import pandas as pd
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:
"""
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):
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')

View File

@ -0,0 +1,43 @@
"""
Temperature Sensor 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.attributes.sensor import Sensor
import pandas as pd
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:
"""
Sensor measures [yyyy-mm-dd, hh:mm:ss Celsius]
:return: DataFrame["Date time", "Temperature"]
"""
return self._measures
@measures.deleter
def measures(self):
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')

View File

@ -1,11 +0,0 @@
{
"sensors": [
{ "building" : "EV",
"sensors": ["COMPTEUR.SQD.017.IC:POWER 3P", "COMPTEUR.SQD.B1.IC:POWER 3P", "COMPTEUR.SQD.B2.IC:POWER 3P",
"TOTKWEV-MB.IC"]
},
{ "building" : "GM",
"sensors": ["MDICOR.GM"]
}
]
}

View File

@ -0,0 +1,7 @@
{
"sensors": [
{ "city_object" : "EV",
"sensors": ["COMPTEUR.SQD.017.IC:POWER 3P", "COMPTEUR.SQD.B1.IC:POWER 3P", "COMPTEUR.SQD.B2.IC:POWER 3P"]
}
]
}

View File

@ -0,0 +1,10 @@
{
"sensors": [
{ "city_object" : "GM",
"sensors": ["MDICOR.GM"]
},
{ "city_object" : "GM_MB_EV",
"sensors": ["TOTAL.GAZ.MOIS.ENCS.IC"]
}
]
}

View File

@ -0,0 +1,7 @@
{
"sensors": [
{ "city_object" : "EV",
"sensors": ["MTX-017.IC", "MTACBT.IC","MTRCBT.IC"]
}
]
}

View File

@ -22,7 +22,7 @@ class ConcordiaEnergyConsumption:
self._sensor_database = base_path
metadata = True
content = False
with open(Path(base_path / 'concordia.json').resolve()) as concordia_db:
with open(Path(base_path / 'concordia_energy_db.json').resolve()) as concordia_db:
self._sensor_database = json.load(concordia_db)
for building in self._sensor_database['sensors']: