-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathwall.py
334 lines (287 loc) · 13.3 KB
/
wall.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
"""asd"""
from teaser.logic.buildingobjects.buildingphysics.buildingelement \
import BuildingElement
from teaser.logic.buildingobjects.buildingphysics.layer import Layer
from teaser.logic.buildingobjects.buildingphysics.material import Material
import numpy as np
import warnings
class Wall(BuildingElement):
"""Wall class
This class holds functions and information for walls. It inherits for
BuildingElement() and is a base class for all inner and outer walls.
Parameters
----------
parent : ThermalZone()
The parent class of this object, the ThermalZone the BE belongs to.
Allows for better control of hierarchical structures.
Default is None.
Attributes
----------
internal_id : float
Random id for the distinction between different elements.
name : str
Individual name
construction_data : str
Type of construction (e.g. "heavy" or "light"). Needed for
distinction between different constructions types in the same
building age period.
year_of_retrofit : int
Year of last retrofit
year_of_construction : int
Year of first construction
building_age_group : list
Determines the building age period that this building
element belongs to [begin, end], e.g. [1984, 1994]
area : float [m2]
Area of building element
tilt : float [degree]
Tilt against horizontal
orientation : float [degree]
Azimuth direction of building element (0 : north, 90: east, 180: south,
270: west)
inner_convection : float [W/(m2*K)]
Constant heat transfer coefficient of convection inner side (facing
the zone)
inner_radiation : float [W/(m2*K)]
Constant heat transfer coefficient of radiation inner side (facing
the zone)
outer_convection : float [W/(m2*K)]
Constant heat transfer coefficient of convection outer side (facing
the ambient or adjacent zone). Currently for all InnerWalls and
GroundFloors this value is set to 0.0
outer_radiation : float [W/(m2*K)]
Constant heat transfer coefficient of radiation outer side (facing
the ambient or adjacent zone). Currently for all InnerWalls and
GroundFloors this value is set to 0.0
layer : list
List of all layers of a building element (to be filled with Layer
objects). Use element.layer = None to delete all layers of the building
element
Calculated Attributes
r1 : float [K/W]
equivalent resistance R1 of the analogous model given in VDI 6007
r2 : float [K/W]
equivalent resistance R2 of the analogous model given in VDI 6007
r3 : float [K/W]
equivalent resistance R3 of the analogous model given in VDI 6007
c1 : float [J/K]
equivalent capacity C1 of the analogous model given in VDI 6007
c2 : float [J/K]
equivalent capacity C2 of the analogous model given in VDI 6007
c1_korr : float [J/K]
corrected capacity C1,korr for building elements in the case of
asymmetrical thermal load given in VDI 6007
calc_u: Required area-specific U-value in retrofit cases [W/K]
ua_value : float [W/K]
UA-Value of building element (Area times U-Value)
r_inner_conv : float [K/W]
Convective resistance of building element on inner side (facing the
zone)
r_inner_rad : float [K/W]
Radiative resistance of building element on inner side (facing the
zone)
r_inner_conv : float [K/W]
Combined convective and radiative resistance of building element on
inner side (facing the zone)
r_outer_conv : float [K/W]
Convective resistance of building element on outer side (facing
the ambient or adjacent zone). Currently for all InnerWalls and
GroundFloors this value is set to 0.0
r_outer_rad : float [K/W]
Radiative resistance of building element on outer side (facing
the ambient or adjacent zone). Currently for all InnerWalls and
GroundFloors this value is set to 0.0
r_outer_conv : float [K/W]
Combined convective and radiative resistance of building element on
outer side (facing the ambient or adjacent zone). Currently for all
InnerWalls and GroundFloors this value is set to 0.0
wf_out : float
Weightfactor of building element ua_value/ua_value_zone
"""
def __init__(self, parent=None):
"""Constructor of Wall
"""
super(Wall, self).__init__(parent)
def calc_equivalent_res(self, t_bt=7):
"""Equivalent resistance according to VDI 6007.
Calculates the equivalent resistance and capacity of a wall according
to VDI 6007 guideline. (Analogous model).
Parameters
----------
t_bt : int
Time constant according to VDI 6007 (default t_bt = 7)
"""
nr_of_layer, density, thermal_conduc, heat_capac, thickness = \
self.gather_element_properties()
omega = 2 * np.pi / (86400 * t_bt)
r_layer = thickness / thermal_conduc
c_layer = heat_capac * density * thickness * 1000
re11 = np.cosh(np.sqrt(0.5 * omega * r_layer * c_layer)) * \
np.cos(np.sqrt(0.5 * omega * r_layer * c_layer))
im11 = np.sinh(np.sqrt(0.5 * omega * r_layer * c_layer)) * \
np.sin(np.sqrt(0.5 * omega * r_layer * c_layer))
re12 = r_layer * np.sqrt(1 / (2 * omega * r_layer * c_layer)) * \
(np.cosh(np.sqrt(0.5 * omega * r_layer * c_layer)) *
np.sin(np.sqrt(0.5 * omega * r_layer * c_layer)) +
np.sinh(np.sqrt(0.5 * omega * r_layer * c_layer)) *
np.cos(np.sqrt(0.5 * omega * r_layer * c_layer)))
im12 = r_layer * np.sqrt(1 / (2 * omega * r_layer * c_layer)) * \
(np.cosh(np.sqrt(0.5 * omega * r_layer * c_layer)) *
np.sin(np.sqrt(0.5 * omega * r_layer * c_layer)) -
np.sinh(np.sqrt(0.5 * omega * r_layer * c_layer)) *
np.cos(np.sqrt(0.5 * omega * r_layer * c_layer)))
re21 = (-1 / r_layer) * (np.sqrt(0.5 * omega * r_layer * c_layer)) * \
(np.cosh(np.sqrt(0.5 * omega * r_layer * c_layer)) *
np.sin(np.sqrt(0.5 * omega * r_layer * c_layer)) -
np.sinh(np.sqrt(0.5 * omega * r_layer * c_layer)) *
np.cos(np.sqrt(0.5 * omega * r_layer * c_layer)))
im21 = (1 / r_layer) * (np.sqrt(0.5 * omega * r_layer * c_layer)) * \
(np.cosh(np.sqrt(0.5 * omega * r_layer * c_layer)) *
np.sin(np.sqrt(0.5 * omega * r_layer * c_layer)) +
np.sinh(np.sqrt(0.5 * omega * r_layer * c_layer)) *
np.cos(np.sqrt(0.5 * omega * r_layer * c_layer)))
re22 = re11
im22 = im11
# -----setting up the matrix for each layer
a_layer = np.zeros((nr_of_layer, 4, 4))
for i, r in enumerate(re11):
a_layer[i][0][0] = r
a_layer[i][0][1] = im11[i]
a_layer[i][0][2] = re12[i]
a_layer[i][0][3] = im12[i]
a_layer[i][1][0] = -im11[i]
a_layer[i][1][1] = re11[i]
a_layer[i][1][2] = -im12[i]
a_layer[i][1][3] = re12[i]
a_layer[i][2][0] = re21[i]
a_layer[i][2][1] = im21[i]
a_layer[i][2][2] = re22[i]
a_layer[i][2][3] = im22[i]
a_layer[i][3][0] = -im21[i]
a_layer[i][3][1] = re21[i]
a_layer[i][3][2] = -im22[i]
a_layer[i][3][3] = re22[i]
# -----multiplication of the matrix
new_mat = np.diag(np.ones(4))
for count_layer in a_layer:
new_mat = np.dot(new_mat, count_layer)
# calculation of equivalent Resistance and capacities of each element
self.r1 = (1 / self.area) * ((new_mat[3][3] - 1) *
new_mat[0][2] + new_mat[2][3] *
new_mat[0][3]) / \
((new_mat[3][3] - 1) ** 2 + new_mat[2][3] ** 2)
self.r2 = (1 / self.area) * ((new_mat[0][0] - 1) *
new_mat[0][2] + new_mat[0][1] *
new_mat[0][3]) / \
((new_mat[0][0] - 1) ** 2 + new_mat[0][1] ** 2)
self.c1 = self.area * ((new_mat[3][3] - 1) ** 2 +
(new_mat[2][3]) ** 2) / \
(omega * (new_mat[0][2] * new_mat[2][3] -
(new_mat[3][3] - 1) * new_mat[0][3]))
self.c2 = self.area * ((new_mat[0][0] - 1) ** 2 +
(new_mat[0][1]) ** 2) / (
omega * (new_mat[0][2] *
new_mat[0][1] -
(new_mat[0][0] - 1) *
new_mat[0][3]))
self.r3 = (1 / self.area) * (np.sum(r_layer)) - self.r1 - self.r2
r_wall = self.r1 + self.r2 + self.r3
self.c1_korr = (1 / (omega * self.r1)) * ((r_wall * self.area -
new_mat[0][2] * new_mat[3][
3] -
new_mat[0][3] * new_mat[2][
3]) /
(new_mat[3][3] * new_mat[0][
3] -
new_mat[0][2] * new_mat[2][
3]))
if type(self).__name__ == "OuterWall" \
or type(self).__name__ == "Rooftop" \
or type(self).__name__ == "GroundFloor":
self.c1 = self.c1_korr
def insulate_wall(
self,
material=None,
thickness=None):
"""Retrofit the walls with an additional insulation layer
Adds an additional layer on the wall, outer sight
Parameters
----------
material : string
Type of material, that is used for insulation, default = EPS035
thickness : float
thickness of the insulation layer, default = None
"""
if material is None:
material = "EPS035"
else:
pass
ext_layer = Layer(self)
new_material = Material(ext_layer)
new_material.load_material_template(
material,
data_class=self.parent.parent.parent.data)
if thickness is None:
pass
else:
ext_layer.thickness = thickness
ext_layer.material = new_material
def retrofit_wall(self, year_of_retrofit, material=None):
"""Retrofits wall to German refurbishment standards.
This function adds an additional layer of insulation and sets the
thickness of the layer according to the retrofit standard in the
year of refurbishment. Refurbishment year must be newer then 1977
Note: To Calculate thickness and U-Value, the standard TEASER
coefficients for outer and inner heat transfer are used.
The used Standards are namely the Waermeschutzverordnung (WSVO) and
Energieeinsparverordnung (EnEv)
Parameters
----------
material : string
Type of material, that is used for insulation
year_of_retrofit : int
Year of the retrofit of the wall/building
"""
raise NotImplementedError("Please call this method only against"
"Outerwalls, Rooftops and Groundfloors")
def initialize_retrofit(self, material, year_of_retrofit):
"""Checks the retrofit inputs and sets material and year of retrofit
if needed."""
self.set_calc_default()
self.calc_ua_value()
if material is None:
material = "EPS_perimeter_insulation_top_layer"
else:
pass
if year_of_retrofit < 1977:
year_of_retrofit = 1977
warnings.warn("You are using a year of retrofit not supported\
by teaser. We will change your year of retrofit to 1977\
for the calculation. Be careful!")
return material, year_of_retrofit
def set_insulation(self, material, calc_u, year_of_retrofit):
"""Sets the correct insulation thickness based on the given u-value"""
if calc_u:
if self.u_value <= calc_u:
warnings.warn(
f'No retrofit needed for {self.name} as u value '
f'is already lower than needed.')
else:
self.insulate_wall(material)
d_ins = self.calc_ins_layer_thickness(calc_u)
self.layer[-1].thickness = d_ins
self.layer[-1].id = len(self.layer)
else:
warnings.warn(
f'No fitting retrofit type found for {year_of_retrofit}')
def calc_ins_layer_thickness(self, calc_u):
"""Calculates the thickness of the fresh insulated layer from
retrofit"""
r_conduc_rem = 0
for count_layer in self.layer[:-1]:
r_conduc_rem += (count_layer.thickness /
count_layer.material.thermal_conduc)
lambda_ins = self.layer[-1].material.thermal_conduc
d_ins = lambda_ins * (1 / calc_u - self.r_outer_comb * self.area -
self.r_inner_comb * self.area - r_conduc_rem)
return d_ins