In [1]:

```
#pg 612
print('Example 18.1');
# aim : To determine
# (a) the coefficient of performance
# (b) the mass flow of the refrigerant
# (c) the cooling water required by the condenser
import math
from math import log
# given values
P1 = 462.47;# pressure limit, [kN/m**2]
P3 = 1785.90;# pressure limit, [kN/m**2]
T2 = 273.+59;# entering saturation temperature, [K]
T5 = 273.+32;# exit temperature of condenser, [K]
d = 75*10**-3;# bore, [m]
L = d;# stroke, [m]
N = 8;# engine speed, [rev/s]
VE = .8;# olumetric efficiency
cpL = 1.32;# heat capacity of liquid, [kJ/kg K]
c = 4.187;# heat capacity of water, [kj/kg K]
# solution
# from given table
# at P1
h1 = 231.4;# specific enthalpy, [kJ/kg]
s1 = .8614;# specific entropy,[ kJ/kg K
v1 = .04573;# specific volume, [m**3/kg]
# at P3
h3 = 246.4;# specific enthalpy, [kJ/kg]
s3 = .8093;# specific entropy,[ kJ/kg K
v3 = .04573;# specific volume, [m**3/kg]
T3= 273+40;# saturation temperature, [K]
h4 = 99.27;# specific enthalpy, [kJ/kg]
# (a)
s2 = s1;# specific entropy, [kJ/kg k]
# using s2=s3+cpv*log(T2/T3)
cpv = (s2-s3)/log(T2/T3);# heat capacity, [kj/kg k]
# from Fig.18.8
T4 = T3;
h2 = h3+cpv*(T2-T3);# specific enthalpy, [kJ/kg]
h5 = h4-cpL*(T4-T5);# specific enthalpy, [kJ/kg]
h6 = h5;
COP = (h1-h6)/(h2-h1);# coefficient of performance
print ' (a) The coefficient of performance of the refrigerator is = ',round(COP,2)
# (b)
SV = math.pi/4*d**2*L;# swept volume of compressor/rev, [m**3]
ESV = SV*VE*N*3600;# effective swept volume/h, [m**3]
m = ESV/v1;# mass flow of refrigerant/h,[kg]
print ' (b) The mass flow of refrigerant/h is (kg) = ',round(m,2)
# (c)
dT = 12;# temperature limit, [C]
Q = m*(h2-h5);# heat transfer in condenser/h, [kJ]
# using Q=m_dot*c*dT, so
m_dot = Q/(c*dT);# mass flow of water required, [kg/h]
print ' (c) The mass flow of water required is (kg/h) = ',round(m_dot,2)
print 'The answer is a bit different due to rounding off error in textbook'
# End
```

In [2]:

```
#pg 614
print('Example 18.2');
# aim : To determine
# (a) the mass flow of R401
# (b) the dryness fraction of R401 at the entry to the evaporator
# (c) the power of driving motor
# (d) the ratio of heat transferred from condenser to the power required to the motor
from math import log
# given values
P1 = 411.2;# pressure limit, [kN/m^2]
P3 = 1118.9;# pressure limit, [kN/m^2]
Q = 100*10**3;# heat transfer from the condenser,[kJ/h]
T2 = 273+60;# entering saturation temperature, [K]
# given
# from given table
# at P1
h1 = 409.3;# specific enthalpy, [kJ/kg]
s1 = 1.7431;# specific entropy,[ kJ/kg K
# at P3
h3 = 426.4;# specific enthalpy, [kJ/kg]
s3 = 1.7192;# specific entropy,[ kJ/kg K
T3 = 273.+50;# saturation temperature, [K]
h4 = 265.5;# specific enthalpy, [kJ/kg]
# (a)
s2 = s1;# specific entropy, [kJ/kg k]
# using s2=s3+cpv*log(T2/T3)
cpv = (s2-s3)/log(T2/T3);# heat capacity, [kj/kg k]
# from Fig.18.8
h2 = h3+cpv*(T2-T3);# specific enthalpy, [kJ/kg]
Qc = h2-h4;# heat transfer from condenser, [kJ/kg]
mR401 = Q/Qc;# mass flow of R401, [kg]
print ' (a) The mass flow of R401 is (kg/h) = ',round(mR401,1)
# (b)
hf1 = 219;# specific enthalpy, [kJ/kg]
h5 = h4;
# using h5=hf1+s5*(h1-hf1),so
x5 = (h5-hf1)/(h1-hf1);# dryness fraction
print ' (b) The dryness fraction of R401 at the entry to the evaporator is = ',round(x5,3)
# (c)
P = mR401*(h2-h1)/3600/.7;# power to driving motor, [kW]
print ' (c) The power to driving motor is (kW) = ',round(P,2)
# (d)
r = Q/3600./P;# ratio
print ' (d) The ratio of heat transferred from condenser to the power required to the motor is = ',round(r,2),":1"
# End
```