In [1]:

```
import math
## Example 9.1
print('Example 9.1\n\n');
print('Page No. 252\n\n');
##given
a = 40.;## in m
b = 25.;## in m
c = 20.;## in m
d = 10.;## in m
e = 5.;## in m
f = 2.;## in m
g = 3.;## in m
h = 6.;## in m
##(1) Production Area
T1 = 21.;## Temperature difference in degree celcius
T2 = -3.;## Temperature difference in degree celcius
U1 = 1.2;## heat transfer coefficent in W/m-K
U2 = 5.6;## heat transfer coefficent in W/m-K
U3 = 2.0;## heat transfer coefficent in W/m-K
U4 = 0.7;## heat transfer coefficent in W/m-K
U5 = 0.9;## heat transfer coefficent in W/m-K
## As Q = U*A*T
Q1 = (b*h)*U1*T1;## Heat loss in W. wall in W
Q2 = (((a-c)*h) + (d*h) + (d*f))*U1*T1;## Heat loss in N. wall in W
Q3 = (c*f)*U2*T1;## Heat loss in N. window in W
Q4 = (b*g)*U3*T2;## Heat loss in N. wall/internal in W
Q5 = (b*g)*U1*T1;## Heat loss in E. wall/external in W
Q6 = (((a-c)*h) + (d*h) + (d*f))*U1*T1;## Heat loss in S. wall in W
Q7 = (c*f)*U2*T1;## Heat loss in S. window in W
Q8 = (b*a)*U4*T1;## Heat loss in roof in W
Q9 = (b*a)*U5*T1;## Heat loss in floor in W
T_Q_P = Q1 + Q2 + Q3 + Q4 + Q5 + Q6 + Q7 + Q8 + Q9;## in W
##For Office surface
T3 = 24;## Temperature difference in degree celcius
T4 = 3;## Temperature difference in degree celcius
## As Q = U*A*T
Q_1 = (b*g)*U3*T4;## Heat loss in W. wall in W
Q_2 = (d*g)*U1*T3;## Heat loss in N. wall in W
Q_3 = (((b-(2*e))*g) +(e*f))*U1*T3;## Heat loss in E. Wall in W
Q_4 = (e*f)*U2*T3;## Heat loss in E. window in W
Q_5 = (e*f)*U2*T3;## Heat loss in E. window in W
Q_6 = (d*g)*U1*T3;## Heat loss in S. wall in W
Q_7 = (b*d)*U4*T3;## Heat loss in S. roof in W
Q_8 = (b*d)*U5*T3;## Heat loss in floor in W
T_Q_O = Q_1 + Q_2 + Q_3 + Q_4 + Q_5 + Q_6 + Q_7 + Q_8; ##in W
T_Q = T_Q_P + T_Q_O;## in W
print'%s %.2f %s'%('Total building fabric loss is ',T_Q,' W')
```

In [2]:

```
import math
## Example 9.2
print('Example 9.2\n\n');
print('Page No. 255\n\n');
##given
L_Br = 0.105;## Length of brickwork in m
L_Bl = 0.100;## Length of blockwork in m
L_C = 0.05;## Length of cavity in m
K_Br = 0.84;## Thermal conductivity of brickwork in W/m-K
K_Bl = 0.22;## Thermal conductivity of blockwork in W/m-K
K_C_in = 0.033;## Thermal conductivity of insulation in cavity in W/m-K
R_Ex = 0.055;## Resistance of external surface in W/m^2-K
##As R = L/K
R_Br = (L_Br/K_Br);## Resistance of brickwork in W/m^2-K
R_Bl = (L_Bl/K_Bl);## Resistance of blockwork in W/m^2-K
R_C = 0.18;## Resistance of cavity in W/m^2-K
##Without insulation of cavity
R_T = 0.938;## Total Resistance in W/m^2-K
## Thermal transmittance - U = (1/R_T)
U = (1./R_T);## in W/m^2-K
print'%s %.2f %s'%('The U-value of external wall is ',U,' W/sq.m K \n')
##With insulation of cavity
##As R = L/K
R_C_in = (L_C/K_C_in);## Resistance of insulation in cavity in W/m^2-K
In = R_C_in - R_C;## Net increase in W/m^2-K
R_T_New = R_T + In;## New total resistance in W/m^2-K
## Thermal transmittance - U = (1/R_T)
U_New = (1./R_T_New);## in W/m^2-K
print'%s %.2f %s'%('The new U-value is with foamed insulation ',U_New,' W/sq.m K')
```

In [3]:

```
import math
## Example 9.3
print('Example 9.3\n\n');
print('Page No. 256\n\n');
##given
N_1 = 1.5;## Ventilation rate in the production area (air changes per hour)
N_2 = 1.0;## Ventilation rate in the office suite (air changes per hour)
##From example 9.1
V_P = 6000.;## Voulme of production area in m^3
V_O = 750.;## Voulme of office suite in m^3
T1 = 21.;## Temperature difference in degree celcius
T2 = -3.;## Temperature difference in degree celcius
T_P = 18.;## Temperature difference in degree celcius
F_loss = 74.4*10**3;## Total fabric loss in W
## As Q_vent = 0.33 * N * V * (T1 - T2)
Q_vent_P = 0.33 * N_1 * V_P * (T_P - T2);## Ventilation loss in production area in W
Q_vent_O = 0.33 * N_2 * V_O * (T1 - T2);## Ventilation loss in office suite in W
V_loss = Q_vent_P + Q_vent_O;## Total ventilation loss in W
T_loss = F_loss + V_loss;## Total heat loss in W
p = (V_loss/T_loss)*100.;
print'%s %.2f %s'%('percentage of ventilation loss is ',p,' percent',)
```

In [4]:

```
import math
import numpy
## Example 9.4
print('Example 9.4\n\n');
print('Page No. 260\n\n');
##(a) Design loss
T1 = 18.;## Internal teemperature(specified as an Environmental temperature) in degree celcius
##From example 9.1
A = numpy.array([150, 200 ,40 ,75 ,75 ,200 ,40 ,1000, 1000]);## in m^2
U = numpy.array([1.2, 1.2 ,5.6, 2, 1.2 ,1.2 ,5.6 ,0.7 ,0.9]);## in W/m-K
Qf = 58.3*10**3;## Fabric loss in production area in W
T2 = -3.;## in degree celcius
s1 =0.;
s2 = 0.;
for i in range (0,9):
s1 = s1+A[i];
s2 = s2+U[i]*A[i];
A_T = s1;## Total area in m^2
UA_T = s2;## sum of U*A in W/m-K (answer wrongly calculated in the book)
##From example 9.3
N_1 = 1.5;## Ventilation rate in the production area (air changes per hour)
V_P = 6000;## Voulme of production area in m^3
##As Qvent = C * (T1 - T2) & C = 0.33*N*V*(1 + ((UA_T)/(4.8*A_T)))
C = 0.33*N_1*V_P*(1. + ((UA_T)/(4.8*A_T)));
Q_vent = C * (T1 - T2);## in W
T_Q1 = Qf + Q_vent;## in W
print'%s %.2f %s'%('The total design loss is ',T_Q1,' W \n') ## (deviation in answer is due to error in calculation in the book)
##(b) Reduced heat loss
## The heat transfer coeffieint in this problem has been changed as U1
U1 = [0.44, 0.44, 2.8, 2, 0.44,0.44, 2.8, 0.44, 0.9];##in W/m^2-K
T = [21 ,21 ,21 ,-3 ,21 ,21 ,21 ,21 ,21];## Temperature difference in degree celcius
s3 = 0;
s4 = 0;
for i in range (0,9):
s3 = s3+U1[i]*A[i];
s4 = s4+U1[i]*A[i]*T[i];
U1A_T = s3;## in W/m-k (answer wrongly calculated in the book)
Q_loss = s4## in W
##As Qvent = C * (T1 - T2) & C = 0.33*N*V*(1 + ((UA_T)/(4.8*A_T)))
C = 0.33*N_1*V_P*(1 + ((U1A_T)/(4.8*A_T)))
Q_vent = C * (T1 - T2)## in W
T_Q2 = Q_loss + Q_vent## in W
Red = T_Q1 - T_Q2;## In W
print'%s %.2f %s'%('The reduction in loss is ',Red,' W') ## (deviation in answer is due to error in calculation in the book)
```

In [5]:

```
import math
## Example 9.5
print('Example 9.5\n\n');
print('Page No. 265\n\n');
##given
T = 21.;## Temperature difference in degree celcius
Deg_d = 2186.;## Total degree-days base(15.5 deg C) September_April
T_D = 18.;## Design Temperature in degree celcius
T_O = 4.;## base offset temperature in degree celcius
T_b = T_D - T_O;## Base temperature in degree celcius
## From Table 9.11 Correction factor for base tempratures other than 15.5 deg C is obtained. So for 14 deg c its 0.82
C = 0.82;## Correction factor
Do = Deg_d * C## Corrected degree-days
##(a) Original construction
##from example 9.4
Q_d_1 = 133.7*10**3;## Design heat loss in W
H_1 = Q_d_1/T;
##As E = 24 * H * Do - E = Energy consumption in (Wh)
E1 = (24.*H_1 *Do)/10**6;## in 10^6 Wh ( from this step 'Do' is mistakely taken as 1972 inplace of 1792 in the solution of the book, so there is deviation in answer)
E_1 = (E1 * 3600.)*10**6;## in J
print'%s %.2e %s'%('The total energy consumption in original construction is ',E_1,' J \n')## Deviation in the answer is due to some calculation error as mentioned above
##(b) Improved insulation
##from example 9.4
Q_d_2 = 104.4*10**3;## Design heat loss in W
H_2 = Q_d_2/T;
##As E = 24 * H * Do - E = Energy consumption in (Wh)
E2 = (24.*H_2 *Do)/10**6;## in 10^6 Wh ( from this step 'Do' is mistakely taken as 2972 inplace of 2792 in the solution of the book, so there is deviation in answer)
E_2 = (E2 * 3600.)*10**6;## in J
print'%s %.2e%s'%('The total energy consumption in improved insulation is ',E_2,' J \n')## Deviation in the answer is due to some calculation error as mentioned above
```

In [6]:

```
import math
## Example 9.6
print('Example 9.6\n\n');
print('Page No. 268\n\n');
##given
U1 = 5.6;## Single glazing heat transfer coefficient in W/m^2_K
U2 = 2.8;## Double glazing heat transfer coefficient in W/m^2_K
Ti = 21.;## Internal Temperature in degree celcius
To = -1.;## External Temperature in degree celcius
R_H = 0.5;## Relative humidity
Rs_i = 0.123;## Surface resistance in (W/m^2-K)^-1
## At 21 Degree celcius and R.H. = 0.5, the dew point is 10.5 degree celcius
Dew_pt = 10.5;## Dew point in degree celcius
##As Ts_i = Ti - (Rs_i * U *(Ti - To))
##(a) Single Glazing
Ts_i_S = Ti - (Rs_i * U1 *(Ti - To));## in degree celcius
print'%s %.2f %s'%('The internal surface temperature for single glazing is ',Ts_i_S,' deg C \n')
if (Dew_pt > Ts_i_S):
print('Surface condensation will occur since it is less than 10.5 deg C.')
else:
print('No surface condensation is expected as it is greater than 10.5 deg C.')
##(b) Double Glazing
Ts_i_D = Ti - (Rs_i * U2 *(Ti - To));## in degree celcius
print'%s %.2f %s'%('The internal surface temperature for single glazing is ',Ts_i_D,' deg C \n')
if (Dew_pt > Ts_i_D):
print('Surface condensation will occur since it is less than 10.5 deg C.')
else:
print('No surface condensation is expected since it is greater than 10.5 deg C.')
```

In [7]:

```
import math
## Example 9.7
print('Example 9.7\n\n');
print('Page No. 269\n\n');
##given
l_1 = 240.;## existing length of solid brick in mm
l_u = 25.;## upgraded internal lining in mm
l_e = 9.5;## Expanded polystyrenne in mm
T_i = 20.;## Internal temperature in degre celcius
R_H_i = 50.;## Internal Relative humidity in percent
T_e = 0.;## External temperature in degre celcius
R_H_e = 90.;## External Relative humidity in percent
K = ([0.123, 0.059 ,0.714, 0.286, 0.055]);## Thermal resistance in W/m^2-K
V_r = ([0.0, 0.475 ,3.57 ,9.60 ,0.0]);## Vapour Resistance in 10^9 N-s/kg
##Refer Figure 9.3
##From Figure 9.3, the tempeature, dew point, vapour pressure for different interface are obtained
T = ([18.01, 17.06, 5.51 ,0.89]);## Temperature in degree celcius
V_p = ([1170, 1148 ,986 ,550]);##Vapour pressure in N/m^2
D_P = ([9.5, 9.2, 7.1, -1.5]);## Dew point in degree celcius
h = (T_i - T_e)/sum (K);## in W/m^2
print'%s %.2f %s'%('The heat flow is ',h,' W/m^2 \n')
V_p_i = V_p[0];## Internal vapour pressure in N/m^2
V_p_e = V_p[3];## External vapour pressure in N/m^2
m = ((V_p_i - V_p_e)/sum(V_r))*10**-9;## in kg/s
print'%s %.2e %s'%('The vapour mass flow is ',m,' kg/s')
```

In [7]:

```
import math
import numpy
## Example 9.8
print('Example 9.8\n\n');
print('Page No. 275\n\n');
A_G_S=numpy.zeros
##given
A = 10.;## in m^2
S = 0.77;
Sa = 0.54;
##for South
print('\t\t\t SOUTH \n')
I1 = ([200 ,185 ,165 ,155 ,165 ,185 ,200]);## in W-m^2
I2 = ([500, 455 ,405 ,385, 405 ,455, 500]);## in W-m^2
A_G_S0 = (A*200*S) + (A*500*Sa)
A_G_S1 = (A*185*S) + (A*455*Sa)
A_G_S2 = (A*165*S) + (A*405*Sa)
A_G_S3 = (A*155*S) + (A*385*Sa)
A_G_S4 = (A*165*S) + (A*405*Sa)
A_G_S5 = (A*185*S) + (A*455*Sa)
A_G_S6 = (A*200*S) + (A*500*Sa)
print'%s %.2f %s'%('The monthly peak cooling loads for the month April is ',A_G_S0,' W \n')
print'%s %.2f %s'%('The monthly peak cooling loads for the month May is ',A_G_S1,' W \n')
print'%s %.2f %s'%('The monthly peak cooling loads for the month June is ',A_G_S2,' W \n')
print'%s %.2f %s'%('The monthly peak cooling loads for the month July is ',A_G_S3,' W \n')
print'%s %.2f %s'%('The monthly peak cooling loads for the month Aug. is ',A_G_S4,' W \n')
print'%s %.2f %s'%('The monthly peak cooling loads for the month Sept. is ',A_G_S5,' W \n\n')
##For east
print('\t\t\t EAST \n')
I3 = ([110, 150, 180 ,190 ,180 ,150 ,110]);## in W-m^2
I4 = ([435 ,510, 515, 505, 515 ,510 ,435]);## in W-m^2
A_G_E0 = (A*110*S) + (A*435*Sa)
A_G_E1 = (A*150*S) + (A*510*Sa)
A_G_E2 = (A*180*S) + (A*515*Sa)
A_G_E3 = (A*190*S) + (A*505*Sa)
A_G_E4 = (A*180*S) + (A*515*Sa)
A_G_E5 = (A*150*S) + (A*510*Sa)
A_G_E6 = (A*110*S) + (A*435*Sa)
print'%s %.2f %s'%('The monthly peak cooling loads for the month March is ',A_G_E0,' W \n')
print'%s %.2f %s'%('The monthly peak cooling loads for the month April is ',A_G_E1,' W \n')
print'%s %.2f %s'%('The monthly peak cooling loads for the month May is ',A_G_E2,' W \n')
print'%s %.2f %s'%('The monthly peak cooling loads for the month June is ',A_G_E3,' W \n')
print'%s %.2f %s'%('The monthly peak cooling loads for the month July is ',A_G_E4,' W \n')
print'%s %.2f %s'%('The monthly peak cooling loads for the month Aug. is ',A_G_E5,' W \n')
print'%s %.2f %s'%('The monthly peak cooling loads for the month Sept. is ',A_G_E6,' W \n\n')
```

In [11]:

```
import math
## Example 9.9
print('Example 9.9\n\n');
print('Page No. 277\n\n');
##given
A = 15.;## glazing area in m^2
l = 10.;## Length of office in m
h = 6.;## height of office in m
w = 3.5;## width of office in m
Y_w = 4.;## Admittance of wall in W/m^2-K
Y_f = 3.;## Admittance of floor in W/m^2-K
Y_c = 3.;## Admittance of ceiling in W/m^2-K
N = 1.5;##Ventilation rate (air changes per hour)
V = l*h*w;## Volume in m^3
U_G = 5.6;## Transmittance in W/m^2-K
##From table 9.18 and table 9.16
To = 16.5;## External temperature of June in degree celcius
T_O = 7.5;## Swing temperature in degre celcius
I = 155.; ##Vertical S in W-m^2
Is = 385.;##Vertical S in W-m^2
S = 0.77;## Solar gain factor
Sa = 0.54;## Solar gain factor
##As For the mean internal temperature -Ti = To + ((A*I*S)/((0.33*N*V) + (A*U_G)))
Ti = To + ((A*I*S)/((0.33*N*V) + (A*U_G)));## in degree celcius
print'%s %.2f %s'%('the mean internal temperature is ',Ti,' deg C \n')
A_G = (A*Is*Sa) + ((A*U_G) + (0.33*N*V))*T_O;## Swing in gain in W
Net_A = 2*((w*h) + (l*w)) - A;## Net wall area in m^2
A_f = l*h;## floor area in m^2
A_c = l*h;##ceiling area in m^2
A_Y_w = Net_A * Y_w;## Wall AY in W/K
A_Y_f = A_f * Y_f;## Floor AY in W/K
A_Y_c = A_c * Y_c;## ceiling AY in W/K
A_Y_wi = 84.;## Window AY in W/K
Net_AY = A_Y_w + A_Y_f + A_Y_c + A_Y_wi## in W/K
Ti_s = ((A_G)/((0.33*N*V) + (Net_AY)))## Internal Temperature swing in deg C
T_p = Ti + Ti_s;## in deg C
print'%s %.2f %s'%('Peak internal temperature is ',T_p,' deg C') ## Deviation in the answer is due to some calculation approximation in the book
```