diff --git a/hub_api/mockup/building.py b/hub_api/mockup/building.py index a329a33..b7c68f5 100644 --- a/hub_api/mockup/building.py +++ b/hub_api/mockup/building.py @@ -12,40 +12,23 @@ class Building: """ Building class """ - def __init__(self, - function, - volume, - area, - total_heating_area, - wall_area, - windows_area, - roof_area, - solar_collectors_area_reduction_factor, - heating_consumption, - cooling_consumption, - domestic_hot_water_consumption, - lighting_electrical_demand, - appliances_electrical_demand, - heating_peak_load, - cooling_peak_load, - onsite_electrical_production, - catalog_archetype): - self._function = function - self._area = area - self._volume = volume - self._total_heating_area = total_heating_area - self._wall_area = wall_area - self._windows_area = windows_area - self._roof_area = roof_area - self._solar_collectors_area_reduction_factor = solar_collectors_area_reduction_factor - self._heating_consumption = heating_consumption - self._cooling_consumption = cooling_consumption - self._domestic_hot_water_consumption = domestic_hot_water_consumption - self._lighting_electrical_demand = lighting_electrical_demand - self._appliances_electrical_demand = appliances_electrical_demand - self._heating_peak_load = heating_peak_load - self._cooling_peak_load = cooling_peak_load - self._onsite_electrical_production = onsite_electrical_production + def __init__(self, building_info, catalog_archetype): + self._function = building_info.function + self._area = building_info.area + self._volume = building_info.volume + self._total_heating_area = building_info.total_heating_area + self._wall_area = building_info.wall_area + self._windows_area = building_info.windows_area + self._roof_area = building_info.roof_area + self._solar_collectors_area_reduction_factor = building_info.total_pv_area + self._heating_consumption = building_info.heating_consumption + self._cooling_consumption = building_info.cooling_consumption + self._domestic_hot_water_consumption = building_info.domestic_hot_water_consumption + self._lighting_electrical_demand = building_info.lighting_electrical_demand + self._appliances_electrical_demand = building_info.appliances_electrical_demand + self._heating_peak_load = building_info.heating_peak_load + self._cooling_peak_load = building_info.cooling_peak_load + self._onsite_electrical_production = building_info.onsite_electrical_production self._catalog_archetype = catalog_archetype @property diff --git a/hub_api/persistence/retrofit_results.py b/hub_api/persistence/retrofit_results.py index dd2a935..938b032 100644 --- a/hub_api/persistence/retrofit_results.py +++ b/hub_api/persistence/retrofit_results.py @@ -5,6 +5,7 @@ from flask_restful import Resource from hub_api.config import Config from hub_api.helpers.session_helper import session, refresh_session +from hub_api.mockup.building import Building class RetrofitResults(Resource, Config): @@ -40,8 +41,10 @@ class RetrofitResults(Resource, Config): buildings.append(name) for building in buildings: building_info = self.database.building(building, user_id, application_id, scenario_name) - self.energy_systems_catalog.get_entry(building_info.system_name) + archetype = self.energy_systems_catalog.get_entry(building_info.system_name) buildings_info.append(building_info) + buildings.append(Building(building_info, archetype)) + results = self.database.results(user_id, application_id, payload) if results == {}: # no data found for the given parameters