##Part A Chapter 7 Example 2 pg no 237
##find the dryness fraction
h2=2682.5;##kJ/kg(For 0.05 MPa & 100 degree C)
h1=h2;##kJ/kg(for throttling)
hf=1407.56;##kJ/kg(For 10 MPa)
hfg=1317.1;##kJ/kg(For 10 MPa)
x1=(h1-hf)/hfg;##dryness fraction
print"%s %.2f %s"%("Dryness fraction = ",x1,"");
##Part A Chapter 7 Example 3 pg no 238
##find the entropy change
import math
m=5.;##kg
cp_super_heat=2.1;##kJ/kgK
cp_water=4.18;##kJ/kgK
Tsuper_heat=300.+273.15;##K
Tsat=212.42;##degreeC(at 2 MPa)
Tsat=Tsat+273.15;##K
hfg=1890.7;##kJ/kg(For 2 MPa & Tsat)\
S=cp_water*math.log(Tsat/273.15)+hfg/Tsat+cp_super_heat*math.log(Tsuper_heat/Tsat);##kJ/kgK
S_5kg=S*5;##kJ/K
print"%s %.2f %s"%("Entropy of 5 kg steam = ",S_5kg," kJ/K");
##Part A Chapter 7 Example 4 pg no 238
##find the pressure
T=110.+273.15;##K
h=50.;##cm
p=143.47;##kPa(at 110 degree C)
g=9.81;##ravity constant
p_dash=p-(1000.*g*h/100.)/1000.;##kPa(pressure at 50 cm depth)
Tsat=108.866;##degree C(for pdash=138.365 kPa);
print"%s %.2f %s %.2f %s "%("Pressure at 50 cm depth is ",p_dash," kPa"and " From steam table, Boiling point = ",Tsat," degree C");
##Part A Chapter 7 Example 5 pg no 239
##find the mass and volume of water
V=0.5;##m^3
T=100.+273.15;##K
v2=0.003155;##m^3/kg(at critical state)
v1=v2;##constant volume process
vf=0.001044;##m^3/kg(at 100 degree C)
vg=1.6729;##m^3/kg(at 100 degree C)
x1=(v1-vf)/vg;##dryness fraction
m=V/v2;##kg
mw=m*(1.-x1);##kg
Vw=mw*vf;##m^3
print"%s %.2f %s"%("Mass of water is ",mw," kg.");
print"%s %.2f %s"%("Volume of water is ",Vw," m^3.");
##Part A Chapter 7 Example 6
##find the slope of an isobar
p=2.;##MPa
T=500.+273.15;##K
dh_by_ds=T;##for constant pressure
print"%s %.2f %s"%("Slope of an isobar is ",dh_by_ds,"");
##Part A Chapter 7 Example 7
##find the enthalpy and specific volume and entropy
p=0.15;##MPa
x=10./100.;##quality
hf=467.11;##kJ/kg##at 0.15 MPa
hg=2693.6;##kJ/kg##at 0.15 MPa
vf=0.001053;##m^3/kg##at 0.15 MPa
vg=1.1593;##m^3/kg##at 0.15 MPa
sf=1.4336;##kJ/kg.K##at 0.15 MPa
sg=7.2233;##kJ/kg.K##at 0.15 MPa
hfg=hg-hf;##kJ/kg##
h=hf+x*hfg;##kJ/kg
print"%s %.2f %s"%("Enthalpy is ",h," kJ/kg");
vfg=vg-vf;##m^3/kg##
v=vf+x*vfg;##m^3/kg
print"%s %.2f %s"%("Specific volume is ",v," m^3/kg");
sfg=sg-sf;##kJ/kg.K
s=sf+x*sfg;##kJ/kg.K
print"%s %.2f %s"%("Entropy is ",s," kJ/kg.K");
##Part A Chapter 7 Example 8 pg no 240
##find the heat added volume
P1=1;##MPa
V1=0.05;##m^3
x1=80/100;##dryness fraction
P2=1;##MPa
V2=0.2;##m^3
W=P1*1000*(V2-V1);##kJ
vf=0.001127;##m^3/kg##at 1 MPa
vg=0.19444;##m^3/kg##at 1 MPa
uf=761.68;##kJ/kg##at 1 MPa
ufg=1822;##kJ/kg##at 1 MPa
vfg=vg-vf;##m^3/kg
v1=vf+x1*vfg;##m^3/kg
ms=V1/v1;##kg(mass of steam)
v2=V2/ms;##m^3/kg
T1=1000;T2=1100;##degree C(as v2>vg(1MPa))
T=T1+(T2-T1)*(v2-0.5871)/(0.6355-0.5871);##degree C
u2=4209.6;##kJ/kg(at 1MPa & T degree C)
u1=uf+x1*ufg;##kJ/kg
Q=W+ms*(u2-u1);##kJ
print"%s %.2f %s"%("Heat added is ",Q," kJ");
##Part A Chapter 7 Example 9 pg no 241
##find the pressure and temparature
p=800;##kPa
T=200##degree C
Tsat=170.43;##degree C(at 800kPa)
v1=0.2404;##m^3/kg(at 800kPa)
v2=0.2404;##m^3/kg(at 800kPa)
vg=v2;##m^3/kg##(at 800kPa)
T1=175;T2=170;##degree C(vg=0.2404;##m^3/kg)
vg1=0.2168;##m^3/kg
vg2=0.2428;##m^3/kg
T2_begin=T1-(T1-T2)*(v1-vg1)/(vg2-vg1);##degree C
p1=892;p2=791.7;##kPa(vg=0.2404;##m^3/kg)
p2_begin=p1-(p1-p2)*(v1-vg1)/(vg2-vg1);##degree C
print"%s %.2f %s %.2f %s "%("Pressure and temperature at condensation is ",p2_begin," kPa & "and "",T2_begin," degree C");
##Part A Chapter 7 Example 10 pg 242
##find the enthalpy change
p2=200.;##kPa
T=30.##degree C
ds=0.;##for isentropic process
##for saturated liquid at 30 degree C
p1=4.25;##kPa
vf=0.001004;##m^3/kg
v1=vf;##m^3/kg
h21=v1*(p2-p1);##kJ/kg(h21=h2-h1)
print"%s %.2f %s"%("Enthalpy change is ",h21," kJ/kg");
##Part A Chapter 7 Example 11 pg 243
##find the total mass
V=2.;##m^3(Volume of vessel)
T=150.##degree C
vf=0.001091;##m^3/kg##at 150 degree C
vg=0.3928;##m^3/kg##at 150 degree C
v_water=V*3./5.##m^3
v_steam=V*2./5.##m^3
mf=v_water/vf;##kg
mg=v_steam/vg;##kg
m=mf+mg;##kg##Total mass
x=mg/m;##dryness fraction
print"%s %.2f %s %.4f %s "%("Total mass is ",m," kg & Quality is ",x,"")
##Answer is wrong in the book.
##Part A Chapter 7 Example 12 pg 243
##find the stream work
p=4.;##MPa
T1=300.##degree C
T2=50.##degree C
h1=2886.2;##kJ/kg(at 4 MPa & 300 degree C)
s1=6.2285;##kJ/kg.K(at 4 MPa & 300 degree C)
hf=209.33;##kJ/kg(at 50 degree C)
sf=0.7038;##kJ/kg.K(at 50 degree C)
hfg=2382.7;##kJ/kg(at 50 degree C)
sfg=7.3725;##kJ/kg.K(at 50 degree C)
x2=(s1-sf)/sfg;##dryness fraction
h2=hf+x2*hfg;##kJ/kg
W=h1-h2;##kJ/kg
print"%s %.2f %s"%("Steam turbine work is ",W," kJ/kg");
##Part A Chapter 7 Example 13 pg 244
##find the mass of dry stream
mg=100.;##kg
pg=100.;##kPa
x1=0.5;##dryness at 1000kPa
##At 100 kPa
hf=417.46;##kJ/kg
uf=417.46;##kJ/kg
vf=0.001043;##m^3/kg
hfg=2258.;##kJ/kg
ufg=2088.7;##kJ/kg
vfg=1.6940;##m^3/kg
v1=vf+x1*vfg;##m^3/kg
h1=hf+x1*hfg;##kJ/kg
V=mg*x1*v1;##m^3
U1=mg*(hf+x1*ufg);##kJ
##At 2000 kPa
vg=0.09963;##m^3/kg
ug=2600.3;##m^3/kg
hg=2799.5;##kJ/kg
v2=1./(1./vg+1./v1);##m^3/kg
##At 1000 kPa
hf=762.81;##kJ/kg
hfg=2015.3;##kJ/kg
vf=0.001127;##m^3/kg
vg=0.19444;##m^3/kg
x2=(v2-vf)/(vg-vf);##dryness at 1000 ka
h2=hf+x2*hfg;##kJ/kg
m=(mg*h1-mg*h2)/(h2-hg);##kg
print"%s %.2f %s"%("Mass of dry steam at 2000 kPa to be added is ",m," kg");
print"%s %.2f %s"%("Quality of final mixture is ",x2,"");
##Part A Chapter 7 Example 14 pg 245
##find the dryness fraction
rcv=71.5;##cm of Hg(Recorded condenser vaccum)
br=76.8;##cm of Hg(Barometer reading)
Tc=35;##degree C(Temperature of condensation)
Tw=27.6;##degree C(Temperature of hot well)
mc=1930;##kg(Mass of condensate/hour)
mw=62000;##kg(Mass of cooling water/hour)
T1=8.51;##degree C(Inlet temperature)
T2=26.24;##degree C(Outlet temperature)
pc=(br-rcv)/73.55*101.325;##kPa(condenser pressure)
p_partial=5.628;##kPa(at 35 degree C)
hf=146.68;##kJ/kg
hfg=2418.6;##kJ/kg
x=(mw*(T2-T1)*4.18/mc+4.18*Tw-hf)/hfg;##dryness fraction
print"%s %.2f %s"%("State of steam(Dryness fraction) entering condenser is ",x,"");
##Part A Chapter 7 Example 15 pg 247
##find the workdone
import math
d=20./100.;##m
h=2.;##cm
T=150.;##degree C
F=10.;##kN
Q=600.;##kJ
Patm=101.3;##kPa
P=F/(math.pi/4.*d**2.)+Patm;##kPa
V1=math.pi/4.*d**2*h/100.;##m^3
m=V1*1000.;##kg
hf=612.1;##kJ/kg(at Pressure P)
hfg=2128.7;##kJ/kg(at Pressure P)
h2=1582.8;##kJ/kg
x=(Q/m+4.18*T-hf)/hfg;##dryness factor
print"%s %.2f %s"%("Dryness fraction of steam produced is ",x,"");
U1=m*4.18*T-P*V1;##kJ
vg=0.4435;##m^3/kg at Pressure P
V2=m*x*vg;##m^3
U2=m*h2-P*V2;##kJ
U21=U2-U1;##kJ(U2-U1)
print"%s %.2f %s"%("Change in internal energy is ",U21," kJ.");
W=P*(V2-V1);##kJ
print"%s %.2f %s"%("Workdone is ",W," kJ.");
##Part A Chapter 7 Example 16 pg 248
##find the dryness fraction
mg=40.;##kg
mf=2.2;##kg
p1=1.47;##MPa
T=120;##degree C
p2=107.88;##kPa
cv=2.09;##kJ/kg.K
Td=T-101.8;##degree C(DegreeSuperHeat)
hf=2673.95;##kJ/kg
h=hf+Td*cv;##kJ/kg
hf2=918.926;##kJ/kg
hfg2=1864.28;##kJ/kg
x2=(h-hf2)/hfg2;##dryness fraction
x1=(mg-mf)/mg;##dryness fraction
x=x1*x2;##overall dryness fraction
print"%s %.2f %s"%("Dryness fraction is ",x,"");