Modified main to calculate more than one building

This commit is contained in:
Pilar 2022-02-21 11:56:21 -05:00
parent 4c23a112a1
commit 512ce55b55

30
main.py
View File

@ -30,10 +30,10 @@ keep_weather_file = True
keep_ig_file = True
pickle_geometry = True
pickle_weather = True
pickle_construction = True
pickle_usage = True
pickle_schedules = True
pickle_weather = False
pickle_construction = False
pickle_usage = False
pickle_schedules = False
pickle_file = 'tests/tests_data/one_building_in_kelowna.pickle'
# Load geometry
@ -57,18 +57,18 @@ if not pickle_weather:
WeatherFactory(weather_format, city, base_path=weather_path, file_name=weather_file_name).enrich()
# calculate radiation on external surfaces
max_buildings_handled_by_sra = 100
path = (example_path / 'tests').resolve()
radius = 80
building = city.city_object('BLD109438')
# building = city.city_object('1066157')
new_city = city.region(building.centroid, radius)
sra = SimplifiedRadiosityAlgorithm(new_city, path, weather_file_name)
sra.call_sra(weather_format, keep_files=keep_sra_file, selected_buildings=[building])
sra.set_irradiance_surfaces(city, mode=1, building_name=building.name)
total_number_of_buildings = len(city.buildings)
if total_number_of_buildings > max_buildings_handled_by_sra:
sys.stderr.write(f'{max_buildings_handled_by_sra} buildings are too many buildings to be simulated. '
'The workflow does not handle more that 100 at a time')
else:
sra = SimplifiedRadiosityAlgorithm(city, path, weather_file_name)
sra.call_sra(weather_format, keep_files=keep_sra_file)
sra.set_irradiance_surfaces(city)
sra.set_irradiance_surfaces(city, mode=1)
# to save only the targeted building
radius = 10
city = city.region(building.centroid, radius)
city.save(pickle_file)
else:
city = City.load(pickle_file)
@ -77,7 +77,7 @@ else:
if not pickle_construction or not pickle_usage or not pickle_schedules:
for building in city.buildings:
building.function = 'large office'
building.function = 'residential'
building.year_of_construction = 2010
if function_format == 'hft':