In [1]:

```
import math
# Variables :
m = 2.; #Kg
p = 8.; #bar
H = 5535.; #KJ
# Calculations and Results
h = H/m; #KJ/Kg
hg = 2767.5; #KJ/Kg
print "Specific Enthalpy in KJ/Kg : %.1f"%h
print "Given Enthalpy in KJ/Kg : %.1f"%hg
print ("Given enthalpy = specific enthalpy. System is dry saturated.");
m = 1; #Kg
p = 2550*10**3/10**5; #bar
v = 0.2742; #m**3/Kg
print "Specific volume in m**3/Kg : %.4f"%v
vg = 0.078352; #m**3
print "Given specific volume in m**3/Kg : %.4f"%vg
Ts = 225+273; #K
print ("Since v>vg. System is super heated.");
Tsup = v/vg*Ts; #K
print "Temperature of super heated steam in degree C :%.1f"%(Tsup-273)
m = 1; #Kg
p = 60; #bar
h = 2470.73; #KJ/Kg
print "Enthalpy in KJ/Kg : %.1f"%h
hg = 2475; #KJ/Kg
print "Given enthalpy in KJ/Kg : %.1f"%hg
print ("Since h>hg. System is in vapour state.");
#let x be the dryness fraction
#h = hf+x*hg
hf = 1213.69; #KJ/Kg
hfg = 1517.3; #KJ/Kg
x = (h-hf)/hfg;
print "Dryness fraction : %.1f"%x
#Steam table is used to get some data.
```

In [2]:

```
# Variables :
p = 5; #bar
x = 0.98;
ts = 151.84; #degree C
hf = 652.8; #KJ/Kg
hfg = 2098; #KJ/Kg
vg = 0.373; #m**3/Kg
# Calculations and Results
print "Temperature of steam in degree C : %.2f"%ts
h = hf+x*hfg; #KJ/Kg
print "Enthalpy of steam in KJ/Kg : %.2f"%h
v = x*vg; #m**3/Kg
print "Specific volume in m**3/Kg ; %.4f"%v
#Steam table is used to get some data.
```

In [3]:

```
# Variables :
m = 1; #Kg
p = 12; #bar
x = 0.95;
ts = 187.96; #degree C
vg = 0.1632; #m**3/Kg
hf = 814.7; #KJ/Kg
hfg = 1970.7; #KJ/Kg
# Calculations and Results
print "Temperature of steam in degree C : ",ts
v = x*vg; #m**3/Kg
print "Specific volume in m**3/Kg ; ",v
h = hf+x*hfg; #KJ/Kg
print "Enthalpy of steam in KJ/Kg : %.1f"%h
u = h-p*10**5*v/1000; #KJ/Kg
print "Internal energy in KJ/Kg : %.1f"%u
#Steam table is used to get some data.
```

In [4]:

```
# Variables :
m = 1.; #Kg
p = 8.; #bar
Tsup = 280.; #degree C
h1 = 2950.4; #KJ/Kg(at 250 degree C)
h2 = 3057.3; #KJ/Kg(at 300 degree C)
Tsup1 = 250.; #degree C
Tsup2 = 300.; #degree C
# Calculations and Results
hsup = h1+(h2-h1)/(Tsup2-Tsup1)*(Tsup-Tsup1); #KJ/Kg
print "Specific enthalpy in KJ/Kg : %.1f"%hsup
v1 = 0.293; #m**3/Kg(at 250 degree C)
v2 = 0.324; #m**3/Kg(at 300 degree C)
vsup = v1+(v2-v1)/(Tsup2-Tsup1)*(Tsup-Tsup1); #m**3/Kg
print "Specific volume in m**3/Kg : ",vsup
S1 = 7.04; #KJ/KgK(at 250 degree C)
S2 = 7.235; #KJ/KgK(at 300 degree C)
Ssup = S1+(S2-S1)/(Tsup2-Tsup1)*(Tsup-Tsup1)
print "Specific enthalpy in KJ/KgK : ",Ssup
#Steam table is used to get some data.
```

In [5]:

```
# Variables :
p1 = 0.1; #bar
p2 = 0.1; #bar
x1 = 0.95;
t3 = 20.; #degree C
t2 = 35.; #degree C
t4 = 45.; #degree C
hf1 = 191.8; #KJ/Kg
hfg1 = 2397.9; #KJ/Kg
# Calculations
h1 = hf1+x1*hfg1; #KJ/kg
h2 = 188.4; #KJ/Kg(at 45 degree C)
h3 = 83.9; #KJ/Kg(at 20 degree C)
h4 = 146.6; #KJ/Kg(at 35 degree C)
#m1*(h1-h2) = mw*(h4-h3)
mwBYm1 = (h1-h2)/(h4-h3); #Kg of water/Kg of steam
# Results
print "Ratio of mass flow rate of cooling water to condensing steam(Kg of water/Kg of steam): %.3f"%mwBYm1
#Steam table is used to get some data.
```

In [1]:

```
# Variables :
V = 3.; #m**3
t = 200.; #degree C
Pat = 1.; #bar
Pgauge = 7.; #bar
P = Pgauge+Pat; #bar
ts = 170.41; #degree C
tsup = t; #degree C
vsup = 0.261; #m**3/Kg
hsup = 2838.6; #KJ/Kg
# Calculations and Results
m = V/vsup; #Kg
H = m*hsup; #KJ
print "Total Enthalpy in KJ : %.2f"%H
#H = U+p*V
U = H-P*10**5*V/1000; #KJ
print "Total internal energy of system in KJ : %.2f"%U
print "Mass of steam in Kg : %.3f"%m
#Steam table is used to get some data.
```

In [7]:

```
# Variables :
mw = 1.; #Kg
m_steam = 39.; #mass of dry steam in Kg
# Calculations
ms = mw+m_steam; #Kg
x = m_steam/ms; #dryness fraction
# Results
print "Dryness fraction ; ",x
```

In [8]:

```
# Variables :
m = 10.; #Kg
p = 10.; #bar
x = 0.9;
t1 = 20.; #degree C
hf = 762.6; #KJ/Kg
hfg = 2013.6; #KJ/Kg
# Calculations and Results
H = m*(hf+x*hfg); #KJ;
print "Enthalpy of wet steam in KJ : ",H
hf1 = 83.9; #KJ/Kg(at 20 degree C)
Hf1 = m*hf1; #KJ
HeatAdded = H-Hf1; #KJ
print "Heat added in KJ : ",HeatAdded
#Steam table is used to get some data.
```

In [7]:

```
# Variables :
t = 50.; #degree C
p1 = 13.; #bar
Cpw = 4.187; #KJ/KgK
Cp = 0.0535; #KJ/KgK
x1 = 0.97;
hf = Cpw*(t-0); #KJ/Kg
hf1 = 814.7; #KJ/Kg(at p1 = 13 bar)
hfg1 = 1970.7; #KJ/Kg(at p1 = 13 bar)
hg1 = 2785.4; #KJ/Kg(at p1 = 13 bar)
# Calculations and Results
Q = hf1+x1*hfg1-hf; #KJ/Kg
print "Heat required to produce steam in KJ/Kg : %.2f"%Q
Q1 = hg1-hf; #KJ/Kg
print "Heat required to produce dry saturated steam in KJ/Kg : ",Q1
tsup1SUBts1 = 40; #degree C
Q2 = hg1+Cp*(tsup1SUBts1)-hf; #KJ/Kg
print "Heat required to produce super heated steam in KJ/Kg : ",Q2
#Steam table is used to get some data.
#Ans is wrong in the book for last part.
```

In [8]:

```
# Variables :
p = 8; #bar
x = 0.8;
vf = 0.001115; #m**3/kg
vg = 0.24; #m**3/kg
hf = 720.9; #kJ/kg(at p = 8 bar)
hfg = 2046.5; #kJ/kg(at p = 8 bar)
m = 1; #kg
# Calculations and Results
We = 100*p*(x*vg-vf); #kJ/kg
print "External workdone during evaporation in kJ/kg : %.2f"%We
Q = x*hfg-We; #KJ
print "External latent heat of steam in kJ: %.2f"%Q
#Steam table is used to get some data.
#Ans is wrong in the book for last part.
```

In [9]:

```
# Variables :
p1 = 20.; #bar
Tsup1 = 350.; #degree C
m1 = 1.; #Kg
p2 = 20.; #bar
m2 = 1.; #Kg
p3 = p1; #bar
Tsup3 = 250.; #degree C
m3 = m1+m2; #Kg
Cp = 2.25; #KJ/Kg
hg1 = 2797.2; #KJ/Kg(at p = 20 bar)
hg2 = hg1; #KJ/Kg(at p = 20 bar)
hg3 = hg1; #KJ/Kg(at p = 20 bar)
ts1 = 212.37; #degree C
ts2 = ts1; #degree C
ts3 = ts1; #degree C
# Calculations and Results
#m1*h1+m2*h2 = m3*h3
h2 = (m3*(hg3+Cp*(Tsup3-ts3))-m1*(hg1+Cp*(Tsup1-ts1)))/m2; #KJ/Kg
print "Enthalpy of boiler2 in KJ/Kg : %.2f"%h2
print "hg2(KJ/Kg) : ",hg2
print ("steam is wet because h2<hg2")
#h2 = hf2+x2*hfg2 # as steam is wet because h2<hg2
hf2 = 908.6; #KJ/Kg
hfg2 = 1888.6; #KJ/Kg
x2 = (h2-hf2)/hfg2; #
print "Dryness : %.5f"%x2
#Steam table is used to get some data.
#Ans is wrong in the book.
```

In [12]:

```
# Variables :
m = 2.; #Kg
p = 8.; #bar
x = 0.8;
hf = 720.9; #KJ/Kg(at p = 8 bar)
hfg = 2046.5; #KJ/Kg(at p = 8 bar)
# Calculations and Results
h = hf+x*hfg; #KJ/Kg
H = m*h; #KJ
print "Total enthalpy of steam in KJ : ",H
Vg = 0.227; #m**3/Kg
V = m*x*Vg; #m**3
print "Volume in m**3 : ",V
We = p*10**5*V/1000; #KJ
print "External work of evaporation in KJ : ",We
U = H-We; #KJ
print "Total internal energy in KJ : ",U
Sf = 2.061; #KJ/K
Sfg = 4.578; #KJ/K
S = m*(Sf+x*Sfg); #KJ/K
print "Total entropy in KJ/K : ",S
#Steam table is used to get some data.
```

In [10]:

```
# Variables :
p1 = 600.; #KPa
p1 = p1/100.; #bar
T1 = 200.; #degree C
Vsup1 = 0.352; #m**3/Kg(at 6 bar)
V1 = Vsup1; #m**3/Kg
V2 = V1; #m**3(system is at consmath.tant volume)
Vg2 = V2; #m**3/Kg(For dry saturated)
Tsup1 = 153.3; #degree C
Tsup2 = 154.8; #degree C
vg1 = 0.34844; #m**3/Kg
vg2 = 0.36106; #m**3/Kg
# Calculations and Results
ts2 = Tsup1+(Tsup2-Tsup1)/(vg2-vg1)*(V1-vg1); #degree C
print "Temperature at which steam begins to condense in degree C : %.2f"%ts2
pg1 = 5.2; #bar
pg2 = 5.4; #bar
p2 = pg1+(pg2-pg1)/(Tsup2-Tsup1)*(ts2-Tsup1); #bar
print "Pressure in bar is : %.3f"%p2
#Some data is taken from steam table.
```

In [11]:

```
# Variables :
m = 2.; #Kg
p1 = 15.; #bar
p2 = 15.; #bar
Tsup1 = 250.; #degree C
T1 = Tsup1; #degree C
V1 = 0.152; #m**3/Kg(at 15 bar)
hf2 = 844.7; #KJ/Kg(at p = 15 bar)
hg2 = 2789.9; #KJ/Kg(at p = 15 bar)
hfg2 = 1945.2; #KJ/Kg(at p = 15 bar)
h1 = 2923.; #KJ/Kg
Vg2 = 0.1317; #m**3/Kg(at 15 bar)
x2 = 0.6; #dry
# Calculations and Results
h2 = hf2+x2*hfg2; #KJ/Kg
V2 = x2*Vg2; #m**3/Kg
w = (p2*V2-p1*V1)*10**5/10**3; #KJ/Kg
W = m*w; #KJ
print "Total work done in KJ : ",W
H2subH1 = m*(h2-h1); #KJ/Kg
print "Change in enthalpy in KJ/Kg : %.1f"%H2subH1
Q = H2subH1; #KJ
print "Heat transfered in KJ : %.1f"%Q
#Steam table is used to get some data.
```

In [12]:

```
# Variables :
p_gauge = 15.; #bar
p_at = 750.; #mm of Hg
p_at = p_at/760.*1.01325; #bar
p = p_gauge+p_at; #bar
ms = 200.; #Kg/hr
Cpw = 4.187; #KJ/KgK
t1 = 80.; #degree C
hf1 = Cpw*t1; #KJ/Kg
hf2 = 858.6; #KJ/Kg(at p = 16 bar)
hg2 = 2791.8; #KJ/Kg(at p = 16 bar)
hfg2 = 1933.2; #KJ/Kg(at p = 16 bar)
ts = 201.37; #degree C
x2 = 0.8; #dry
# Calculations and Results
h2 = hf2+x2*hfg2; #KJ/Kg
q = ms*(h2-hf1); #KJ/hr
q = q/3600; #KJ/s
print "Heat transfer in boiler in KJ/s : %.3f"%q
tsup = ts+t1; #degree C
Cp = 2.2; #KJ/KgK
hsup3 = hg2+Cp*(tsup-ts); #KJ/Kg
qsup = ms*(hsup3-h2)/3600; #KJ/s
print "Heat transfered in superheated steam in KJ/s : %.3f"%qsup
Vg = 0.1237; #m**3/Kg(at 16 bar)
Ts = 201.37+273; #K
Tsup = tsup+273; #K
Vsup = Tsup/Ts*Vg; #m**3/Kg
density = 1/Vsup; #Kg/m**3
print "Density of steam in Kg/m**3 : %.3f"%density
#Steam table is used to get some data.
```

In [16]:

```
# Variables :
m = 1.5; #Kg
p1 = 5; #bar
x1 = 0.8; #dry
x2 = 0.4; #dry
Vg1 = 0.373; #m**3/Kg(at 5 bar)
hf1 = 640.1; #KJ/Kg(at p = 5 bar)
hfg1 = 2107.4; #KJ/Kg(at p = 5 bar)
Vg2 = x1/x2*Vg1; #m**3/Kg
p2 = 4.; #bar(at Vg2 = 0.746)
hf2 = 529.6; #KJ/Kg(at p = 4 bar)
hfg2 = 2184.9; #KJ/Kg(at p = 4 bar)
# Calculations
V1 = x1*Vg1; #m**3/Kg
V2 = V1; #m**3/Kg
h1 = hf1+x1*hfg1; #KJ/Kg
h2 = hf2+x2*hfg2; #KJ/Kg
Q = m*((h2-h1)-100*(p2*V2-p1*V1)); #KJ
# Results
print "Quantity of heat in KJ : ",Q
#Steam table is used to get some data.
```

In [13]:

```
# Variables :
p1 = 1; #bar
x1 = 0.523; #dry
Vg1 = 1.694; #m**3/Kg(at 1 bar)
hf1 = 417.5; #KJ/Kg(at p = 1 bar)
hfg1 = 2258; #KJ/Kg(at p = 1 bar)
# Calculations
h1 = hf1+x1*hfg1; #KJ/Kg
V1 = x1*Vg1; #m**3/Kg
V2 = V1; #m**3/Kg(Consmath.tant volume process)
Vg2 = V2; #m**3/Kg
p2 = 2; #bar; #at Vg2 from steam table
hg2 = 2706.3; #KJ/Kg(at 2 bar)
h2 = hg2; #KJ/Kg
W = 0; #KJ/Kg of steam
q = W+(h2-h1)-100*(p2*V2-p1*V1); #KJ/Kg
# Results
print "Heat transfered in KJ/Kg : %.1f"%q
#Steam table is used to get some data.
```

In [14]:

```
# Variables :
V1 = 0.9; #m**3
p1 = 8; #bar
x1 = 0.9; #dry
p2 = 4; #bar
Vg1 = 0.24; #m**3/Kg(at 8 bar)
hf1 = 720.9; #KJ/Kg(at p = 8 bar)
hfg1 = 2046.5; #KJ/Kg(at p = 8 bar)
Vg2 = 0.462; #m**3/Kg(at 4 bar)
hf2 = 604.7; #KJ/Kg(at p = 4 bar)
hfg2 = 2132.9; #KJ/Kg(at p = 4 bar)
# Calculations and Results
#h1 = h2 : hf1+x1*hfg1 = hf2+x2*hfg2
x2 = ((hf1+x1*hfg1)-hf2)/hfg2; #dry
print "Dryness fraction of steam : %.3f"%x2
m1 = V1/x1/Vg1; #Kg
V2 = V1; #m**3
m2 = V2/x2/Vg2; #Kg
m = m1-m2; #Kg
print "Mass of steam blown off in Kg : %.4f"%m
#Steam table is used to get some data.
```

In [15]:

```
import math
# Variables :
m = 5.; #Kg
p1 = 10.; #bar
x1 = 0.9; #dry
p2 = 4.; #bar
ts1 = 179.88; #degree C(at 10 bar)
print "Final condition of steam,(Temperature in degree C) : ",ts1
Vg1 = 0.1943; #m**3/Kg(at 8 bar)
hf1 = 762.6; #KJ/Kg(at p = 10 bar)
hfg1 = 2013.6; #KJ/Kg(at p = 10 bar)
h1 = hf1+x1*hfg1; #KJ/Kg
V1 = x1*Vg1; #KJ/kg
u1 = h1-p1*V1*10**5/1000; #KJ/Kg
U1 = m*u1; #KJ
Tsup2 = 179.88; #degree C
t11 = 150; #degree C
h11 = 2752; #KJ/Kg(at 4bar,150 degree C)
v11 = 0.471; #m**3/Kg(at 4bar,150 degree C)
s11 = 6.929; #KJ/KgK(at 4bar,150 degree C)
t22 = 200; #degree C
h22 = 2860.4; #KJ/Kg(at 4bar,200 degree C)
v22 = 0.534; #m**3/Kg(at 4bar,200 degree C)
s22 = 7.171; #KJ/KgK(at 4bar,200 degree C)
h2 = h11+(h22-h11)/(t22-t11)*(ts1-t11); #KJ/Kg
v2 = v11+(v22-v11)/(t22-t11)*(ts1-t11); #m**3/Kg
s2 = s11+(s22-s11)/(t22-t11)*(ts1-t11); #m**3
u2 = h2-p2*10**5*v2/1000; #KJ/Kg
U2 = m*u2; #KJ
deltaU = U2-U1; #KJ
print "Change in internal energy in KJ : %.1f"%deltaU
sf1 = 2.138; #KJ/KgK
sfg1 = 4.445; #KJ/Kg
s1 = (sf1+x1*sfg1); #KJ/KgK
deltaS = m*(s2-s1); #KJ/K
Q = (ts1+273)*(deltaS); #KJ
print "Heat transfer in KJ : %.1f"%Q
W = Q-deltaU; #KJ
print "Workdone in KJ : %.1f"%W
#Steam table is used to get some data.
#Answer is not accurate in the book.
```

In [17]:

```
import math
# Variables :
m = 2.; #Kg
p1 = 15.; #bar
V1 = 0.3; #m**3
p2 = 1.5; #bar
v1 = V1/m; #m**3/Kg
# Calculations and Results
#p1*v1**(1.3) = p2*v2**(1.3)
v2 = math.exp((math.log(p1)+1.3*math.log(v1)-math.log(p2))/1.3); #m**3/Kg
Vg2 = 1.1635; #m**3/Kg(at 1.5 bar)
x2 = v2/Vg2; #dry
print "Dryness of steam : %.4f"%x2
n = 1.3;
W = m*(p1*v1-p2*v2)*10**5/(n-1); #J
W = W/1000; #KJ
print "Workdone in KJ : %.1f"%W
#Steam table is used to get some data.
#Answer is wrong in the book.
```

In [21]:

```
# Variables :
m1 = 5.; #Kg
p1 = 5.; #bar
Tsup1 = 200.; #degree C
p2 = 0.1; #bar
h1 = 2855; #KJ/Kg(from molliers diagram)
h2 = 2235; #KJ/Kg(from molliers diagram)
# Calculations
W = m1*(h1-h2); #KJ
# Results
print "Workdone in KJ : ",W
#Steam table is used to get some data.
```

In [18]:

```
# Variables :
p1 = 160.; #bar
Tsup1 = 550.; #degree C(from steam table)
q = 0.; #adiabatic process
deltaS = 0.1; #KJ/KgK
p2 = 0.2; #bar
t11 = 500.; #degree C
t22 = 600.; #degree C
h11 = 3297.1; #KJ/Kg(at 4bar,500 degree C)
h22 = 3571.; #KJ/Kg(at 4bar,600 degree C)
# Calculations
h1 = h11+(h22-h11)/(t22-t11)*(Tsup1-t11); #KJ/Kg
s11 = 6.305; #KJ/KgK(at 4bar,500 degree C)
s22 = 6.639; #KJ/KgK(at 4bar,600 degree C)
s1 = s11+(s22-s11)/(t22-t11)*(Tsup1-t11); #KJ/KgK
s2 = deltaS+s1; #KJ/KgK
hf2 = 251.4; #KJ/Kg(at 0.2 bar)
hfg2 = 2358.2; #KJ/Kg(at 0.2 bar)
sf2 = 0.832; #KJ/KgK(at 0.2 bar)
sfg2 = 7.077; #KJ/KgK(at 0.2 bar)
#s2 = sf2+x2*sfg2
x2 = (s2-sf2)/sfg2; #dryness
h2 = hf2+x2*hfg2; #KJ
Wsf_a = h1-h2; #KJ/Kg
# Results
print "Actual Work of expansion in KJ : %.1f"%Wsf_a
#Steam table is used to get some data.
```

In [3]:

```
# Variables :
mdot = 2.; #Kg/s
p1 = 10.; #bar
Tsup1 = 200.; #degree C(from steam table)
p2 = 1.; #bar
h1 = 2826.8; #KJ/Kg(at 10bar,200 degree C)
S1 = 6.692; #KJ/KgK(at 10bar,200 degree C)
ts2 = 99.63; #degree C(at 1bar)
Vg2 = 1.694; #m**3/Kg(at 1bar)
hf2 = 417.5; #KJ/Kg(at 1bar)
hfg2 = 2258.; #KJ/Kg(at 1bar)
sf2 = 1.303; #KJ/KgK(at 1bar)
sfg2 = 6.057; #KJ/KgK(at 1bar)
# Calculations
#S1 = sf2+x2*sfg2
x2 = (S1-sf2)/sfg2; #dryness
V3 = x2*Vg2; #m**3/Kg
t2 = ts2; #degree C
S2 = S1; #KJ/KgK
Qdot = 0; #KJ
h2 = hf2+x2*hfg2; #KJ/Kg
Wsf_dot = Qdot-mdot*((h2-h1)); #KJ/Kg
# Results
print "Final specific volume, v2 = %.4f m**3/kg"%V3
print "Final temperature , t2 = %.2f C"%t2
print "Final specific entropy, S2 = %.3f kJ/kg K"%S2
print "Work output of turbine in KJ/s or W : %.1f"%Wsf_dot
#Steam table is used to get some data.
```

In [2]:

```
# Variables :
p1 = 7.; #bar
x1 = 0.8; #dryness
p2 = 1.; #bar
hf1 = 697.; #KJ/Kg(at 7bar)
hfg1 = 2064.9; #KJ/Kg(at 7bar)
hf2 = 417.5; #KJ/Kg(at 1bar)
hfg2 = 2258; #KJ/Kg(at 1bar)
# Calculations and Results
#hf1+x1*hfg1 = hf2+x2*hfg2
x2 = (hf1+x1*hfg1-hf2)/hfg2; #dryness
print "Final conditio of steam(dryness) : %.4f"%x2
sf2 = 1.303; #KJ/Kg(at 1bar)
sfg2 = 6.057; #KJ/Kg(at 1bar)
sf1 = 1.992; #KJ/Kg(at 7bar)
sfg1 = 4.713; #KJ/Kg(at 7bar)
deltaS = (sf2+x2*sfg2)-(sf1+x1*sfg1)
print "Change in entropy in KJ/KgK : %.4f"%deltaS
print "Entropy change of surroundings = %.4f KJ/kg K"%(deltaS + 0)
#Steam table is used to get some data.
```

In [25]:

```
# Variables :
p1 = 10.; #bar
x1 = 0.9; #dryness
p2 = 1.; #bar
hf1 = 762.6; #KJ/Kg(at 10bar)
hfg1 = 2013.6; #KJ/Kg(at 10bar)
# Calculations
h1 = hf1+x1*hfg1; #KJ/Kg
h2 = h1; #KJ/Kg
hg2 = h2; #KJ/Kg
p2 = 0.075; #bar(from steam table)
# Results
print "Pressure at exit in bar : ",p2
#Steam table is used to get some data.
```

In [22]:

```
import math
# Variables :
m1dot = 3.; #Kg/min
p1 = 10.; #bar
Tsup1 = 250.; #degree C
m2dot = 5.; #Kg/min
p2 = 10.; #bar
x2 = 0.7; #dryness
p3 = 10.; #bar
p4 = 5.; #bar
p5 = 2.; #bar
m3dot = m1dot+m2dot; #Kg/min
hsup1 = 2826.8; #KJ/Kg(at 10bar)
hf2 = 762.6; #KJ/Kg(at 10bar)
hf3 = 762.6; #KJ/Kg(at 10bar)
hfg2 = 2013.6; #KJ/Kg(at 10bar)
hfg3 = 2013.6; #KJ/Kg(at 10bar)
# Calculations and Results
#m1dot*hsup1+m2dot*(hf2+x2*hfg2) = m3dot*(hf3+x3*hfg3)
x3 = ((m1dot*hsup1+m2dot*(hf2+x2*hfg2))/m3dot-hf3)/hfg3; #dryness
print "State of steam after mixing(dryness) : %.2f"%x3
x4 = 0.838; #dryness(from molliers diagram)
print "State of steam after throttling(dryness) : %.3f"%x4
sf3 = 2.138; #KJ/KgK(From steam table
sfg3 = 4.445; #KJ/KgK(From steam table
sf4 = 1.860; #KJ/KgK(From steam table)
sfg4 = 4.959; #KJ/KgK(From steam table
s4SUBs3 = m3dot/60*((sf4+x4*sfg4)-(sf3+x3*sfg3)); #KJ/Kg
print "Increase in entropy due to throttling in KJ/KgK : %.5f"%s4SUBs3
h4 = 2405; #KJ/Kg(from Molliers diagram)
h5 = 2265; #KJ/Kg(from Molliers diagram)
x5 = 0.802; #dryness
C4 = 0; #m/s(from S.F.E.E)
#h4+C4**2/2/1000 = h5+C5**2/2/1000
C5 = math.sqrt((h4+C4**2/2/1000-h5)*2*1000); #m/s
p5 = 2; #bar(from steam table)
Vg5 = 0.885; #m**3/Kg(from steam table)
#mdot/60 = A5*C5/x5/Vg5
A5 = m3dot/60/C5*x5*Vg5; #m**2
print "Exit area of nozzle in cm**2 : %.4f"%(A5*10**4)
#Steam table is used to get some data.
```

In [23]:

```
# Variables :
ms = 5.; #Kg
m2 = 140.; #Kg
p = 10.; #bar
mc = 20.; #KJ/K
t1 = 20.; #degree C
mwdot = 20.; #Kg
t2 = 40.; #degree C
Cpw = 4.19; #KJ/KgK
hfg = 2021.4; #KJ/Kg(at 10bar)
ts = 179.88; #degree C
# Calculations
#ms*(x*hfg)+ms*Cpw*(ts-t2) = m2*Cpw*(t2-t1)+mc*(t2-t1)
x = (m2*Cpw*(t2-t1)+mc*(t2-t1)-ms*Cpw*(ts-t2))/ms/hfg; #dryness
# Results
print "Dryness fraction of steam : %.4f"%x
#Steam table is used to get some data.
```

In [24]:

```
# Variables :
p1 = 15.; #bar
p2 = 15.; #bar
p3 = 1.; #bar
Tsup3 = 150.; #degree C
mw = 0.2; #Kg/min
ms = 10.; #Kg/min
# Calculations and Results
x1 = ms/(ms+mw); #dryness
print "Dryness factor of steam : %.4f"%x1
hf2 = 844.7; #KJ/Kg(from steam table,at 15 bar)
hfg2 = 1945.2; #KJ/Kg(from steam table,at 15 bar)
hsup3 = 2776.3; #KJ/Kg(from steam table,at 15 bar)
#hsup3 = hf2+x2*hfg2; #KJ/Kg
x2 = (hsup3-hf2)/hfg2; #KJ/Kg
x = x1*x2; #dryness
print "Dryness fraction in the mains : %.4f"%x
#Steam table is used to get some data.
```

In [25]:

```
# Variables :
p1 = 1.; #MPa
p2 = 100.; #KPa
p1 = p1*10**6./10**5; #bar
p2 = p2*10**3./10**5; #bar
hf1 = 762.5; #KJ/Kg(from steam table)
hfg2 = 2013.6; #KJ/Kg(from steam table)
hg2 = 2675.5; #KJ/Kg(from steam table)
# Calculations
#hg2 = hf1+x1*hfg2; #KJ/Kg
x1 = (hg2-hf1)/hfg2; #
# Results
print "Dryness fraction in the mains : %.2f"%x1
#Steam table is used to get some data.
```

In [26]:

```
# Variables :
p1 = 900.; #KN/m**2
p2 = 900.; #KN/m**2
p3 = 0.1013; #MN/m**2
p1 = p1/10.**2; #bar
p3 = p2/10.**2; #bar
p3 = p3*10.**6/10**5; #bar
Tsup3 = 115.; #degree C
ms = 1.8; #Kg
mw = 0.16; #Kg
# Calculations
x1 = ms/(ms+mw); #dryness
hf2 = 742.6; #KJ/Kg(from steam table)
hfg2 = 2029.5; #KJ/Kg(from steam table)
hg3 = 2676; #KJ/Kg(from steam table)
Ts3 = 100; #degree C
Cp = 2; #KJ/KgK
#hf2+x2*hfg2 = hg3+Cp*(Tsup3-Ts3); #KJ/Kg
x2 = (hg3+Cp*(Tsup3-Ts3)-hf2)/hfg2; #KJ/Kg
x = x1*x2; #dryness
# Results
print "Dryness fraction of steam in mains : %.4f"%x
#Steam table is used to get some data.
```

In [27]:

```
# Variables :
p1 = 1.5; #MPa
p1 = p1*10**6/10**5; #bar
p2 = p1; #bar
p3 = 0.1; #MPa
p3 = p3*10**6/10**5; #bar
Tsup3 = 110; #degree C
Vw = 0.15; #litres
Vw = 0.15*10**-3; #m**3 at 70 degree C
ms = 3.24; #Kg
Vf = 0.001023; #m**3/Kg
mw = Vw/Vf; #Kg
x1 = ms/(ms+mw); #dryness
hf2 = 844.7; #KJ/Kg(from steam table)
hfg2 = 1945.2; #KJ/Kg(from steam table)
hg3 = 2675; #KJ/Kg(from steam table)
Ts3 = 99.63; #degree C
Cp = 2; #KJ/KgK
# Calculations
#hf2+x2*hfg2 = hg3+Cp*(Tsup3-Ts3); #KJ/Kg
x2 = (hg3+Cp*(Tsup3-Ts3)-hf2)/hfg2; #KJ/Kg
x = x1*x2; #dryness
# Results
print "Quality of steam in pipe line(Dryness fraction) : %.4f"%x
#Steam table is used to get some data.
```

In [28]:

```
# Variables :
p1 = 1.5; #MPa
p1 = p1*10**6/10**5; #bar
p_gauge = 7; #bar
p_at = 1; #bar
p2 = p_gauge+p_at; #bar
p3 = 1; #bar
Tsup3 = 110; #degree C
mw = 3.5; #Kg
ms = 48; #Kg
Cp = 2.1; #KJ/KgK
x1 = ms/(ms+mw); #dryness
hf2 = 720.9; #KJ/Kg(from steam table)
hfg2 = 2059.3; #KJ/Kg(from steam table)
hg3 = 2675.5; #KJ/Kg(from steam table)
Ts3 = 99.63; #degree C
# Calculations
#hf2+x2*hfg2 = hg3+Cp*(Tsup3-Ts3); #KJ/Kg
x2 = (hg3+Cp*(Tsup3-Ts3)-hf2)/hfg2; #KJ/Kg
x = x1*x2; #dryness
# Results
print "Quality of steam in pipe line(Dryness fraction) : %.4f"%x
#Steam table is used to get some data.
```

In [30]:

```
# Variables :
p1 = 20; #bar
Tsup3 = 360; #degree C
pb = 0.08; #bar
m = 1; #Kg
hf1 = 173.9; #KJ/Kg(from steam table)
h1 = hf1; #KJ/Kg
wp = (p1-pb)/10; #KJ/Kg
h2 = h1+wp; #KJ/Kg
h3 = 3160.62; #KJ/Kg(from steam table)
S3 = 6.994; #KJ/Kg
Sf4 = 0.593; #KJ/Kg(from steam table)
Sfg4 = 7.637; #KJ/Kg(from steam table)
S3 = 6.994; #KJ/Kg
#S3 = S4 = Sf4+x4*Sfg4
x4 = (S3-Sf4)/Sfg4; #dryness
hf4 = 173.9; #KJ/Kg(from steam table)
hfg4 = 2403.2; #KJ/Kg(from steam table)
# Calculations and Results
h4 = hf4+x4*hfg4; #KJ/Kg
Ws = h3-h4-wp; #KJ/Kg
print "Net work done in KJ/Kg : %.3f"%Ws
EtaR = Ws/(h3-h2)*100; #%
print "Rankine efficiency in %% : %.2f"%EtaR
#Steam table is used to get some data.
```

In [31]:

```
# Variables :
p1 = 80; #bar
Tsup3 = 350; #degree C
pb = 712.5/760*1.01325; #bar
mdot = 2; #Kg/s
#mdot = 1; #Kg
h3 = 2964.; #KJ/Kg(Molliers diagram)
h4 = 2184.; #KJ/Kg(Molliers diagram)
# Calculations and Results
WT = h3-h4; #KJ/Kg
WTdot = mdot*WT; #KW
print "Total turbine work in KW : ",WTdot
wp = (p1-pb)/10; #KJ/Kg
hf1 = 411.35; #KJ/Kg(from steam table)
h1 = hf1; #KJ/Kg
h2 = h1+wp; #KJ/Kg
qi = h3-h2; #KJ/Kg
EtaR = (WT-wp)/qi*100; #%
print "Rankine efficiency in %% : %.2f"%EtaR
#Steam table is used to get some data.
```

In [32]:

```
# Variables :
p1 = 30. #bar
Tsup3 = 350. #degree C
pb = 0.5; #bar
h1 = 340.5; #KJ/Kg(from steam table, at 0.5 bar)
Vw = 0.001; #m**3/Kg
wp = (p1-pb)*10**5*Vw/1000; #KJ/Kg
h2 = h1+wp; #KJ/Kg
h3 = 2854.8; #KJ/Kg(from steam table, at 30 bar)
S3 = 6.286; #KJ/KgK
S4 = S3; #KJ/KgK
Sf4 = 1.091; #KJ/KgK
Sfg4 = 6.503; #KJ/KgK
# Calculations and Results
#S4 = Sf4+x4*Sfg4
x4 = (S4-Sf4)/Sfg4; #dryness
print "Dryness fraction of steam entering in condenser : %.3f"%x4
hf4 = 340.5; #KJ/Kg(from steam table)
hfg4 = 2305.4; #KJ/Kg(from steam table)
h4 = hf4+x4*hfg4; #KJ/Kg
q = h3-h2; #
print "Heat supplied to stem in boiler in KJ : %.2f"%q
Ws = h3-h4-(h2-h1); #KJ/Kg
print "Work done in KJ/Kg : %.2f"%Ws
steam_rate = 3600/Ws; #KJ/KWh
print "Steam rate per in KJ/Kwh : %.3f"%steam_rate
EtaR = Ws/(h3-h2)*100; #%
print "Rankine efficiency in %% : %.2f"%EtaR
#Steam table is used to get some data.
```