diff --git a/city_model_structure/attributes/concordia_energy_sensor.py b/city_model_structure/attributes/concordia_energy_sensor.py index 5da97e8a..e6be9ed4 100644 --- a/city_model_structure/attributes/concordia_energy_sensor.py +++ b/city_model_structure/attributes/concordia_energy_sensor.py @@ -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 diff --git a/city_model_structure/attributes/concordia_gas_flow_sensor.py b/city_model_structure/attributes/concordia_gas_flow_sensor.py new file mode 100644 index 00000000..2f36abe8 --- /dev/null +++ b/city_model_structure/attributes/concordia_gas_flow_sensor.py @@ -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') diff --git a/city_model_structure/attributes/concordia_temperature_sensor.py b/city_model_structure/attributes/concordia_temperature_sensor.py new file mode 100644 index 00000000..227edd51 --- /dev/null +++ b/city_model_structure/attributes/concordia_temperature_sensor.py @@ -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') + diff --git a/data/sensors/concordia.json b/data/sensors/concordia.json deleted file mode 100644 index 0a7bae46..00000000 --- a/data/sensors/concordia.json +++ /dev/null @@ -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"] - } - ] -} \ No newline at end of file diff --git a/data/sensors/concordia_energy_db.json b/data/sensors/concordia_energy_db.json new file mode 100644 index 00000000..42e68088 --- /dev/null +++ b/data/sensors/concordia_energy_db.json @@ -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"] + } + ] +} \ No newline at end of file diff --git a/data/sensors/concordia_gas_flow_db.json b/data/sensors/concordia_gas_flow_db.json new file mode 100644 index 00000000..42213658 --- /dev/null +++ b/data/sensors/concordia_gas_flow_db.json @@ -0,0 +1,10 @@ +{ + "sensors": [ + { "city_object" : "GM", + "sensors": ["MDICOR.GM"] + }, + { "city_object" : "GM_MB_EV", + "sensors": ["TOTAL.GAZ.MOIS.ENCS.IC"] + } + ] +} \ No newline at end of file diff --git a/data/sensors/concordia_temperature_db.json b/data/sensors/concordia_temperature_db.json new file mode 100644 index 00000000..42fb239d --- /dev/null +++ b/data/sensors/concordia_temperature_db.json @@ -0,0 +1,7 @@ +{ + "sensors": [ + { "city_object" : "EV", + "sensors": ["MTX-017.IC", "MTACBT.IC","MTRCBT.IC"] + } + ] +} \ No newline at end of file diff --git a/imports/sensors/concordia_energy_consumption.py b/imports/sensors/concordia_energy_consumption.py index 9b49cd20..802c03e9 100644 --- a/imports/sensors/concordia_energy_consumption.py +++ b/imports/sensors/concordia_energy_consumption.py @@ -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']: