two bugs solved befor students workshop
This commit is contained in:
parent
e064adc29e
commit
51fc72b921
5
main.py
5
main.py
@ -12,12 +12,13 @@ import pandas as pd
|
|||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from helpers import monthly_values as mv
|
from helpers import monthly_values as mv
|
||||||
from populate import Populate
|
|
||||||
from simplified_radiosity_algorithm import SimplifiedRadiosityAlgorithm
|
from simplified_radiosity_algorithm import SimplifiedRadiosityAlgorithm
|
||||||
from imports.geometry_factory import GeometryFactory
|
from imports.geometry_factory import GeometryFactory
|
||||||
from imports.weather_factory import WeatherFactory
|
from imports.weather_factory import WeatherFactory
|
||||||
from city_model_structure.city import City
|
from city_model_structure.city import City
|
||||||
from monthly_demand_calculation import MonthlyDemandCalculation
|
from monthly_demand_calculation import MonthlyDemandCalculation
|
||||||
|
from helpers.enrich_city import EnrichCity
|
||||||
|
|
||||||
|
|
||||||
parser = ArgumentParser(description='Monthly energy balance workflow v0.1.')
|
parser = ArgumentParser(description='Monthly energy balance workflow v0.1.')
|
||||||
required = parser.add_argument_group('required arguments')
|
required = parser.add_argument_group('required arguments')
|
||||||
@ -65,7 +66,7 @@ populated_step_in_pickle = ast.literal_eval(args.populated_step_in_pickle)
|
|||||||
if populated_step_in_pickle:
|
if populated_step_in_pickle:
|
||||||
populated_city = city
|
populated_city = city
|
||||||
else:
|
else:
|
||||||
populated_city = Populate(city).populated_city
|
populated_city = EnrichCity(city).enriched_city(construction_format='nrcan', usage_format='hft')
|
||||||
pickle_file = Path(str(pickle_file).replace('.pickle', '_populated.pickle'))
|
pickle_file = Path(str(pickle_file).replace('.pickle', '_populated.pickle'))
|
||||||
populated_city.save(pickle_file)
|
populated_city.save(pickle_file)
|
||||||
if populated_city.buildings is None:
|
if populated_city.buildings is None:
|
||||||
|
63
populate.py
63
populate.py
@ -1,63 +0,0 @@
|
|||||||
"""
|
|
||||||
Populate city
|
|
||||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
||||||
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
|
|
||||||
"""
|
|
||||||
|
|
||||||
from imports.construction_factory import ConstructionFactory
|
|
||||||
from imports.usage_factory import UsageFactory
|
|
||||||
from city_model_structure.city import City
|
|
||||||
|
|
||||||
|
|
||||||
class Populate:
|
|
||||||
def __init__(self, city):
|
|
||||||
self._city = city
|
|
||||||
self._populated_city = None
|
|
||||||
self._errors = []
|
|
||||||
|
|
||||||
@property
|
|
||||||
def handler(self):
|
|
||||||
if self._city.name == 'New York':
|
|
||||||
handler = '{0}_{1}'
|
|
||||||
return handler.format(self._city.country_code, self._city.name.lower().replace(' ', '_'))
|
|
||||||
return self._city.country_code
|
|
||||||
|
|
||||||
@property
|
|
||||||
def errors(self):
|
|
||||||
return self._errors
|
|
||||||
|
|
||||||
@property
|
|
||||||
def populated_city(self):
|
|
||||||
if self._populated_city is None:
|
|
||||||
self._errors = []
|
|
||||||
# Step 2.1: Thermal parameters
|
|
||||||
tmp_city = City(self._city.lower_corner, self._city.upper_corner, self._city.srs_name)
|
|
||||||
# todo: just for Rabeehs case!!
|
|
||||||
#PhysicsFactory(self.handler, self._city)
|
|
||||||
ConstructionFactory('ca', self._city).enrich()
|
|
||||||
print('original:', len(self._city.buildings))
|
|
||||||
for building in self._city.buildings:
|
|
||||||
# infiltration_rate_system_off is a mandatory parameter.
|
|
||||||
# If it is not returned, extract the building from the calculation list
|
|
||||||
if building.thermal_zones[0].infiltration_rate_system_off is not None:
|
|
||||||
tmp_city.add_city_object(building)
|
|
||||||
if tmp_city.buildings is None:
|
|
||||||
self._populated_city = tmp_city
|
|
||||||
return self._populated_city
|
|
||||||
|
|
||||||
# Step 2.2: Usage parameters
|
|
||||||
print('physics:', len(tmp_city.buildings))
|
|
||||||
|
|
||||||
# todo: just for Rabeehs case!!
|
|
||||||
#UsageFactory(self.handler, tmp_city)
|
|
||||||
UsageFactory('ca', tmp_city).enrich()
|
|
||||||
self._populated_city = City(self._city.lower_corner, self._city.upper_corner, self._city.srs_name)
|
|
||||||
for building in tmp_city.buildings:
|
|
||||||
# heating_setpoint is a mandatory parameter.
|
|
||||||
# If it is not returned, extract the building from the calculation list
|
|
||||||
if len(building.usage_zones) > 0:
|
|
||||||
self._populated_city.add_city_object(building)
|
|
||||||
if self._populated_city.buildings is None:
|
|
||||||
self._errors.append('no archetype found per usage')
|
|
||||||
print('usage:', len(tmp_city.buildings))
|
|
||||||
return self._populated_city
|
|
Loading…
Reference in New Issue
Block a user