mirror of
https://rs-loy-gitlab.concordia.ca/PMAU/DynamicBuildingSimulation.git
synced 2024-11-14 15:00:29 -05:00
Added new attributes in thermal_opening.py and thermal_boundary.py. Modified surface.py and thermal_boundary.py to adapt to dynamic simulation. First version of thermal_demand_dynamic_simulation.py working well (only tested for one room)
This commit is contained in:
parent
308a91dbe1
commit
fc0a8c98d6
|
@ -3,17 +3,22 @@
|
|||
|
||||
|
||||
class SimulationParameters:
|
||||
year_start = 2005
|
||||
month_start = 1
|
||||
day_start = 1
|
||||
hour_start = 0
|
||||
minute_start = 0
|
||||
second_start = 0
|
||||
year_end = 2005
|
||||
month_end = 12
|
||||
day_end = 31
|
||||
hour_end = 24
|
||||
minute_end = 60
|
||||
second_end = 60
|
||||
delta_time = 5
|
||||
year_start = '2005'
|
||||
month_start = '1'
|
||||
day_start = '1'
|
||||
hour_start = '0'
|
||||
minute_start = '0'
|
||||
second_start = '0'
|
||||
year_end = '2005'
|
||||
month_end = '12'
|
||||
day_end = '31'
|
||||
hour_end = '24'
|
||||
minute_end = '60'
|
||||
second_end = '60'
|
||||
delta_time = '5'
|
||||
delta_time_unit = "'m'"
|
||||
|
||||
temp_ini = '20'
|
||||
cooling_power = '100000000'
|
||||
heating_power = '100000000'
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
from insel.insel import Insel
|
||||
import helpers.constants as cte
|
||||
|
||||
|
||||
class ThermalDemandDynamicSimulation:
|
||||
@staticmethod
|
||||
def generate_thermal_dynamic_template(building, outputs_paths, weather_path, ig_path, simulation_period):
|
||||
def generate_thermal_dynamic_template(building, outputs_paths, weather_path, ig_path, fij_paths,
|
||||
simulation_parameters):
|
||||
number_usage_zones = len(building.usage_zones)
|
||||
|
||||
file = ""
|
||||
|
@ -17,142 +19,139 @@ class ThermalDemandDynamicSimulation:
|
|||
i_block += 1
|
||||
n_clock = i_block
|
||||
|
||||
parameters = [str(simulation_period.year_start) + " %[YearIni]",
|
||||
str(simulation_period.month_start) + " %[MonthIni]",
|
||||
str(simulation_period.day_start) + " %[DayIni]",
|
||||
str(simulation_period.hour_start) + " %[HourIni]",
|
||||
str(simulation_period.minute_start) + " %[MinIni]",
|
||||
str(simulation_period.second_start) + " %[SecIni]",
|
||||
str(simulation_period.year_end) + " %[YearEnd]",
|
||||
str(simulation_period.month_end) + " %[MonthEnd]",
|
||||
str(simulation_period.day_end) + " %[DayEnd]",
|
||||
str(simulation_period.hour_end) + " %[HourEnd]",
|
||||
str(simulation_period.minute_end) + " %[MinEnd]",
|
||||
str(simulation_period.second_end) + " %[SecEnd]",
|
||||
str(simulation_period.delta_time) + " %[Incr]",
|
||||
str(simulation_period.delta_time_unit) + " %[Unit]"]
|
||||
parameters = [f"{simulation_parameters.year_start} %[YearIni]",
|
||||
f"{simulation_parameters.month_start} %[MonthIni]",
|
||||
f"{simulation_parameters.day_start} %[DayIni]",
|
||||
f"{simulation_parameters.hour_start} %[HourIni]",
|
||||
f"{simulation_parameters.minute_start} %[MinIni]",
|
||||
f"{simulation_parameters.second_start} %[SecIni]",
|
||||
f"{simulation_parameters.year_end} %[YearEnd]",
|
||||
f"{simulation_parameters.month_end} %[MonthEnd]",
|
||||
f"{simulation_parameters.day_end} %[DayEnd]",
|
||||
f"{simulation_parameters.hour_end} %[HourEnd]",
|
||||
f"{simulation_parameters.minute_end} %[MinEnd]",
|
||||
f"{simulation_parameters.second_end} %[SecEnd]",
|
||||
f"{simulation_parameters.delta_time} %[Incr]",
|
||||
f"{simulation_parameters.delta_time_unit} %[Unit]"]
|
||||
file = Insel.add_block(file, i_block, 'CLOCK', parameters=parameters)
|
||||
|
||||
i_block += 1
|
||||
n_moy = i_block
|
||||
inputs = [str(n_clock) + ".1",
|
||||
str(n_clock) + ".2",
|
||||
str(n_clock) + ".3",
|
||||
str(n_clock) + ".4",
|
||||
str(n_clock) + ".5"]
|
||||
inputs = [f"{n_clock}.1",
|
||||
f"{n_clock}.2",
|
||||
f"{n_clock}.3",
|
||||
f"{n_clock}.4",
|
||||
f"{n_clock}.5"]
|
||||
file = Insel.add_block(file, i_block, 'MOY', inputs)
|
||||
|
||||
i_block += 1
|
||||
n_gain_moy = i_block
|
||||
inputs = [str(n_moy) + ".1"]
|
||||
inputs = [f"{n_moy}.1"]
|
||||
parameters = ["60 %[MinToSec]"]
|
||||
file = Insel.add_block(file, i_block, 'GAIN', inputs, parameters)
|
||||
|
||||
i_block += 1
|
||||
n_hoy = i_block
|
||||
inputs = [str(n_clock) + ".1",
|
||||
str(n_clock) + ".2",
|
||||
str(n_clock) + ".3",
|
||||
str(n_clock) + ".4"]
|
||||
inputs = [f"{n_clock}.1",
|
||||
f"{n_clock}.2",
|
||||
f"{n_clock}.3",
|
||||
f"{n_clock}.4"]
|
||||
file = Insel.add_block(file, i_block, 'HOY', inputs)
|
||||
|
||||
# weather blocks
|
||||
i_block += 1
|
||||
n_weather = i_block
|
||||
# todo: n_records is the number of columns to be read in the weather file ->
|
||||
# it should be = number of external surfaces
|
||||
n_records = 1000
|
||||
inputs = [str(n_hoy) + ".1"]
|
||||
parameters = [str(n_records) + " %[Nrec]",
|
||||
str(n_records * 12) + " %[RecLen]",
|
||||
"'" + str(weather_path) + "' %[FileName]",
|
||||
"'(" + str(n_records) + "F12.3)' %[FileFormat]"]
|
||||
n_records = 3 + len(building.surfaces) * 5
|
||||
inputs = [f"{n_hoy}.1"]
|
||||
parameters = [f"{n_records} %[Nrec]",
|
||||
f"{n_records * 12} %[RecLen]",
|
||||
f"'{weather_path}' %[FileName]",
|
||||
f"'({n_records}F12.3)' %[FileFormat]"]
|
||||
file = Insel.add_block(file, i_block, 'READD', inputs, parameters)
|
||||
|
||||
# internal gains and control blocks
|
||||
i_block += 1
|
||||
n_ig = i_block
|
||||
n_records = number_usage_zones * 5
|
||||
inputs = [str(n_hoy) + ".1"]
|
||||
parameters = [str(n_records) + " %[Nrec]",
|
||||
str(n_records * 12) + " %[RecLen]",
|
||||
"'" + str(ig_path) + "' %[FileName]",
|
||||
"'(" + str(n_records) + "F12.3)' %[FileFormat]"]
|
||||
inputs = [f"{n_hoy}.1"]
|
||||
parameters = [f"{n_records} %[Nrec]",
|
||||
f"{n_records * 12} %[RecLen]",
|
||||
f"'{ig_path}' %[FileName]",
|
||||
f"'({n_records}F12.3)' %[FileFormat]"]
|
||||
file = Insel.add_block(file, i_block, 'READD', inputs, parameters)
|
||||
|
||||
# results blocks
|
||||
i_block += 1
|
||||
inputs = [str(n_clock) + ".1",
|
||||
str(n_clock) + ".2",
|
||||
str(n_clock) + ".3",
|
||||
str(n_clock) + ".4"]
|
||||
inputs = [f"{n_clock}.1",
|
||||
f"{n_clock}.2",
|
||||
f"{n_clock}.3",
|
||||
f"{n_clock}.4"]
|
||||
headline = ''
|
||||
for i in range(0, number_usage_zones):
|
||||
inputs.append(str(i_block+2) + "." + str(i*2+2))
|
||||
inputs.append(str(i_block+2) + "." + str(i*2+3))
|
||||
headline += "CoolingTZ_" + str(i+1) + " (Wh); " + "HeatingTZ_" + str(i+1) + " (Wh); "
|
||||
inputs.append(f"{i_block + 2}." + str(i*2+2))
|
||||
inputs.append(f"{i_block + 2}." + str(i*2+3))
|
||||
headline += f"CoolingTZ_{i + 1} (Wh); HeatingTZ_{i + 1} (Wh); "
|
||||
parameters = ["1 %[Mode]",
|
||||
"'" + str(outputs_paths) + "_demand.out' %[FileName]",
|
||||
f"'{outputs_paths}_demand.out' %[FileName]",
|
||||
"'*' %[FileFormat]",
|
||||
f"'Year; month; day; hour; {headline}' %[Headline]"]
|
||||
file = Insel.add_block(file, i_block, 'WRITE', inputs, parameters)
|
||||
|
||||
i_block += 1
|
||||
inputs = [str(n_clock) + ".1",
|
||||
str(n_clock) + ".2",
|
||||
str(n_clock) + ".3",
|
||||
str(n_clock) + ".4"]
|
||||
n_w_temp = i_block
|
||||
inputs = [f"{n_clock}.1",
|
||||
f"{n_clock}.2",
|
||||
f"{n_clock}.3",
|
||||
f"{n_clock}.4"]
|
||||
headline = ''
|
||||
for i in range(0, number_usage_zones):
|
||||
inputs.append(str(i_block+2) + "." + str(i+2))
|
||||
headline += "TempTZ_" + str(i+1) + " (C); "
|
||||
headline += f"TempTZ_{i + 1} (C); "
|
||||
parameters = ["1 %[Mode]",
|
||||
"'" + str(outputs_paths) + "_temp.out' %[FileName]",
|
||||
f"'{outputs_paths}_temp.out' %[FileName]",
|
||||
"'*' %[FileFormat]",
|
||||
f"'Year; month; day; hour; {headline}' %[Headline]"]
|
||||
file = Insel.add_block(file, i_block, 'WRITE', inputs, parameters)
|
||||
|
||||
# todo: NDelayRoom[usage_zone] = NDelayRoom[usage_zone-1] + 2/(10 surfaces) being surface = any wall or window + 2/window
|
||||
NDelayRoom = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
|
||||
i_block += 1
|
||||
inputs = [str(n_hoy) + ".1"]
|
||||
inputs = [f"{n_hoy}.1"]
|
||||
for i in range(0, number_usage_zones):
|
||||
inputs.append(str(i * 7 + NDelayRoom[i] + n_ig + 8 + 2 * number_usage_zones) + ".2")
|
||||
inputs.append(str(i * 7 + NDelayRoom[i] + n_ig + 8 + 2 * number_usage_zones) + ".3")
|
||||
inputs.append(f"{n_w_temp + 8 + 10 * i}.2")
|
||||
inputs.append(f"{n_w_temp + 8 + 10 * i}.3")
|
||||
file = Insel.add_block(file, i_block, 'AVEC', inputs)
|
||||
|
||||
i_block += 1
|
||||
inputs = [str(n_hoy) + ".1"]
|
||||
inputs = [f"{n_hoy}.1"]
|
||||
for i in range(0, number_usage_zones):
|
||||
inputs.append(str(i * 7 + NDelayRoom[i] + n_ig + 8 + 2 * number_usage_zones) + ".1")
|
||||
inputs.append(f"{n_w_temp + 8 + 10 * i}.1")
|
||||
file = Insel.add_block(file, i_block, 'AVEC', inputs)
|
||||
|
||||
i_block += 1
|
||||
n_cumc = i_block
|
||||
inputs = [str(n_clock) + ".2"]
|
||||
inputs = [f"{n_clock}.2"]
|
||||
for i in range(0, number_usage_zones):
|
||||
inputs.append(str(i_block - 2) + "." + str(2*i+2))
|
||||
inputs.append(str(i_block - 2) + "." + str(2*i+3))
|
||||
inputs.append(f"{i_block - 2}.{2 * i + 2}")
|
||||
inputs.append(f"{i_block - 2}.{2 * i + 3}")
|
||||
file = Insel.add_block(file, i_block, 'CUMC', inputs)
|
||||
|
||||
for i in range(0, number_usage_zones):
|
||||
i_block += 1
|
||||
inputs = [str(n_cumc) + "." + str(2*i+2),
|
||||
str(i_block - 2) + "." + str(2*i+3)]
|
||||
inputs = [f"{n_cumc}.{2 * i + 2}",
|
||||
f"{n_cumc}.{2 * i + 3}"]
|
||||
file = Insel.add_block(file, i_block, 'SUM', inputs)
|
||||
|
||||
i_block += 1
|
||||
inputs = [str(i_block - 1) + ".1"]
|
||||
inputs = [f"{i_block - 1}.1"]
|
||||
parameters = ["1000000 %Wh to MWh"]
|
||||
file = Insel.add_block(file, i_block, 'ATT', inputs, parameters)
|
||||
|
||||
i_block += 1
|
||||
inputs = [str(n_clock) + ".1",
|
||||
str(n_clock) + ".2"]
|
||||
inputs = [f"{n_clock}.1",
|
||||
f"{n_clock}.2"]
|
||||
for i in range(0, number_usage_zones):
|
||||
inputs.append(str(i_block - 2 * number_usage_zones + 2 * i + 1) + ".1")
|
||||
parameters = ["1 %[Mode]",
|
||||
"'" + str(outputs_paths) + "_month.out' %[FileName]",
|
||||
f"'{outputs_paths}_month.out' %[FileName]",
|
||||
"'*' %[FileFormat]",
|
||||
f"'Total heated area: {building.floor_area} (m2)' %[Headline]"]
|
||||
file = Insel.add_block(file, i_block, 'WRITE', inputs, parameters)
|
||||
|
@ -164,254 +163,347 @@ class ThermalDemandDynamicSimulation:
|
|||
file = Insel.add_block(file, i_block, 'CONST', parameters=parameters)
|
||||
|
||||
# Zones:
|
||||
n_start_zones = i_block
|
||||
n_start_zones = i_block + 1
|
||||
n_start_surfaces = n_start_zones + len(building.thermal_zones * 10)
|
||||
n_zone = []
|
||||
i_zone = 0
|
||||
for usage_zone in building.usage_zones:
|
||||
number_of_windows = []
|
||||
for i_zone, thermal_zone in enumerate(building.thermal_zones):
|
||||
n_window = 0
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
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:
|
||||
if thermal_boundary.surface.type == cte.GROUND:
|
||||
n_start_windows += 2
|
||||
elif thermal_boundary.surface.type == cte.GROUND_WALL:
|
||||
n_start_windows += 2
|
||||
else:
|
||||
n_start_windows += 3
|
||||
for i_zone, thermal_zone in enumerate(building.thermal_zones):
|
||||
i_block += 1
|
||||
n_zone.append(i_block)
|
||||
inputs = [str(n_gain_moy) + ".1",
|
||||
str(n_zero) + ".1",
|
||||
str(n_ig) + "." + str(1+5*i_zone), # convective part of IG # todo: recheck depending on how I write the ig file
|
||||
str(n_weather) + ".1", # ambient temperature
|
||||
str(n_zone[i_zone]) + ".1", # infiltration rate
|
||||
str(n_ig) + "." + str(4+5*i_zone), # set point cooling # todo: recheck depending on how I write the ig file
|
||||
str(n_ig) + "." + str(5+5*i_zone), # set point heating # todo: recheck depending on how I write the ig file
|
||||
str(n_ig) + "." + str(3+5*i_zone), # ventilation rate # todo: recheck depending on how I write the ig file
|
||||
str(n_weather) + ".1", # ventilation temperature
|
||||
str(n_zone[i_zone] + 4) + ".1", # from chs
|
||||
inputs = [f"{n_gain_moy}.1",
|
||||
f"{n_zero}.1",
|
||||
f"{n_ig}.{1 + 5 * i_zone}", # convective part of IG
|
||||
f"{n_weather}.1", # ambient temperature
|
||||
f"{n_zone[i_zone] + 2}.1", # infiltration rate
|
||||
f"{n_ig}." + str(4 + 5 * i_zone), # set point cooling
|
||||
f"{n_ig}." + str(5 + 5 * i_zone), # set point heating
|
||||
f"{n_ig}." + str(3 + 5 * i_zone), # ventilation rate
|
||||
f"{n_weather}.1", # ventilation temperature
|
||||
f"{n_zone[i_zone] + 4}.1", # from chs
|
||||
]
|
||||
|
||||
parameters = [usage_zone.volume + " %[RoomAirVol]",
|
||||
usage_zone.initial_temperature + " %[Tini]",
|
||||
usage_zone.cooling_on + " %[CSOn]",
|
||||
usage_zone.cooling_maximum_power + " %[CPMax]",
|
||||
usage_zone.heating_on + " %[HSOn]",
|
||||
usage_zone.heating_maximum_power + " %[HPMax]",
|
||||
usage_zone.thermal_bridges + " %[TBridges]",
|
||||
usage_zone.n_surfaces + " %[Nwalls+Nwindow]"
|
||||
cooled = '1'
|
||||
if building.cooled:
|
||||
cooled = '0'
|
||||
heated = '1'
|
||||
if building.heated:
|
||||
heated = '0'
|
||||
parameters = [f"{thermal_zone.volume} %[RoomAirVol]",
|
||||
f"{simulation_parameters.temp_ini} %[Tini]",
|
||||
f"{cooled} %[CSOn]",
|
||||
f"{simulation_parameters.cooling_power} %[CPMax]",
|
||||
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]"
|
||||
]
|
||||
print('aaaaa')
|
||||
for surface in usage_zone.surfaces:
|
||||
parameters.append(str(surface.area) + " " + str(surface.interior_covective_coefficient) + " %[Area] + [ConvCoefi]")
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
parameters.append(f"{thermal_boundary.area} "
|
||||
f"{thermal_boundary.hi} %[Area] + [ConvCoefi]")
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
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)
|
||||
|
||||
i_block += 1
|
||||
inputs = [str(i_block-1) + ".1"]
|
||||
parameters = [usage_zone.initial_temperature + " %[Tini]"]
|
||||
inputs = [f"{i_block - 1}.1"]
|
||||
parameters = ["20 %[Tini]"]
|
||||
file = Insel.add_block(file, i_block, 'DELAY', inputs, parameters)
|
||||
|
||||
# infiltration
|
||||
i_block += 1
|
||||
parameters = [usage_zone.infiltration_rate + " %[InfiltrationRate]"]
|
||||
parameters = [f"{thermal_zone.infiltration_rate_system_off} %[InfiltrationRate]"]
|
||||
file = Insel.add_block(file, i_block, 'CONST', parameters=parameters)
|
||||
|
||||
# SUM convection flux
|
||||
i_block += 1
|
||||
inputs = []
|
||||
# int isurf;
|
||||
# for (int icont = 0; icont < Nsurface.elementAt(iRoom); icont++)
|
||||
# {
|
||||
# isurf = SurfRoom[iRoom][icont];
|
||||
# //Check if the wall has already been used, in that case, second connector
|
||||
# if (UsedSUM[isurf - 1]) {
|
||||
# SecondSUM[isurf - 1] = true; //It can only happen for UBWALLV2
|
||||
# }
|
||||
# else {
|
||||
# UsedSUM[isurf - 1] = true;
|
||||
# }
|
||||
# int jj = iblockStartRoom + 7 * NRoom + NDelay; //Counts all the blocks written before walls block starts
|
||||
# for (int ii = 0; ii < isurf; ii++)
|
||||
# {
|
||||
# HashMap<String,String> surfaceValues = (HashMap<String,String>) matSurfaces.get(ii);
|
||||
# // if (!MatSurfaces[1][ii].equals("UBWALLGV2")) //All except WallG => wall, wallx, wdyn
|
||||
# if (!surfaceValues.get("type").equals("UBWALLGV2")) //All except WallG => wall, wallx, wdyn
|
||||
# {
|
||||
# jj = jj + 3;
|
||||
# }
|
||||
# else{
|
||||
# jj = jj + 2;
|
||||
# }
|
||||
# }
|
||||
# if (!SecondSUM[isurf - 1])
|
||||
# {
|
||||
# HashMap<String,String> surfaceValues = (HashMap<String,String>) matSurfaces.get(isurf-1);
|
||||
# if (!surfaceValues.get("type").equals("UBWALLGV2"))
|
||||
# {
|
||||
# jj = jj - 1;
|
||||
# }
|
||||
# }
|
||||
# myInselModel.add(Integer.toString(jj) + ".1"); //SURFACES GAIN
|
||||
# }
|
||||
i = n_start_surfaces + 1
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
inputs.append(f"{i}.1")
|
||||
if thermal_boundary.surface.type == cte.GROUND:
|
||||
i += 2
|
||||
elif thermal_boundary.surface.type == cte.GROUND_WALL:
|
||||
i += 2
|
||||
else:
|
||||
i += 3
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
inputs.append(f"{i}.1")
|
||||
i += 3
|
||||
file = Insel.add_block(file, i_block, 'SUM', inputs=inputs)
|
||||
|
||||
i_block += 1
|
||||
inputs = [str(i_block-1) + ".1"]
|
||||
file = Insel.add_block(file, i_block, 'CHS', inputs=inputs)
|
||||
|
||||
# todo: RADI and IRADIA should be dependent on the geometrical zones and not the thermal/usage zones
|
||||
# RADI
|
||||
# iblock ++;
|
||||
# myInselModel.add("S " + Integer.toString(iblock) + " UBRADIV2");
|
||||
# for (int icont = 0; icont < Nsurface.elementAt(iRoom); icont++)
|
||||
# {
|
||||
# isurf = SurfRoom[iRoom][icont];
|
||||
# //Check if the wall has already been used, in that case, second connector
|
||||
# if (UsedRADI[isurf - 1]){
|
||||
# SecondRADI[isurf - 1] = true; //It can only happen for UBWALLV2
|
||||
# }
|
||||
# else{
|
||||
# UsedRADI[isurf - 1] = true;
|
||||
# }
|
||||
# int jj = iblockStartRoom + 7 * NRoom + NDelay;
|
||||
# for (int ii = 0; ii < isurf; ii++)
|
||||
# {
|
||||
# HashMap<String,String> surfaceValues = (HashMap<String,String>) matSurfaces.get(ii);
|
||||
# if (!surfaceValues.get("type").equals("UBWALLGV2")) //All except WallG => wall, wallx, wdyn
|
||||
# {
|
||||
# jj = jj + 3;
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# jj = jj + 2;
|
||||
# }
|
||||
# }
|
||||
# String sal;
|
||||
# if (SecondRADI[isurf - 1])
|
||||
# {
|
||||
# jj = jj - 2;
|
||||
# sal = ".2";
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# HashMap<String,String> surfaceValues = (HashMap<String,String>) matSurfaces.get(isurf-1);
|
||||
# if (!surfaceValues.get("type").equals("UBWALLGV2")) //All except WallG => wall, wallx, wdyn
|
||||
# {
|
||||
# jj = jj - 2;
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# jj --;
|
||||
# }
|
||||
# sal = ".1";
|
||||
# }
|
||||
# HashMap<String,String> surfaceValues = (HashMap<String,String>) matSurfaces.get(isurf-1);
|
||||
# if (surfaceValues.get("type").equals("UBWDYNV2")){
|
||||
# myInselModel.add(Integer.toString(jj) + ".1");
|
||||
# }
|
||||
# else{
|
||||
# myInselModel.add(Integer.toString(jj) + sal);
|
||||
# }
|
||||
# }
|
||||
# myInselModel.add("P " + Integer.toString(iblock));
|
||||
# myInselModel.add(Integer.toString(Nsurface.elementAt(iRoom)) + " %[Nwalls+Nwindow]");
|
||||
# for (int iwall = 0; iwall < Nsurface.elementAt(iRoom); iwall++)
|
||||
# {
|
||||
# HashMap<String,String> roomSurfObjectSon = (HashMap<String,String>) roomSurfObject.get(iwall);
|
||||
# myInselModel.add(roomSurfObjectSon.get("area") + " " + roomSurfObjectSon.get("emwall") + " %[Area] + [Emwall]");
|
||||
# //myInselModel.add(Area[iRoom][iwall] + " " + Emwall[iRoom][iwall] + " %[Area]+[Emwall]");
|
||||
# }
|
||||
# m = m + 3;
|
||||
#// myInselModel.add("'" + templateLoc + System.getProperty("file.separator") + "FijFile" + egid +"Room" + Integer.toString(iRoom+1) + ".txt'" + " %[Fijfile]");
|
||||
# myInselModel.add("'" + FijFilePaths.get(iRoom) + "' %[Fijfile]");
|
||||
#
|
||||
# for (int icont = 0; icont < (int)Math.abs((Nsurface.elementAt(iRoom) - 1) / 10) + 1; icont++){
|
||||
# if (10 * (icont + 1) < Nsurface.elementAt(iRoom)){
|
||||
# iblock ++;
|
||||
# myInselModel.add("S " + Integer.toString(iblock) + " DELAY");
|
||||
# for (int i = icont * 10; i < 10 * (icont + 1); i++){
|
||||
# myInselModel.add(Integer.toString(iblock - icont - 1) + "." + Integer.toString(i + 1));
|
||||
# }
|
||||
# myInselModel.add("P " + Integer.toString(iblock));
|
||||
# myInselModel.add("0 % [RadFlux]");
|
||||
# }
|
||||
# else{
|
||||
# iblock ++;
|
||||
# myInselModel.add("S " + Integer.toString(iblock) + " DELAY");
|
||||
# for (int i = 10 * icont; i < Nsurface.elementAt(iRoom); i++){
|
||||
# myInselModel.add(Integer.toString(iblock - icont - 1) + "." + Integer.toString(i + 1));
|
||||
# }
|
||||
# myInselModel.add("P " + Integer.toString(iblock));
|
||||
# myInselModel.add("0 % [RadFlux]");
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# //IRADIA
|
||||
# iblock ++;
|
||||
# myInselModel.add("S " + Integer.toString(iblock) + " UBNIRADIA");
|
||||
# int NcontIrad = (int)Math.abs((Nsurface.elementAt(iRoom) -1) / 10) + 1;
|
||||
# int Nblocks = Nwindow.elementAt(iRoom);
|
||||
# myInselModel.add(Integer.toString(iblock + 2 * Nblocks + NcontIrad + 1) + ".1");
|
||||
# myInselModel.add("P " + Integer.toString(iblock));
|
||||
# myInselModel.add(Integer.toString(Nsurface.elementAt(iRoom)) + " %[Nwalls+Nwindow]");
|
||||
# for (int ient = 0; ient < Nsurface.elementAt(iRoom); ient++){
|
||||
# mwall = mm + ient;
|
||||
# HashMap<String,String> roomSurfObjectSon = (HashMap<String,String>) roomSurfObject.get(ient);
|
||||
# myInselModel.add(roomSurfObjectSon.get("area") + " " + roomSurfObjectSon.get("alphaCoef") + " %[Area] + [AlphaCoef]");
|
||||
# }
|
||||
# mm = mwall;
|
||||
# for (int icont = 0; icont < (int)Math.abs((Nsurface.elementAt(iRoom) -1) / 10) + 1; icont++){
|
||||
# if (10 * (icont + 1) < Nsurface.elementAt(iRoom)){
|
||||
# iblock ++;
|
||||
# myInselModel.add("S " + Integer.toString(iblock) + " DELAY");
|
||||
# for (int i = icont * 10; i < 10 * (icont + 1); i++){
|
||||
# myInselModel.add(Integer.toString(iblock - (icont + 1)) + "." + Integer.toString(i + 1));
|
||||
# }
|
||||
# myInselModel.add("P " + Integer.toString(iblock));
|
||||
# myInselModel.add("0 % [IrradFlux]");
|
||||
# }
|
||||
# else{
|
||||
# iblock ++;
|
||||
# myInselModel.add("S " + Integer.toString(iblock) + " DELAY");
|
||||
# for (int i = 10 * icont; i < Nsurface.elementAt(iRoom); i++){
|
||||
# myInselModel.add(Integer.toString(iblock - icont - 1) + "." + Integer.toString(i + 1));
|
||||
# }
|
||||
# myInselModel.add("P " + Integer.toString(iblock));
|
||||
# myInselModel.add("0 % [IrradFlux]");
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# if (Nwindow.elementAt(iRoom) > 0) //TODO: There must be a much simple way!
|
||||
# {
|
||||
# for (int icont = 0; icont < Nwindow.elementAt(iRoom); icont++){
|
||||
# iblock ++;
|
||||
# myInselModel.add("S " + Integer.toString(iblock) + " SUM");
|
||||
# isurf = WindRoom[iRoom][icont];
|
||||
# int jj = iblockStartRoom + 7 * NRoom + NDelay;
|
||||
# for (int ii = 0; ii < isurf; ii++){
|
||||
# HashMap<String,String> surfaceValues = (HashMap<String,String>) matSurfaces.get(ii);
|
||||
# if (!surfaceValues.get("type").equals("UBWALLGV2")) //All except WallG => wall, wallx, wdyn
|
||||
# {
|
||||
# jj = jj + 3;
|
||||
# }
|
||||
# else{
|
||||
# jj = jj + 2;
|
||||
# }
|
||||
# }
|
||||
# myInselModel.add(Integer.toString(jj - 2) + ".5"); //Windows
|
||||
# myInselModel.add(Integer.toString(jj - 2) + ".6"); //Windows
|
||||
#
|
||||
# iblock ++;
|
||||
# myInselModel.add("S " + Integer.toString(iblock) + " GAIN");
|
||||
# myInselModel.add(Integer.toString(iblock - 1) + ".1");
|
||||
# myInselModel.add("P " + Integer.toString(iblock));
|
||||
# HashMap<String,String> surfaceValues = (HashMap<String,String>) matSurfaces.get(isurf-1);
|
||||
# myInselModel.add(Double.parseDouble(surfaceValues.get("area"))*(1-Double.parseDouble(surfaceValues.get("frameRatio"))) + " %[AreaWindow]");
|
||||
# }
|
||||
#
|
||||
# iblock ++;
|
||||
# myInselModel.add("S " + Integer.toString(iblock) + " SUM");
|
||||
# for (int icont = 0; icont < Nwindow.elementAt(iRoom); icont++){
|
||||
# int jj = iblock - 2 * Nwindow.elementAt(iRoom) + (icont) * 2 + 1;
|
||||
# myInselModel.add(Integer.toString(jj) + ".1");
|
||||
# }
|
||||
# }
|
||||
# else{
|
||||
# iblock ++;
|
||||
# myInselModel.add("S " + Integer.toString(iblock) + " SUM");
|
||||
# myInselModel.add(Integer.toString(numZero) + ".1"); //If there is no windows, conected to const = 0
|
||||
# }
|
||||
# }
|
||||
print(file)
|
||||
i_zone += 1
|
||||
i_block += 1
|
||||
inputs = []
|
||||
i = n_start_surfaces
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
inputs.append(f"{i}.1")
|
||||
if thermal_boundary.surface.type == cte.GROUND:
|
||||
i += 2
|
||||
elif thermal_boundary.surface.type == cte.GROUND_WALL:
|
||||
i += 2
|
||||
else:
|
||||
i += 3
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
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.append(f"{thermal_boundary.area} {thermal_boundary.inside_emissivity} %[Area] + [Emwall]")
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
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]")
|
||||
file = Insel.add_block(file, i_block, 'UBRADIV2', inputs=inputs, parameters=parameters)
|
||||
|
||||
i_block += 1
|
||||
inputs = []
|
||||
i = 0
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
i += 1
|
||||
inputs.append(f"{i_block - 1}.{i}")
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
i += 1
|
||||
inputs.append(f"{i_block - 1}.{i}")
|
||||
parameters = ["0 %[RadFlux]"]
|
||||
file = Insel.add_block(file, i_block, 'DELAY', inputs, parameters)
|
||||
|
||||
# IRADIA
|
||||
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.append(f"{thermal_boundary.area} {thermal_boundary.alpha_coefficient} %[Area] + [AlphaCoef]")
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
parameters.append(f"{thermal_opening.area} {thermal_opening.alpha_coefficient} %[Area] + [AlphaCoef]")
|
||||
|
||||
file = Insel.add_block(file, i_block, 'UBNIRADIA', inputs=inputs, parameters=parameters)
|
||||
|
||||
i_block += 1
|
||||
inputs = []
|
||||
i = 0
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
i += 1
|
||||
inputs.append(f"{i_block - 1}.{i}")
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
i += 1
|
||||
inputs.append(f"{i_block - 1}.{i}")
|
||||
parameters = ["0 %[IrradFlux]"]
|
||||
file = Insel.add_block(file, i_block, 'DELAY', inputs, parameters)
|
||||
|
||||
if number_of_windows[i_zone] == 0:
|
||||
i_block += 1
|
||||
inputs = [f"{n_zero}.1"]
|
||||
file = Insel.add_block(file, i_block, 'SUM', inputs)
|
||||
else:
|
||||
# (SUM + GAIN) per window + SUM
|
||||
inputs_next = []
|
||||
i_opening = 0
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
i_block += 1
|
||||
inputs = [f"{n_start_windows + 3 * i_opening}.5",
|
||||
f"{n_start_windows + 3 * i_opening}.6"]
|
||||
i_opening += 1
|
||||
file = Insel.add_block(file, i_block, 'SUM', inputs)
|
||||
|
||||
i_block += 1
|
||||
inputs = [f"{i_block - 1}.1"]
|
||||
parameters = [f"{float(thermal_opening.area) * (1 - float(thermal_opening.frame_ratio))} %[AreaWindow]"]
|
||||
file = Insel.add_block(file, i_block, 'GAIN', inputs=inputs, parameters=parameters)
|
||||
|
||||
inputs_next.append(f"{i_block}.1")
|
||||
|
||||
i_block += 1
|
||||
inputs = inputs_next
|
||||
file = Insel.add_block(file, i_block, 'SUM', inputs)
|
||||
|
||||
# Surfaces
|
||||
i_weather = 3
|
||||
i_weather_window = 3
|
||||
for i_tz, thermal_zone in enumerate(building.thermal_zones):
|
||||
i_surface = 0
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
i_block += 1
|
||||
i_surface += 1
|
||||
inputs = [f"{n_gain_moy}.1"]
|
||||
if thermal_boundary.surface.type == cte.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"{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 = [f"{n_weather}.{i_weather + 1}"]
|
||||
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:
|
||||
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]"]
|
||||
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
|
||||
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
|
||||
file = Insel.add_block(file, i_block, 'GAIN', 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_WALL:
|
||||
file = Insel.add_block(file, i_block, 'UBWALLV2', inputs=inputs, parameters=parameters)
|
||||
i_block += 1
|
||||
file = Insel.add_block(file, i_block, 'GAIN', 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.ATTIC_FLOOR:
|
||||
file = Insel.add_block(file, i_block, 'UBWALLV2', inputs=inputs, parameters=parameters)
|
||||
i_block += 1
|
||||
file = Insel.add_block(file, i_block, 'GAIN', inputs=inputs, parameters=parameters)
|
||||
i_block += 1
|
||||
file = Insel.add_block(file, i_block, 'GAIN', inputs=inputs, parameters=parameters)
|
||||
|
||||
# Windows
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
i_surface += 1
|
||||
i_block += 1
|
||||
inputs = [f"{n_gain_moy}.1",
|
||||
f"{i_block + 2}.1",
|
||||
f"{n_zero}.1",
|
||||
f"{n_weather}.{i_weather_window + 1}",
|
||||
f"{n_weather}.{i_weather_window + 2}",
|
||||
f"{n_weather}.1",
|
||||
f"{n_weather}.2",
|
||||
f"{n_weather}.{i_weather_window + 5}",
|
||||
f"{n_zone[i_tz] + 1}.1",
|
||||
f"{n_weather}.{i_weather_window + 3}",
|
||||
f"{n_weather}.{i_weather_window + 4}"]
|
||||
parameters = [f"{thermal_opening.hi} % [ConvCoefiW]",
|
||||
f"{thermal_opening.he} % [ConvCoefeW1]",
|
||||
f"0 % [ConvCoefeW2]",
|
||||
f"{thermal_opening.radiative_coefficient} % [RadCoefeW]",
|
||||
f"0 % [Ubi]",
|
||||
f"1 % [Nlay]"]
|
||||
layer_conductivity = float(thermal_opening.thickness) / ((1/float(thermal_opening.overall_u_value)) -
|
||||
(1/float(thermal_opening.hi)) -
|
||||
(1/float(thermal_opening.he)))
|
||||
parameters_layer = f"{thermal_opening.thickness} {layer_conductivity} 1000 750 " \
|
||||
f"% [thick] + [lambda ] +[rho] +[cp]"
|
||||
parameters.append(parameters_layer)
|
||||
file = Insel.add_block(file, i_block, 'UBWDYNV2', inputs=inputs, parameters=parameters)
|
||||
i_block += 1
|
||||
inputs = [f"{i_block - 1}.3"]
|
||||
parameters = [f"{thermal_opening.area} %[AreaWindow]"]
|
||||
file = Insel.add_block(file, i_block, 'GAIN', inputs=inputs, parameters=parameters)
|
||||
i_block += 1
|
||||
inputs = [f"{n_zone[i_tz] + 6}.{i_surface}",
|
||||
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
|
||||
|
|
24
main.py
24
main.py
|
@ -13,7 +13,7 @@ from city_model_structure.city import City
|
|||
|
||||
name_gml = 'one_building_in_kelowna.gml'
|
||||
function_format = 'hft'
|
||||
construction_format = 'nrcan'
|
||||
construction_format = 'nrel'
|
||||
usage_format = 'hft'
|
||||
schedules_format = 'comnet'
|
||||
climate_reference_city = 'Summerland'
|
||||
|
@ -31,6 +31,13 @@ pickle_file = 'tests/tests_data/one_building_in_kelowna.pickle'
|
|||
if not pickle_created:
|
||||
city = GeometryFactory('citygml', full_path_gml).city
|
||||
|
||||
# Assumptions for this workflow
|
||||
for building in city.buildings:
|
||||
for thermal_zone in building.thermal_zones:
|
||||
for thermal_boundary in thermal_zone.bounded:
|
||||
thermal_boundary.hi = 3.5
|
||||
thermal_boundary.he = 20
|
||||
|
||||
weather_format = 'epw'
|
||||
city.climate_reference_city = climate_reference_city
|
||||
city.climate_file = (tmp_path / f'{climate_reference_city}.cli').resolve()
|
||||
|
@ -73,17 +80,26 @@ 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
|
||||
for building in city.buildings:
|
||||
building.heated = True
|
||||
building.cooled = False
|
||||
building.attic_heated = 2
|
||||
building.basement_heated = 0
|
||||
|
||||
# Demand calculation (one model per building)
|
||||
for building in city.buildings:
|
||||
full_path_out = (outputs_path / building.name).resolve()
|
||||
full_path_wea = (tmp_path / (building.name + '.weather')).resolve()
|
||||
full_path_ig = (tmp_path / (building.name + '.ig')).resolve()
|
||||
full_paths_fij = ['D:\Concordia\DynamicModel\DEBW522AA0000ce5f\FijFile_one_zoneRoom1.txt']
|
||||
|
||||
insel_file_name = building.name + '.insel'
|
||||
try:
|
||||
content = Templates.generate_thermal_dynamic_template(building, full_path_out, full_path_wea, full_path_ig, Sp)
|
||||
print(content)
|
||||
#insel = Insel(example_path, insel_file_name, content, mode=2, keep_files=keep_files).results
|
||||
content = Templates.generate_thermal_dynamic_template(building, full_path_out, full_path_wea, full_path_ig,
|
||||
full_paths_fij, Sp)
|
||||
quit()
|
||||
insel = Insel(example_path, insel_file_name, content, mode=2, keep_files=keep_files).results
|
||||
except:
|
||||
print(sys.exc_info()[1])
|
||||
print('Building ' + building.name + ' could not be processed')
|
||||
|
|
Loading…
Reference in New Issue
Block a user