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

37
main.py
View File

@ -16,10 +16,14 @@ function_format = 'hft'
construction_format = 'nrcan'
usage_format = 'hft'
schedules_format = 'comnet'
climate_reference_city = 'Summerland'
weather_file_name = 'CAN_BC_Summerland.717680_CWEC.epw'
example_path = Path(__file__).parent
full_path_gml = (example_path / 'tests' / 'tests_data' / name_gml).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
# 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]
populated_city = Populate(city).populated_city(construction_format, usage_format, schedules_format)
quit()
weather_format = 'epw'
city.climate_reference_city = args.climate_reference_city
path = (Path(args.project_folder) / 'tmp').resolve()
city.climate_file = (path / f'{args.climate_reference_city}.cli').resolve()
WeatherFactory(weather_format, populated_city, file_name=args.weather_file_name).enrich()
city.climate_reference_city = climate_reference_city
city.climate_file = (tmp_path / f'{climate_reference_city}.cli').resolve()
WeatherFactory(weather_format, populated_city, base_path=weather_path, file_name=weather_file_name).enrich()
for building in populated_city.buildings:
if cte.HOUR not in building.external_temperature:
print('No external temperature found')
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
for building in city.buildings:
for surface in building.surfaces:
surface.swr = 0.2
sra = SimplifiedRadiosityAlgorithm(city, Path(args.project_folder).resolve(), args.weather_file_name)
if ast.literal_eval(args.use_cached_sra_file):
sra.results()
sra.set_irradiance_surfaces(populated_city)
else:
total_number_of_buildings = len(city.buildings)
if total_number_of_buildings > max_buildings_handled_by_sra:
path = (example_path / 'tests').resolve()
sra = SimplifiedRadiosityAlgorithm(city, path, weather_file_name)
total_number_of_buildings = len(city.buildings)
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(args.project_folder).resolve(), args.weather_file_name)
sra_new.call_sra(weather_format, keep_files=True)
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:
sra.call_sra(weather_format, keep_files=keep_files)
sra.set_irradiance_surfaces(populated_city)
sra.set_irradiance_surfaces(populated_city, mode=1)
print(city.buildings[0].surfaces[1].global_irradiance)
quit()
# Demand calculation (one model per building)
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