Sra step repaired. Wall changed to WallSurface in simplified_radiosity_algorithm.py. A decision on the internal names of the surfaces must be also taken (not yet).

This commit is contained in:
Pilar 2021-05-28 11:53:22 -04:00
parent f3a50745c4
commit 2851d9e99f
3 changed files with 420162 additions and 24 deletions

45
main.py
View File

@ -16,10 +16,14 @@ function_format = 'hft'
construction_format = 'nrcan' construction_format = 'nrcan'
usage_format = 'hft' usage_format = 'hft'
schedules_format = 'comnet' schedules_format = 'comnet'
climate_reference_city = 'Summerland'
weather_file_name = 'CAN_BC_Summerland.717680_CWEC.epw'
example_path = Path(__file__).parent example_path = Path(__file__).parent
full_path_gml = (example_path / 'tests' / 'tests_data' / name_gml).resolve() full_path_gml = (example_path / 'tests' / 'tests_data' / name_gml).resolve()
outputs_path = (example_path / 'tests' / 'tests_outputs').resolve() outputs_path = (example_path / 'tests' / 'tests_outputs').resolve()
tmp_path = (example_path / 'tests' / 'tmp').resolve()
weather_path = (Path(__file__).parent.parent / 'libs' / 'data' / 'weather').resolve()
keep_files = True keep_files = True
# Initialize the city model and add thermal- and usage-related parameters # Initialize the city model and add thermal- and usage-related parameters
@ -34,42 +38,35 @@ for building in city.buildings:
building.function = GeometryHelper.pluto_to_function[building.function] building.function = GeometryHelper.pluto_to_function[building.function]
populated_city = Populate(city).populated_city(construction_format, usage_format, schedules_format) populated_city = Populate(city).populated_city(construction_format, usage_format, schedules_format)
quit()
weather_format = 'epw' weather_format = 'epw'
city.climate_reference_city = args.climate_reference_city city.climate_reference_city = climate_reference_city
path = (Path(args.project_folder) / 'tmp').resolve() city.climate_file = (tmp_path / f'{climate_reference_city}.cli').resolve()
city.climate_file = (path / f'{args.climate_reference_city}.cli').resolve() WeatherFactory(weather_format, populated_city, base_path=weather_path, file_name=weather_file_name).enrich()
WeatherFactory(weather_format, populated_city, file_name=args.weather_file_name).enrich()
for building in populated_city.buildings: for building in populated_city.buildings:
if cte.HOUR not in building.external_temperature: if cte.HOUR not in building.external_temperature:
print('No external temperature found') print('No external temperature found')
sys.exit() sys.exit()
if cte.MONTH not in building.external_temperature:
building.external_temperature[cte.MONTH] = mv.MonthlyValues().\
get_mean_values(building.external_temperature[cte.MONTH][[weather_format]])
max_buildings_handled_by_sra = 500 max_buildings_handled_by_sra = 500
for building in city.buildings: for building in city.buildings:
for surface in building.surfaces: for surface in building.surfaces:
surface.swr = 0.2 surface.swr = 0.2
sra = SimplifiedRadiosityAlgorithm(city, Path(args.project_folder).resolve(), args.weather_file_name) path = (example_path / 'tests').resolve()
if ast.literal_eval(args.use_cached_sra_file): sra = SimplifiedRadiosityAlgorithm(city, path, weather_file_name)
sra.results() total_number_of_buildings = len(city.buildings)
sra.set_irradiance_surfaces(populated_city) if total_number_of_buildings > max_buildings_handled_by_sra:
radius = 80
for building in city.buildings:
new_city = city.region(building.centroid, radius)
sra_new = SimplifiedRadiosityAlgorithm(new_city, path, weather_file_name)
sra_new.call_sra(weather_format, keep_files=keep_files)
sra_new.set_irradiance_surfaces(populated_city, building_name=building.name)
else: else:
total_number_of_buildings = len(city.buildings) sra.call_sra(weather_format, keep_files=keep_files)
if total_number_of_buildings > max_buildings_handled_by_sra: sra.set_irradiance_surfaces(populated_city, mode=1)
radius = 80 print(city.buildings[0].surfaces[1].global_irradiance)
for building in city.buildings: quit()
new_city = city.region(building.centroid, radius)
sra_new = SimplifiedRadiosityAlgorithm(new_city, Path(args.project_folder).resolve(), args.weather_file_name)
sra_new.call_sra(weather_format, keep_files=True)
sra_new.set_irradiance_surfaces(populated_city, building_name=building.name)
else:
sra.call_sra(weather_format, keep_files=keep_files)
sra.set_irradiance_surfaces(populated_city)
# Demand calculation (one model per building) # Demand calculation (one model per building)
for city_object in city.city_objects: for city_object in city.city_objects:

4
tests/cache/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

File diff suppressed because one or more lines are too long