In [88]:

```
#cal of thermal efficiency,turbine work,compression work
#intiation of all variables
# Chapter 8
print"Example 8.1, Page:260 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 8 Example 1")
print("T-S representation for carnot cycle operating between pressure of 7 MPa and 7KPa is shown in fig.")
print("enthalpy at state 2,h2= hg at 7 MPa")
print("from steam table,h=2772.1 KJ/kg")
h2=2772.1;
print("entropy at state 2,s2=sg at 7MPa")
print("from steam table,s2=5.8133 KJ/kg K")
s2=5.8133;
print("enthalpy and entropy at state 3,")
print("from steam table,h3=hf at 7 MPa =1267 KJ/kg and s3=sf at 7 MPa=3.1211 KJ/kg K")
h3=1267;
s3=3.1211;
print("for process 2-1,s1=s2.Let dryness fraction at state 1 be x1 ")
s1=s2;
print("from steam table, sf at 7 KPa=0.5564 KJ/kg K,sfg at 7 KPa=7.7237 KJ/kg K")
sf=0.5564;
sfg=7.7237;
print("s1=s2=sf+x1*sfg")
x1=(s2-sf)/sfg
print("so x1="),round(x1,2)
x1=0.6806;#approx.
print("from steam table,hf at 7 KPa=162.60 KJ/kg,hfg at 7 KPa=2409.54 KJ/kg")
hf=162.60;
hfg=2409.54;
h1=hf+x1*hfg
print("enthalpy at state 1,h1 in KJ/kg="),round(h1,2)
print("let dryness fraction at state 4 be x4")
print("for process 4-3,s4=s3=sf+x4*sfg")
s4=s3;
x4=(s4-sf)/sfg
print("so x4="),round(x4,2)
x4=0.3321;#approx.
h4=hf+x4*hfg
print("enthalpy at state 4,h4 in KJ/kg="),round(h4,2)
print("thermal efficiency=net work/heat added")
(h2-h1)
print("expansion work per kg=(h2-h1) in KJ/kg"),round((h2-h1),2)
(h3-h4)
print("compression work per kg=(h3-h4) in KJ/kg(+ve)"),round((h3-h4),2)
(h2-h3)
print("heat added per kg=(h2-h3) in KJ/kg(-ve)"),round((h2-h3),2)
(h2-h1)-(h3-h4)
print("net work per kg=(h2-h1)-(h3-h4) in KJ/kg"),round((h2-h1)-(h3-h4),2)
((h2-h1)-(h3-h4))/(h2-h3)
print("thermal efficiency"),round(((h2-h1)-(h3-h4))/(h2-h3),2)
print("in percentage"),round((((h2-h1)-(h3-h4))/(h2-h3))*100,2)
print("so thermal efficiency=44.21%")
print("turbine work=969.57 KJ/kg(+ve)")
print("compression work=304.19 KJ/kg(-ve)")
```

In [89]:

```
#cal of n_carnot,n_rankine
#intiation of all variables
# Chapter 8
print"Example 8.2, Page:261 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 8 Example 2")
print("from steam tables,at 5 MPa,hf_5MPa=1154.23 KJ/kg,sf_5MPa=2.92 KJ/kg K")
print("hg_5MPa=2794.3 KJ/kg,sg_5MPa=5.97 KJ/kg K")
hf_5MPa=1154.23;
sf_5MPa=2.92;
hg_5MPa=2794.3;
sg_5MPa=5.97;
print("from steam tables,at 5 Kpa,hf_5KPa=137.82 KJ/kg,sf_5KPa=0.4764 KJ/kg K")
print("hg_5KPa=2561.5 KJ/kg,sg_5KPa=8.3951 KJ/kg K,vf_5KPa=0.001005 m^3/kg")
hf_5KPa=137.82;
sf_5KPa=0.4764;
hg_5KPa=2561.5;
sg_5KPa=8.3951;
vf_5KPa=0.001005;
print("as process 2-3 is isentropic,so s2=s3")
print("and s3=sf_5KPa+x3*sfg_5KPa=s2=sg_5MPa")
s2=sg_5MPa;
s3=s2;
x3=(s3-sf_5KPa)/(sg_5KPa-sf_5KPa)
print("so x3="),round(x3,2)
x3=0.694;#approx.
print("hence enthalpy at 3,")
h3=hf_5KPa+x3*(hg_5KPa-hf_5KPa)
print("h3 in KJ/kg="),round(h3,2)
print("enthalpy at 2,h2=hg_5KPa=2794.3 KJ/kg")
print("process 1-4 is isentropic,so s1=s4")
s1=sf_5MPa;
print("s1=sf_5KPa+x4*(sg_5KPa-sf_5KPa)")
x4=(s1-sf_5KPa)/(sg_5KPa-sf_5KPa)
print("so x4="),round(x4,2)
x4=0.308;#approx.
h4=hf_5KPa+x4*(hg_5KPa-hf_5KPa)
print("enthalpy at 4,h4 in KJ/kg="),round(h4,2)
h1=hf_5MPa
h2=hg_5MPa;
n_carnot=((h2-h3)-(h1-h4))/(h2-h1)
print("enthalpy at 1,h1 in KJ/kg="),round(h1,2)
print("carnot cycle(1-2-3-4-1) efficiency:")
print("n_carnot=net work/heat added")
print("n_carnot"),round(n_carnot,2)
print("in percentage"),round(n_carnot*100,2)
print("so n_carnot=42.95%")
print("In rankine cycle,1-2-3-5-6-1,")
p6=5000;#boiler pressure in KPa
p5=5;#condenser pressure in KPa
vf_5KPa*(p6-p5)
print("pump work,h6-h5=vf_5KPa*(p6-p5)in KJ/kg"),round(vf_5KPa*(p6-p5),2)
h5=hf_5KPa;
print("h5 KJ/kg="),round(hf_5KPa,2)
h6=h5+(vf_5KPa*(p6-p5))
print("hence h6 in KJ/kg"),round(h6,2)
(h2-h3)-(h6-h5)
print("net work in rankine cycle=(h2-h3)-(h6-h5)in KJ/kg"),round((h2-h3)-(h6-h5),2)
(h2-h6)
print("heat added=(h2-h6)in KJ/kg"),round((h2-h6),2)
n_rankine=((h2-h3)-(h6-h5))/(h2-h6)
print("rankine cycle efficiency(n_rankine)="),round(n_rankine,2)
print("in percentage"),round(n_rankine*100,2)
print("so n_rankine=36.56%")
```

In [90]:

```
#cal of net work per kg of steam,cycle efficiency,pump work per kg of steam
#intiation of all variables
# Chapter 8
print"Example 8.3, Page:263 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 8 Example 3")
print("from steam tables,h2=hg_40bar=3092.5 KJ/kg")
h2=3092.5;
print("s2=sg_40bar=6.5821 KJ/kg K")
s2=6.5821;
print("h4=hf_0.05bar=137.82 KJ/kg,hfg=2423.7 KJ/kg ")
h4=137.82;
hfg=2423.7;
print("s4=sf_0.05bar=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K")
s4=0.4764;
sfg=7.9187;
print("v4=vf_0.05bar=0.001005 m^3/kg")
v4=0.001005;
print("let the dryness fraction at state 3 be x3,")
print("for ideal process,2-3,s2=s3")
s3=s2;
print("s2=s3=6.5821=sf_0.05bar+x3*sfg_0.05bar")
x3=(s2-s4)/(sfg)
print("so x3="),round(x3,2)
x3=0.7711;#approx.
print("h3=hf_0.05bar+x3*hfg_0.05bar in KJ/kg")
h3=h4+x3*hfg
print("for pumping process,")
print("h1-h4=v4*deltap=v4*(p1-p4)")
p1=40*100;#pressure of steam enter in turbine in mPa
p4=0.05*100;#pressure of steam leave turbine in mPa
h1=h4+v4*(p1-p4)
print("so h1=h4+v4*(p1-p4) in KJ/kg"),round(h1,2)
(h1-h4)
print("pump work per kg of steam in KJ/kg"),round((h1-h4),2)
print("net work per kg of steam =(expansion work-pump work)per kg of steam")
(h2-h3)-(h1-h4)
print("=(h2-h3)-(h1-h4) in KJ/kg="),round((h2-h3)-(h1-h4),2)
print("cycle efficiency=net work/heat added"),round(((h2-h3)-(h1-h4))/(h2-h1),2)
print("in percentage"),round(((h2-h3)-(h1-h4))*100/(h2-h1),2)
print("so net work per kg of steam=1081.74 KJ/kg")
print("cycle efficiency=36.67%")
print("pump work per kg of steam=4.02 KJ/kg")
```

In [1]:

```
#cal of maximum possible work
#intiation of all variables
# Chapter 8
print"Example 8.4, Page:264 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 8 Example 4")
print("Let us assume that the condensate leaves condenser as saturated liquid and the expansion in turbine and pumping processes are isentropic.")
print("from steam tables,h2=h_20MPa=3238.2 KJ/kg")
h2=3238.2;
print("s2=6.1401 KJ/kg K")
s2=6.1401;
print("h5=h_0.005MPa in KJ/kg")
print("from steam tables,at 0.005 MPa,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K")
hf=137.82;
hfg=2423.7;
sf=0.4764;
sfg=7.9187;
h5=hf+0.9*hfg
print("h5=hf+0.9*hfg in KJ/kg"),round(h5,2)
s5=sf+0.9*sfg
print("s5 in KJ/kg K="),round(s5,2)
print("h6=hf=137.82 KJ/kg")
h6=137.82;
print("it is given that temperature at state 4 is 500 degree celcius and due to isentropic processes s4=s5=7.6032 KJ/kg K.The state 4 can be conveniently located on mollier chart by the intersection of 500 degree celcius constant temperature line and entropy value of 7.6032 KJ/kg K and the pressure and enthalpy obtained.but these shall be approximate.")
print("The state 4 can also be located by interpolation using steam table.The entropy value of 7.6032 KJ/kg K lies between the superheated steam states given under,p=1.20 MPa,s at 1.20 MPa=7.6027 KJ/kg K")
print("p=1.40 MPa,s at 1.40 MPa=7.6027 KJ/kg K")
print("by interpolation state 4 lies at pressure=")
1.20+((1.40-1.20)/(7.6027-7.6759))*(7.6032-7.6759)
print("=1.399,approx.=1.40 MPa")
print("thus,steam leaves HP turbine at 1.40 MPa")
print("enthalpy at state 4,h4=3474.1 KJ/kg")
h4=3474.1;
print("for process 2-33,s2=s3=6.1401 KJ/kg K.The state 3 thus lies in wet region as s3<sg at 1.40 MPa.Let dryness fraction at state 3 be x3.")
s3=s2;
print("s3=sf+x3*sfg")
print("from staem tables,at 1.4 MPa,sf=2.2842 KJ/kg K,sfg=4.1850 KJ/kg K")
sf=2.2842;
sfg=4.1850;
x3=(s3-sf)/sfg
print("so x3"),round(x3,2)
hf=830.3;
hfg=1959.7;
h3=hf+x3*hfg
print("h3 in KJ/kg"),round(h3,2)
print("from steam tables,at 1.4 MPa,hf=830.3 KJ/kg,hfg=1959.7 KJ/kg")
print("enthalpy at 1,h1=h6+v6*(p1-p6) in KJ/kg")
print("h1=hf at 0.005MPa+vf at 0.005MPa*(p1-p6)")
print("from steam tables, at 0.005 MPa,h6=137.82 KJ/kg,v6=0.001005 m^3/kg")
h6=137.82;
v6=0.001005;
p1=20*1000;#steam entering HP turbine in KPa
p6=0.005*1000;#condensor pressure in KPa
h1=h6+v6*(p1-p6)
W_net=(h2-h3)+(h4-h5)-(h1-h6)
print("net work per kg steam in KJ/kg="),round(W_net,2)
Q=(h2-h1)
print("heat added per kg of steam in KJ/kg="),round(Q,2)
#thermal efficiency=W_net/Q
print("thermal efficiency=net work/heat added"),round(W_net/Q,2)
print("in percentage"),round(W_net/Q*100,2)
print("pressure of steam leaving HP turbine=1.40 MPa")
print("thermal efficiency=56.39%")
```

In [92]:

```
#cal of mass of flow rate of steam,mass flow rate of condenser cooling water,thermal efficiency,ratio of heat supplied and rejected
#intiation of all variables
# Chapter 8
print"Example 8.5, Page:266 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 8 Example 5")
P=50*10**3;#output of plant in KW
Cpw=4.18;#specific heat of water in KJ/kg K
Tw_in=15;#cooling water entering condenser temperature in degree celcius
Tw_out=30;#cooling water leaving condenser temperature in degree celcius
print("from steam table,at inlet to turbine,")
print("h2=h_10MPa,700oc")
print("h2=3870.5 KJ/kg,s2=7.1687 KJ/kg K")
h2=3870.5;
s2=7.1687;
s3=s2;
print("for process 2-3,s2=s3 and s3<sf at 0.005 MPa so state 3 lies in wet region .Let dryness fraction at state 3 be x3.")
print("s3=7.1687=sf at 0.005 MPa+x3*sfg at 0.005 MPa")
print("from steam tables,at 0.005 MPa,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg")
sf=0.4764;
sfg=7.9187;
x3=(s3-sf)/sfg
print("so x3"),round(x3,2)
x3=0.845;#approx.
print("h3=hf at 0.005 MPa+x3*hfg at 0.005 MPa")
print("from steam tables,at 0.005 MPa,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg")
hf=137.82;
hfg=2423.7;
h3=hf+x3*hfg
print("so h3 in KJ/kg="),round(h3,2)
print("h4=hf at 0.005 MPa")
h4=hf;
print("for pumping process,(h1-h4)=v4*(p1-p4)")
print("from steam tables,v4=vf at 0.005 MPa=0.001005 m^3/kg")
v4=0.001005;
p1=10;#pressure of steam leave boiler in MPa
p4=0.005;#pressure of steam leave turbine in MPa
h1=h4+v4*(p1-p4)*100
print("h1 in KJ/kg="),round(h1,2)
w_net=(h2-h3)-(h1-h4)
print("net output per kg of steam,w_net in KJ/kg="),round(w_net,2)
ms=P/w_net
print("mass flow rate of steam,ms in kg/s"),round(ms,2)
ms=29.69;#approx.
print("by heat balance on condenser,for mass flow rate of water being mw kg/s")
print("(h3-h4)*ms=mw*Cpw*(Tw_out-Tw_in)")
mw=(h3-h4)*ms/(Cpw*(Tw_out-Tw_in))
print("so mw in kg/s="),round(mw,2)
q_add=(h2-h1)
print("the heat added per kg of steam (q_add) in KJ/kg="),round(q_add,2)
w_net/q_add
print("thermal efficiency="),round(w_net/q_add,2)
print("in percentage"),round(w_net*100/q_add,2)
(h2-h1)/(h3-h4)
print("ratio of heat supplied and rejected="),round((h2-h1)/(h3-h4),2)
print("mass of flow rate of steam=29.69 kg/s")
print("mass flow rate of condenser cooling water=969.79 kg/s")
print("thermal efficiency=45.12%")
print("ratio of heat supplied and rejected=1.822")
```

In [2]:

```
#cal of maximum possible work
#intiation of all variables
# Chapter 8
print"Example 8.6, Page:267 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 8 Example 6")
print("case (a) When there is no feed water heater")
print("Thermal efficiency of cycle=((h2-h3)-(h1-h4))/(h2-h1)")
print("from steam tables,h2=h at 200 bar,650oc=3675.3 KJ/kg,s2=s at 200 bar,650oc=6.6582 KJ/kg K,h4=hf at 0.05 bar=137.82 KJ/kg,v4=vf at 0.05 bar=0.001005 m^3/kg")
h2=3675.3;
s2=6.6582;
h4=137.82;
v4=0.001005;
print("hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg,sf at 0.05 bar=0.4764 KJ/kg K,sfg at 0.05 bar=7.9187 KJ/kg K")
hf=137.82;
hfg=2423.7;
sf=0.4764;
sfg=7.9187;
print("For process 2-3,s2=s3.Let dryness fraction at 3 be x3.")
s3=s2;
print("s3=6.6582=sf at 0.05 bar+x3*sfg at 0.05 bar")
x3=(s3-sf)/sfg
print("so x3="),round(x3,2)
x3=0.781;#approx.
print("h3=hf at 0.05 bar+x3*hfg at 0.05 bar in KJ/kg")
h3=hf+x3*hfg
print("For pumping process 4-1,")
print("h1-h4=v4*deltap")
h1=h4+v4*(200-0.5)*10**2
print("h1= in KJ/kg="),round(h1,2)
((h2-h3)-(h1-h4))/(h2-h1)
print("Thermal efficiency of cycle="),round(((h2-h3)-(h1-h4))/(h2-h1),2)
print("in percentage"),round(((h2-h3)-(h1-h4))*100/(h2-h1),2)
print("case (b) When there is only one feed water heater working at 8 bar")
print("here,let mass of steam bled for feed heating be m kg")
print("For process 2-6,s2=s6=6.6582 KJ/kg K")
s6=s2;
print("Let dryness fraction at state 6 be x6")
print("s6=sf at 8 bar+x6*sfg at 8 bar")
print("from steam tables,hf at 8 bar=721.11 KJ/kg,vf at 8 bar=0.001115 m^3/kg,hfg at 8 bar=2048 KJ/kg,sf at 8 bar=2.0462 KJ/kg K,sfg at 8 bar=4.6166 KJ/kg K")
hf=721.11;
vf=0.001115;
hfg=2048;
sf=2.0462;
sfg=4.6166;
x6=(s6-sf)/sfg
print("substituting entropy values,x6="),round(x6,2)
x6=0.999;#approx.
print("h6=hf at at 8 bar+x6*hfg at 8 bar in KJ/kg")
h6=hf+x6*hfg
print("Assuming the state of fluid leaving open feed water heater to be saturated liquid at 8 bar.h7=hf at 8 bar=721.11 KJ/kg")
h7=721.11;
h5=h4+v4*(8-.05)*10**2
print("For process 4-5,h5 in KJ/kg"),round(h5,2)
print("Applying energy balance at open feed water heater,")
print("m*h6+(1-m)*h5=1*h7")
m=(h7-h5)/(h6-h5)
print("so m= in kg"),round(m,2)
h7=hf;
v7=vf;
h1=h7+v7*(200-8)*10**2
print("For process 7-1,h1 in KJ/kg="),round(h1,2)
print("here h7=hf at 8 bar,v7=vf at 8 bar")
#TE=((h2-h6)+(1-m)*(h6-h3)-((1-m)*(h5-h4)+(h1-h7))/(h2-h1)
print("Thermal efficiency of cycle=0.4976")
print("in percentage=49.76")
print("case (c) When there are two feed water heaters working at 40 bar and 4 bar")
print("here, let us assume the mass of steam at 40 bar,4 bar to be m1 kg and m2 kg respectively.")
print("2-10-9-3,s2=s10=s9=s3=6.6582 KJ/kg K")
s3=s2;
s9=s3;
s10=s9;
print("At state 10.s10>sg at 40 bar(6.0701 KJ/kg K)so state 10 lies in superheated region at 40 bar pressure.")
print("From steam table by interpolation,T10=370.6oc,so h10=3141.81 KJ/kg")
T10=370.6;
h10=3141.81;
print("Let dryness fraction at state 9 be x9 so,")
print("s9=6.6582=sf at 4 bar+x9*sfg at 4 bar")
print("from steam tables,at 4 bar,sf=1.7766 KJ/kg K,sfg=5.1193 KJ/kg K")
sf=1.7766;
sfg=5.1193;
x9=(s9-sf)/sfg
print("x9=(s9-sf)/sfg"),round(x9,2)
x9=0.9536;#approx.
print("h9=hf at 4 bar+x9*hfg at 4 bar in KJ/kg")
print("from steam tables,at 4 bar,hf=604.74 KJ/kg,hfg=2133.8 KJ/kg")
hf=604.74;
hfg=2133.8;
h9=hf+x9*hfg
print("Assuming the state of fluid leaving open feed water heater to be saturated liquid at respective pressures i.e.")
print("h11=hf at 4 bar=604.74 KJ/kg,v11=0.001084 m^3/kg=vf at 4 bar")
h11=604.74;
v11=0.001084;
print("h13=hf at 40 bar=1087.31 KJ/kg,v13=0.001252 m^3/kg=vf at40 bar")
h13=1087.31;
v13=0.001252;
print("For process 4-8,i.e in CEP.")
h8=h4+v4*(4-0.05)*10**2
print("h8 in KJ/kg="),round(h8,2)
print("For process 11-12,i.e in FP2,")
h12=h11+v11*(40-4)*10**2
print("h12=h11+v11*(40-4)*10^2 in KJ/kg"),round(h12,2)
h1_a=h13+v13*(200-40)*10**2
print("For process 13-1_a i.e. in FP1,h1_a= in KJ/kg="),round(h1_a,2)
print("m1*3141.81+(1-m1)*608.64=1087.31")
print("so m1=(1087.31-608.64)/(3141.81-608.64)in kg")
m1=(1087.31-608.64)/(3141.81-608.64)
print("Applying energy balance on open feed water heater 1 (OFWH1)")
print("m1*h10+(1-m1)*h12)=1*h13")
m1=(h13-h12)/(h10-h12)
print("so m1 in kg="),round(m1,2)
print("Applying energy balance on open feed water heater 2 (OFWH2)")
print("m2*h9+(1-m1-m2)*h8=(1-m1)*h11")
m2=(1-m1)*(h11-h8)/(h9-h8)
print("so m2 in kg="),round(m2,2)
W_CEP=(1-m1-m2)*(h8-h4)
W_FP1=(h1_a-h13)
W_FP2=(1-m1)*(h12-h11)
n=(((h2-h10)+(1-m1)*(h10-h9)+(1-m1-m2)*(h9-h3))-(W_CEP+W_FP1+W_FP2))/(h2-h1_a)
print("Thermal efficiency of cycle,n="),round(n,2)
print("W_CEP in KJ/kg steam from boiler="),round(W_CEP,2)
print("W_FP1=(h1_a-h13)in KJ/kg of steam from boiler"),round(W_FP1)
print("W_FP2 in KJ/kg of steam from boiler="),round(W_FP2,2)
W_CEP+W_FP1+W_FP2
print("W_CEP+W_FP1+W_FP2 in KJ/kg of steam from boiler="),round(W_CEP+W_FP1+W_FP2,2)
n=(((h2-h10)+(1-m1)*(h10-h9)+(1-m1-m2)*(h9-h3))-(W_CEP+W_FP1+W_FP2))/(h2-h1_a)
print("n="),round(n,2)
print("in percentage"),round(n*100,2)
print("so cycle thermal efficiency,na=46.18%")
print("nb=49.76%")
print("nc=51.37%")
print("hence it is obvious that efficiency increases with increase in number of feed heaters.")
```

In [94]:

```
#cal of cycle efficiency,specific steam consumption,work ratio
#intiation of all variables
# Chapter 8
print"Example 8.7, Page:272 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 8 Example 7")
print("from steam tables,")
print("h2=h at 50 bar,500oc=3433.8 KJ/kg,s2=s at 50 bar,500oc=6.9759 KJ/kg K")
h2=3433.8;
s2=6.9759;
print("s3=s2=6.9759 KJ/kg K")
s3=s2;
print("by interpolation from steam tables,")
print("T3=183.14oc at 5 bar,h3=2818.03 KJ/kg,h4= h at 5 bar,400oc=3271.9 KJ/kg,s4= s at 5 bar,400oc=7.7938 KJ/kg K")
T3=183.14;
h3=2818.03;
h4=3271.9;
s4=7.7938;
print("for expansion process 4-5,s4=s5=7.7938 KJ/kg K")
s5=s4;
print("let dryness fraction at state 5 be x5")
print("s5=sf at 0.05 bar+x5*sfg at 0.05 bar")
print("from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K")
sf=0.4764;
sfg=7.9187;
x5=(s5-sf)/sfg
print("so x5="),round(x5,2)
x5=0.924;#approx.
print("h5=hf at 0.05 bar+x5*hfg at 0.05 bar in KJ/kg")
print("from steam tables,hf at 0.05 bar=137.82 KJ/kg,hfg at 0.05 bar=2423.7 KJ/kg")
hf=137.82;
hfg=2423.7;
h5=hf+x5*hfg
print("h6=hf at 0.05 bar=137.82 KJ/kg")
h6=137.82;
print("v6=vf at 0.05 bar=0.001005 m^3/kg")
v6=0.001005;
p1=50.;#steam generation pressure in bar
p6=0.05;#steam entering temperature in turbine in bar
h1=h6+v6*(p1-p6)*100
print("for process 6-1 in feed pump,h1 in KJ/kg="),round(h1,2)
print("cycle efficiency=W_net/Q_add")
Wt=(h2-h3)+(h4-h5)
print("Wt in KJ/kg="),round(Wt,2)
W_pump=(h1-h6)
print("W_pump=(h1-h6)in KJ/kg"),round(W_pump,2)
W_net=Wt-W_pump
print("W_net=Wt-W_pump in KJ/kg"),round(W_net,2)
Q_add=(h2-h1)
print("Q_add in KJ/kg="),round(Q_add,2)
print("cycle efficiency="),round(W_net/Q_add,4)
W_net*100/Q_add
print("in percentage="),round(W_net*100/Q_add,2)
print("we know ,1 hp=0.7457 KW")
print("specific steam consumption in kg/hp hr="),round(0.7457*3600/W_net,2)
print("work ratio=net work/positive work"),round(W_net/Wt,4)
print("so cycle efficiency=45.74%,specific steam consumption =1.78 kg/hp hr,work ratio=0.9967")
```

In [95]:

```
#cal of mass of steam bled for feed heating,capacity of boiler required,overall thermal efficiency
#intiation of all variables
# Chapter 8
print"Example 8.8, Page:273 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 8 Example 8")
T_cond=115;#condensate temperature in degree celcius
Cp=4.18;#specific heat at constant pressure in KJ/kg K
P=30*10**3;#actual alternator output in KW
n_boiler=0.9;#boiler efficiency
n_alternator=0.98;#alternator efficiency
print("from steam tables,at state 2,h2=3301.8 KJ/kg,s2=6.7193 KJ/kg K")
h2=3301.8;
s2=6.7193;
print("h5=hf at 0.05 bar=137.82 KJ/kg,v5= vf at 0.05 bar=0.001005 m^3/kg")
h5=137.82;
v5=0.001005;
print("Let mass of steam bled for feed heating be m kg/kg of steam generated in boiler.Let us also assume that condensate leaves closed feed water heater as saturated liquid i.e")
print("h8=hf at 3 bar=561.47 KJ/kg")
h8=561.47;
print("for process 2-3-4,s2=s3=s4=6.7193 KJ/kg K")
s3=s2;
s4=s3;
print("Let dryness fraction at state 3 and state 4 be x3 and x4 respectively.")
print("s3=6.7193=sf at 3 bar+x3* sfg at 3 bar")
print("from steam tables,sf=1.6718 KJ/kg K,sfg=5.3201 KJ/kg K")
sf_3bar=1.6718;
sfg_3bar=5.3201;
x3=(s3-sf_3bar)/sfg_3bar
print("so x3="),round(x3,2)
x3=0.949;#approx.
print("s4=6.7193=sf at 0.05 bar+x4* sfg at 0.05 bar")
print("from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K")
sf=0.4764;
sfg=7.9187;
x4=(s4-sf)/sfg
print("so x4="),round(x4,2)
x4=0.788;#approx.
print("thus,h3=hf at 3 bar+x3* hfg at 3 bar in KJ/kg")
print("here from steam tables,at 3 bar,hf_3bar=561.47 KJ/kg,hfg_3bar=2163.8 KJ/kg K")
hf_3bar=561.47;
hfg_3bar=2163.8;
h3=hf_3bar+x3*hfg_3bar
print("h4=hf at 0.05 bar+x4*hfg at 0.05 bar in KJ/kg")
print("from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg")
hf=137.82;
hfg=2423.7;
h4=hf+x4*hfg
print("assuming process across trap to be of throttling type so,h8=h9=561.47 KJ/kg.Assuming v5=v6,")
h9=h8;
v6=v5;
print("pumping work=(h7-h6)=v5*(p1-p5)in KJ/kg")
p1=60;#pressure of steam in high pressure turbine in bar
p5=0.05;#pressure of steam in low pressure turbine in bar
v5*(p1-p5)*100
print("for mixing process between condenser and feed pump,")
print("(1-m)*h5+m*h9=1*h6")
print("h6=m(h9-h5)+h5")
print("we get,h6=137.82+m*423.65")
print("therefore h7=h6+6.02=143.84+m*423.65")
print("Applying energy balance at closed feed water heater;")
print("m*h3+(1-m)*h7=m*h8+(Cp*T_cond)")
print("so (m*2614.92)+(1-m)*(143.84+m*423.65)=m*561.47+480.7")
print("so m=0.144 kg")
m=0.144;
h6=137.82+m*423.65;
h7=143.84+m*423.65;
print("steam bled for feed heating=0.144 kg/kg steam generated")
W_net=(h2-h3)+(1-m)*(h3-h4)-(1-m)*(h7-h6)
print("The net power output,W_net in KJ/kg steam generated="),round(W_net,2)
P/(n_alternator*W_net)
print("mass of steam required to be generated in kg/s="),round(P/(n_alternator*W_net),2)
print("or in kg/hr")
26.23*3600
print("so capacity of boiler required=94428 kg/hr")
print("overall thermal efficiency=W_net/Q_add")
Q_add=(h2-Cp*T_cond)/n_boiler
print("here Q_add in KJ/kg="),round(Q_add,2)
W_net/Q_add
print("overall thermal efficiency="),round(W_net/Q_add,2)
W_net*100/Q_add
print("in percentage="),round(W_net*100/Q_add,2)
print("so overall thermal efficiency=37.24%")
```

In [96]:

```
#cal of capacity of drain pump
#intiation of all variables
# Chapter 8
print"Example 8.9, Page:275 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 8 Example 9")
P=15*10**3;#turbine output in KW
print("At inlet to first turbine stage,h2=3230.9 KJ/kg,s2=6.9212 KJ/kg K")
h2=3230.9;
s2=6.9212;
print("For ideal expansion process,s2=s3")
s3=s2;
print("By interpolation,T3=190.97 degree celcius from superheated steam tables at 6 bar,h3=2829.63 KJ/kg")
T3=190.97;
h3=2829.63;
h3_a=h2-0.8*(h2-h3)
print("actual stste at exit of first stage,h3_a in KJ/kg="),round(h3_a,2)
s3_a=7.1075;
print("actual state 3_a shall be at 232.78 degree celcius,6 bar,so s3_a KJ/kg K="),round(s3_a,4)
print("for second stage,s3_a=s4;By interpolation,s4=7.1075=sf at 1 bar+x4*sfg at 1 bar")
s4=7.1075;
print("from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K")
sf=1.3026;
sfg=6.0568;
x4=(s4-sf)/sfg
print("so x4="),round(x4,2)
x4=0.958;#approx.
print("h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg")
print("from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg")
hf=417.46;
hfg=2258.0;
h4=hf+x4*hfg
h4_a=h3_a-.8*(h3_a-h4)
print("actual enthalpy at exit from second stage,h4_a in KJ/kg="),round(h4_a,2)
print("actual dryness fraction,x4_a=>h4_a=hf at 1 bar+x4_a*hfg at 1 bar")
x4_a=(h4_a-hf)/hfg
print("so x4_a="),round(x4_a,2)
print("x4_a=0.987,actual entropy,s4_a=7.2806 KJ/kg K")
s4_a=7.2806;
print("for third stage,s4_a=7.2806=sf at 0.075 bar+x5*sfg at 0.075 bar")
print("from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K")
sf=0.5764;
sfg=7.6750;
x5=(s4_a-sf)/sfg
print("so x5="),round(x5,2)
x5=0.8735;#approx.
print("h5=2270.43 KJ/kg")
h5=2270.43;
h5_a=h4_a-0.8*(h4_a-h5)
print("actual enthalpy at exit from third stage,h5_a in KJ/kg="),round(h5_a,2)
print("Let mass of steam bled out be m1 and m2 kg at 6 bar,1 bar respectively.")
print("By heat balance on first closed feed water heater,(see schematic arrangement)")
print("h11=hf at 6 bar=670.56 KJ")
h11=670.56;
print("m1*h3_a+h10=m1*h11+4.18*150")
print("(m1*2829.63)+h10=(m1*670.56)+627")
print("h10+2159.07*m1=627")
print("By heat balance on second closed feed water heater,(see schematic arrangement)")
print("h7=hf at 1 bar=417.46 KJ/kg")
h7=417.46;
print("m2*h4+(1-m1-m2)*4.18*38=(m1+m2)*h7+4.18*95*(1-m1-m2)")
print("m2*2646.4+(1-m1-m2)*158.84=((m1+m2)*417.46)+(397.1*(1-m1-m2))")
print("m2*2467.27-m1*179.2-238.26=0")
print("heat balance at point of mixing,")
print("h10=(m1+m2)*h8+(1-m1-m2)*4.18*95")
print("neglecting pump work,h7=h8")
print("h10=m2*417.46+(1-m1-m2)*397.1")
print("substituting h10 and solving we get,m1=0.1293 kg and m2=0.1059 kg/kg of steam generated")
m1=0.1293;
m2=0.1059;
Wt=(h2-h3_a)+(1-m1)*(h3_a-h4_a)+(1-m1-m2)*(h4_a-h5_a)
print("Turbine output per kg of steam generated,Wt in KJ/kg of steam generated="),round(Wt,3)
P/Wt
print("Rate of steam generation required in kg/s="),round(P/Wt,2)
print("in kg/hr")
P*3600/Wt
(m1+m2)*69192
print("capacity of drain pump i.e. FP shown in layout in kg/hr="),round((m1+m2)*69192,2)
print("so capacity of drain pump=16273.96 kg/hr")
```

In [97]:

```
#cal of cycle efficiency
#intiation of all variables
# Chapter 8
print"Example 8.10, Page:277 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 8 Example 10")
print("at inlet to HP turbine,h2=3287.1 KJ/kg,s2=6.6327 KJ/kg K")
h2=3287.1;
s2=6.6327;
print("By interpolation state 3 i.e. for isentropic expansion betweeen 2-3 lies at 328.98oc at 30 bar.h3=3049.48 KJ/kg")
h3=3049.48;
h3_a=h2-0.80*(h2-h3)
print("actual enthapy at 3_a,h3_a in KJ/kg="),round(h3_a,2)
print("enthalpy at inlet to LP turbine,h4=3230.9 KJ/kg,s4=6.9212 KJ K")
h4=3230.9;
s4=6.9212;
print("for ideal expansion from 4-6,s4=s6.Let dryness fraction at state 6 be x6.")
s6=s4;
print("s6=6.9212=sf at 0.075 bar+x6* sfg at 0.075 bar in KJ/kg K")
print("from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K")
sf=0.5764;
sfg=7.6750;
x6=(s6-sf)/sfg
print("so x6="),round(x6,2)
x6=0.827;#approx.
print("h6=hf at 0.075 bar+x6*hfg at 0.075 bar in KJ/kg K")
print("from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg")
hf=168.79;
hfg=2406.0;
h6=hf+x6*hfg
print("for actual expansion process in LP turbine.")
h6_a=h4-0.85*(h4-h6)
print("h6_a=h4-0.85*(h4-h6) in KJ/kg"),round(h6_a,2)
print("Ideally,enthalpy at bleed point can be obtained by locating state 5 using s5=s4.The pressure at bleed point shall be saturation pressure corresponding to the 140oc i.e from steam tables.Let dryness fraction at state 5 be x5.")
p5=3.61;
s5=s4;
print("s5_a=6.9212=sf at 140oc+x5*sfg at 140oc")
print("from steam tables,at 140oc,sf=1.7391 KJ/kg K,sfg=5.1908 KJ/kg K")
sf=1.7391;
sfg=5.1908;
x5=(s5-sf)/sfg
print("so x5="),round(x5,2)
x5=0.99;#approx.
print("h5=hf at 140oc+x5*hfg at 140oc in KJ/kg")
print("from steam tables,at 140oc,hf=589.13 KJ/kg,hfg=2144.7 KJ/kg")
hf=589.13;
hfg=2144.7;
h5=hf+x5*hfg
h5_a=h4-0.85*(h4-h5)
print("actual enthalpy,h5_a in KJ/kg="),round(h5_a,2)
print("enthalpy at exit of open feed water heater,h9=hf at 30 bar=1008.42 KJ/kg")
h9=1008.42;
print("specific volume at inlet of CEP,v7=0.001008 m^3/kg")
v7=0.001008;
print("enthalpy at inlet of CEP,h7=168.79 KJ/kg")
h7=168.79;
h8=h7+v7*(3.61-0.075)*10**2
print("for pumping process 7-8,h8 in KJ/kg="),round(h8,2)
print("Applying energy balance at open feed water heater.Let mass of bled steam be m kg per kg of steam generated.")
print("m*h5+(1-m)*h8=h9")
m=(h9-h8)/(h5-h8)
print("so m in kg /kg of steam generated="),round(m,2)
print("For process on feed pump,9-1,v9=vf at 140oc=0.00108 m^3/kg")
v9=0.00108;
h1=h9+v9*(70-3.61)*10**2
print("h1= in KJ/kg="),round(h1,2)
W_net=(h2-h3_a)+(h4-h5_a)+(1-m)*(h5_a-h6_a)-((1-m)*(h8-h7)+(h1-h9))
print("Net work per kg of steam generated,W_net=in KJ/kg steam generated="),round(W_net,2)
q_add=(h2-h1)+(h4-h3_a)
print("heat added per kg of steam generated,q_add in KJ/kg of steam generated="),round(q_add,2)
n=W_net/q_add
print("Thermal efficiency,n="),round(n,2)
n=n*100
print("in percentage="),round(n,2)
print("so thermal efficiency=39.03%%")
print("NOTE=>In this question there is some calculation mistake while calculating W_net and q_add in book, which is corrected above and the answers may vary.")
```

In [98]:

```
#cal of cycle thermal efficiency,Net power developed
#intiation of all variables
# Chapter 8
print"Example 8.11, Page:279 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 8 Example 11")
print("Enthalpy of steam entering ST1,h2=3308.6 KJ/kg,s2=6.3443 KJ/kg K")
h2=3308.6;
s2=6.3443;
print("for isentropic expansion 2-3-4-5,s2=s3=s4=s5")
s3=s2;
s4=s3;
s5=s4;
print("Let dryness fraction of states 3,4 and 5 be x3,x4 and x5")
print("s3=6.3443=sf at 10 bar+x3*sfg at 10 bar")
print("so x3=(s3-sf)/sfg")
print("from steam tables,at 10 bar,sf=2.1387 KJ/kg K,sfg=4.4478 KJ/kg K")
sf=2.1387;
sfg=4.4478;
x3=(s3-sf)/sfg
x3=0.945;#approx.
print("h3=hf+x3*hfg in KJ/kg")
print("from steam tables,hf=762.81 KJ/kg,hfg=2015.3 KJ/kg")
hf=762.81;
hfg=2015.3;
h3=hf+x3*hfg
print("s4=6.3443=sf at 1.5 bar+x4*sfg at 1.5 bar")
print("so x4=(s4-sf)/sfg")
print("from steam tables,at 1.5 bar,sf=1.4336 KJ/kg K,sfg=5.7897 KJ/kg K")
sf=1.4336;
sfg=5.7897;
x4=(s4-sf)/sfg
x4=0.848;#approx.
print("so h4=hf+x4*hfg in KJ/kg")
print("from steam tables,at 1.5 bar,hf=467.11 KJ/kg,hfg=2226.5 KJ/kg")
hf=467.11;
hfg=2226.5;
h4=hf+x4*hfg
print("s5=6.3443=sf at 0.05 bar+x5*sfg at 0.05 bar")
print("so x5=(s5-sf)/sfg")
print("from steam tables,at 0.05 bar,sf=0.4764 KJ/kg K,sfg=7.9187 KJ/kg K")
sf=0.4764;
sfg=7.9187;
x5=(s5-sf)/sfg
x5=0.739;#approx.
print("h5=hf+x5*hfg in KJ/kg")
print("from steam tables,at 0.05 bar,hf=137.82 KJ/kg,hfg=2423.7 KJ/kg")
hf=137.82;
hfg=2423.7;
h5=hf+x5*hfg
print("h6=hf at 0.05 bar=137.82 KJ/kg")
h6=137.82;
print("v6=vf at 0.05 bar=0.001005 m^3/kg")
v6=0.001005;
print("h7=h6+v6*(1.5-0.05)*10^2 in KJ/kg")
h7=h6+v6*(1.5-0.05)*10**2
print("h8=hf at 1.5 bar=467.11 KJ/kg")
h8=467.11;
print("v8=0.001053 m^3/kg=vf at 1.5 bar")
v8=0.001053;
print("h9=h8+v8*(150-1.5)*10^2 in KJ/kg")
h9=h8+v8*(150-1.5)*10**2
print("h10=hf at 150 bar=1610.5 KJ/kg")
h10=1610.5;
print("v10=0.001658 m^3/kg=vf at 150 bar")
v10=0.001658;
print("h12=h10+v10*(150-10)*10^2 in KJ/kg")
h12=h10+v10*(150-10)*10**2
print("Let mass of steam bled out at 10 bar,1.5 bar be m1 and m2 per kg of steam generated.")
print("Heat balance on closed feed water heater yields,")
print("m1*h3+(1-m)*h9=m1*h10+(1-m1)*4.18*150")
print("so m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)in kg/kg of steam generated.")
m1=(4.18*150-h9)/(h3-h9-h10+4.18*150)
print("heat balance on open feed water can be given as under,")
print("m2*h4+(1-m1-m2)*h7=(1-m1)*h8")
print("so m2=((1-m1)*(h8-h7))/(h4-h7)in kg/kg of steam")
m2=((1-m1)*(h8-h7))/(h4-h7)
print("for mass flow rate of 300 kg/s=>m1=36 kg/s,m2=39 kg/s")
print("For mixing after closed feed water heater,")
print("h1=(4.18*150)*(1-m1)+m1*h12 in KJ/kg")
h1=(4.18*150)*(1-m1)+m1*h12
print("Net work output per kg of steam generated=W_ST1+W_ST2+W_ST3-{W_CEP+W_FP+W_FP2}")
print("W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-{(1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10))}in KJ/kg of steam generated.")
W_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-((1-m1-m2)*(h7-h6)+(1-m1)*(h9-h8)+(m1*(h12-h10)))
print("heat added per kg of steam generated,q_add=(h2-h1) in KJ/kg")
q_add=(h2-h1)
n=W_net/q_add
print("cycle thermal efficiency,n=W_net/q_add"),round(n,2)
print("in percentage"),round(n*100,2)
print("Net power developed in KW=1219*300 in KW"),round(1219*300,2)
print("cycle thermal efficiency=47.6%")
print("Net power developed=365700 KW")
```

In [99]:

```
#cal of thermal efficiency,steam generation rate
#intiation of all variables
# Chapter 8
print"Example 8.12, Page:282 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 8 Example 12")
P=100*10**3;#net power output in KW
print("At inlet to HPT,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K")
h2=3373.7;
s2=6.5966;
print("For isentropic expansion between 2-3-4-5,s2=s3=s4=s5")
s3=s2;
s4=s3;
s5=s4;
print("state 3 lies in superheated region as s3>sg at 20 bar.By interpolation from superheated steam table,T3=261.6oc.Enthalpy at 3,h3=2930.57 KJ/kg")
T3=261.6;
h3=2930.57;
print("since s4<sg at 4 bar so state 4 and 5 lies in wet region.")
print("Let dryness fraction at state 4 ans 5 be x4 and x5.")
print("s4=6.5966=sf at 4 bar+x4*sfg at 4 bar")
print("from steam tables,at 4 bar,sf=1.7766 KJ/kg K,sfg=5.1193 KJ/kg K")
sf=1.7766;
sfg=5.1193;
print("x4=(s4-sf)/sfg")
x4=(s4-sf)/sfg
x4=0.941;#approx.
print("h4=hf at 4 bar+x4*hfg at 4 bar in KJ/kg")
print("from steam tables,at 4 bar,hf=604.74 KJ/kg,hfg=2133.8 KJ/kg")
hf=604.74;
hfg=2133.8;
h4=hf+x4*hfg
print("for state 5,")
print("s5=6.5966=sf at 0.075 bar+x5*sfg at 0.075 bar")
print("from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K")
sf=0.5764;
sfg=7.6750;
print("x5=(s5-sf)/sfg")
x5=(s5-sf)/sfg
x5=0.784;#approx.
print("h5=hf at 0.075 bar+x5*hfg at 0.075 bar in KJ/kg")
print("from steam tables,at 0.075 bar,hf=168.76 KJ/kg,hfg=2406.0 KJ/kg")
hf=168.76;
hfg=2406.0;
h5=hf+x5*hfg
print("Let mass of steam bled at 20 bar be m1 and m2 per kg of steam generated.")
print("h10=hf at 20 bar=908.76 KJ/kg,h8=hf at 4 bar=604.74 KJ/kg")
h10=908.76;
h8=604.74;
print("At trap h10=h11=908.79 KJ/kg")
h11=h10;
print("At condensate extraction pump,(CEP),h7-h6=v6*(4-0.075)*10^2 in KJ/kg")
print("here v6=vf at 0.075 bar=0.001008 m^3/kg,h6=hf at 0.075 bar=168.79 KJ/kg")
v6=0.001008;
h6=168.79;
print("so h7=h6+v6*(4-0.075)*10^2 in KJ/kg")
h7=h6+v6*(4-0.075)*10**2
print("At feed pump,(FP),h9-h8=v8*(20-4)*10^2 in KJ/kg")
print("here v8=vf at 4 bar=0.001084 m^3/kg,h8=hf at 4 bar=604.74 KJ/kg")
v8=0.001084;
h8=604.74;
print("so h9=h8+v8*(20-4)*10^2 in KJ/kg")
h9=h8+v8*(20-4)*10**2
print("Let us apply heat balance at closed feed water heater,")
print("m1*h3+h9=m1*h10+4.18*200")
print("so m1=(4.18*200-h9)/(h3-h10) in kg")
m1=(4.18*200-h9)/(h3-h10)
m1=0.114;#approx.
print("Applying heat balance at open feed water,")
print("m1*h11+m2*h4+(1-m1-m2)*h7=h8")
print("so m2=(h8-m1*h11-h7+m1*h7)/(h4-h7) in kg")
m2=(h8-m1*h11-h7+m1*h7)/(h4-h7)
m2=0.144;#approx.
print("Net work per kg steam generated,")
print("w_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-{(1-m1-m2)*(h7-h6)+(h9-h8)} in KJ/kg")
w_net=(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-((1-m1-m2)*(h7-h6)+(h9-h8))
print("Heat added per kg steam generated,q_add=(h2-h1) in KJ/kg")
h1=4.18*200;
q_add=(h2-h1)
print("Thermal efficiency=w_net/q_add"),round(w_net/q_add,2)
print("in percentage"),round(w_net*100/q_add,2)
print("steam generation rate=P/w_net in kg/s"),round(P/w_net,2)
print("so thermal efficiency=44.78%")
print("steam generation rate=87.99 kg/s")
print("a> For the reheating introduced at 20 bar up to 400oc.The modified cycle representation is shown on T-S diagram by 1-2-3-3_a-4_a-5_a-6-7-8-9-10-11")
print("At state 2,h2=3373.7 KJ/kg,s2=6.5966 KJ/kg K")
h2=3373.7;
s2=6.5966;
print("At state 3,h3=2930.57 KJ/kg")
h3=2930.57;
print("At state 3_a,h3_a=3247.6 KJ/kg,s3_a=7.1271 KJ/kg K")
h3_a=3247.6;
s3_a=7.1271;
print("At state 4_a and 5_a,s3_a=s4_a=s5_a=7.1271 KJ/kg K")
s4_a=s3_a;
s5_a=s4_a;
print("From steam tables by interpolation state 4_a is seen to be at 190.96oc at 4 bar,h4_a=2841.02 KJ/kg")
h4_a=2841.02;
print("Let dryness fraction at state 5_a be x5,")
print("s5_a=7.1271=sf at 0.075 bar+x5_a*sfg at 0.075 bar")
print("from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K")
print("so x5_a=(s5_a-sf)/sfg")
x5_a=(s5_a-sf)/sfg
x5_a=0.853;#approx.
print("h5_a=hf at 0.075 bar+x5_a*hfg at 0.075 bar in KJ/kg")
print("from steam tables,at 0.075 bar,hf=168.76 KJ/kg,hfg=2406.0 KJ/kg")
h5_a=hf+x5_a*hfg
print("Let mass of bled steam at 20 bar and 4 bar be m1_a,m2_a per kg of steam generated.Applying heat balance at closed feed water heater.")
print("m1_a*h3+h9=m1*h10+4.18*200")
print("so m1_a=(4.18*200-h9)/(h3-h10) in kg")
m1_a=(4.18*200-h9)/(h3-h10)
m1_a=0.114;#approx.
print("Applying heat balance at open feed water heater,")
print("m1_a*h11+m2_a*h4_a+(1-m1_a-m2_a)*h7=h8")
print("so m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7) in kg")
m2_a=(h8-m1_a*h11-h7+m1_a*h7)/(h4_a-h7)
m2_a=0.131;#approx.
print("Net work per kg steam generated")
print("w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-{(1-m1_a-m2_a)*(h7-h6)+(h9-h8)}in KJ/kg")
w_net=(h2-h3)+(1-m1_a)*(h3_a-h4_a)+(1-m1_a-m2_a)*(h4_a-h5_a)-((1-m1_a-m2_a)*(h7-h6)+(h9-h8))
print("Heat added per kg steam generated,q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)in KJ/kg")
q_add=(h2-h1)+(1-m1_a)*(h3_a-h3)
n=w_net/q_add
print("Thermal efficiency,n="),round(n,2)
print("in percentage"),round(n*100,2)
print("% increase in thermal efficiency due to reheating="),round((0.4503-0.4478)*100/0.4478,2)
print("so thermal efficiency of reheat cycle=45.03%")
print("% increase in efficiency due to reheating=0.56%")
```

In [100]:

```
#cal of thermal efficiency
#intiation of all variables
# Chapter 8
print"Example 8.13, Page:286 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 8 Example 13")
print("For mercury cycle,")
print("insentropic heat drop=349-234.5 in KJ/kg Hg")
349-234.5
print("actual heat drop=0.85*114.5 in KJ/kg Hg")
0.85*114.5
print("Heat rejected in condenser=(349-97.325-35)in KJ/kg")
(349-97.325-35)
print("heat added in boiler=349-35 in KJ/kg")
349-35
print("For steam cycle,")
print("Enthalpy of steam generated=h at 40 bar,0.98 dry=2767.13 KJ/kg")
h=2767.13;
print("Enthalpy of inlet to steam turbine,h2=h at 40 bar,450oc=3330.3 KJ/kg")
h2=3330.3;
print("Entropy of steam at inlet to steam turbine,s2=6.9363 KJ/kg K")
s2=6.9363;
print("Therefore,heat added in condenser of mercury cycle=h at 40 bar,0.98 dry-h_feed at 40 bar in KJ/kg")
h-4.18*150
print("Therefore,mercury required per kg of steam=2140.13/heat rejected in condenser in kg per kg of steam")
2140.13/216.675
print("for isentropic expansion,s2=s3=s4=s5=6.9363 KJ/kg K")
s3=s2;
s4=s3;
s5=s4;
print("state 3 lies in superheated region,by interpolation the state can be given by,temperature 227.07oc at 8 bar,h3=2899.23 KJ/kg")
h3=2899.23;
print("state 4 lies in wet region,say with dryness fraction x4")
print("s4=6.9363=sf at 1 bar+x4*sfg at 1 bar")
print("so x4=(s4-sf)/sfg")
print("from steam tables,at 1 bar,sf=1.3026 KJ/kg K,sfg=6.0568 KJ/kg K")
sf=1.3026;
sfg=6.0568;
x4=(s4-sf)/sfg
x4=0.93;#approx.
print("h4=hf at 1 bar+x4*hfg at 1 bar in KJ/kg")
print("from steam tables,at 1 bar,hf=417.46 KJ/kg,hfg=2258.0 KJ/kg")
hf=417.46;
hfg=2258.0;
h4=hf+x4*hfg
print("Let state 5 lie in wet region with dryness fraction x5,")
print("s5=6.9363=sf at 0.075 bar+x5*sfg at 0.075 bar")
print("so x5=(s5-sf)/sfg")
print("from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K")
sf=0.5764;
sfg=7.6750;
x5=(s5-sf)/sfg
x5=0.828;#approx.
print("h5=hf+x5*hfg in KJ/kg")
print("from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg")
hf=168.79;
hfg=2406.0;
h5=hf+x5*hfg
print("Let mass of steam bled at 8 bar and 1 bar be m1 and m2 per kg of steam generated.")
print("h7=h6+v6*(1-0.075)*10^2 in KJ/kg")
print("from steam tables,at 0.075 bar,h6=hf=168.79 KJ/kg,v6=vf=0.001008 m^3/kg")
h6=168.79;
v6=0.001008;
h7=h6+v6*(1-0.075)*10**2
print("h9=hf at 1 bar=417.46 KJ/kg,h13=hf at 8 bar=721.11 KJ/kg")
h9=417.46;
h13=721.11;
print("Applying heat balance on CFWH1,T1=150oc and also T15=150oc")
T1=150;
T15=150;
print("m1*h3+(1-m1)*h12=m1*h13+(4.18*150)*(1-m1)")
print("(m1-2899.23)+(1-m1)*h12=(m1*721.11)+627*(1-m1)")
print("Applying heat balance on CFEH2,T11=90oc")
T11=90;
print("m2*h4+(1-m1-m2)*h7=m2*h9+(1-m1-m2)*4.18*90")
print("(m2*2517.4)+(1-m1-m2)*168.88=(m2*417.46)+376.2*(1-m1-m2)")
print("Heat balance at mixing between CFWH1 and CFWH2,")
print("(1-m1-m2)*4.18*90+m2*h10=(1-m1)*h12")
print("376.2*(1-m1-m2)+m2*h10=(1-m1)*h12")
print("For pumping process,9-10,h10=h9+v9*(8-1)*10^2 in KJ/kg")
print("from steam tables,h9=hf at 1 bar=417.46 KJ/kg,v9=vf at 1 bar=0.001043 m^3/kg")
h9=417.46;
v9=0.001043;
h10=h9+v9*(8-1)*10**2
print("solving above equations,we get")
print("m1=0.102 kg per kg steam generated")
print("m2=0.073 kg per kg steam generated")
m1=0.102;
m2=0.073;
print("pump work in process 13-14,h14-h13=v13*(40-8)*10^2")
print("so h14-h13 in KJ/kg")
v13=0.001252;
v13*(40-8)*10**2
print("Total heat supplied(q_add)=(9.88*314)+(3330.3-2767.13) in KJ/kg of steam")
q_add=(9.88*314)+(3330.3-2767.13)
print("net work per kg of steam,w_net=w_mercury+w_steam")
print("w_net=(9.88*97.325)+{(h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h4-h6)-m2*(h10-h9)-m1*(h14-h13)} in KJ/kg")
w_net=(9.88*97.325)+((h2-h3)+(1-m1)*(h3-h4)+(1-m1-m2)*(h4-h5)-(1-m1-m2)*(h7-h6)-m2*(h10-h9)-m1*4.006)
print("thermal efficiency of binary vapour cycle=w_net/q_add"),round(w_net/q_add,2)
print("in percentage"),round(w_net*100/q_add,2)
print("so thermal efficiency=55.36%")
print("NOTE=>In this question there is some mistake in formula used for w_net which is corrected above.")
```

In [101]:

```
#cal of HP steam required
#intiation of all variables
# Chapter 8
print"Example 8.14, Page:288 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 8 Example 14")
n=0.8;#efficiency of both HP and LP turbine
P=2500;#output in hp
print("This is a mixed pressure turbine so the output of turbine shall be sum of the contributions by HP and LP steam streams.")
print("For HP:at inlet of HP steam=>h1=3023.5 KJ/kg,s1=6.7664 KJ/kg K")
h1=3023.5;
s1=6.7664;
print("ideally, s2=s1=6.7664 KJ/kg K")
s2=s1;
print("s2=sf at 0.075 bar +x3* sfg at 0.075 bar")
print("from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K")
sf=0.5764;
sfg=7.6750;
print("so x3=(s2-sf)/sfg")
x3=(s2-sf)/sfg
x3=0.806;#approx.
print("h_3HP=hf at 0.075 bar+x3*hfg at 0.075 bar in KJ/kg")
print("from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg")
hf=168.79;
hfg=2406.0;
h_3HP=hf+x3*hfg
print("actual enthalpy drop in HP(h_HP)=(h1-h_3HP)*n in KJ/kg")
h_HP=(h1-h_3HP)*n
print("for LP:at inlet of LP steam")
print("h2=2706.7 KJ/kg,s2=7.1271 KJ/kg K")
h2=2706.7;
s2=7.1271;
print("Enthalpy at exit,h_3LP=2222.34 KJ/kg")
h_3LP=2222.34;
print("actual enthalpy drop in LP(h_LP)=(h2-h_3LP)*n in KJ/kg")
h_LP=(h2-h_3LP)*n
print("HP steam consumption at full load=P*0.7457/h_HP in kg/s")
P*0.7457/h_HP
print("HP steam consumption at no load=0.10*(P*0.7457/h_HP)in kg/s")
0.10*(P*0.7457/h_HP)
print("LP steam consumption at full load=P*0.7457/h_LP in kg/s")
P*0.7457/h_LP
print("LP steam consumption at no load=0.10*(P*0.7457/h_LP)in kg/s")
0.10*(P*0.7457/h_LP)
print("The problem can be solved geometrically by drawing willans line as per scale on graph paper and finding out the HP stream requirement for getting 1000 hp if LP stream is available at 1.5 kg/s.")
print("or,Analytically the equation for willans line can be obtained for above full load and no load conditions for HP and LP seperately.")
print("Willians line for HP:y=m*x+C,here y=steam consumption,kg/s")
print("x=load,hp")
print("y_HP=m_HP*x+C_HP")
print("0.254=m_HP*0+C_HP")
print("so C_HP=0.254")
C_HP=0.254;
print("2.54=m_HP*2500+C_HP")
print("so m_HP=(2.54-C_HP)/2500")
m_HP=(2.54-C_HP)/2500
print("so y_HP=9.144*10^-4*x_HP+0.254")
print("Willans line for LP:y_LP=m_LP*x_LP+C_LP")
print("0.481=m_LP*0+C_LP")
print("so C_LP=0.481")
C_LP=0.481;
print("4.81=m_LP*2500+C_LP")
print("so m_LP=(4.81-C_LP)/2500")
m_LP=(4.81-C_LP)/2500
print("so y_LP=1.732*10^-3*x_LP+0.481")
print("Total output(load) from mixed turbine,x=x_HP+x_LP")
print("For load of 1000 hp to be met by mixed turbine,let us find out the load shared by LP for steam flow rate of 1.5 kg/s")
y_LP=1.5;
print("from y_LP=1.732*10^-3*x_LP+0.481,")
print("x_LP=(y_LP-0.481)/1.732*10^-3")
x_LP=(y_LP-0.481)/(1.732*10**-3)
print("since by 1.5 kg/s of LP steam only 588.34 hp output contribution is made so remaining(1000-588.34)=411.66 hp,411.66 hp should be contributed by HP steam.By willans line for HP turbine,")
x_HP=411.66;
y_HP=9.144*10**-4*x_HP+C_HP
print("from y_HP=9.144*10^-4*x_HP+C_HP in kg/s"),round(y_HP,2)
print("so HP steam requirement=0.63 kg/s")
```

In [102]:

```
#cal of thermal efficiency,heat transferred and temperature
#intiation of all variables
# Chapter 8
print"Example 8.15, Page:289 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 8 Example 15")
print("Let us carry out analysis for 1 kg of steam generated in boiler.")
print("Enthalpy at inlet to HPT,h2=2960.7 KJ/kg,s2=6.3615 KJ/kg K")
h2=2960.7;
s2=6.3615;
print("state at 3 i.e. exit from HPT can be identified by s2=s3=6.3615 KJ/kg K")
s3=s2;
print("Let dryness fraction be x3,s3=6.3615=sf at 2 bar+x3*sfg at 2 bar")
sf=1.5301;
sfg=5.5970;
x3=(s3-sf)/sfg
print("so x3="),round(x3,2)
print("from stem tables,at 2 bar,sf=1.5301 KJ/kg K,sfg=5.5970 KJ/kg K")
x3=0.863;#approx.
print("h3=2404.94 KJ/kg")
h3=2404.94;
print("If one kg of steam is generated in bolier then at exit of HPT,0.5 kg goes into process heater and 0.5 kg goes into separator")
print("mass of moisture retained in separator(m)=(1-x3)*0.5 kg")
m=(1-x3)*0.5
print("Therefore,mass of steam entering LPT(m_LP)=0.5-m kg")
m_LP=0.5-m
print("Total mass of water entering hot well at 8(i.e. from process heater and drain from separator)=(0.5+0.685)=0.5685 kg")
print("Let us assume the temperature of water leaving hotwell be T oc.Applying heat balance for mixing;")
print("(0.5685*4.18*90)+(0.4315*4.18*40)=(1*4.18*T)")
T=((0.5685*4.18*90)+(0.4315*4.18*40))/4.18
print("so T in degree celcius="),round(T,3)
print("so temperature of water leaving hotwell=68.425 degree celcius")
print("Applying heat balanced on trap")
print("0.5*h7+0.0685*hf at 2 bar=(0.5685*4.18*90)")
print("so h7=((0.5685*4.18*90)-(0.0685*hf))/0.5 in KJ/kg")
print("from steam tables,at 2 bar,hf=504.70 KJ/kg")
hf=504.70;
h7=((0.5685*4.18*90)-(0.0685*hf))/0.5
print("Therefore,heat transferred in process heater in KJ/kg steam generated="),round(0.5*(h3-h7),3)
print("so heat transferred per kg steam generated=1023.175 KJ/kg steam generated")
print("For state 10 at exit of LPT,s10=s3=s2=6.3615 KJ/kg K")
s10=s3;
print("Let dryness fraction be x10")
print("s10=6.3615=sf at 0.075 bar+x10*sfg at 0.075 bar")
print("from steam tables,at 0.075 bar,sf=0.5764 KJ/kg K,sfg=7.6750 KJ/kg K")
sf=0.5764;
sfg=7.6750;
print("so x10=(s10-sf)/sfg")
x10=(s10-sf)/sfg
x10=0.754;#approx.
print("h10=hf at 0.075 bar+x10*hfg at 0.075 bar")
print("from steam tables,at 0.075 bar,hf=168.79 KJ/kg,hfg=2406.0 KJ/kg")
hf=168.79;
hfg=2406.0;
print("so h10=hf+x10*hfg in KJ/kg ")
h10=hf+x10*hfg
print("net work output,neglecting pump work per kg of steam generated,")
print("w_net=(h2-h3)*1+0.4315*(h3-h10) in KJ/kg steam generated")
w_net=(h2-h3)*1+0.4315*(h3-h10)
q_add=(h2-4.18*68.425)
print("Heat added in boiler per kg steam generated,q_add in KJ/kg="),round(q_add,2)
w_net/q_add
print("thermal efficiency=w_net/q_add"),round(w_net/q_add,2)
print("in percentage"),round(w_net*100/q_add,2)
print("so Thermal efficiency=27.58%")
```

In [103]:

```
#cal of thermal efficiency,net power
#intiation of all variables
# Chapter 8
print"Example 8.16, Page:291 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 8 Example 16")
m=35;#mass flow rate in kg/s
print("from steam tables,h1=3530.9 KJ/kg,s1=6.9486 KJ/kg K")
h1=3530.9;
s1=6.9486;
print("Assuming isentropic expansion in nozzle,s1=s2=6.9486")
s2=s1;
print("Letdryness fraction at state 2,x2=0.864")
print("s2=sf at 0.2 bar+x2*sfg at 0.2 bar")
print("from steam tables,sf=0.8320 KJ/kg K,sfg=7.0766 KJ/kg K")
sf=0.8320;
sfg=7.0766;
x2=(s2-sf)/sfg
print("so x2="),round(x2,2)
x2=0.864;#approx.
print("hence,h2=hf at 0.2 bar+x2*hfg at 0.2 bar in KJ/kg")
print("from steam tables,hf at 0.2 bar=251.4 KJ/kg,hfg at 0.2 bar=2358.3 KJ/kg")
hf=251.4;
hfg=2358.3;
h2=hf+x2*hfg
print("considering pump work to be of isentropic type,deltah_34=v3*deltap_34")
print("from steam table,v3=vf at 0.2 bar=0.001017 m^3/kg")
v3=0.001017;
p3=70;#;pressure of steam entering turbine in bar
p4=0.20;#condenser pressure in bar
deltah_34=v3*(p3-p4)*100
print("or deltah_34 in KJ/kg="),round(deltah_34,2)
Wp=deltah_34
print("pump work,Wp in KJ/kg="),round(Wp,2)
print("turbine work,Wt=deltah_12=(h1-h2)in KJ/kg")
Wt=(h1-h2)
print("net work(W_net)=Wt-Wp in KJ/kg")
W_net=Wt-Wp
print("power produced(P)=mass flow rate*W_net in KJ/s")
P=m*W_net
print("so net power=43.22 MW")
print("heat supplied in boiler(Q)=(h1-h4) in KJ/kg")
print("enthalpy at state 4,h4=h3+deltah_34 in KJ/kg")
h3=hf;
h4=h3+deltah_34
Q=m*(h1-h4)
print("total heat supplied to boiler(Q)=m*(h1-h4)in KJ/s"),round(Q,2)
print("thermal efficiency=net work/heat supplied=W_net/Q"),round(P/Q,2)
print("in percentage"),round(P*100/Q,2)
print("so thermal efficiency=37.73%")
```

In [104]:

```
#cal of heat added,steam bled
#intiation of all variables
# Chapter 8
print"Example 8.1, Page:292 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 8 Example 17")
P=10*10**3;#output in KW
print("from steam tables,h1=3625.3 KJ/s,s1=6.9029 KJ/kg K")
h1=3625.3;
s1=6.9029;
print("due to isentropic expansion,s1=s2=s3=6.9029 KJ/kg K")
s2=s1;
s3=s2;
print("at state 2,i.e at pressure of 2 MPa and entropy 6.9029 KJ/kg K")
print("by interpolating state for s2 between 2 MPa,300 degree celcius and 2 MPa,350 degree celcius from steam tables,")
print("h2=3105.08 KJ/kg ")
h2=3105.08;
print("for state 3,i.e at pressure of 0.01 MPa entropy,s3 lies in wet region as s3<sg at 0.01 MPa.Let dryness fraction be x3 at this state")
print("s3=sf at 0.01 MPa+x3*sfg at 0.01 MPa")
print("from steam tables,sf at 0.01 MPa=0.6493 KJ/kg K,sfg at 0.01 MPa=7.5009 KJ/kg K")
sf=0.6493;
sfg=7.5009;
x3=(s3-sf)/sfg
print("so x3="),round(x3,2)
x3=0.834;#approx.
print("enthalpy at state 3,h3= hf at 0.01 MPa+x3*hfg at 0.01 MPa in KJ/kg")
print("from steam tables,at 0.01 MPa,hf=191.83 KJ/kg,hfg=2392.8 KJ/kg")
hf=191.83;
hfg=2392.8;
h3=hf+x3*hfg
print("let the mass of steam bled be mb per kg of steam from exit of HP for regenerative feed heating.")
print("Considering state at exit from feed heater being saturated liquid the enthalpy at exit of feed heater will be,hf at 2 MPa")
print("h6=hf at 2 MPa=908.79 KJ/kg")
h6=908.79;
print("for adiabatic mixing in feed heater,for one kg of steam leaving boiler,the heat balance yields,")
print("(1-mb)*h5+mb*h2=h6")
print("while neglecting pump work,")
print("h5=h4=hf at 0.01MPa=191.83 KJ/kg")
h4=191.83;
h5=h4;
print("substituting in heat balance on the feed heater,")
print("(1-mb)*h5+mb*h2=h6")
mb=(h6-h5)/(h2-h5)
print("so mb in kg per kg of steam entering HP turbine="),round((h6-h5)/(h2-h5),2)
mb=0.246;#approx.
print("steam bled per kg of steam passing through HP stage=0.246 kg")
print("let mass of steam leaving boiler be m kg/s")
print("output(P)=m*(h1-h2)+m*(1-mb)*(h2-h3)")
m=P/((h1-h2)+(1-mb)*(h2-h3))
print("so m in kg/s="),round(m,2)
m=8.25;#approx.
print("neglecting pump work,h7=h6=908.79 KJ/kg")
h7=h6;
Q_71=m*(h1-h7)
print("heat supplied to boiler,Q_71 in KJ/s="),round(Q_71,2)
print("so heat added=22411.21 KJ/s")
```

In [1]:

```
#cal of thermal efficiency,mass of steam
#intiation of all variables
# Chapter 8
print"Example 8.18, Page:294 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 8 Example 18")
W_net=50*10**3;#net output of turbine in KW
print("from steam tables,at inlet to first stage of turbine,h1=h at 100 bar,500oc=3373.7 KJ/kg,s1=s at 100 bar,500oc=6.5966 KJ/kg")
h1=3373.7;
s1=6.5966;
print("Due to isentropic expansion,s1=s6=s2 and s3=s8=s4")
s2=s1;
s6=s2;
print("State at 6 i.e bleed state from HP turbine,temperature by interpolation from steam table =261.6oc.")
print("At inlet to second stage of turbine,h6=2930.572 KJ/kg")
h6=2930.572;
print("h3=h at 10 bar,500oc=3478.5 KJ/kg,s3=s at 10 bar,500oc=7.7622 KJ/kg K")
h3=3478.5;
s3=7.7622;
s4=s3;
s8=s4;
print("At exit from first stage of turbine i.e. at 10 bar and entropy of 6.5966 KJ/kg K,Temperature by interpolation from steam table at 10 bar and entropy of 6.5966 KJ/kg K")
print("T2=181.8oc,h2=2782.8 KJ/kg")
T2=181.8;
h2=2782.8;
print("state at 8,i.e bleed state from second stage of expansion,i.e at 4 bar and entropy of 7.7622 KJ/kg K,Temperature by interpolation from steam table,T8=358.98oc=359oc")
T8=359;
print("h8=3188.7 KJ/kg")
h8=3188.7;
print("state at 4 i.e. at condenser pressure of 0.1 bar and entropy of 7.7622 KJ/kg K,the state lies in wet region.So let the dryness fraction be x4.")
print("s4=sf at 0.1 bar+x4*sfg at 0.1 bar")
print("from steam tables,at 0.1 bar,sf=0.6493 KJ/kg K,sfg=7.5009 KJ/kg K")
sf=0.6493;
sfg=7.5009;
x4=(s4-sf)/sfg
print("so x4="),round(x4,2)
x4=0.95;#approx.
print("h4=hf at 0.1 bar+x4*hfg at 0.1 bar in KJ/kg ")
print("from steam tables,at 0.1 bar,hf=191.83 KJ/kg,hfg=2392.8 KJ/kg")
hf=191.83;
hfg=2392.8;
h4=hf+x4*hfg
print("given,h4=2464.99 KJ/kg,h11=856.8 KJ/kg,h9=hf at 4 bar=604.74 KJ/kg")
h4=2464.99;
h11=856.8;
h9=604.74;
print("considering pump work,the net output can be given as,")
print("W_net=W_HPT+W_LPT-(W_CEP+W_FP)")
print("where,W_HPT={(h1-h6)+(1-m6)*(h6-h2)}per kg of steam from boiler.")
print("W_LPT={(1-m6)+(h3-h8)*(1-m6-m8)*(h8-h4)}per kg of steam from boiler.")
print("for closed feed water heater,energy balance yields;")
print("m6*h6+h10=m6*h7+h11")
print("assuming condensate leaving closed feed water heater to be saturated liquid,")
print("h7=hf at 20 bar=908.79 KJ/kg")
h7=908.79;
print("due to throttline,h7=h7_a=908.79 KJ/kg")
h7_a=h7;
print("for open feed water heater,energy balance yields,")
print("m6*h7_a+m8*h8+(1-m6-m8)*h5=h9")
print("for condensate extraction pump,h5-h4_a=v4_a*deltap")
print("h5-hf at 0.1 bar=vf at 0.1 bar*(4-0.1)*10^2 ")
print("from steam tables,at 0.1 bar,hf=191.83 KJ/kg,vf=0.001010 m^3/kg")
hf=191.83;
vf=0.001010;
h5=hf+vf*(4-0.1)*10**2
print("so h5 in KJ/kg="),round(h5,2)
print("for feed pump,h10-h9=v9*deltap")
print("h10=h9+vf at 4 bar*(100-4)*10^2 in KJ/kg")
print("from steam tables,at 4 bar,hf=604.74 KJ/kg,vf=0.001084 m^3/kg ")
hf=604.74;
vf=0.001084;
h10=h9+vf*(100-4)*10**2
print("substituting in energy balance upon closed feed water heater,")
m6=(h11-h10)/(h6-h7)
print("m6 in kg per kg of steam from boiler="),round(m6,3)
print("substituting in energy balance upon feed water heater,")
m8=(h9-m6*h7_a+m6*h5-h5)/(h8-h5)
print("m8 in kg per kg of steam from boiler="),round(m8,3)
print("Let the mass of steam entering first stage of turbine be m kg,then")
{(h1-h6)+(1-m6)*(h6-h2)}
print("W_HPT=m*{(h1-h6)+(1-m6)*(h6-h2)}")
print("W_HPT/m="),round(((h1-h6)+(1-m6)*(h6-h2)),2)
print("so W_HPT=m*573.24 KJ")
print("also,W_LPT={(1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)}per kg of steam from boiler")
{(1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)}
print("W_LPT/m="),round(((1-m6)*(h3-h8)+(1-m6-m8)*(h8-h4)),2)
print("so W_LPT=m*813.42 KJ")
print("pump works(negative work)")
print("W_CEP=m*(1-m6-m8)*(h5-h4_a)")
h4_a=191.83;#h4_a=hf at 0.1 bar
print("W_CEP/m=")
(1-m6-m8)*(h5-h4_a)
print("so W_CEP=m* 0.304")
print("W_FP=m*(h10-h9)")
print("W_FP/m="),round((h10-h9),2)
print("so W_FP=m*10.41")
print("net output,")
print("W_net=W_HPT+W_LPT-W_CEP-W_FP ")
print("so 50*10^3=(573.24*m+813.42*m-0.304*m-10.41*m)")
m=W_net/(573.24+813.42-0.304-10.41)
print("so m in kg/s="),round(m,2)
Q_add=m*(h1-h11)
print("heat supplied in boiler,Q_add in KJ/s="),round(m*(h1-h11),2)
print("Thermal efficenncy="),round(W_net/Q_add,2)
print("in percentage"),round(W_net*100/Q_add,2)
print("so mass of steam bled at 20 bar=0.119 kg per kg of steam entering first stage")
print("mass of steam bled at 4 bar=0.109 kg per kg of steam entering first stage")
print("mass of steam entering first stage=36.33 kg/s")
print("thermal efficiency=54.66%")
print("NOTE=>In this question there is some caclulation mistake while calculating m6 in book,which is corrected above so some answers may vary.")
```