In [2]:

```
from __future__ import division
import math
# Initialization of Variable
P1 = 8E6 #Pa
P2 = 0.008E6 #Pa
Wtdot = 100E6 #W
T1 = 15 #degC
T2 = 35 #degC
#Calculations:
#from Table T-3
h1 = 2758.0 #kJ/kg
s1 = 5.7432 #kJ/kg-K
sf = 0.5926 #kJ/kg-K
sg = 8.2287 #kJ/kg-K
s2 = s1
hf = 173.88 #kJ/kg
hfg = 2403.1 #kJ/kg
#qualty at 2
x2 = (s2 - sf)/(sg - sf)
#enthalpy at 2
h2 = hf + x2*hfg
#from Table T-3
h3 = 173.88 #kJ/kg
v3 = 1.0084E-3 #specific vol in m3/kg
P4 = P1
P3 = P2
#enthalpy at 4
h4 = h3 + v3*(P4 - P3)/1000
#thermal Efficiency
n = ((h1-h2)-(h4-h3))/(h1-h4)
#back work ratio
bwr = (h4-h3)/(h1-h2)
#mass flow rate of steam
mdot = Wtdot*3.600/((h1-h2)-(h4-h3))
#heat transfer rate in to the working fluid through the boiler
Qindot = mdot*(h1-h4)/3600000
#heat transfer rate fromom the condensing steam as it passes through the condenser
Qoutdot = mdot*(h2 - h3)/3600000
#mass flow rate of the condenser cooling water
#from Table T-2
hcwout = 146.68 #kJ/kg
hcwin = 62.99 #kJ/kg
#
mcwdot = mdot*(h2 - h3)/(hcwout - hcwin)
#Results
print "a)thermal efficiency is", round(n*100,1),"%"
print "b)back work ratio is", round(bwr*100,2),"%"
print "c)mass flow rate of steam is", round(mdot,0),"kg/h"
print "d)energy inflow rate is",round(Qindot,2),"MW"
print "e)energy outflow rate is",round(Qoutdot,2),"MW"
print "f)mass flow rate of cooling water is",round(mcwdot,0),"kg/h"
```

In [3]:

```
from __future__ import division
import math
# Initialization of Variable
P1 = 8E6 #Pa
P2 = 0.008E6 #Pa
Wtdot = 100E6 #W
T1 = 15 #degC
T2 = 35 #degC
nt = 0.85
#Calculations:
#from Table T-3
h1 = 2758.0 #kJ/kg
s1 = 5.7432 #kJ/kg-K
h2s = 1794.8 #kJ/kg
#specific enthalpy at 2
h2 = h1 - nt*(h1 - h2s)
#from Table T-3
h3 = 173.88 #kJ/kg
v3 = 1.0084E-3 #specific vol in m3/kg
P4 = P1
P3 = P2
#enthalpy at 4
h4 = h3 + v3*(P4 - P3)/(1000*nt)
#thermal Efficiency
n = ((h1-h2)-(h4-h3))/(h1-h4)
#mass flow rate of steam
mdot = Wtdot*3.600/((h1-h2)-(h4-h3))
#heat transfer rate in to the working fluid through the boiler
Qindot = mdot*(h1-h4)/3600000
#heat transfer rate fromom the condensing steam as it passes through the condenser
Qoutdot = mdot*(h2 - h3)/3600000
#mass flow rate of the condenser cooling water
#from Table T-2
hcwout = 146.68 #kJ/kg
hcwin = 62.99 #kJ/kg
#
mcwdot = mdot*(h2 - h3)/(hcwout - hcwin)
#Results
print "a)thermal efficiency is", round(n*100,1),"%"
print "b)mass flow rate of steam is", round(mdot,0),"kg/h"
print "c)energy inflow rate is",round(Qindot,1),"MW"
print "d)energy outflow rate is",round(Qoutdot,1),"MW"
print "e)mass flow rate of cooling water is",round(mcwdot,0),"kg/h"
```

In [20]:

```
from __future__ import division
import math
%pylab inline
# Initialization of Variable
P1 = 8 #MPa
T1 = 480 #degC
P2 = 0.7 #MPa
T2 = 480 #degC
Pcond = 0.008 #Mpa
T3 = 440 #degC
Wtdot = 100 #MW
nt = 0.85
#calculations:
##from Table T-4
h1 = 3348.4 #kJ/kg
s1 = 6.6586 #kJ/kg-K
s2 = s1
sf2 = 1.9922 #kJ/kg-K
sg2 = 6.708 #kJ/kg-K
hf2 = 697.22 #kJ/kg
hfg2 = 2066.3 #kJ/kg
#quality at 2
x2 = (s2 - sf2)/(sg2 - sf2)
#Enthalpy at 2
h2 = hf2 + x2*hfg2
#from Table T-4
h3 = 3353.3 #kJ/kg
s3 = 7.7571 #kJ/kg-K
s4 = s3
sf4 = 0.5926 #kJ/kg-K
sg4 = 8.2287 #kJ/kg-K
hf4 = 173.88 #kJ/kg
hfg4 = 2403.1 #kJ/kg
#quality at 4
x4 = (s4 - sf4)/(sg4 - sf4)
#enthalpy
h4 = hf4 + x4*hfg4
#from table T-4
h5 = 173.88 #kJ/kg
h6 = 181.94 #kJ/kg
#thermal eff
n1 = (h1 - h2 + h3 - h4 - h6 + h5)/(h1 - h6 + h3 - h2)
#mass flow rate of steam
mdot = Wtdot*3600*1000/(h1 - h2 + h3 - h4 - h6 + h5)
#rate of heat transfer from the condensing steam to the cooling water
Qoutdot = mdot*(h4 - h5)/(3600*1000)
h2s = h2
h4s = h4
#specific enthalpy at the exit of the first-stage turbine
h2 = h1 - nt*(h1 - h2s)
#specific enthalpy at the exit of the second-stage turbine
h4 = h3 - nt*(h3 - h4s)
#thermal efficiency
n2 = (h1 - h2 + h3 - h4 - h6 + h5)/(h1 - h6 + h3 - h2)
#creating empty lists for plotting
cte = []
ite = []
for t in range(0, 16):
ite.append((t+85)/100)
k=(t+85)/100
h2 = h1 - k*(h1 - h2s)
h4 = h3 - k*(h3 - h4s)
cte.append((h1 - h2 + h3 - h4 - h6 + h5)/(h1 - h6 + h3 - h2))
# plots
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.plot(ite,cte)
xlabel('Isentropic Turbine Efficiency')
ylabel('Cycle thermal efficiency')
title('Thermal efficiency vs Turbine stage efficiency')
show()
#Results
print "a)thermal efficiency is", round(n1*100,1),"%"
print "b)mass flow rate of steam is", round(mdot,0),"kg/h"
print "c)energy outflow rate is", round(Qoutdot,0),"MW"
print "d)thermal efficiency is", round(n2*100,1),"%"
```

In [5]:

```
from __future__ import division
import math
# Initialization of Variable
P1 = 8 #MPa
T1 = 480 #degC
P6 = 0.7 #MPa
Pcond = 0.008 #Mpa
Wtdot = 100 #MW
nt = 0.85
#calculations:
#from example 8.3,
h1 = 3348.4 #kJ/kg
s1 = 6.6586 #kJ/kg-K
s2 = 6.8606 #kJ/kg-K
h2 = 2832.8 #kJ/kg
h4 = 173.88 #kJ/kg
s3s = s2
#from Table T-4
x3s = 0.8208
h3s = 2146.3 #kJ/kg
h6 = 697.22 #kJ/kg
#enthalpy at 3, 5 and 7
h3 = h2 - nt*(h2 - h3s)
#
P5 = P6
P4 = Pcond
P7 = P1
v4 = 1.0084E-3 #specific vol in m3/kg
v6 = 1.1080E-3 #in m3/kg
#
h5 = h4 + v4*(P5 - P4)*1000
h7 = h6 + v6*(P7 - P6)*1000
#fraction y of the flow extraced at 2
y = (h6 - h5)/(h2 - h5)
#total turbine work output
Wtm1dot = (h1 - h2) + (1 - y)*(h2 - h3)
#total pump work per unit of mass passing through the first-stage turbine
Wpm1dot = (h7 - h6) + (1 - y)*(h5 - h4)
#heat added in the steam generator per unit of mass passing through the first-stage turbine
Qinm1dot = h1 - h7
#thermal eff
n = (Wtm1dot - Wpm1dot)/Qinm1dot
#mass flow rate
m1dot = Wtdot*3600*1000/(Wtm1dot - Wpm1dot)
#Results
print "a)thermal efficiency is", round(n*100,1),"%"
print "b)mass flow rate is", round(m1dot,0),"kg/h"
```

In [6]:

```
from __future__ import division
import math
# Initialization of Variable
Tc = 0 #degC
Th = 26 #degC
mdot = 0.08 #kg/s
#calculations:
#from Table T-6
h1 = 247.33 #kJ/kg
s1 = 0.9190 #kJ/kg-K
P2 = 6.853 #bar
h2s = 264.7 #kJ/kg
h3 = 85.75 #kJ/kg
h4 = h3
#compressor work input
Wcdot = mdot*(h2s - h1)
#heat transfer rate to the refrigerant passing through the evaporator
Qindot = mdot*60*(h1 - h4)/211
#coeff of performance
b = (h1 - h4)/(h2s - h1)
bmax = (Tc + 273)/(Th - Tc)
#Results
print "a) compressor work input is", round(Wcdot,1),"kW"
print "b) refrigration capacity is", round(Qindot,2),"ton"
print "c) coefficient of performanceis", round(b,2)
print "d) maximum coefficient of performance is", round(bmax,1)
```

In [7]:

```
from __future__ import division
import math
# Initialization of Variable
Tc = 0 #degC
Th = 26 #degC
mdot = 0.08 #kg/s
P2 = 9 #bar
T1 = -10 #degC
#calculations:
#from Table T-6
h1 = 241.35 #kJ/kg
s1 = 0.9253 #kJ/kg-K
h2s = 272.39 #kJ/kg
h3 = 99.56 #kJ/kg
h4 = h3
#compressor work input
Wcdot = mdot*(h2s - h1)
#heat transfer rate to the refrigerant passing through the evaporator
Qindot = mdot*60*(h1 - h4)/211
#coeff of performance
b = (h1 - h4)/(h2s - h1)
#Results
print "a) compressor work input is", round(Wcdot,2),"kW"
print "b) refrigration capacity is", round(Qindot,2),"ton"
print "c) coefficient of performanceis", round(b,2)
```

In [8]:

```
from __future__ import division
import math
# Initialization of Variable
Tc = 0 #degC
Th = 26 #degC
mdot = 0.08 #kg/s
P2 = 9 #bar
nc = 0.8
T1 = -10 #degC
T3 = 30 #degC
#calculations:
#from Table T-6
h1 = 241.35 #kJ/kg
s1 = 0.9253 #kJ/kg-K
h2s = 272.39 #kJ/kg
#enthalpy at 2
h2 = (h2s - h1)/nc + h1
#from table T-6
hf = 91.49 #kJ/kg
h3 = hf
h4 = h3
#compressor work input
Wcdot = mdot*(h2 - h1)
#heat transfer rate to the refrigerant passing through the evaporator
Qindot = mdot*60*(h1 - h4)/211
#coeff of performance
b = (h1 - h4)/(h2 - h1)
#Results
print "a) compressor work input is", round(Wcdot,2),"kW"
print "b) refrigration capacity is", round(Qindot,2),"ton"
print "c) coefficient of performanceis", round(b,2)
```