mirror of
https://rs-loy-gitlab.concordia.ca/PMAU/DynamicBuildingSimulation.git
synced 2024-11-14 15:00:29 -05:00
Some bugs of libs solved (due to last commit) and populate.py of Dynamic finished
This commit is contained in:
parent
4bf2576677
commit
f3a50745c4
14
main.py
14
main.py
|
@ -9,8 +9,14 @@ from insel.templates.thermal_demand_dynamic_simulation import ThermalDemandDynam
|
|||
from helpers.simulation_parameters import SimulationParameters as Sp
|
||||
import helpers.constants as cte
|
||||
from imports.geometry_factory import GeometryFactory
|
||||
from imports.geometry_feeders.helpers.geometry_helper import GeometryHelper
|
||||
|
||||
name_gml = 'one_building_in_kelowna.gml'
|
||||
function_format = 'hft'
|
||||
construction_format = 'nrcan'
|
||||
usage_format = 'hft'
|
||||
schedules_format = 'comnet'
|
||||
|
||||
example_path = Path(__file__).parent
|
||||
full_path_gml = (example_path / 'tests' / 'tests_data' / name_gml).resolve()
|
||||
outputs_path = (example_path / 'tests' / 'tests_outputs').resolve()
|
||||
|
@ -21,9 +27,13 @@ keep_files = True
|
|||
# - simplification of the data model (for all work-flows)
|
||||
# - internal zoning of buildings (for dynamic simulation only)
|
||||
city = GeometryFactory('citygml', full_path_gml).city
|
||||
for building in city.buildings:
|
||||
if function_format == 'hft':
|
||||
building.function = GeometryHelper.hft_to_function[building.function]
|
||||
elif function_format == 'pluto':
|
||||
building.function = GeometryHelper.pluto_to_function[building.function]
|
||||
|
||||
populated_city = Populate(city).populated_city
|
||||
print(len(city.buildings))
|
||||
populated_city = Populate(city).populated_city(construction_format, usage_format, schedules_format)
|
||||
quit()
|
||||
|
||||
weather_format = 'epw'
|
||||
|
|
66
populate.py
66
populate.py
|
@ -6,7 +6,7 @@ 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
|
||||
from imports.schedules_factory import SchedulesFactory
|
||||
|
||||
|
||||
class Populate:
|
||||
|
@ -15,45 +15,55 @@ class Populate:
|
|||
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):
|
||||
def populated_city(self, construction_format, usage_format, schedules_format):
|
||||
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)
|
||||
ConstructionFactory(self.handler, self._city)
|
||||
print('original:', len(self._city.buildings))
|
||||
|
||||
# Step 2.1: Thermal parameters
|
||||
ConstructionFactory(construction_format, self._city).enrich()
|
||||
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
|
||||
if building.thermal_zones[0].infiltration_rate_system_off is None:
|
||||
self._city.remove_city_object(building)
|
||||
if self._city.buildings is None:
|
||||
self._errors.append('no archetype found per construction')
|
||||
self._populated_city = self._city
|
||||
return self._populated_city
|
||||
print('enriched with construction:', len(self._city.buildings))
|
||||
|
||||
# Step 2.2: Usage parameters
|
||||
print('construction:', len(tmp_city.buildings))
|
||||
UsageFactory(usage_format, self._city).enrich()
|
||||
for building in self._city.buildings:
|
||||
# At least one thermal zone must be created.
|
||||
# If it is not created, extract the building from the calculation list
|
||||
if len(building.usage_zones) <= 0:
|
||||
self._city.remove_city_object(building)
|
||||
if self._city.buildings is None:
|
||||
self._errors.append('no archetype found per usage')
|
||||
self._populated_city = self._city
|
||||
return self._populated_city
|
||||
print('enriched with usage:', len(self._city.buildings))
|
||||
|
||||
# Step 2.3: Schedules parameters
|
||||
SchedulesFactory(schedules_format, self._city).enrich()
|
||||
for building in self._city.buildings:
|
||||
counter_schedules = 0
|
||||
for usage_zone in building.usage_zones:
|
||||
# At least one schedule must be created at each thermal zone.
|
||||
# If it is not created, extract the building from the calculation list
|
||||
if len(usage_zone.schedules) > 0:
|
||||
counter_schedules += 1
|
||||
if counter_schedules < len(building.usage_zones):
|
||||
self._city.remove_city_object(building)
|
||||
if self._city.buildings is None:
|
||||
self._errors.append('no archetype found per usage')
|
||||
self._populated_city = self._city
|
||||
print('enriched with occupancy:', len(self._city.buildings))
|
||||
|
||||
UsageFactory(self.handler, tmp_city)
|
||||
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