mirror of
https://rs-loy-gitlab.concordia.ca/PMAU/DynamicBuildingSimulation.git
synced 2024-12-22 21:15:43 -05:00
Some new attributes added to thermal boundaries and thermal zones to fit with the needs of the dynamic simulation
This commit is contained in:
parent
fc0a8c98d6
commit
096cec2503
@ -169,13 +169,16 @@ class ThermalDemandDynamicSimulation:
|
||||
number_of_windows = []
|
||||
for i_zone, thermal_zone in enumerate(building.thermal_zones):
|
||||
n_window = 0
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
print('1', thermal_zone.id)
|
||||
thermal_zone.ordinate_number = i_zone
|
||||
print(thermal_zone.ordinate_number)
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
n_window += len(thermal_boundary.thermal_openings)
|
||||
number_of_windows.append(n_window)
|
||||
n_start_surfaces += n_window * 2
|
||||
n_start_windows = n_start_surfaces
|
||||
for i_zone, thermal_zone in enumerate(building.thermal_zones):
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
if thermal_boundary.surface.type == cte.GROUND:
|
||||
n_start_windows += 2
|
||||
elif thermal_boundary.surface.type == cte.GROUND_WALL:
|
||||
@ -209,12 +212,12 @@ class ThermalDemandDynamicSimulation:
|
||||
f"{heated} %[HSOn]",
|
||||
f"{simulation_parameters.cooling_power} %[HPMax]",
|
||||
f"{thermal_zone.additional_thermal_bridge_u_value} %[TBridges]",
|
||||
f"{len(thermal_zone.bounded) + number_of_windows[i_zone]} %[Nwalls+Nwindow]"
|
||||
f"{len(thermal_zone.thermal_boundaries) + number_of_windows[i_zone]} %[Nwalls+Nwindow]"
|
||||
]
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
parameters.append(f"{thermal_boundary.area} "
|
||||
f"{thermal_boundary.hi} %[Area] + [ConvCoefi]")
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
parameters.append(f"{thermal_opening.area} {thermal_opening.hi} %[Area] + [ConvCoefi]")
|
||||
file = Insel.add_block(file, i_block, 'UBROOMV2', inputs, parameters)
|
||||
@ -233,7 +236,7 @@ class ThermalDemandDynamicSimulation:
|
||||
i_block += 1
|
||||
inputs = []
|
||||
i = n_start_surfaces + 1
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
inputs.append(f"{i}.1")
|
||||
if thermal_boundary.surface.type == cte.GROUND:
|
||||
i += 2
|
||||
@ -241,7 +244,7 @@ class ThermalDemandDynamicSimulation:
|
||||
i += 2
|
||||
else:
|
||||
i += 3
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
inputs.append(f"{i}.1")
|
||||
i += 3
|
||||
@ -255,7 +258,7 @@ class ThermalDemandDynamicSimulation:
|
||||
i_block += 1
|
||||
inputs = []
|
||||
i = n_start_surfaces
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
inputs.append(f"{i}.1")
|
||||
if thermal_boundary.surface.type == cte.GROUND:
|
||||
i += 2
|
||||
@ -263,14 +266,14 @@ class ThermalDemandDynamicSimulation:
|
||||
i += 2
|
||||
else:
|
||||
i += 3
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
inputs.append(f"{i}.1")
|
||||
i += 3
|
||||
parameters = [f"{len(thermal_zone.bounded) + number_of_windows[i_zone]} %[Nwalls+Nwindow]"]
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
parameters = [f"{len(thermal_zone.thermal_boundaries) + number_of_windows[i_zone]} %[Nwalls+Nwindow]"]
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
parameters.append(f"{thermal_boundary.area} {thermal_boundary.inside_emissivity} %[Area] + [Emwall]")
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
parameters.append(f"{thermal_opening.area} {thermal_opening.inside_emissivity} %[Area] + [Emwall]")
|
||||
parameters.append(f"'{fij_paths[i_zone]}' %[Fijfile]")
|
||||
@ -279,7 +282,7 @@ class ThermalDemandDynamicSimulation:
|
||||
i_block += 1
|
||||
inputs = []
|
||||
i = 0
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
i += 1
|
||||
inputs.append(f"{i_block - 1}.{i}")
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
@ -292,10 +295,10 @@ class ThermalDemandDynamicSimulation:
|
||||
i_block += 1
|
||||
n_sum_iradia = i_block + 2 * number_of_windows[i_zone] + 2
|
||||
inputs = [f"{n_sum_iradia}.1"]
|
||||
parameters = [f"{len(thermal_zone.bounded) + number_of_windows[i_zone]} %[Nwalls+Nwindow]"]
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
parameters = [f"{len(thermal_zone.thermal_boundaries) + number_of_windows[i_zone]} %[Nwalls+Nwindow]"]
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
parameters.append(f"{thermal_boundary.area} {thermal_boundary.alpha_coefficient} %[Area] + [AlphaCoef]")
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
parameters.append(f"{thermal_opening.area} {thermal_opening.alpha_coefficient} %[Area] + [AlphaCoef]")
|
||||
|
||||
@ -304,7 +307,7 @@ class ThermalDemandDynamicSimulation:
|
||||
i_block += 1
|
||||
inputs = []
|
||||
i = 0
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
i += 1
|
||||
inputs.append(f"{i_block - 1}.{i}")
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
@ -321,7 +324,7 @@ class ThermalDemandDynamicSimulation:
|
||||
# (SUM + GAIN) per window + SUM
|
||||
inputs_next = []
|
||||
i_opening = 0
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
i_block += 1
|
||||
inputs = [f"{n_start_windows + 3 * i_opening}.5",
|
||||
@ -341,15 +344,76 @@ class ThermalDemandDynamicSimulation:
|
||||
file = Insel.add_block(file, i_block, 'SUM', inputs)
|
||||
|
||||
# Surfaces
|
||||
i_weather = 3
|
||||
i_weather_window = 3
|
||||
for i_tb, thermal_boundary in enumerate(building.thermal_boundaries):
|
||||
i_block += 1
|
||||
inputs = [f"{n_gain_moy}.1"]
|
||||
if (thermal_boundary.surface.type == cte.WALL) or (thermal_boundary.surface.type == cte.ROOF):
|
||||
print('aa')
|
||||
for tz in thermal_boundary.delimits:
|
||||
print('2', tz.id)
|
||||
inputs.append(f"{n_zone[int(thermal_boundary.delimits[0].ordinate_number)] + 8}.{i_tb}")
|
||||
inputs.append(f"{n_zone[int(thermal_boundary.delimits[0].ordinate_number)] + 6}.{i_tb}")
|
||||
inputs.append(f"{n_ig}.{int(thermal_boundary.delimits[0].ordinate_number) * 5 + 2}")
|
||||
inputs.append(f"{i_block + 2}.1")
|
||||
inputs.append(f"{n_weather}.1")
|
||||
inputs.append(f"{n_weather}.2")
|
||||
print('bb')
|
||||
inputs.append(f"{n_weather}.{int(thermal_boundary.surface.id) * 3 + 6}")
|
||||
inputs.append(f"{n_zone[thermal_boundary.delimits[0].ordinate_number] + 1}.1")
|
||||
parameters = [f"{thermal_boundary.hi} % [ConvCoefiW]",
|
||||
f"{thermal_boundary.he} % [ConvCoefeW1]",
|
||||
f"0 % [ConvCoefeW2]",
|
||||
f"{thermal_boundary.radiative_coefficient} % [RadCoefeW]",
|
||||
f"{len(thermal_boundary.layers)} % [Nlay]"]
|
||||
for layer in thermal_boundary.layers:
|
||||
material = layer.material
|
||||
if material.no_mass:
|
||||
parameters.append(f"1 {1 / float(material.thermal_resistance)} 1 1 % [thick] + [lambda ] +[rho] +[cp]")
|
||||
else:
|
||||
parameters.append(f"{layer.thickness} {material.conductivity} {material.density} {material.specific_heat}"
|
||||
f" % [thick] + [lambda ] +[rho] +[cp]")
|
||||
file = Insel.add_block(file, i_block, 'UBWALLXV2', inputs=inputs, parameters=parameters)
|
||||
i_block += 1
|
||||
inputs = [f"{i_block - 1}.3"]
|
||||
parameters = [f"{thermal_boundary.area} % [AreaW]"]
|
||||
file = Insel.add_block(file, i_block, 'GAIN', inputs=inputs, parameters=parameters)
|
||||
i_block += 1
|
||||
inputs = [f"{n_weather}.{int(thermal_boundary.surface.id) * 3 + 2}"]
|
||||
parameters = [f"{thermal_boundary.outside_solar_absorptance} %[AbsorptionCoef]"]
|
||||
file = Insel.add_block(file, i_block, 'GAIN', inputs=inputs, parameters=parameters)
|
||||
elif (thermal_boundary.surface.type == cte.GROUND) or (thermal_boundary.surface.type == cte.GROUND_WALL):
|
||||
inputs.append(f"{n_zone[thermal_boundary.delimits[0].ordinate_number] + 8}.{i_tb}")
|
||||
inputs.append(f"{n_zone[thermal_boundary.delimits[0].ordinate_number] + 6}.{i_tb}")
|
||||
inputs.append(f"{n_ig}.{thermal_boundary.delimits[0].ordinate_number * 5 + 2}")
|
||||
inputs.append(f"{n_weather}.3")
|
||||
inputs.append(f"{n_zone[thermal_boundary.delimits[0].ordinate_number] + 1}.1")
|
||||
parameters = [f"{thermal_boundary.hi} % [ConvCoefiW]",
|
||||
f"{len(thermal_boundary.layers)} %[Nlay]"]
|
||||
for layer in thermal_boundary.layers:
|
||||
material = layer.material
|
||||
if material.no_mass:
|
||||
parameters.append(f"1 {1 / float(material.thermal_resistance)} 1 1 % [thick] + [lambda ] +[rho] +[cp]")
|
||||
else:
|
||||
parameters.append(f"{layer.thickness} {material.conductivity} {material.density} {material.specific_heat}"
|
||||
f" % [thick] + [lambda ] +[rho] +[cp]")
|
||||
parameters.append(f"1 1.3 1500 800 %[thick] + [lambda] + [rho] + [cp]")
|
||||
file = Insel.add_block(file, i_block, 'UBWALLGV2', inputs=inputs, parameters=parameters)
|
||||
i_block += 1
|
||||
inputs = [f"{i_block - 1}.3"]
|
||||
parameters = [f"{thermal_boundary.area} % [AreaW]"]
|
||||
file = Insel.add_block(file, i_block, 'GAIN', inputs=inputs, parameters=parameters)
|
||||
|
||||
return file
|
||||
|
||||
|
||||
"""
|
||||
for i_tz, thermal_zone in enumerate(building.thermal_zones):
|
||||
i_surface = 0
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
i_block += 1
|
||||
i_surface += 1
|
||||
inputs = [f"{n_gain_moy}.1"]
|
||||
if thermal_boundary.surface.type == cte.WALL:
|
||||
if (thermal_boundary.surface.type == cte.WALL) or (thermal_boundary.surface.type == cte.ROOF):
|
||||
inputs.append(f"{n_zone[i_tz] + 8}.{i_surface}")
|
||||
inputs.append(f"{n_zone[i_tz] + 6}.{i_surface}")
|
||||
inputs.append(f"{n_ig}.{i_tz * 5 + 2}")
|
||||
@ -357,9 +421,9 @@ class ThermalDemandDynamicSimulation:
|
||||
inputs.append(f"{n_weather}.1")
|
||||
inputs.append(f"{n_weather}.2")
|
||||
if len(thermal_boundary.thermal_openings) > 0:
|
||||
inputs.append(f"{n_weather}.{i_weather + 2}")
|
||||
else:
|
||||
inputs.append(f"{n_weather}.{i_weather + 5}")
|
||||
else:
|
||||
inputs.append(f"{n_weather}.{i_weather + 2}")
|
||||
inputs.append(f"{n_zone[i_tz] + 1}.1")
|
||||
parameters = [f"{thermal_boundary.hi} % [ConvCoefiW]",
|
||||
f"{thermal_boundary.he} % [ConvCoefeW1]",
|
||||
@ -383,53 +447,17 @@ class ThermalDemandDynamicSimulation:
|
||||
parameters = [f"{thermal_boundary.outside_solar_absorptance} %[AbsorptionCoef]"]
|
||||
file = Insel.add_block(file, i_block, 'GAIN', inputs=inputs, parameters=parameters)
|
||||
if len(thermal_boundary.thermal_openings) > 0:
|
||||
i_weather += 2
|
||||
else:
|
||||
i_weather += 5
|
||||
elif thermal_boundary.surface.type == cte.ROOF:
|
||||
inputs.append(f"{n_zone[i_tz] + 8}.{i_surface}")
|
||||
inputs.append(f"{n_zone[i_tz] + 6}.{i_surface}")
|
||||
inputs.append(f"{n_ig}.{i_tz * 5 + 2}")
|
||||
inputs.append(f"{i_block + 2}.1")
|
||||
inputs.append(f"{n_weather}.1")
|
||||
inputs.append(f"{n_weather}.2")
|
||||
if len(thermal_boundary.thermal_openings) > 0:
|
||||
inputs.append(f"{n_weather}.{i_weather + 2}")
|
||||
else:
|
||||
inputs.append(f"{n_weather}.{i_weather + 5}")
|
||||
inputs.append(f"{n_zone[i_tz] + 1}.1")
|
||||
parameters = [f"{thermal_boundary.hi} % [ConvCoefiW]",
|
||||
f"{thermal_boundary.he} % [ConvCoefeW1]",
|
||||
f"0 % [ConvCoefeW2]",
|
||||
f"{thermal_boundary.radiative_coefficient} % [RadCoefeW]",
|
||||
f"{len(thermal_boundary.layers)} % [Nlay]"]
|
||||
for layer in thermal_boundary.layers:
|
||||
material = layer.material
|
||||
if material.no_mass:
|
||||
parameters.append(f"1 {1 / float(material.thermal_resistance)} 1 1 % [thick] + [lambda ] +[rho] +[cp]")
|
||||
else:
|
||||
parameters.append(f"{layer.thickness} {material.conductivity} {material.density} {material.specific_heat}"
|
||||
f" % [thick] + [lambda ] +[rho] +[cp]")
|
||||
file = Insel.add_block(file, i_block, 'UBWALLXV2', inputs=inputs, parameters=parameters)
|
||||
i_block += 1
|
||||
inputs = [f"{i_block - 1}.3"]
|
||||
parameters = [f"{thermal_boundary.area} % [AreaW]"]
|
||||
file = Insel.add_block(file, i_block, 'GAIN', inputs=inputs, parameters=parameters)
|
||||
i_block += 1
|
||||
inputs = []
|
||||
parameters = [f"{thermal_boundary.outside_solar_absorptance} %[AbsorptionCoef]"]
|
||||
file = Insel.add_block(file, i_block, 'GAIN', inputs=inputs, parameters=parameters)
|
||||
if len(thermal_boundary.thermal_openings) > 0:
|
||||
i_weather += 2
|
||||
else:
|
||||
i_weather += 5
|
||||
elif thermal_boundary.surface.type == cte.GROUND:
|
||||
elif (thermal_boundary.surface.type == cte.GROUND) or (thermal_boundary.surface.type == cte.GROUND_WALL):
|
||||
inputs.append(f"{n_zone[i_tz] + 8}.{i_surface}")
|
||||
inputs.append(f"{n_zone[i_tz] + 6}.{i_surface}")
|
||||
inputs.append(f"{n_ig}.{i_tz * 5 + 2}")
|
||||
inputs.append(f"{n_weather}.3")
|
||||
inputs.append(f"{n_zone[i_tz] + 1}.1")
|
||||
parameters = [f"{thermal_boundary.hi} % [ConvCoefiW]"]
|
||||
parameters = [f"{thermal_boundary.hi} % [ConvCoefiW]",
|
||||
f"{len(thermal_boundary.layers)} %[Nlay]"]
|
||||
for layer in thermal_boundary.layers:
|
||||
material = layer.material
|
||||
if material.no_mass:
|
||||
@ -440,12 +468,9 @@ class ThermalDemandDynamicSimulation:
|
||||
parameters.append(f"1 1.3 1500 800 %[thick] + [lambda] + [rho] + [cp]")
|
||||
file = Insel.add_block(file, i_block, 'UBWALLGV2', inputs=inputs, parameters=parameters)
|
||||
i_block += 1
|
||||
inputs = [f"{i_block - 1}.3"]
|
||||
parameters = [f"{thermal_boundary.area} % [AreaW]"]
|
||||
file = Insel.add_block(file, i_block, 'GAIN', inputs=inputs, parameters=parameters)
|
||||
elif thermal_boundary.surface.type == cte.GROUND_WALL:
|
||||
file = Insel.add_block(file, i_block, 'UBWALLGV2', inputs=inputs, parameters=parameters)
|
||||
i_block += 1
|
||||
file = Insel.add_block(file, i_block, 'GAIN', inputs=inputs, parameters=parameters)
|
||||
elif thermal_boundary.surface.type == cte.INTERIOR_SLAB:
|
||||
file = Insel.add_block(file, i_block, 'UBWALLV2', inputs=inputs, parameters=parameters)
|
||||
i_block += 1
|
||||
@ -466,7 +491,7 @@ class ThermalDemandDynamicSimulation:
|
||||
file = Insel.add_block(file, i_block, 'GAIN', inputs=inputs, parameters=parameters)
|
||||
|
||||
# Windows
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
i_surface += 1
|
||||
i_block += 1
|
||||
@ -503,7 +528,8 @@ class ThermalDemandDynamicSimulation:
|
||||
f"{n_ig}.{i_tz * 5 + 2}"]
|
||||
file = Insel.add_block(file, i_block, 'SUM', inputs=inputs)
|
||||
if len(thermal_boundary.thermal_openings) > 0:
|
||||
i_weather_window += 2
|
||||
else:
|
||||
i_weather_window += 5
|
||||
return file
|
||||
else:
|
||||
i_weather_window += 2
|
||||
"""
|
||||
|
||||
|
25
main.py
25
main.py
@ -34,7 +34,7 @@ if not pickle_created:
|
||||
# Assumptions for this workflow
|
||||
for building in city.buildings:
|
||||
for thermal_zone in building.thermal_zones:
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
thermal_boundary.hi = 3.5
|
||||
thermal_boundary.he = 20
|
||||
|
||||
@ -81,6 +81,28 @@ else:
|
||||
# todo: when the enrichment step goes after SRA, check whether srw has changed
|
||||
# after reading the construction library or not
|
||||
# Assign user defined parameters
|
||||
if not pickle_created:
|
||||
for building in city.buildings:
|
||||
print('number of thermal boundaries', len(building.thermal_boundaries))
|
||||
for i_tb, thermal_boundary in enumerate(building.thermal_boundaries):
|
||||
print(i_tb, thermal_boundary.type)
|
||||
for thermal_zone in thermal_boundary.delimits:
|
||||
print(thermal_zone.id)
|
||||
quit()
|
||||
for thermal_zone in building.thermal_zones:
|
||||
print('volume', thermal_zone.volume)
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
print('type', thermal_boundary.surface.type)
|
||||
print('id', thermal_boundary.surface.id)
|
||||
print('area tb', thermal_boundary.area)
|
||||
for tz in thermal_boundary.delimits:
|
||||
print('delimits', tz.id)
|
||||
print('window ratio', thermal_boundary.window_ratio)
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
print('area window', thermal_opening.area)
|
||||
print('frame', thermal_opening.frame_ratio)
|
||||
quit()
|
||||
|
||||
for building in city.buildings:
|
||||
building.heated = True
|
||||
building.cooled = False
|
||||
@ -98,6 +120,7 @@ for building in city.buildings:
|
||||
try:
|
||||
content = Templates.generate_thermal_dynamic_template(building, full_path_out, full_path_wea, full_path_ig,
|
||||
full_paths_fij, Sp)
|
||||
print(content)
|
||||
quit()
|
||||
insel = Insel(example_path, insel_file_name, content, mode=2, keep_files=keep_files).results
|
||||
except:
|
||||
|
Loading…
Reference in New Issue
Block a user