# Appendix B¶

## Example 3¶

In [1]:
# -*- coding: utf8 -*-
from __future__ import division
#Example: 13.3
'''Consider 100 m 3 of an air–water vapor mixture at 0.1 MPa, 35◦C, and 70% relative
humidity. Calculate the humidity ratio, dew point, mass of air, and mass of vapor.'''

#Variable Declaration:
r = 0.70			#relative humidity
Pg = 5.628			#saturation pressure in kPa
P = 100				#net pressure kPa
V = 100				#volume in m**3
Ra = 0.287			#gas constant for water vapour
T = 308.2			#Temperature in K

#Calculations:
Pv = r*Pg			#vapour pressure in kPa
Pa = P-Pv			#Partial pressure of air
w = 0.622*Pv/Pa		#humidity ratio formula
ma = Pa*V/(Ra*T)	#mass in kg
mv = w*ma			#mass of vapour

#Results:
print 'Mass of vapour: ', round(mv,2),'Kg'

Mass of vapour:  2.77 Kg


## Example 4¶

In [2]:
# -*- coding: utf8 -*-
from __future__ import division
#Example: 13.4
'''Calculate the amount of water vapor condensed if the mixture of Example 13.3 is cooled
to 5◦C in a constant-pressure process.'''

#Variable Declaration:
w1 = 0.0255		#w1 = w, humidity ratio at initial temperature
ma = 108.6		#mass of air in kg
P = 100			#kPa net pressure
Pg2 = 0.8721

#Calculations:
Pv2 = Pg2
w2 = 0.622*Pv2/(P-Pg2)
mc = ma*(w1-w2)

#Results:
print 'Mass of vapour condense',round(mc,3) ,'Kg'

Mass of vapour condense 2.175 Kg


## Example 5¶

In [3]:
# -*- coding: utf8 -*-
from __future__ import division
#Example: 13.5
''' An air-conditioning unit is shown in Fig. 13.5, with pressure, temperature, and relative
humidity data. Calculate the heat transfer per kilogram of dry air, assuming that changes
in kinetic energy are negligible.'''

#Variable Declaration:
r1 = 0.80				#realtive humidity at state 1
Pg1 = 4.246				#saturation pressure of vapour in kPa
P1 = 105				#net pressure at state 1 in kPa
P2 = 100				#net pressure at state 2 in kPa
r2 = 0.95				#relative humidity at state 2
Pg2 = 1.7051			#saturation pressure of vapour in kPa
T1 = 30					#C
T2 = 15					#C
Cp = 1.004				#specific heat of water vapour in kJ/kg
hv2 = 2528.9			#enthalpy of vapourisation of vapour in kJ/kg
hv1 = 2556.3			#enthalpy of vapourisation of vapour in kJ/kg
hl2 = 62.99

#Calculations:
Pv1 = r1*Pg1			#partial pressure of vapour in kPa
w1 = 0.622*Pv1/(P1-Pv1)	#humidity ratio at state 1
Pv2 = r2*Pg2			#partial pressure of vapour in kPa
w2 = 0.622*Pv2/(P2-Pv2)	#humidity ratio at state 2
q = Cp*(T2-T1)+w2*hv2-w1*hv1+hl2*(w1-w2)		#kJ/kg

#Results:
print 'Heat transferred per unit mass: ',round(q,2),' kJ/kg of dry air'

Heat transferred per unit mass:  -41.65  kJ/kg of dry air


## Example 6¶

In [4]:
# -*- coding: utf8 -*-
from __future__ import division
#Example: 13.6
''' A tank has a volume of 0.5 m 3 and contains nitrogen and water vapor. The temperature
of the mixture is 50◦C, and the total pressure is 2 MPa. The partial pressure of the water
vapor is 5 kPa. Calculate the heat transfer when the contents of the tank are cooled to
10◦C.'''

#Variable Declaration:
Pn2 = 1995				#Pressure of nitrogen in kPa
V = 0.5					#Volume in m**3
Rn2 = 0.2968			#Gas constant for nitrogen in kJ/kg.K
Rv = 0.4615				#gas constant for vapour
T1 = 323.2				#Temperature in K
T2 = 283.2				#Temperature in K
Pv1 = 5					#Pressure of water vapour in kPa at state 1
Pv2 = 1.2276			#Pressure of water vapour in kPa at state 2
uv1 = 2443.1			#specific internal energy of vapour in kJ/kg at state 1
uv2 = 2389.2			#specific internal energy of vapour in kJ/kg at state 2
ul2 = 42.0				#specific internal energy of liquid water in kJ/kg
Cv = 0.745				#specific heat at constant volume in kJ/kg.K

#Calculations:
mn2 = Pn2*V/(Rn2*T1)	#mass of nitrogen
mv1 = Pv1*V/(Rv*T1)		#mass of vapour in kg
mv2 = Pv2*V/(Rv*T2)		#mass of vapour in kg
ml2 = mv1-mv2			#mass of liquid condensed n kg
Q = mn2*Cv*(T2-T1)+mv2*uv2+ml2*ul2-mv1*uv1

#Results:
print 'Heat transferred',round(Q,1),'kJ'

Heat transferred -339.1 kJ


## Example 7¶

In [5]:
# -*- coding: utf8 -*-
from __future__ import division
#Example: 13.7
'''The pressure of the mixture entering and leaving the adiabatic saturator is 0.1 MPa, the
entering temperature is 30◦C, and the temperature leaving is 20◦C, which is the adiabatic
saturation temperature. Calculate the humidity ratio and relative humidity of the air–water
vapor mixture entering.'''

#Variable Declaration:
P = 100				#net pressure n kPa
Pg2 = 2.339			#saturation pressure of vapour in kPa
Cpa = 1.004			#specific heat n kJ/kg/K
T2 = 20				#final temp in C
T1 = 30				#initial temp in C
Hfg2 = 2454.1		#specific heat difference at state 2 in kJ/kg
hv1 = 2556.3		#enthalpy of water vapour at state 1 in kJ/kg
hl2 = 83.96			#enthalpy of liquid water in kJ/kg
Pg1 = 4.246			#saturation pressure at state 1 in kPa

#Calculations:
Pv2 = Pg2			#partial pressure of vapour
w2 = 0.622*Pv2/(P-Pg2)
w1 = (Cpa*(T2-T1)+w2*Hfg2)/(hv1-hl2)
Pv1 = 100*w1/(0.622+w1)
r = Pv1/Pg1			#humidity ratio

#Results:
print 'Relative humidity: ',round(w1,4)
print 'Humidity ratio: ',round(r,3)

Relative humidity:  0.0107
Humidity ratio:  0.399