import math
# Part (a)
P1 = 1 # Initial pressure in bar
P2 = 10 # Final pressure in bar
vf = 0.001043 # specific volume of liquid in m**3/kg
Wrev = vf*(P1-P2)*1e5 # Work done
print "\n Example 12.1"
print "\n The work required in saturated liquid form is ",Wrev/1000 ," kJ/kg"
#The answers vary due to round off error
# Part (b)
h1 = 2675.5 # Enthalpy at state 1 in kJ/kg
s1 = 7.3594 # Entropy at state 1 kJ/kgK
s2 = s1 # Isentropic process
h2 = 3195.5 # Enthalpy at state 2 kJ/kg
Wrev1 = h1-h2 # Work done
print "\n The work required in saturated vapor form is ",Wrev1 ," kJ/kg"
import math
h1 = 3159.3 # Enthalpy at state 1 in kJ/kg
s1 = 6.9917 # Entropy at state 1 in kJ/kgK
h3 = 173.88 # Enthalpy at state 3 in kJ/kg
s3 = 0.5926 # Entropy at state 3 in kJ/kgK
sfp2 = s3 # Isentropic process
hfp2 = h3 # Isenthalpic process
hfgp2 = 2403.1 # Latent heat of vaporization in kJ/kg
sgp2 = 8.2287 # Entropy of gas in kJ/kgK
vfp2 = 0.001008 # Specific volume in m**3/kg
sfgp2 = 7.6361# Entropy of liquid in kJ/kgK
x2s = (s1-sfp2)/(sfgp2)# Steam quality
h2s = hfp2+(x2s*hfgp2) # Enthalpy at state 2s
# Part (a)
P1 = 20 # Turbine inlet pressure in bar
P2 = 0.08 # Turbine exit pressure in bar
h4s = vfp2*(P1-P2)*1e2+h3 # Enthalpy at state 4s
Wp = h4s-h3 # Pump work
Wt = h1-h2s # Turbine work
Wnet = Wt-Wp # Net work
Q1 = h1-h4s # Heat addition
n_cycle = Wnet/Q1# Cycle efficiency
print "\n Example 12.2"
print "\n Net work per kg of steam is ",Wnet ," kJ/kg"
#The answer provided in the textbook is wrong
print "\n Cycle efficiency is ",n_cycle*100 ," percent"
# Part (b)
n_p = 0.8 # pump efficiency
n_t = 0.8# Turbine efficiency
Wp_ = Wp/n_p # Pump work
Wt_ = Wt*n_t # Turbine work
Wnet_ = Wt_-Wp_# Net work
P = 100*((Wnet-Wnet_)/Wnet) # Percentage reduction in net work
n_cycle_ = Wnet_/Q1 # cycle efficiency
P_ = 100*((n_cycle-n_cycle_)/n_cycle) #reduction in cycle
print "\n\n Percentage reduction in net work per kg of steam is ",P ," percent"
print "\n Percentage reduction in cycle efficiency is ",P_ ," percent"
#The answers vary due to round off error
import math
P1 = 0.08 # Exhaust pressure in bar
sf = 0.5926 # Entropy of fluid in kJ/kgK
x2s = 0.85 # Steam quality
sg = 8.2287 # Entropy of gas in kJ/kgK
s2s = sf+(x2s*(sg-sf)) # Entropy of mixture at state 2s in kJ/kgK
s1 = s2s # Isentropic process
P2 = 16.832 # by steam table opposite to s1 in bar
h1 = 3165.54 # Enthalpy at state 1 in kJ/kg
h2s = 173.88 + (0.85*2403.1) # Enthalpy at state 2s in kJ/kg
h3 = 173.88# Enthalpy at state 3 in kJ/kg
vfp2 = 0.001 # specific volume of liquid in m**3/kg
h4s = h3 + (vfp2*(P2-P1)*100)# Enthalpy at state 4s in kJ/kg
Q1 = h1-h4s # Heat addition
Wt = h1-h2s # Turbine work
Wp = h4s-h3 # Pump work
n_cycle = 100*((Wt-Wp)/Q1) # Cycle efficiency
Tm = (h1-h4s)/(s2s-sf) # Mean temperature of heat addition
print "\n Example 12.3"
print "\n The greatest allowable steam pressure at the turbine inlet is ",P2 ," bar"
print "\n Rankine cycle efficiency is ",n_cycle ," percent"
print "\n Mean temperature of heat addition is ",Tm-273 ," degree celcius"
#The answers vary due to round off error
import math
h1 = 3465 # Enthalpy at state 1 in kJ/kgK
h2s = 3065 #Enthalpy at state 2s in kJ/kgK
h3 = 3565 #Enthalpy at state 3 in kJ/kgK
h4s = 2300 # Enthalpy at state 4s in kJ/kgK
x4s = 0.88 # Steam quality at state 4s
h5 = 191.83# Enthalpy at state 5 in kJ/kgK
v = 0.001 # specific volume in m**3/kg
P = 150 # Boiler outlet pressure in bar
Wp = v*P*100 # Pump work
h6s = 206.83 # Enthalpy at state 6s in kJ/kgK
Q1 = (h1-h6s)+(h3-h2s) # Heat addition
Wt = (h1-h2s)+(h3-h4s) # Turbine work
Wnet = Wt-Wp # Net work
n_cycle = 100*Wnet/Q1 # cycle efficiency
sr = 3600/Wnet #Steam rate
print "\n Example 12.4 \n"
print "\n Quality at turbine exhaust is ",0.88
print "\n Cycle efficiency is ",n_cycle ," percent"
print "\n Steam rate is ",sr ," kg/kW h"
#The answers vary due to round off error
import math
h1 = 3230.9 # Enthalpy at state 1 in kJ/kg
s1 = 6.9212 # Entropy at state 1 in kJ/kgK
s2 = s1 # Isentropic process
s3 = s1 # Isentropic process
h2 = 2796 # Enthalpy at state 2 in kJ/kg
sf = 0.6493 # ENtropy of fluid onkJ/kgK
sfg = 7.5009 # Entropy change due to vaporization
x3 = (s3-sf)/sfg # steam quality
h3 = 191.83 + x3*2392.8 # Enthalpy at state 3
h4 = 191.83 # Enthalpy at state 4 in kJ/kg
h5 = h4 # Isenthalpic process
h6 = 640.23 # Enthalpy at state 6 in kJ/kg
h7 = h6 # Isenthalpic process
m = (h6-h5)/(h2-h5) # regenerative mass
Wt = (h1-h2)+(1-m)*(h2-h3) # turbine work
Q1 = h1-h6 # Heat addition
n_cycle = 100*Wt/Q1 # Cycle efficiency
sr = 3600/Wt # Steam rate
s7 = 1.8607 # Entropy at state 7 in kJ/kgK
s4 = 0.6493 # Entropy at state 4 in kJ/kgK
Tm = (h1-h7)/(s1-s7) # Mean temperature of heat addition with regeneration
Tm1 = (h1-h4)/(s1-s4) # Mean temperature of heat addition without regeneration
dT = Tm-Tm1 # Change in temperature
Wt_ = h1-h3 # Turbine work
sr_ = 3600/Wt_ # Steam rate
dsr = sr-sr_# Change in steam rate
n_cycle_ = 100*(h1-h3)/(h1-h4) # Cycle effciency
dn = n_cycle-n_cycle_# Change in efficiency
print "\n Example 12.5\n"
print "\n Efficiency of the cycle is ",n_cycle ," percent"
print "\n Steam rate of the cycle is ",sr ," kg/kW h"
#The answer provided in the textbook is wrong
print "\n Increase in temperature due to regeneration is ",dT ," degree centigrade"
print "\n Increase in steam rate due to regeneration is ",dsr ," kg/kW h"
#The answer provided in the textbook is wrong
print "\n Increase in Efficiency of the cycle due to regeneration is ",dn ," percent"
#The answers vary due to round off error
import math
h1 = 3023.5 # Enthalpy of steam at state 1 in kJ/kg
s1 = 6.7664 # Enthalpy of steam at state 1 in kJ/kgK
s2 = s1 # Isentropic process
s3 = s1 #Isentropic process
s4 = s1 #Isentropic process
t_sat_20 = 212 # Saturation temperature at 20 bar in degree Celsius
t_sat_1 = 46 # Saturation temperature at 1 bar in degree Celsius
dt = t_sat_20-t_sat_1 # Change in temperature
n =3 # number of heaters
t = dt/n # temperature rise per heater
t1 = t_sat_20-t # Operational temperature of first heater
t2 = t1-t# Operational temperature of second heater
# 0.1 bar
hf = 191.83 # Enthalpy of fluid in kJ/kg
hfg = 2392.8 # Latent heat of vaporization in kJ/kg
sf = 0.6493# Entropy of fluid in kJ/kgK
sg = 8.1502# Entropy of gas in kJ/kgK
# At 100 degree
hf100 = 419.04 # Enthalpy of fluid in kJ/kg
hfg100 = 2257.0# Latent heat of vaporization in kJ/kg
sf100 = 1.3069 # Entropy of fluid in kJ/kgK
sg100 = 7.3549 # Entropy of gas in kJ/kgK
# At 150 degree
hf150 = 632.20 # Enthalpy of fluid in kJ/kg
hfg150 = 2114.3# Latent heat of vaporization in kJ/kg
sf150 = 1.8418 # Entropy of fluid in kJ/kgK
sg150 = 6.8379# Entropy of gas in kJ/kgK
x2 = (s1-sf150)/4.9961 # Steam quality
h2 = hf150+(x2*hfg150) # Enthalpy at state 2 in kJ/kg
x3 = (s1-sf100)/6.0480 # Steam quality
h3 = hf100+(x3*hfg100) # Enthalpy at state 3 in kJ/kg
x4 = (s1-sf)/7.5010 # Steam quality
h4 = hf+(x4*hfg)#Enthalpy at state 4 in kJ/kg
h5 = hf # Enthalpy at state 5 in kJ/kg
h6 = h5 #Enthalpy at state 6 in kJ/kg
h7 = hf100 # Enthalpy at state 7 in kJ/kg
h8 = h7 # Enthalpy at state 8 in kJ/kg
h9 = 632.2 # Enthalpy at state 9 in kJ/kg
h10 = h9 # Enthalpy at state 10 in kJ/kg
m1 = (h9-h7)/(h2-h7) # regenerative mass
m2 = ((1-m1)*(h7-h6))/(h3-h6) # regenerative mass
Wt = 1*(h1-h2)+(1-m1)*(h2-h3)+(1-m1-m2)*(h3-h4) # Turbine work
Q1 = h1-h9 # Heat addition
Wp = 0 # Pump work is neglected
n_cycle = 100*(Wt-Wp)/Q1 # Cycle efficiency
sr = 3600/(Wt-Wp) # Steam rate
print "\n Example 12.6\n"
print "\n Steam quality at turbine exhaust is ",x3
print "\n Net work per kg of stem is ",Wt ," kJ/kg"
print "\n Cycle efficiency is ",n_cycle ," percent"
print "\n Stream rate is ",sr ," kg/kW h"
#The answers vary due to round off error
import math
Ti = 2000.0 # Hot gas inlet temperature in K
Te = 450.0 # Hot gas exhaust temperature in K
T0 = 300.0 # Ambient temperature in K
Q1_dot = 100.0 # Heating rate provided by steam in kW
cpg = 1.1 # Heat capacity of gas in kJ/kg
wg = Q1_dot/(cpg*(Ti-Te)) # mass flow rate of hot gas
af1 = wg*cpg*T0*((Ti/T0)-1-math.log(Ti/T0)) # Availability at inlet
af2 = wg*cpg*T0*((Te/T0)-1-math.log(Te/T0)) # Availability at exit
afi = af1-af2 # Change in availability
h1 = 2801.0 # Enthalpy at state 1 in kJ/kg
h3 = 169.0 #Enthalpy at state 3 in kJ/kg
h4 = 172.8 #Enthalpy at state 4 in kJ/kg
h2 = 1890.2 # Enthalpy at state 2 in kJ/kg
s1 = 6.068 # Entropy at state 1 in kJ/kgK
s2 = s1 # Isentropic process
s3 = 0.576 # Entropy at state 3 in kJ/kgK
s4 = s3 # Isentropic process
Wt = h1-h2 # Turbine work
Wp = h4-h3 # Pump work
Q1 = h1-h4 # Heat addition
Q2 = h2-h3# Heat rejection
Wnet = Wt-Wp # Net work
ws = Q1_dot/2628 # steam mass flow rate
afu = 38*(h1-h4-T0*(s1-s3)) # availability loss
I_dot = afi-afu # Rate of exergy destruction
Wnet_dot = ws*Wnet# Mechanical power rate
afc = ws*(h2-h3-T0*(s2-s3)) # Exergy flow rate of of wet steam
n2 = 100*Wnet_dot/af1 # second law efficiency
print "\n Example 12.7\n"
print "\n The second law efficiency is ",n2 ," percent"
#The answers vary due to round off error
import math
# Part (a)
h1 = 2758.0 # Enthalpy at state 1 in kJ/kg
h2 = 1817.0 # Enthalpy at state 2 in kJ/kg
h3 = 192.0 # Enthalpy at state 3 in kJ/kg
h4 = 200.0# Enthalpy at state 4 in kJ/kg
Wt = h1-h2 # turbine work
Wp = h4-h3 # Pump work
Q1 = h1-h4 # Heat addition
Wnet = Wt-Wp # Net work doen
n1 = Wnet/Q1 # First law efficiency
WR = Wnet/Wt # Work ratio
Q1_ = 100.0 # Heat addition rate in MW
PO = n1*Q1_ # power output
cpg = 1000 # Specific heat capacity in J/kg
wg = (Q1_/(833-450)) # mass flow rate of gas
EIR = wg*cpg*((833-300)-300*(math.log(833/300)))/1000 # Exergy input
n2 = PO/EIR # Second law efficiency
print "\n Example 12.8\n"
print "\n Part (a)"
print "\n The first law efficiency n1 is ",n1*100
print "\n The second law efficiency n2 is ",n2*100
print "\n The work ratio is ",WR
# Part (b)
h1b = 3398.0 # Enthalpy at state 1 in kJ/kg
h2b = 2130.0 # Enthalpy at state 2 in kJ/kg
h3b = 192.0 # Enthalpy at state 3 in kJ/kg
h4b = 200.0# Enthalpy at state 4 in kJ/kg
Wtb = 1268.0 # turbine work in kJ/kg
Wpb = 8.0 # Pump work in kJ/kg
Q1b = 3198.0# Heat addition rate in kW
n1b = (Wtb-Wpb)/Q1b #first law efficiency
WRb = (Wtb-Wpb)/Wtb # WOrk ratio
EIRb = 59.3 # Exergy input rate in MW
Wnetb = Q1_*n1b # net work done
n2b = Wnetb/EIRb # Second law efficiency
print "\n Part (b)"
print "\n The first law efficiency n1 is ",n1b*100
print "\n The second law efficiency n2 is ",n2b*100
print "\n The work ration is ",WRb
# Part (c)
h1c = 3398.0 # Enthalpy at state 1 in kJ/kg
h2c = 2761.0 # Enthalpy at state 2 in kJ/kg
h3c = 3482.0# Enthalpy at state 3 in kJ/kg
h4c = 2522.0 # Enthalpy at state 4 in kJ/kg
h5c = 192.0 # Enthalpy at state 5 in kJ/kg
h6c = 200.0# Enthalpy at state 6 in kJ/kg
Wt1 = 637.0 # Turbine work in kJ/kg
Wt2 = 960.0 # Turbine work in kJ/kg
Wtc = Wt1+Wt2 # Net turbine work in kJ/kg
Wp = 8.0 # Pump work in kJ/kg
Wnetc = Wtc-Wp # net work done
Q1c = 3198+721 # Heat addition
n1c = Wnetc/Q1c# First law efficiency
WRc = Wnetc/Wtc# Work ratio
POc = Q1_*n1c# Power output
EIRc = 59.3# Exergy input in MW
n2c = POc/EIRc # Second law efficiency
print "\n Part (c)"
print "\n The first law efficiency n1 is ",n1c*100
print "\n The second law efficiency n2 is ",n2c*100
print "\n The work ration is ",WRc
# Part (d)
T3 = 45.8 # saturation temperature at 0.1 bar in degree celsius
T1 = 295.0 # saturation temperature at 80 bar in degree celsius
n1d = 1.0-((T3+273)/(T1+273)) # First law efficiency
Q1d = 2758-1316 # Heat addition
Wnet = Q1d*n1d # Net work output
Wpd = 8.0 # Pump work in kJ/kg
Wtd = 641.0# Turbine work in kJ/kg
WRd = (Wt-Wp)/Wt # Work ratio
POd = Q1_*0.439# Power output
EIRd = (Q1_/(833-593))*cpg*((833-300)-300*(math.log(833/300)))/1000 #Exergy Input rate in MW
n2d = POd/EIRd # Second law efficiency
print "\n Part (d)"
print "\n The first law efficiency n1 is ",n1d*100
print "\n The second law efficiency n2 is ",n2d*100
print "\n The work ration is ",WRd
#The answers vary due to round off error
import math
hfg = 2202.6 # Latent heat of fusion in kJ/kg
Qh = 5.83 # Heat addition in MJ/s
ws = Qh/hfg # steam flow rate
eg = 0.9 # efficiency of generator
P = 1000.0 # Power generation rate in kW
Wnet = 1000.0/eg # Net output
nbrake = 0.8 # brake thermal efficiency
h1_2s = Wnet/(ws*nbrake) # Ideal heat addition
n_internal = 0.85 # internal efficiency
h12 = n_internal*h1_2s # Actual heat addition
hg = 2706.3 # Enthalpy of gas in kJ/kg
h2 = hg #Isenthalpic process
h1 = h12+h2 # Total enthalpy
h2s = h1-h1_2s # Enthalpy change
hf = 503.71 # Enthalpy of fluid in kJ/kg
x2s = (h2s-hf)/hfg # Quality of steam
sf = 1.5276 # entropy of fluid in kJ/kgK
sfg = 5.6020 # Entropy change due to vaporization in kJ/kgK
s2s = sf+(x2s*sfg) # Entropy at state 2s
s1 = s2s # Isentropic process
P1 = 22.5 # Turbine inlet pressure in bar from Mollier chart
t1 = 360.0 # Temperature of the steam in degree Celsius from Mollier chart
print "\n Example 12.9\n"
print "\n Temperature of the steam is ",t1 ," degree celcius"
print "\n Pressure of the steam is ",P1 ," bar"
#The answers vary due to round off error
import math
h1 = 3037.3 # Enthalpy at state 1 in kJ/kg
x = 0.96 # Steam quality
h2 = 561+(x*2163.8) # Enthalpy at state 2
s2 = 1.6718+(x*5.3201)# Entropy at state 2
s3s = s2 # Isentropic process
x3s = (s3s-0.6493)/7.5009 # Quality at state 3s
h3s = 191.83+(x3s*2392.8) # Enthalpy at state 3s
h23 = 0.8*(h2-h3s) # Enthalpy change in process 23
h3 = h2-h23 # Enthalpy at state 3
h5 = 561.47 # Enthalpy at state 5
h4 = 191.83# Enthalpy at state 4
Qh = 3500 # Heat addition in kJ/s
w = Qh/(h2-h5) # mass flow rate
Wt = 1500 # Turbine work
ws = (Wt+w*(h2-h3))/(h1-h3) # Steam flow rate
ws_ = 3600*ws # Steam flow rate in kg/h
h6 = ((ws-w)*h4+w*h5)/ws #Enthalpy at state 6
h7 = h6# Enthalpy at state 7
n_boiler = 0.85 # Boiler efficiency
CV = 44000 # Calorific value of fuel in kJ/kg
wf = (1.1*ws_*(h1-h7))/(n_boiler*CV) # Fuel consumption rate
print "\n Example 12.10\n"
print "\n Fuel burning rate is ",wf*24/1000 ," tonnes/day"
#The answers vary due to round off error
import math
h1 = 3285.0 # Enthalpy at state 1 in kJ/kg
h2s = 3010.0 # Enthalpy at state 2s in kJ/kg
h3 = 3280.0 # # Enthalpy at state 3 in kJ/kg
h4s = 3030.0 # # Enthalpy at state 4s in kJ/kg
# Saturation pressure at temperature 180 degree centigrade
psat = 10 # In bar
h4 = h3-0.83*(h3-h4s) # # Enthalpy at state 4
h5s = 2225.0 # # Enthalpy at state 5s in kJ/kg
h5 = h4-0.83*(h4-h5s) # # Enthalpy at state 5
h6 = 162.7 # Enthalpy at state 6 in kJ/kg
h7 = h6 # # Enthalpy at state 7
h8 = 762.81# Enthalpy at state 8 in kJ/kg
h2 = h1-0.785*(h1-h2s) #Enthalpy at state 2
m = (h8-h7)/(h4-h7) # regenerative mass flow
n_cycle = ((h1-h2)+(h3-h4)+(1-m)*(h4-h5))/((h1-h8)+(h3-h2)) # Cycle efficiency
print "\n Example 12.11\n"
print "\n The minimum pressure at which bleeding is neccessary is ",psat ," bar"
print "\n Steam flow at turbine inlet is ",m ," kg/s"
print "\n Cycle efficiency is ",n_cycle*100 ," percent"
#The answers vary due to round off error
# Part A and Part B are theoretical problems
import math
# From table
h1 = 2792.2 # Enthalpy at state 1 in kJ/kg
h4 = 122.96# Enthalpy at state 4 in kJ/kg
hb = 254.88 # Enthalpy at state b in kJ/kg
hc = 29.98# Enthalpy at state c in kJ/kg
ha = 355.98 # Enthalpy at state a in kJ/kg
hd = hc # Isenthalpic process
h2 = 1949.27 # # Enthalpy at state 2 in kJ/kg
#
m = (h1-h4)/(hb-hc) # Amount of mercury circulating
Q1t = m*(ha-hd) # Heat addition
W1t = m*(ha-hb) + (h1-h2) # Turbine work
n = W1t/Q1t # first law efficiency
print "\n Example 12.12 \n"
print "\n Overall efficiency of the cycle is ",n*100 ," percent"
#The answers vary due to round off error
S = 50000 # Stem flow rate through turbine in kg/h
wm = S*m # mercury flow rate
print "\n Flow through the mercury turbine is math.exp kg/h",wm
Wt = W1t*S/3600 # Turbine work
print "\n Useful work done in binary vapor cycle is ",Wt/1e3 ," MW"
nm = 0.85 # Internal efficiency of mercury turbine
ns = 0.87 # Internal efficiency of steam turbine
WTm = nm*(ha-hb) # turbine work of mercury based cycle
hb_ = ha-WTm # Enthalpy at state b in kJ/kg
m_ = (h1-h4)/(hb_-hc) # mass flow rate of mercury
h1_ = 3037.3 # Enthalpy at state 1 in kJ/kg
Q1t = m_*(ha-hd)+(h1_-h1) # Heat addition
x2_ = (6.9160-0.4226)/(8.47-0.4226) # steam quality
h2_ = 121+(0.806*2432.9) # Enthalpy at state 2 in kJ/kg
WTst = ns*(h1_-h2_) # Turbine work
WTt = m_*(ha-hb_)+WTst # Total turbine work
N = WTt/Q1t #Overall efficiency
print "\n Overall efficiency is ",N*100 ," percent"
# The answers vary due to round off error