Coverage for teaser/logic/buildingobjects/buildingphysics/window.py: 68%

104 statements  

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

1# created June 2015 

2# by TEASER4 Development Team 

3 

4 

5from teaser.logic.buildingobjects.buildingphysics.buildingelement \ 

6 import BuildingElement 

7import warnings 

8 

9 

10class Window(BuildingElement): 

11 """Window class 

12 

13 This class holds information of a window and is a child of 

14 BuildingElement(). 

15 

16 Parameters 

17 ---------- 

18 

19 parent : ThermalZone() 

20 The parent class of this object, the ThermalZone the BE belongs to. 

21 Allows for better control of hierarchical structures. If not None it 

22 adds this Window to ThermalZone.windows. 

23 Default is None. 

24 

25 Attributes 

26 ---------- 

27 

28 internal_id : float 

29 Random id for the distinction between different elements. 

30 name : str 

31 Individual name 

32 construction_data : str 

33 Type of construction (e.g. "heavy" or "light"). Needed for 

34 distinction between different constructions types in the same 

35 building age period. 

36 year_of_retrofit : int 

37 Year of last retrofit 

38 year_of_construction : int 

39 Year of first construction 

40 building_age_group : list 

41 Determines the building age period that this building 

42 element belongs to [begin, end], e.g. [1984, 1994] 

43 area : float [m2] 

44 Area of building element 

45 tilt : float [degree] 

46 Tilt against horizontal, default 90.0 

47 orientation : float [degree] 

48 Azimuth direction of building element (0 : north, 90: east, 180: south, 

49 270: west) 

50 inner_convection : float [W/(m2*K)] 

51 Constant heat transfer coefficient of convection inner side (facing 

52 the zone), default 2.7 

53 inner_radiation : float [W/(m2*K)] 

54 Constant heat transfer coefficient of radiation inner side (facing 

55 the zone), default 5.0 

56 outer_convection : float [W/(m2*K)] 

57 Constant heat transfer coefficient of convection outer side (facing 

58 the ambient or adjacent zone), default 20.0 

59 outer_radiation : float [W/(m2*K)] 

60 Constant heat transfer coefficient of radiation outer side (facing 

61 the ambient or adjacent zone), default 5.0 

62 layer : list 

63 List of all layers of a building element (to be filled with Layer 

64 objects). Use element.layer = None to delete all layers of the building 

65 element 

66 other_side : ThermalZone() 

67 the thermal zone on the other side of the building element (only for 

68 interzonal elements) 

69 interzonal_type_material : str 

70 one of (None (default), 'inner', 'outer_ordered', 'outer_reversed') 

71 describes as which kind of element the element is treated when loading 

72 type elements. Caution: Make sure that the complimentary element of 

73 the other zone is also changed accordingly if this is adapted manually 

74 None: treatment based on project.method_interzonal_export_enrichment 

75 'inner': InterzonalWall treated as InnerWall, 

76 InterzonalFloor treated as Floor, 

77 InterzonalCeiling treated as Ceiling 

78 'outer_ordered': InterzonalWall treated as Wall, 

79 InterzonalFloor treated as GroundFloor, 

80 InterzonalCeiling treated as Rooftop 

81 'outer_reversed': InterzonalWall treated as Wall, 

82 InterzonalFloor treated as Rooftop, 

83 InterzonalCeiling treated as GroundFloor, but with 

84 reversed layers, resulting in the reversed 

85 sequence of layers as for the complimentary 

86 element declared as 'outer_ordered' 

87 interzonal_type_export : str 

88 one of (None (default), 'inner', 'outer_ordered', 'outer_reversed') 

89 describes as which kind of element the element is treated when exporting 

90 to Modelica. Caution: Make sure that the complimentary element of 

91 the other zone is also changed accordingly if this is adapted manually 

92 'inner': element will be lumped with InnerWall. No heat flow to the 

93 zone on the other side will be modelled. 

94 'outer_ordered': element will be lumped with OuterWall (OneElement 

95 to FourElement export) or treated as border to an 

96 adjacent zone (FiveElement export). Borders to the 

97 same adjacent zone will be lumped. 

98 'outer_reversed': like 'outer_ordered', but the lumping follows 

99 VDI 6007-1 in reversed order, resulting in the 

100 reversed order of resistances and capacitors as 

101 for the complimentary element declared as 

102 'outer_ordered' 

103 

104 Specific Attributes for Window 

105 

106 g_value : float 

107 solar heat gain coefficient of Window 

108 a_conv : float 

109 relative convective heat emission because of absorption of short wave 

110 irradiation of inner side of Window according to VDI 6007 

111 shading_g_total : float 

112 shaded g value of the window 

113 shading_max_irr : float 

114 threshold for automatic shading 

115 

116 Calculated Attributes 

117 

118 r1 : float [K/W] 

119 equivalent resistance R1 of the analogous model given in VDI 6007 

120 r2 : float [K/W] 

121 equivalent resistance R2 of the analogous model given in VDI 6007 

122 r3 : float [K/W] 

123 equivalent resistance R3 of the analogous model given in VDI 6007 

124 c1 : float [J/K] 

125 equivalent capacity C1 of the analogous model given in VDI 6007 

126 c2 : float [J/K] 

127 equivalent capacity C2 of the analogous model given in VDI 6007 

128 c1_korr : float [J/K] 

129 corrected capacity C1,korr for building elements in the case of 

130 asymmetrical thermal load given in VDI 6007 

131 ua_value : float [W/K] 

132 UA-Value of building element (Area times U-Value) 

133 r_inner_conv : float [K/W] 

134 Convective resistance of building element on inner side (facing the 

135 zone) 

136 r_inner_rad : float [K/W] 

137 Radiative resistance of building element on inner side (facing the 

138 zone) 

139 r_inner_conv : float [K/W] 

140 Combined convective and radiative resistance of building element on 

141 inner side (facing the zone) 

142 r_outer_conv : float [K/W] 

143 Convective resistance of building element on outer side (facing 

144 the ambient or adjacent zone). Currently for all InnerWalls and 

145 GroundFloors this value is set to 0.0 

146 r_outer_rad : float [K/W] 

147 Radiative resistance of building element on outer side (facing 

148 the ambient or adjacent zone). Currently for all InnerWalls and 

149 GroundFloors this value is set to 0.0 

150 r_outer_comb : float [K/W] 

151 Combined convective and radiative resistance of building element on 

152 outer side (facing the ambient or adjacent zone). Currently for all 

153 InnerWalls and GroundFloors this value is set to 0.0 

154 wf_out : float 

155 Weightfactor of building element ua_value/ua_value_zone 

156 

157 """ 

158 

159 def __init__(self, parent=None): 

160 

161 super(Window, self).__init__(parent) 

162 self._g_value = 0.0 

163 self._a_conv = 0.0 

164 self._shading_g_total = 1.0 

165 self._shading_max_irr = 0.0 

166 self._tilt = 90.0 

167 self._inner_convection = 2.7 

168 self._inner_radiation = 5.0 

169 self._outer_convection = 20.0 

170 self._outer_radiation = 5.0 

171 

172 def calc_equivalent_res(self): 

173 """Equivalent resistance VDI 6007 

174 

175 Calculates the equivalent resistance of a wall according to VDI 

176 6007 guideline. 

177 

178 Parameters 

179 ---------- 

180 t_bt : int 

181 time constant according to VDI 6007 (default t_bt = 7) 

182 """ 

183 self.set_calc_default() 

184 number_of_layer, density, thermal_conduc, heat_capac, thickness = \ 

185 self.gather_element_properties() 

186 

187 r_layer = thickness / thermal_conduc 

188 c_layer = heat_capac * density * thickness # *1000 

189 

190 for layer_count in r_layer: 

191 self.r1 += layer_count / self.area 

192 

193 for layer_count in c_layer: 

194 self.c1 += layer_count 

195 

196 def replace_window(self, year_of_retrofit, window_type=None): 

197 """Replace a window, with a newer one. 

198 

199 Replaces all attributes from the window and replaces it with a high 

200 insulated one. 

201 

202 Parameters 

203 ---------- 

204 year_of_retrofit: int 

205 The year, the building was refurbished 

206 """ 

207 

208 if window_type is None: 

209 window_type = "EnEv" 

210 else: 

211 pass 

212 

213 if year_of_retrofit < 1995: 

214 year_of_retrofit = 1995 

215 warnings.warn("You are using a year of retrofit not supported\ 

216 by teaser. We will change your year of retrofit to 1995\ 

217 for the calculation. Be careful!") 

218 

219 self.set_calc_default() 

220 self.layer = None 

221 self.load_type_element(year_of_retrofit, 

222 window_type, 

223 self.parent.parent.parent.data) 

224 

225 @property 

226 def parent(self): 

227 return self.__parent 

228 

229 @parent.setter 

230 def parent(self, value): 

231 if value is not None: 

232 

233 ass_error_1 = "Parent has to be an instance of ThermalZone()" 

234 

235 assert type(value).__name__ == "ThermalZone", ass_error_1 

236 

237 self.__parent = value 

238 

239 if type(self).__name__ == "Window": 

240 self.__parent.windows.append(self) 

241 else: 

242 raise ValueError('Instance of Window not known') 

243 

244 if self.parent.parent is not None: 

245 self.year_of_construction = \ 

246 self.parent.parent.year_of_construction 

247 else: 

248 pass 

249 else: 

250 

251 self.__parent = None 

252 

253 @property 

254 def g_value(self): 

255 return self._g_value 

256 

257 @g_value.setter 

258 def g_value(self, value): 

259 

260 if isinstance(value, float): 

261 self._g_value = value 

262 elif value is None: 

263 self._g_value = value 

264 else: 

265 try: 

266 value = float(value) 

267 self._g_value = value 

268 except: 

269 raise ValueError("Can't convert g value to float") 

270 

271 @property 

272 def a_conv(self): 

273 return self._a_conv 

274 

275 @a_conv.setter 

276 def a_conv(self, value): 

277 

278 if isinstance(value, float): 

279 self._a_conv = value 

280 elif value is None: 

281 self._a_conv = value 

282 else: 

283 try: 

284 value = float(value) 

285 self._a_conv = value 

286 except: 

287 raise ValueError("Can't convert a conv to float") 

288 

289 @property 

290 def shading_g_total(self): 

291 return self._shading_g_total 

292 

293 @shading_g_total.setter 

294 def shading_g_total(self, value): 

295 

296 if isinstance(value, float): 

297 self._shading_g_total = value 

298 elif value is None: 

299 self._shading_g_total = value 

300 else: 

301 try: 

302 value = float(value) 

303 self._shading_g_total = value 

304 except: 

305 raise ValueError("Can't convert shaded g value to float") 

306 

307 @property 

308 def shading_max_irr(self): 

309 return self._shading_max_irr 

310 

311 @shading_max_irr.setter 

312 def shading_max_irr(self, value): 

313 

314 if isinstance(value, float): 

315 self._shading_max_irr = value 

316 elif value is None: 

317 self._shading_max_irr = value 

318 else: 

319 try: 

320 value = float(value) 

321 self._shading_max_irr = value 

322 except: 

323 raise ValueError("Can't convert max irradiation to float")