diff --git a/data/sensors/concordia_energy_db.json b/data/sensors/concordia_energy_db.json index a2649591..eea701f7 100644 --- a/data/sensors/concordia_energy_db.json +++ b/data/sensors/concordia_energy_db.json @@ -1,8 +1,9 @@ { "sensors": [ - { "building" : "EV", + { "city_object" : "EV", "sensors": ["TOTKWCH3.IC","TOTKWEV.IC","COMPTEUR.SQD.017.IC:POWER 3P", "COMPTEUR.SQD.B1.IC:POWER 3P", "COMPTEUR.SQD.B2.IC:POWER 3P", "TOTKWEV-MB.IC"] } + ] } \ No newline at end of file diff --git a/imports/sensors/concordia_energy_consumption.py b/imports/sensors/concordia_energy_consumption.py index 918d35c2..e82cddff 100644 --- a/imports/sensors/concordia_energy_consumption.py +++ b/imports/sensors/concordia_energy_consumption.py @@ -12,20 +12,20 @@ class ConcordiaEnergyConsumption(ConcordiaFileReport): def __init__(self, city, end_point, base_path): super().__init__(city, end_point, base_path, 'concordia_energy_db.json') - for building in city.buildings: - for i in range(len(self._buildings)): - if self._buildings[i] == building.name and self._sensors[i] in self._sensor_point: + 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", "Energy consumption"] 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(building.sensors)): - if building.sensors[j].name is sensor.name: - building.sensors[j].add_period(building_energy_consumption) + for j in range(len(city_object.sensors)): + if city_object.sensors[j].name is sensor.name: + city_object.sensors[j].add_period(building_energy_consumption) sensor_exist = True break if not sensor_exist: sensor.add_period(building_energy_consumption) - building.sensors.append(sensor) + city_object.sensors.append(sensor) diff --git a/imports/sensors/concordia_file_report.py b/imports/sensors/concordia_file_report.py index 6d435e61..e8b6ef46 100644 --- a/imports/sensors/concordia_file_report.py +++ b/imports/sensors/concordia_file_report.py @@ -13,7 +13,7 @@ from city_model_structure.attributes.concordia_energy_sensor import ConcordiaEne class ConcordiaFileReport: def __init__(self, city, end_point, base_path, db_file): - self._buildings = [] + self._city_object = [] self._sensors = [] self._sensor_point = {} self._city = city @@ -24,10 +24,10 @@ class ConcordiaFileReport: with open(Path(base_path / db_file).resolve()) as concordia_db: self._sensor_database = json.load(concordia_db) - for building in self._sensor_database['sensors']: - building_name = building['building'] - for sensor in building['sensors']: - self._buildings.append(building_name) + for city_object in self._sensor_database['sensors']: + city_object_name = city_object['city_object'] + for sensor in city_object['sensors']: + self._city_object.append(city_object_name) self._sensors.append(sensor) buffer = ""