Coverage for teaser/logic/buildingobjects/calculation/one_element.py: 97%

316 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2025-04-29 16:01 +0000

1# created January 2017 

2 

3from __future__ import division 

4import math 

5import random 

6import warnings 

7 

8 

9class OneElement(object): 

10 """This class contains attributes and functions for one element model 

11 

12 his model merges all thermal masses into one element, parameterized by the 

13 length of the RC-chain nExt, the vector of the capacities CExt[nExt] that 

14 is connected via the vector of resistances RExt[nExt] and RExtRem to the 

15 ambient and indoor air. By default, the model neglects all internal thermal 

16 masses that are not directly connected to the ambient. 

17 

18 It treats Rooftops, GroundFloors and OuterWalls as one type of outer 

19 walls and computes one RC-combination for these types. 

20 

21 Depending on the chosen method it will consider an extra resistance for 

22 windows or merge all windows into the RC-Combination for outer walls. 

23 

24 Parameters 

25 ---------- 

26 thermal_zone: ThermalZone() 

27 TEASER instance of ThermalZone 

28 merge_windows : boolean 

29 True for merging the windows into the outer wall's RC-combination, 

30 False for separate resistance for window, default is False. (Only 

31 supported for IBPSA) 

32 t_bt : float [d] 

33 Time constant according to VDI 6007 (default t_bt = 5) 

34 t_bt_layer : float [d] 

35 Time constant according to VDI 6007 for aggragation of layers (default t_bt = 7) 

36 

37 Attributes 

38 ---------- 

39 

40 Outer Walls (OuterWall, Rooftop, GroundFloor) 

41 

42 area_ow : float [m2] 

43 Area of all outer walls. 

44 n_outer : int 

45 Number of total outer walls with different combination of tilt and 

46 orientation, including Rooftops and GroundFloors 

47 alpha_conv_inner_ow : float [W/(m2K)] 

48 Area-weighted convective coefficient of heat transfer of outer walls 

49 facing the inside of this thermal zone. 

50 alpha_rad_inner_ow : float [W/(m2K)] 

51 Area-weighted radiative coefficient of heat transfer of outer walls 

52 facing the inside of this thermal zone. 

53 alpha_comb_inner_ow : float [W/(m2K)] 

54 Area-weighted combined coefficient of heat transfer of outer walls 

55 facing the inside of this thermal zone. 

56 alpha_conv_outer_ow : float [W/(m2K)] 

57 Area-weighted convective coefficient of heat transfer of outer walls 

58 facing the ambient. 

59 alpha_rad_outer_ow : float [W/(m2K)] 

60 Area-weighted radiative coefficient of heat transfer of outer walls 

61 facing the ambient. 

62 alpha_comb_outer_ow : float [W/(m2K)] 

63 Area-weighted combined coefficient of heat transfer of outer walls 

64 facing the ambient. 

65 ua_value_ow : float [W/K] 

66 U-Value times outer wall area. 

67 r_conv_inner_ow : float [K/W] 

68 Sum of convective resistances for all outer walls facing the 

69 inside of this thermal zone. 

70 r_rad_inner_ow : float [K/W] 

71 Sum of radiative resistances for all outer walls facing the 

72 inside of this thermal zone. 

73 r_comb_inner_ow : float [K/W] 

74 Sum of combined resistances for all outer walls facing the 

75 inside of this thermal zone. 

76 r_conv_outer_ow : float [K/W] 

77 Sum of convective resistances for all outer walls facing the 

78 ambient. 

79 r_rad_outer_ow : float [K/W] 

80 Sum of radiative resistances for all outer walls facing the 

81 ambient. 

82 r_comb_outer_ow : float [K/W] 

83 Sum of combined resistances for all outer walls facing the 

84 ambient. 

85 r1_ow : float [K/W] 

86 Lumped resistance of outer walls no heat transfer coefficients for 

87 convection and radiation are accounted in this resistance. 

88 r_rest_ow : float [K/W] 

89 Lumped remaining resistance of outer walls between r1_ow and c1_ow no 

90 heat transfer coefficients for convection and radiation are accounted 

91 in this resistance. 

92 c1_ow : float [J/K] 

93 Lumped capacity of outer walls. 

94 weightfactor_ow : list of floats 

95 Weightfactors of outer walls (UA-Value of walls with same orientation 

96 and tilt divided by ua_value_ow) 

97 weightfactor_ground : list of floats 

98 Weightfactors of groundfloors (UA-Value of groundfloor divided by 

99 ua_value_ow). 

100 tilt_facade : list of floats [degree] 

101 Tilt of outer walls against the horizontal. 

102 orientation_facade : list of floats [degree] 

103 Orientation of outer walls (Azimuth). 

104 0 - North 

105 90 - East 

106 180 - South 

107 270 - West 

108 outer_wall_areas : list of floats [m2] 

109 Area of all outer walls in one list. 

110 r_rad_ow_iw : float [K/W] 

111 Resistance for radiative heat transfer between walls. 

112 TODO: needs to be checked 

113 ir_emissivity_outer_ow : float 

114 Area-weighted ir emissivity of outer wall facing the ambient. 

115 ir_emissivity_inner_ow : float 

116 Area-weighted ir emissivity of outer walls facing the thermal zone. 

117 solar_absorp_ow : float 

118 Area-weighted solar absorption of outer walls facing the ambient. 

119 

120 Windows 

121 

122 area_win : float [m2] 

123 Area of all windows. 

124 alpha_conv_inner_win : float [W/(m2K)] 

125 Area-weighted convective coefficient of heat transfer of windows 

126 facing the inside of this thermal zone. 

127 alpha_rad_inner_win : float [W/(m2K)] 

128 Area-weighted radiative coefficient of heat transfer of windows 

129 facing the inside of this thermal zone. 

130 alpha_comb_inner_win : float [W/(m2K)] 

131 Area-weighted combined coefficient of heat transfer of windows facing 

132 the inside of this thermal zone. 

133 ratio_conv_rad_inner_win : float [-] 

134 Ratio for windows between convective and radiative heat emission, 

135 given in VDI 6007-3 

136 alpha_conv_outer_win : float [W/(m2K)] 

137 Area-weighted convective coefficient of heat transfer of windows 

138 facing the ambient. 

139 alpha_rad_outer_win : float [W/(m2K)] 

140 Area-weighted radiative coefficient of heat transfer of windows 

141 facing the ambient. 

142 alpha_comb_outer_win : float [W/(m2K)] 

143 Area-weighted combined coefficient of heat transfer of windows facing 

144 the ambient. 

145 ua_value_win : float [W/K] 

146 U-Value times window wall area. 

147 u_value_win : float [W/(m2K)] 

148 Area weighted U-Value of windows. 

149 r_conv_inner_win : float [K/W] 

150 Sum of convective resistances for all windows facing the 

151 inside of this thermal zone. 

152 r_rad_inner_win : float [K/W] 

153 Sum of radiative resistances for all windows facing the 

154 inside of this thermal zone. 

155 r_comb_inner_win : float [K/W] 

156 Sum of combined resistances for all windows facing the 

157 inside of this thermal zone. 

158 r_conv_outer_win : float [K/W] 

159 Sum of convective resistances for all windows facing the 

160 ambient. 

161 r_rad_outer_win : float [K/W] 

162 Sum of radiative resistances for all windows facing the 

163 ambient. 

164 r_comb_outer_win : float [K/W] 

165 Sum of combined resistances for all windows facing the 

166 ambient. 

167 r1_win : float [K/W] 

168 Lumped resistance of windows, no heat transfer coefficients for 

169 convection and radiation are accounted in this resistance. 

170 weightfactor_win : list of floats 

171 Weightfactors of windows (UA-Value of windows with same orientation 

172 and tilt divided by ua_value_win or ua_value_win+ua_value_ow, 

173 depending if windows is lumped/merged into the walls or not) 

174 window_areas : list of floats [m2] 

175 Area of all windows in one list, if the windows are merged into the 

176 outer wall this list will be full of zeros 

177 transparent_areas : list of floats [m2] 

178 Area of all transparent elements (most likely windows) in one list, 

179 this list will be always filled with the areas, independent if 

180 windows are merged into walls or not. 

181 solar_absorp_win : float 

182 Area-weighted solar absorption for windows. (typically 0.0) 

183 ir_emissivity_win : float 

184 Area-weighted ir_emissivity for windows. Can be used for windows 

185 facing the thermal zone and the ambient. 

186 weighted_g_value : float 

187 Area-weighted g-Value of all windows. 

188 shading_max_irr : list of float [W/m2] 

189 Threshold value above which the sunblind becomes active for the whole zone. 

190 Threshold regards to the incoming irradiation level with the window direction. 

191 This value does not account for heat flux due to the outside temperature. 

192 shading_g_total : list of float 

193 Factor representing how much of the actual solar irradiation goes through 

194 the sunblind and enters the window element, for the case, that the sunblind is 

195 activated. Defaults to 1, i.e. no shading is active. 

196 

197 Misc values: 

198 

199 alpha_rad_inner_mean : float [W/(m2K)] 

200 Area-weighted radiative coefficient of all surfaces facing the 

201 inside of this thermal zone (OuterWalls, Windows, InnerWalls, ...). 

202 alpha_rad_outer_mean : float [W/(m2K)] 

203 Area-weighted radiative coefficient of all surfaces facing the 

204 ambient (OuterWalls, Windows, ...). 

205 heat_load : [W] 

206 Static heat load of the thermal zone. 

207 heat_load_outside_factor : float [W/K] 

208 Factor needed for recalculation of the heat load of the thermal zone. 

209 This can be used to recalculate the thermalzones heat load inside 

210 Modelica export for parametric studies. This works only together with 

211 heat_load_ground_factor. 

212 

213 heat_load = heat_load_outside_factor * (t_inside - t_outside) + 

214 heat_load_ground_factor * (t_inside - t_ground). 

215 heat_load_ground_factor : float [W/K] 

216 Factor needed for recalculation of the heat load of the thermal zone. 

217 This can be used to recalculate the thermalzones heat load inside 

218 Modelica export for parametric studies. See heat_load_outside_factor. 

219 facade_areas : list of floats [m2] 

220 List containing the area of each facade (with same tilt and 

221 orientation) this includes also roofs and ground floors and windows. 

222 n_outer : int 

223 Number of total facades with different combination of tilt and 

224 orientation, including Rooftops and GroundFloors 

225 tilt_facade : list of floats [degree] 

226 Tilt of facades against the horizontal. 

227 orientation_facade : list of floats [degree] 

228 Orientation of facades (Azimuth). 

229 0 - North 

230 90 - East 

231 180 - South 

232 270 - West 

233 

234 """ 

235 

236 def __init__(self, thermal_zone, merge_windows, t_bt, t_bt_layer=7): 

237 """Constructor for TwoElement""" 

238 

239 self.internal_id = random.random() 

240 

241 self.thermal_zone = thermal_zone 

242 self.merge_windows = merge_windows 

243 self.t_bt = t_bt 

244 self.t_bt_layer = t_bt_layer 

245 

246 # Attributes for outer walls (OuterWall, Rooftop, GroundFloor) 

247 self.area_ow = 0.0 

248 

249 # coefficient of heat transfer facing the inside of this thermal zone 

250 self.alpha_conv_inner_ow = 0.0 

251 self.alpha_rad_inner_ow = 0.0 

252 self.alpha_comb_inner_ow = 0.0 

253 

254 # coefficient of heat transfer facing the ambient 

255 self.alpha_conv_outer_ow = 0.0 

256 self.alpha_rad_outer_ow = 0.0 

257 self.alpha_comb_outer_ow = 0.0 

258 

259 # UA-Value 

260 self.ua_value_ow = 0.0 

261 

262 # resistances for heat transfer facing the inside of this thermal zone 

263 self.r_conv_inner_ow = 0.0 

264 self.r_rad_inner_ow = 0.0 

265 self.r_comb_inner_ow = 0.0 

266 

267 # resistances for heat transfer facing the ambient 

268 self.r_conv_outer_ow = 0.0 

269 self.r_rad_outer_ow = 0.0 

270 self.r_comb_outer_ow = 0.0 

271 

272 # lumped resistances/capacity 

273 self.r1_ow = 0.0 

274 self.r_rest_ow = 0.0 

275 self.c1_ow = 0.0 

276 self.r_total_ow = 0.0 

277 

278 # Optical properties 

279 self.ir_emissivity_outer_ow = 0.0 

280 self.ir_emissivity_inner_ow = 0.0 

281 self.solar_absorp_ow = 0.0 

282 

283 # Additional attributes 

284 self.weightfactor_ow = [] 

285 self.weightfactor_ground = 0.0 

286 self.outer_wall_areas = [] 

287 

288 # Attributes for windows 

289 self.area_win = 0.0 

290 

291 # coefficient of heat transfer facing the inside of this thermal zone 

292 self.alpha_conv_inner_win = 0.0 

293 self.alpha_rad_inner_win = 0.0 

294 self.alpha_comb_inner_win = 0.0 

295 self.ratio_conv_rad_inner_win = 0.0 

296 

297 # coefficient of heat transfer facing the ambient 

298 self.alpha_conv_outer_win = 0.0 

299 self.alpha_rad_outer_win = 0.0 

300 self.alpha_comb_outer_win = 0.0 

301 

302 # UA-Value 

303 self.ua_value_win = 0.0 

304 self.u_value_win = 0.0 

305 

306 # resistances for heat transfer facing the inside of this thermal zone 

307 self.r_conv_inner_win = 0.0 

308 self.r_rad_inner_win = 0.0 

309 self.r_comb_inner_win = 0.0 

310 

311 # resistances for heat transfer facing the ambient 

312 self.r_conv_outer_win = 0.0 

313 self.r_rad_outer_win = 0.0 

314 self.r_comb_outer_win = 0.0 

315 

316 # lumped resistances/capacity 

317 self.r1_win = 0.0 

318 

319 # Optical properties 

320 self.ir_emissivity_win = 0.0 

321 self.ir_emissivity_inner_win = 0.0 

322 self.solar_absorp_win = 0.0 

323 

324 # Additional attributes 

325 self.weightfactor_win = [] 

326 self.window_areas = [] 

327 self.transparent_areas = [] 

328 self.shading_g_total = [] 

329 self.shading_max_irr = [] 

330 self.weighted_g_value = 0.0 

331 

332 # Misc values 

333 

334 self.alpha_rad_inner_mean = 0.0 

335 self.alpha_rad_outer_mean = 0.0 

336 self.n_outer = 0 

337 self.facade_areas = [] 

338 self.tilt_facade = [] 

339 self.orientation_facade = [] 

340 self.heat_load = 0.0 

341 self.cool_load = 0.0 

342 self.heat_load_outside_factor = 0.0 

343 self.heat_load_ground_factor = 0.0 

344 

345 def calc_attributes(self): 

346 """Calls all necessary function to calculate model attributes""" 

347 

348 outer_walls = ( 

349 self.thermal_zone.outer_walls 

350 + self.thermal_zone.ground_floors 

351 + self.thermal_zone.rooftops 

352 + self.thermal_zone.find_izes_outer() 

353 ) 

354 

355 for out_wall in outer_walls: 

356 out_wall.calc_equivalent_res(t_bt=self.t_bt_layer) 

357 out_wall.calc_ua_value() 

358 for win in self.thermal_zone.windows: 

359 win.calc_equivalent_res() 

360 win.calc_ua_value() 

361 for inner_wall in ( 

362 self.thermal_zone.inner_walls 

363 + self.thermal_zone.floors 

364 + self.thermal_zone.ceilings 

365 ): 

366 inner_wall.calc_equivalent_res(t_bt=self.t_bt_layer) 

367 inner_wall.calc_ua_value() 

368 

369 self.set_calc_default() 

370 if len(outer_walls) < 1: 

371 warnings.warn( 

372 "No walls are defined as outer walls for thermal " 

373 + "zone " 

374 + self.thermal_zone.name 

375 + " in building " 

376 + self.thermal_zone.parent.name 

377 + ", please be careful with results. In addition " 

378 + "this might lead to RunTimeErrors" 

379 ) 

380 else: 

381 self._sum_outer_wall_elements() 

382 if len(self.thermal_zone.windows) < 1: 

383 warnings.warn( 

384 "For thermal zone " 

385 + self.thermal_zone.name 

386 + " in building " 

387 + self.thermal_zone.parent.name 

388 + ", no windows have been defined." 

389 ) 

390 else: 

391 self._sum_window_elements() 

392 if len(outer_walls) >= 1 or len(self.thermal_zone.windows) >= 1: 

393 self._calc_outer_elements() 

394 self._calc_wf() 

395 self._calc_mean_values() 

396 if len(self.thermal_zone.interzonal_elements) >= 1: 

397 warnings.warn( 

398 "For thermal zone " 

399 + self.thermal_zone.name 

400 + " in building " 

401 + self.thermal_zone.parent.name 

402 + ", interzonal elements have been defined. OneElement export " 

403 + "will treat them as outer walls or inner walls depending on " 

404 + "the project parameter 'method_interzonal_export'. Consider " 

405 + "using FiveElement instead." 

406 ) 

407 self._calc_number_of_elements() 

408 self._fill_zone_lists() 

409 self._calc_heat_load() 

410 self.cool_load = -self.heat_load 

411 

412 @staticmethod 

413 def _calc_parallel_connection(element_list, omega): 

414 """Parallel connection of walls according to VDI 6007 

415 

416 Calculates the parallel connection of wall elements according to VDI 

417 6007, resulting in R1 and C1 (equation 23, 24). 

418 

419 Parameters 

420 ---------- 

421 element_list : list 

422 List of inner or outer walls 

423 omega : float 

424 VDI 6007 frequency 

425 

426 Returns 

427 ------- 

428 r1 : float [K/W] 

429 VDI 6007 resistance for all inner or outer walls 

430 c1 : float [K/W] 

431 VDI 6007 capacity all for inner or outer walls 

432 """ 

433 

434 for wall_count in range(len(element_list) - 1): 

435 

436 if wall_count == 0: 

437 r1_before = element_list[wall_count].r1 

438 c1_before = element_list[wall_count].c1_korr 

439 else: 

440 r1_before = r1 

441 c1_before = c1 

442 r1_add = element_list[wall_count + 1].r1 

443 c1_add = element_list[wall_count + 1].c1_korr 

444 

445 r1 = ( 

446 r1_before * c1_before ** 2 + r1_add * c1_add ** 2 

447 + omega ** 2 * r1_before * r1_add * (r1_before + r1_add) 

448 * c1_before ** 2 * c1_add ** 2 

449 ) / ( 

450 (c1_before + c1_add) ** 2 

451 + omega ** 2 * (r1_before + r1_add) ** 2 * c1_before ** 2 

452 * c1_add ** 2 

453 ) 

454 

455 c1 = ( 

456 (c1_before + c1_add) ** 2 

457 + omega ** 2 * (r1_before + r1_add) ** 2 * c1_before ** 2 

458 * c1_add ** 2 

459 ) / ( 

460 c1_before + c1_add 

461 + omega ** 2 

462 * (r1_before ** 2 * c1_before + r1_add ** 2 * c1_add) 

463 * c1_before * c1_add 

464 ) 

465 

466 return r1, c1 

467 

468 def _sum_outer_wall_elements(self): 

469 """Sum attributes for outer wall elements 

470 

471 This function sums and computes the area-weighted values, 

472 where necessary (the class doc string) for coefficients of heat 

473 transfer, resistances, areas and UA-Values. 

474 

475 For TwoElement model it treats rooftops, ground floor and outer walls 

476 as one kind of wall type. 

477 

478 """ 

479 # treat all outer wall types identical 

480 

481 outer_walls = ( 

482 self.thermal_zone.outer_walls 

483 + self.thermal_zone.ground_floors 

484 + self.thermal_zone.rooftops 

485 + self.thermal_zone.find_izes_outer() 

486 ) 

487 

488 self.area_ow = ( 

489 sum(out_wall.area for out_wall in outer_walls) 

490 ) 

491 

492 self.ua_value_ow = ( 

493 sum(out_wall.ua_value for out_wall in outer_walls) 

494 ) 

495 

496 self.r_total_ow = 1 / self.ua_value_ow 

497 

498 # values facing the inside of the thermal zone 

499 

500 self.r_conv_inner_ow = 1 / ( 

501 sum(1 / out_wall.r_inner_conv for out_wall in outer_walls) 

502 ) 

503 

504 self.r_rad_inner_ow = 1 / ( 

505 sum(1 / out_wall.r_inner_rad for out_wall in outer_walls) 

506 ) 

507 

508 self.r_comb_inner_ow = 1 / ( 

509 sum(1 / out_wall.r_inner_comb for out_wall in outer_walls) 

510 ) 

511 

512 self.ir_emissivity_inner_ow = ( 

513 sum( 

514 out_wall.layer[0].material.ir_emissivity * out_wall.area 

515 for out_wall in outer_walls 

516 ) 

517 ) / self.area_ow 

518 

519 self.alpha_conv_inner_ow = 1 / (self.r_conv_inner_ow * self.area_ow) 

520 self.alpha_rad_inner_ow = 1 / (self.r_rad_inner_ow * self.area_ow) 

521 self.alpha_comb_inner_ow = 1 / (self.r_comb_inner_ow * self.area_ow) 

522 

523 # values facing the ambient 

524 # ground floor does not have any coefficients on ambient side 

525 

526 _area_ow_rt = sum( 

527 out_wall.area for out_wall in self.thermal_zone.outer_walls 

528 ) + sum( 

529 roof.area for roof in self.thermal_zone.rooftops 

530 ) 

531 

532 _area_ow_rt_nzb = _area_ow_rt + sum( 

533 roof.area for roof in self.thermal_zone.find_izes_outer() 

534 ) 

535 

536 self.r_conv_outer_ow = 1 / ( 

537 sum(1 / out_wall.r_outer_conv for out_wall in self.thermal_zone.outer_walls) 

538 + sum(1 / roof.r_outer_conv for roof in self.thermal_zone.rooftops) 

539 + sum(1 / nzb.r_outer_conv for nzb in self.thermal_zone.find_izes_outer()) 

540 ) 

541 self.r_rad_outer_ow = 1 / ( 

542 sum(1 / out_wall.r_outer_rad for out_wall in self.thermal_zone.outer_walls) 

543 + sum(1 / roof.r_outer_rad for roof in self.thermal_zone.rooftops) 

544 + sum(1 / nzb.r_outer_rad for nzb in self.thermal_zone.find_izes_outer()) 

545 ) 

546 self.r_comb_outer_ow = 1 / ( 

547 sum(1 / out_wall.r_outer_comb for out_wall in self.thermal_zone.outer_walls) 

548 + sum(1 / roof.r_outer_comb for roof in self.thermal_zone.rooftops) 

549 + sum(1 / nzb.r_outer_comb for nzb in self.thermal_zone.find_izes_outer()) 

550 ) 

551 

552 self.ir_emissivity_outer_ow = ( 

553 sum( 

554 out_wall.layer[-1].material.ir_emissivity * out_wall.area 

555 for out_wall in self.thermal_zone.outer_walls 

556 ) 

557 + sum( 

558 roof.layer[-1].material.ir_emissivity * roof.area 

559 for roof in self.thermal_zone.rooftops 

560 ) 

561 ) / _area_ow_rt 

562 

563 self.solar_absorp_ow = ( 

564 sum( 

565 out_wall.layer[-1].material.solar_absorp * out_wall.area 

566 for out_wall in self.thermal_zone.outer_walls 

567 ) 

568 + sum( 

569 roof.layer[-1].material.solar_absorp * roof.area 

570 for roof in self.thermal_zone.rooftops 

571 ) 

572 ) / _area_ow_rt 

573 

574 self.alpha_conv_outer_ow = 1 / (self.r_conv_outer_ow * _area_ow_rt_nzb) 

575 self.alpha_rad_outer_ow = 1 / (self.r_rad_outer_ow * _area_ow_rt_nzb) 

576 self.alpha_comb_outer_ow = 1 / (self.r_comb_outer_ow * _area_ow_rt_nzb) 

577 

578 def _sum_window_elements(self): 

579 """Sum attributes for window elements 

580 

581 This function sums and computes the area-weighted values, 

582 where necessary (the class doc string) for coefficients of heat 

583 transfer, resistances, areas and UA-Values. 

584 

585 Function is identical for TwoElement, ThreeElement and FourElement. 

586 """ 

587 

588 self.area_win = sum(win.area for win in self.thermal_zone.windows) 

589 self.ua_value_win = sum(win.ua_value for win in self.thermal_zone.windows) 

590 self.u_value_win = self.ua_value_win / self.area_win 

591 

592 self.r_total_win = 1 / self.ua_value_win 

593 # values facing the inside of the thermal zone 

594 

595 self.r_conv_inner_win = 1 / ( 

596 sum(1 / win.r_inner_conv for win in self.thermal_zone.windows) 

597 ) 

598 

599 self.r_rad_inner_win = 1 / ( 

600 sum(1 / win.r_inner_rad for win in self.thermal_zone.windows) 

601 ) 

602 

603 self.r_comb_inner_win = 1 / ( 

604 sum(1 / win.r_inner_comb for win in self.thermal_zone.windows) 

605 ) 

606 

607 self.ir_emissivity_inner_win = ( 

608 sum( 

609 win.layer[0].material.ir_emissivity * win.area 

610 for win in self.thermal_zone.windows 

611 ) 

612 / self.area_win 

613 ) 

614 

615 self.alpha_conv_inner_win = 1 / (self.r_conv_inner_win * self.area_win) 

616 self.alpha_rad_inner_win = 1 / (self.r_rad_inner_win * self.area_win) 

617 self.alpha_comb_inner_win = 1 / (self.r_comb_inner_win * self.area_win) 

618 self.ratio_conv_rad_inner_win = ( 

619 sum(win.a_conv * win.area for win in self.thermal_zone.windows) 

620 / self.area_win 

621 ) 

622 

623 # values facing the ambient 

624 

625 self.r_conv_outer_win = 1 / ( 

626 sum(1 / win.r_outer_conv for win in self.thermal_zone.windows) 

627 ) 

628 

629 self.r_rad_outer_win = 1 / ( 

630 sum(1 / win.r_outer_rad for win in self.thermal_zone.windows) 

631 ) 

632 

633 self.r_comb_outer_win = 1 / ( 

634 sum(1 / win.r_outer_comb for win in self.thermal_zone.windows) 

635 ) 

636 

637 self.ir_emissivity_win = ( 

638 sum( 

639 win.layer[-1].material.ir_emissivity * win.area 

640 for win in self.thermal_zone.windows 

641 ) 

642 / self.area_win 

643 ) 

644 

645 self.solar_absorp_win = ( 

646 sum( 

647 win.layer[-1].material.solar_absorp * win.area 

648 for win in self.thermal_zone.windows 

649 ) 

650 / self.area_win 

651 ) 

652 

653 self.weighted_g_value = ( 

654 sum(win.g_value * win.area for win in self.thermal_zone.windows) 

655 / self.area_win 

656 ) 

657 

658 self.alpha_conv_outer_win = 1 / (self.r_conv_outer_win * self.area_win) 

659 self.alpha_rad_outer_win = 1 / (self.r_rad_outer_win * self.area_win) 

660 self.alpha_comb_outer_win = 1 / (self.r_comb_outer_win * self.area_win) 

661 

662 def _calc_outer_elements(self): 

663 """Lumped parameter for outer wall elements 

664 

665 Calculates all necessary parameters for outer walls. This includes 

666 OuterWalls, GroundFloors and Rooftops. 

667 Attributes 

668 ---------- 

669 omega : float [1/s] 

670 angular frequency with given time period. 

671 outer_walls : list 

672 List containing all TEASER Wall instances that are treated as same 

673 outer wall type. In case of TwoElement model OuterWalls, 

674 GroundFloors, Rooftops 

675 """ 

676 

677 omega = 2 * math.pi / 86400 / self.t_bt 

678 

679 outer_walls = ( 

680 self.thermal_zone.outer_walls 

681 + self.thermal_zone.ground_floors 

682 + self.thermal_zone.rooftops 

683 + self.thermal_zone.find_izes_outer() 

684 ) 

685 

686 if 0 < len(outer_walls) <= 1: 

687 # only one outer wall, no need to calculate chain matrix 

688 self.r1_ow = outer_walls[0].r1 

689 self.c1_ow = outer_walls[0].c1_korr 

690 elif len(outer_walls) > 1: 

691 # more than one outer wall, calculate chain matrix 

692 self.r1_ow, self.c1_ow = self._calc_parallel_connection( 

693 outer_walls, omega 

694 ) 

695 

696 if self.merge_windows is False: 

697 try: 

698 

699 if len(self.thermal_zone.windows) > 0: 

700 self.r1_win = 1 / sum( 

701 (1 / win.r1) for win in self.thermal_zone.windows 

702 ) 

703 if len(outer_walls) > 0: 

704 conduction = 1 / sum( 

705 (1 / element.r_conduc) for element in outer_walls 

706 ) 

707 

708 self.r_rest_ow = conduction - self.r1_ow 

709 

710 except RuntimeError: 

711 print( 

712 "As no outer walls or no windows are defined lumped " 

713 "parameter cannot be calculated" 

714 ) 

715 

716 if self.merge_windows is True: 

717 

718 try: 

719 

720 if ( 

721 len(self.thermal_zone.windows) > 0 

722 and len(outer_walls) > 0 

723 ): 

724 self.r1_win = 1 / sum( 

725 1 / (win.r1 / 6) for win in self.thermal_zone.windows 

726 ) 

727 

728 self.r1_ow = 1 / (1 / self.r1_ow + 1 / self.r1_win) 

729 

730 self.r_total_ow = 1 / (self.ua_value_ow + self.ua_value_win) 

731 self.r_rest_ow = ( 

732 self.r_total_ow 

733 - self.r1_ow 

734 - 1 

735 / ( 

736 ( 

737 (1 / self.r_conv_inner_ow) 

738 + (1 / self.r_conv_inner_win) 

739 + (1 / self.r_rad_inner_ow) 

740 + (1 / self.r_rad_inner_win) 

741 ) 

742 ) 

743 ) - 1 / (self.alpha_comb_outer_ow * self.area_ow) 

744 

745 self.ir_emissivity_inner_ow = ( 

746 self.ir_emissivity_inner_ow * self.area_ow 

747 + self.ir_emissivity_inner_win * self.area_win 

748 ) / (self.area_ow + self.area_win) 

749 

750 self.ir_emissivity_outer_ow = ( 

751 self.ir_emissivity_outer_ow * self.area_ow 

752 + self.ir_emissivity_win * self.area_win 

753 ) / (self.area_ow + self.area_win) 

754 

755 self.solar_absorp_ow = ( 

756 self.solar_absorp_ow * self.area_ow 

757 + self.solar_absorp_win * self.area_win 

758 ) / (self.area_ow + self.area_win) 

759 

760 except RuntimeError: 

761 print( 

762 "As no outer walls or no windows are defined lumped " 

763 "parameter cannot be calculated" 

764 ) 

765 

766 def _calc_wf(self): 

767 """Weightfactors for outer elements(walls, roof, ground floor, windows) 

768 

769 Calculates the weightfactors of the outer walls, including ground and 

770 windows. 

771 

772 Parameters 

773 ---------- 

774 outer_walls : list 

775 List containing all TEASER Wall instances that are treated as same 

776 outer wall type. In case of TwoElement model OuterWalls, 

777 GroundFloors, Rooftops 

778 """ 

779 

780 outer_walls = ( 

781 self.thermal_zone.outer_walls 

782 + self.thermal_zone.ground_floors 

783 + self.thermal_zone.rooftops 

784 ) 

785 

786 if self.merge_windows is True: 

787 

788 for wall in outer_walls: 

789 wall.wf_out = wall.ua_value / (self.ua_value_ow + self.ua_value_win) 

790 

791 for win in self.thermal_zone.windows: 

792 win.wf_out = win.ua_value / (self.ua_value_ow + self.ua_value_win) 

793 

794 self.weightfactor_ground = sum( 

795 gf.wf_out for gf in self.thermal_zone.ground_floors 

796 ) 

797 

798 elif self.merge_windows is False: 

799 

800 for wall in outer_walls: 

801 wall.wf_out = wall.ua_value / self.ua_value_ow 

802 

803 for win in self.thermal_zone.windows: 

804 win.wf_out = win.ua_value / self.ua_value_win 

805 

806 self.weightfactor_ground = sum( 

807 gf.wf_out for gf in self.thermal_zone.ground_floors 

808 ) 

809 

810 else: 

811 raise ValueError("specify merge window method correctly") 

812 

813 def _calc_mean_values(self): 

814 """Calculates mean values for inner and outer elements 

815 

816 This function calculates mean values inside the thermal zone (e.g. 

817 the mean value for coefficient of radiative heat transfer between 

818 inner and outer walls 

819 """ 

820 

821 self.alpha_rad_inner_mean = ( 

822 self.area_ow * self.alpha_rad_inner_ow 

823 + self.area_win * self.alpha_rad_inner_win 

824 ) / (self.area_ow + self.area_win) 

825 self.alpha_rad_outer_mean = ( 

826 self.area_ow * self.alpha_rad_outer_ow 

827 + self.area_win * self.alpha_rad_outer_win 

828 ) / (self.area_ow + self.area_win) 

829 

830 def _calc_number_of_elements(self): 

831 """Calculates the number of outer elements with different tilt/orient 

832 

833 This function calculates the number of outer elements with a 

834 different combination of orientation and tilt, this includes the 

835 rooftops, ground floors, and borders to unheated neighboured zones if 

836 this zone is heated. 

837 """ 

838 

839 outer_elements = ( 

840 self.thermal_zone.outer_walls 

841 + self.thermal_zone.find_izes_outer() 

842 + self.thermal_zone.ground_floors 

843 + self.thermal_zone.rooftops 

844 + self.thermal_zone.windows 

845 ) 

846 

847 tilt_orient = [] 

848 for element in outer_elements: 

849 tilt_orient.append((element.orientation, element.tilt)) 

850 self.n_outer = len(list(set(tilt_orient))) 

851 

852 def _fill_zone_lists(self): 

853 """Fills lists like weightfactors and tilt, orientation 

854 

855 Fills the lists of a zone according to orientation and tilt of the 

856 zone. Therefore it compares orientation and tilt of all outer 

857 elements and then creates lists for zone weightfactors, orientation, 

858 tilt, ares and sunblinds.""" 

859 

860 outer_elements = ( 

861 self.thermal_zone.outer_walls 

862 + self.thermal_zone.find_izes_outer() 

863 + self.thermal_zone.ground_floors 

864 + self.thermal_zone.rooftops 

865 + self.thermal_zone.windows 

866 ) 

867 

868 tilt_orient = [] 

869 for element in outer_elements: 

870 tilt_orient.append((element.orientation, element.tilt)) 

871 tilt_orient = list(set(tilt_orient)) 

872 

873 for i in tilt_orient: 

874 wall_rt_nzb = self.thermal_zone.find_walls( 

875 i[0], i[1] 

876 ) + self.thermal_zone.find_rts( 

877 i[0], i[1] 

878 ) + self.thermal_zone.find_izes_outer( 

879 i[0], i[1] 

880 ) 

881 wins = self.thermal_zone.find_wins(i[0], i[1]) 

882 gf = self.thermal_zone.find_gfs(i[0], i[1]) 

883 

884 if self.merge_windows is True: 

885 self.facade_areas.append( 

886 sum([element.area for element in (wall_rt_nzb + wins + gf)]) 

887 ) 

888 else: 

889 self.facade_areas.append( 

890 sum([element.area for element in (wall_rt_nzb + gf)]) 

891 ) 

892 

893 self.orientation_facade.append(i[0]) 

894 self.tilt_facade.append(i[1]) 

895 

896 if not wall_rt_nzb: 

897 

898 if not gf: 

899 self.weightfactor_ow.append(0.0) 

900 self.outer_wall_areas.append(0.0) 

901 else: 

902 self.weightfactor_ow.append(0.0) 

903 self.outer_wall_areas.append( 

904 (sum([element.area for element in gf])) 

905 ) 

906 else: 

907 self.weightfactor_ow.append(sum([wall.wf_out 

908 for wall in wall_rt_nzb])) 

909 self.outer_wall_areas.append(sum([wall.area 

910 for wall in wall_rt_nzb])) 

911 

912 if not wins: 

913 self.weightfactor_win.append(0.0) 

914 self.shading_g_total.append(1.0) 

915 self.window_areas.append(0.0) 

916 self.transparent_areas.append(0.0) 

917 self.shading_max_irr.append(9999.9) 

918 else: 

919 self.weightfactor_win.append(sum([win.wf_out for win in wins])) 

920 if self.merge_windows is False: 

921 self.window_areas.append(sum([win.area for win in wins])) 

922 self.transparent_areas.append(sum([win.area for win in wins])) 

923 

924 else: 

925 self.window_areas.append(0) 

926 self.transparent_areas.append(sum([win.area for win in wins])) 

927 self.shading_g_total.append( 

928 sum( 

929 [ 

930 win.shading_g_total * win.area / sum([w.area for w in wins]) 

931 for win in wins 

932 ] 

933 ) 

934 ) 

935 self.shading_max_irr.append( 

936 sum( 

937 [ 

938 win.shading_max_irr * win.area / sum([w.area for w in wins]) 

939 for win in wins 

940 ] 

941 ) 

942 ) 

943 

944 def _calc_heat_load(self): 

945 """Static heat load calculation 

946 

947 This function calculates the static heat load of the thermal zone by 

948 multiplying the UA-Value of the elements with the given Temperature 

949 difference of t_inside and t_outside. And takes heat losses through 

950 infiltration into account. 

951 

952 Attributes 

953 ---------- 

954 ua_value_ow_temp : float [W/(m2*K)] 

955 UA Value without GroundFloors 

956 ua_value_gf_temp : float [W/(m2*K)] 

957 UA Value of all GroundFloors 

958 """ 

959 if self.thermal_zone.use_conditions.base_infiltration > 0.5: 

960 warnings.warn("The base_infiltration is larger than 0.5, " 

961 "which could lead to ideal heaters being too small.") 

962 

963 self.heat_load = 0.0 

964 

965 if self.thermal_zone.parent.parent.t_soil_mode == 2: 

966 t_ground = self.thermal_zone.t_ground \ 

967 - self.thermal_zone.t_ground_amplitude 

968 else: 

969 t_ground = self.thermal_zone.t_ground 

970 

971 ua_value_gf_temp = sum( 

972 ground.ua_value for ground in self.thermal_zone.ground_floors 

973 ) 

974 ua_value_ow_temp = self.ua_value_ow - ua_value_gf_temp 

975 self.heat_load_outside_factor = ( 

976 (ua_value_ow_temp + self.ua_value_win) 

977 + self.thermal_zone.volume 

978 * self.thermal_zone.use_conditions.normative_infiltration 

979 * 1 

980 / 3600 

981 * self.thermal_zone.heat_capac_air 

982 * self.thermal_zone.density_air 

983 ) 

984 self.heat_load_ground_factor = ua_value_gf_temp 

985 self.heat_load = \ 

986 self.heat_load_outside_factor \ 

987 * (self.thermal_zone.t_inside - self.thermal_zone.t_outside) \ 

988 + self.heat_load_ground_factor \ 

989 * (self.thermal_zone.t_inside - t_ground) 

990 

991 def set_calc_default(self): 

992 """sets default calculation parameters 

993 """ 

994 

995 # Attributes for outer walls (OuterWall, Rooftop, GroundFloor) 

996 self.area_ow = 0.0 

997 

998 # coefficient of heat transfer facing the inside of this thermal zone 

999 self.alpha_conv_inner_ow = 0.0 

1000 self.alpha_rad_inner_ow = 0.0 

1001 self.alpha_comb_inner_ow = 0.0 

1002 

1003 # coefficient of heat transfer facing the ambient 

1004 self.alpha_conv_outer_ow = 0.0 

1005 self.alpha_rad_outer_ow = 0.0 

1006 self.alpha_comb_outer_ow = 0.0 

1007 

1008 # UA-Value 

1009 self.ua_value_ow = 0.0 

1010 

1011 # resistances for heat transfer facing the inside of this thermal zone 

1012 self.r_conv_inner_ow = 0.0 

1013 self.r_rad_inner_ow = 0.0 

1014 self.r_comb_inner_ow = 0.0 

1015 

1016 # resistances for heat transfer facing the ambient 

1017 self.r_conv_outer_ow = 0.0 

1018 self.r_rad_outer_ow = 0.0 

1019 self.r_comb_outer_ow = 0.0 

1020 

1021 # lumped resistances/capacity 

1022 self.r1_ow = 0.0 

1023 self.r_rest_ow = 0.0 

1024 self.c1_ow = 0.0 

1025 self.r_total_ow = 0.0 

1026 

1027 # Optical properties 

1028 self.ir_emissivity_outer_ow = 0.0 

1029 self.ir_emissivity_inner_ow = 0.0 

1030 self.solar_absorp_ow = 0.0 

1031 

1032 # Additional attributes 

1033 self.weightfactor_ow = [] 

1034 self.weightfactor_ground = 0.0 

1035 self.outer_wall_areas = [] 

1036 

1037 # TODO: check this value 

1038 self.r_rad_ow_iw = 0.0 

1039 

1040 # Attributes for windows 

1041 self.area_win = 0.0 

1042 

1043 # coefficient of heat transfer facing the inside of this thermal zone 

1044 self.alpha_conv_inner_win = 0.0 

1045 self.alpha_rad_inner_win = 0.0 

1046 self.alpha_comb_inner_win = 0.0 

1047 self.ratio_conv_rad_inner_win = 0.0 

1048 

1049 # coefficient of heat transfer facing the ambient 

1050 self.alpha_conv_outer_win = 0.0 

1051 self.alpha_rad_outer_win = 0.0 

1052 self.alpha_comb_outer_win = 0.0 

1053 

1054 # UA-Value 

1055 self.ua_value_win = 0.0 

1056 self.u_value_win = 0.0 

1057 

1058 # resistances for heat transfer facing the inside of this thermal zone 

1059 self.r_conv_inner_win = 0.0 

1060 self.r_rad_inner_win = 0.0 

1061 self.r_comb_inner_win = 0.0 

1062 

1063 # resistances for heat transfer facing the ambient 

1064 self.r_conv_outer_win = 0.0 

1065 self.r_rad_outer_win = 0.0 

1066 self.r_comb_outer_win = 0.0 

1067 

1068 # lumped resistances/capacity 

1069 self.r1_win = 0.0 

1070 

1071 # Optical properties 

1072 self.ir_emissivity_win = 0.0 

1073 self.solar_absorp_win = 0.0 

1074 

1075 # Additional attributes 

1076 self.weightfactor_win = [] 

1077 self.window_areas = [] 

1078 self.transparent_areas = [] 

1079 self.shading_g_total = [] 

1080 self.shading_max_irr = [] 

1081 self.weighted_g_value = 0.0 

1082 

1083 # Misc values 

1084 

1085 self.alpha_rad_inner_mean = 0.0 

1086 self.n_outer = 0 

1087 self.facade_areas = [] 

1088 self.tilt_facade = [] 

1089 self.orientation_facade = [] 

1090 self.heat_load = 0.0 

1091 self.cool_load = 0.0