In [2]:

```
T1 = 70+460; #70F = 70+460 R #Energy flows into the system at reservoir at constant temperature T1(unit:R)
T2 = 32+460; #32F = 32+460 R #Heat is rejected to the constant temperature T2(Unit:R)
print "Solution for a"
COP = T2/(T1-T2); #Coefficient of performance
print "Coefficient of performanceCOP) of the cycle is %.2f"%(COP);
print "Solution for b"
Qremoved = 1000; #Unit:Btu/min #heat removal
WbyJ = Qremoved/COP; #The power required #Unit:Btu/min
print "The power required is %.2f Btu/min"%(WbyJ);
print "Solution for c"
Qrej = Qremoved+WbyJ; #The rate of heat rejected to the room #Unit:Btu/min
print "The rate of heat rejected to the room is %.2f Btu/min"%(Qrej);
```

In [4]:

```
T1 = 20+273; #20C = 20+273 R #Energy flows into the system at reservoir at constant temperature T1(unit:R)
T2 = -5+273; #-5C = -5+273 R #Heat is rejected to the constant temperature T2(Unit:R)
print "Solution for a"
COP = T2/(T1-T2); #Coefficient of performance
print "Coefficient of performanceCOP) of the cycle is %.2f"%(COP);
print "Solution for b"
Qremoved = 30; #Unit:kW #heat removal
W = Qremoved/COP; #power required #unit:kW
print "The power required is %.2f kW "%(W);
print "Solution for c"
Qrej = Qremoved+W; #The rate of heat rejected to the room #Unit:kW
print "The rate of heat rejected to the room is %.2f kW"%(Qrej);
```

In [6]:

```
T1 = 70+460; #70F = 70+460 R #Energy flows into the system at reservoir at constant temperature T1(unit:R)
T2 = 20+460; #20F = 20+460 R #Heat is rejected to the constant temperature T2(Unit:R)
print "Solution for a"
COP = T2/(T1-T2); #Coefficient of performance
print "Coefficient of performanceCOP) of the cycle is %.2f"%(COP);
print "Solution for b"
HPperTOR = 4.717/COP; #Horsepower per ton of refrigeration #Unit:hp/ton
COPactual = 2; #Actual Coefficient of performance(COP) is stated to be 2
HPperTORactual = 4.717/COPactual; #Horsepower per ton of refrigeration(actual) #Unit:hp/ton
print "The horsepower required by the actual cycle over the minimum is %.2f hp/ton"%(HPperTORactual-HPperTOR);
```

In [1]:

```
from numpy.linalg import inv
COP = 4.5; #Coefficient of performance #From problem 10.1
HPperTOR = 4.717/COP; #Horsepower per ton of refrigeration #Unit:hp/ton
Qremoved = 1000; #Unit:Btu/min #From problem 10.1
#1000 Btu/min /200 Btu/min ton = 5 tons of refrigeration
HPrequired = HPperTOR*5; #The horsepower required #unit:hp
print "The horsepower required is %.2f hp"%(HPrequired);
#In problem 10.1, 77.2 Btu/min was required
print "The power required is %.2f hp"%(77.2*778*inv([[33000]])); #1 Btu = 778 ft*lbf #1 min*hp = 33000 ft*lbf
#The ratio of the power required in each problem is the same as the inverse ratio of the COP value
#Therefore,
print "The power required is %.2f hp"%((COP/12.95)*HPrequired); #COPin problem 10.1) = 12.95
print "This checks our results"
```

In [8]:

```
# given data
COP = 10.72; #In the problem 10.2 #Coefficient of performance
P = 2.8; #In the problem 10.2 #The power was 2.8 kW
COPactual = 3.8; #Actual Coefficient of performance(COP)
# calculation
power = P*COP/COPactual; #The power required #unit:kW
# results
print "The power required is %.2f kW"%(power)
```

In [10]:

```
#From Appendix 3,at 120psia,the corresponding saturation temperature is 66 F, enthalpies are
h1 = 116.0; #Unit:Btu/lbm #enthalpy
h2 = 116.0; #Unit:Btu/lbm #Throttling gives h1 = h2 #enthalpy
h3 = 602.4; #Unit:Btu/lbm #enthalpy
#From the consideration that s3 = s4,h4 is found at 15 psia,
s3 = 1.3938; #s = entropy #Unit:Btu/(lbm*F)
#Therefore by interpolation in the superheat tables at 120 psia,
t4 = 237.4; #Unit:fahrenheit #temperature
h4 = 733.4; #Unit:Btu/lbm #enthalpy
print "Solution for a"
COP = (h3-h1)/(h4-h3); #Coefficient of performance
print "Coefficient of performance is %.2f"%(COP);
print "Solution for b"
print "The work of compression is %.2f Btu/lbm"%(h4-h3);
print "Solution for c"
print "The refrigatering effect is %.2f Btu/lbm"%(h3-h1);
print "Solution for d"
tons = 30; #capacity of 30 tons is desired
print "The pounds per minute of ammonia required for ciculation is %.2f lbm/min"%((200*tons)/(h3-h1));
print "Solution for e"
print "The ideal horsepower per ton of refrigeration is %.2f hp/ton"%((4.717*h4-h3)/(h3-h1));
```

In [12]:

```
#From Appendix 3,110 psig corresponds to 96 F, enthalpies are
h1 = 30.14; #Unit:Btu/lbm #enthalpy
h2 = 30.14; #Unit:Btu/lbm #Throttling gives h1 = h2 #enthalpy
h3 = 75.110; #Unit:Btu/lbm #enthalpy
#From the consideration that s3 = s4,at -20F,
s3 = 0.17102; #Unit:Btu/(lbm*F) #s = entropy
#Therefore by interpolation in the Freon-12 superheat table at these values,
h4 = 89.293; #Unit:Btu/lbm #enthalpy
print "Solution for a"
COP = (h3-h1)/(h4-h3); #Coefficient of performance
print "Coefficient of performance is %.2f"%(COP);
print "Solution for b"
print "The work of compression is %.2f Btu/lbm"%(h4-h3);
print "Solution for c"
print "The refrigatering effect is %.2f Btu/lbm"%(h3-h1);
print "Solution for d";
tons = 30; #capacity of 30 tons is desired
print "The pounds per minute of ammonia required for ciculation is %.2f lbm/min"%((200*tons)/h3-h1);
print "Solution for e"
print "The ideal horsepower per ton of refrigeration is %.2f hp/ton"%((4.717*h4-h3)/(h3-h1))
```

In [13]:

```
#From Appendix 3,Using the Freon-12 tables, enthalpies are
h1 = 28.713; #Unit:Btu/lbm #enthalpy
h2 = 28.713; #Unit:Btu/lbm #Throttling gives h1 = h2 #enthalpy
h3 = 78.335; #Unit:Btu/lbm #enthalpy
#From the consideration that s3 = s4,
s3 = 0.16798; #Unit:Btu/(lbm*F) #s = entropy
#Therefore by interpolation in the superheat tables at 90 F,
s = 0.16798; #entropy at 90F #Btu/lbm*F
h4 = 87.192; #Unit:Btu/lbm #enthalpy
print "The heat extracted is %.2f Btu/lbm"%(h3-h1);
print "The work required is %.2f Btu/lbm"%(h4-h3);
COP = (h3-h1)/(h4-h3); #Coefficient of performance
print "The Coefficient of performanceCOP) of this ideal cycle is %.2f"%(COP);
```

In [14]:

```
#From Appendix 3,Using the HFC-134a tables, enthalpies are
h1 = 41.6; #Unit:Btu/lbm #enthalpy
h2 = 41.6; #Unit:Btu/lbm #Throttling gives h1 = h2 #enthalpy
h3 = 104.6; #Unit:Btu/lbm #enthalpy
#From the consideration that s3 = s4,
s3 = 0.2244; #Unit:Btu/(lbm*F) #s = entropy
h4 = 116.0; #Unit:Btu/lbm #enthalpy
print "The heat extracted is %.2f Btu/lbm"%(h3-h1);
print "The work required is %.2f Btu/lbm"%(h4-h3);
COP = (h3-h1)/(h4-h3); #Coefficient of performance
print "The Coefficient of performanceCOP) of this ideal cycle is %.2f"%(COP);
```

In [15]:

```
print "Solution for a";
#By defination,the efficiency of the compressor is the ratio of the ideal compression work to actual compression work.
#Based on the points on fig.10.12, #n = (h4-h3)/(h4'-h3);
#There is close correspondence between 5.3 psia and -60F for saturated conditions.Therefore,state 3 is a superheated vapour at 5.3 psia and approximately -20F,because the problem states
#that state 3 has a 40F superheat.Interpolation in the Freon tables in Appendix 3 yields
T = -20; #Unit:F #temperature
# p h s
#7.5 75.719 0.18371
#5.3 76.885 0.18985 h3 = 75.886 Btu/lbm
#5.0 75.990 0.19069
#At 100 psia and s = 0.18985,
# t s h
# 170F 0.18996 100.571
# 169.6F 0.18985 100.5 h4 = 100.5 Btu/lbm
# 160F 0.18726 98.884
#The weight of refrigerant is given by
# 200(tons)/(h3-h1) = (200*5)/(75.886-h1)
#In the saturated tables,h1 is
# p h
# 101.86 26.832
# 100psia 26.542
# 98.87 26.365
#m = mass flow/min
h1 = 26.542; #enthalpy #Unit:Btu/lbm
n = 0.8; #Efficiency
h4 = 100.5; #enthalpy #Unit:Btu/lbm
h3 = 75.886; #enthalpy #Unit:Btu/lbm
m = (200*5)/(75.886-h1); #mass
h4dashminush3 = (h4-h3)/n;
#Total work of compression = m*(h4minush3)
J = 778; #J = Conversion factor
work = (h4dashminush3*m*J)/33000; #1 horsepower = 33,000 ft*LBf/min #Unit:hp #work
print "%.2f horsepower is required to drive the compressor if it has a mechanical efficiency 100percentage"%(work);
print "Solution for b";
#Assuming a specific heat of the water as unity,we obtain
#From part (a),
#h4'-h3 = h4minush3
h4dash = h4dashminush3+h3; #Unit:Btu/lbm
mdot = (m*(h4dash-h1))/(70-60); #water enters at 60F and leaves at 70F #the required capacity in lbm/min
print "%.2f lbm/min of cooling water i.e. %.2f gal/min is the required capacity of cooling water to pump"%(mdot,mdot/8.3);
```

In [17]:

```
print "Solution for a";
#From appendix3,reading the p-h diagram directly,we have
h3 = 76.2; #Unit:Btu/lbm #Enthalpy
h4 = 100.5; #Unit:Btu/lbm #Enthalpy
n = 0.8; #Efficiency #From 10.10
work = (h4-h3)/n; #Work of compression #Unit:Btu/lbm
#The enthalpy of saturated liquid at 100 psia is given at 26.1 Btu/lbm.Proceeding as before yields
m = (200*5)/(h3-26.1); #Unit:lbm/min #m = massflow/min
J = 778; #J = Conversion factor
totalwork = (m*work*J)/33000; #1 horsepower = 33,000 ft*LBf/min #total ideal work #unit:hp
print "Total ideal work of compression is %.2f hp"%(totalwork);
print "Solution for b";
h4dash = h3+work; #Btu/lbm
mdot = (m*(h4dash-26.5))/(70-60); #water enters at 60F and leaves at 70F #the required capacity in lbm/min
print "%.2f lbm/min of cooling water i.e. %.2f gal/min is the required capacity of cooling water to pump"%(mdot,mdot/8.3);
```

In [21]:

```
# given data
COP = 2.5; #Coefficient of performance
cp = 0.24; #Unit:Btu/(lbm*R) #Specific heat constant for constant pressure process
T1 = -100+460; #temperatures converted to absolute temperatures; #Unit:R #lowest temperature of the cycle
T3 = 150+460; #temperatures converted to absolute temperatures; #Unit:R #Upper temperature of the cycle
#T1/T4-T1 = COP
T4 = (3.5*T1)/COP; #Unit:R #temperature at point 4
#T2/T3-T2 = COP
T2 = (COP*T3)/3.5; #Unit:R #temperature at point 2
print "The work of the expander is %.2f Btu/lbm of air"%(cp*T4-T1);
print "The work of the compressor is %.2f Btu/lbm of air"%(cp*T3-T2);
print "The net work required by the cycle is %.2f Btu/lbm"%(((cp*T3-T2))-cp*(T4-T1));
print "Per ton of refrigeration, the required airflow is %.2f lbm/min per ton"%((200/cp*T2-T1))
```

In [22]:

```
#A VACUUM REFRIGERATION SYSTEM
#A vacuum refrigeration system is used to cool water from 90F to 45F
h1 = 58.07; #Unit:Btu/lbm #enthalpy
h2 = 13.04; #Unit:Btu/lbm #enthalpy
h3 = 1081.1; #Unit:Btu/lbm #enthalpy
m1 = 1; #mass #unit:lbm
#m2 = 1-m3 #unit:lbm
#Now, m1*h1 = m2*h2 + m3*h3
#Putting the values and arranging the equation,
m3 = (m1*h1-h2)/(h3+h2); #The mass of vapour that must be removed per pound #unit:lbm
# results
print "The mass of vapour that must be removed per pound of entering water is %.2f lbm"%(m3);
```

In [23]:

```
#In problem 10.13,
#A VACUUM REFRIGERATION SYSTEM
#A vacuum refrigeration system is used to cool water from 90F to 45F
h1 = 58.07; #Unit:Btu/lbm #enthalpy
h2 = 13.04; #Unit:Btu/lbm #enthalpy
h3 = 1081.1; #Unit:Btu/lbm #enthalpy
m1 = 1; #mass #lbm
#m2 = 1-m3 #unit:lbm
#Now, m1*h1 = m2*h2 + m3*h3
#Putting the values and arranging the equation,
m3 = (m1*h1-h2)/(h3+h2); #The mass of vapour that must be removed per pound #unit:lbm
m2 = 1-m3; #mass #unit:lbm
print "The mass of vapour that must be removed per pound of entering water is %.2f lbm"%(m3);
#Now,in problem 10.14,
#The refrigeration effect can be determined as m3*(h3-h1) or m2*(h1-h2)
print "The refrigeration effect Using eqn m3*h3-h1) is %.2f Btu/lbm"%(m3*h3-h1)
print "The refrigeration effect Using eqn m2*h1-h2) is %.2f Btu/lbm"%(m2*h1-h2)
```

In [24]:

```
#THE HEAT PUMP
T1 = 70.+460; #70F = 70+460 R #Energy flows into the system at reservoir at constant temperature T1(unit:R) #from problem 10.1
T2 = 32+460; #32F = 32+460 R #Heat is rejected to the constant temperature T2(Unit:R) #from problem 10.1
COP = T1/(T1-T2); #Coefficient of performance for carnot heat pump
print "Coefficient of performanceCOP) of the carnot cycle is %.2f"%(COP);
print "The COP can also be obtained from the energy items solved for in problem 10.1"
#In problem 10.1, The power was found to be 77.2 Btu/min and the total tare of heat rejection was 1077.2 Btu/min
#Therefore,
print "Coefficient of performanceCOP) of the cycle is %.2f"%(1077.2/77.2);
```

In [27]:

```
#Let us first consider the cycle as a refrigeration cycle
#In problem 10.1
T1 = 70+460; #70F = 70+460 R #Energy flows into the system at reservoir at constant temperature T1(unit:R)
T2 = 0+460; #0F = 32+460 R #Heat is rejected to the constant temperature T2(Unit:R)
COP = T2/(T1-T2); #Coefficient of performance
print "Coefficient of performanceCOP) of the cycle is %.2f"%(COP);
Qremoved = 1000; #Unit:Btu/min #heat removal
WbyJ = Qremoved/COP; #the power input #unit:Btu/min
print "The power input is %.2f Btu/min"%(WbyJ);
Qrej = Qremoved+WbyJ; #The rate of heat rejected to the room #Unit:Btu/min
print "The rate of heat rejected to the room is %.2f Btu/min"%(Qrej);
print "The COP as a heat pump is %.2f"%(Qrej/WbyJ);
print "As a check, COP of heat pump is %.2f = 1 + COP of carnot cycle %.2f"%(Qrej/WbyJ,COP);
```