#cal of work input
#intiation of all variables
# Chapter 11
import math
print"Example 11.1, Page:435 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 11 Example 1")
T1=(-16.+273.);#temperature of refrigerated space in K
T2=(27.+273.);#temperature of atmosphere in K
Q1=500.;#heat extracted from refrigerated space in KJ/min
print("for refrigerator working on reversed carnot cycle.")
print("Q1/T1=Q2/T2")
print("so Q2=Q1*T2/T1 in KJ/min")
Q2=Q1*T2/T1
print("and work input required,W in KJ/min")
W=Q2-Q1
print("W=Q2-Q1"),round(W,2)
#cal of HP required
#intiation of all variables
# Chapter 11
import math
print"Example 11.2, Page:435 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 11 Example 2")
Q=800.;#refrigeration capacity in tons
Q_latent=335.;#latent heat for ice formation from water in KJ/kg
T1=(-7.+273.);#temperature of reservoir 1 in K
T2=(27.+273.);#temperature of reservoir 2 in K
print("refrigeration capacity or heat extraction rate(Q)in KJ/s")
Q=Q*3.5
print("let the ice formation rate be m kg/s")
print("heat to be removed from per kg of water for its transformation into ice(Q1)in KJ/kg.")
Q1=4.18*(27-0)+Q_latent
m=Q/Q1
print("ice formation rate(m)in kg=refrigeration capacity/heat removed for getting per kg of ice="),round(Q/Q1,2)
print("COP of refrigerator,=T1/(T2-T1)=refrigeration capacity/work done")
COP=T1/(T2-T1)
print("also COP=Q/W")
print("so W=Q/COP in KJ/s")
W=Q/COP
W=W/0.7457
print("HP required"),round(W/0.7457,2)
print("NOTE=>In book,this question is solved by taking T1=-5 degree celcius,but according to question T1=-7 degree celcius so this question is correctly solved above by considering T1=-7 degree celcius.")
#cal of COP and temperature of surrounding
#intiation of all variables
# Chapter 11
import math
print"Example 11.3, Page:436 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 11 Example 3")
T1=(-27+273);#temperature of refrigerator in K
W=3*.7457;#work input in KJ/s
Q=1*3.5;#refrigeration effect in KJ/s
COP=Q/W
print("COP=T1/(T2-T1)=Q/W"),round(COP,2)
COP=1.56;#approx.
print("equating,COP=T1/(T2-T1)")
print("so temperature of surrounding(T2)in K")
T2=T1+(T1/COP)
print("T2="),round(T2,2)
#cal of refrigeration capacity and COP
#intiation of all variables
# Chapter 11
import math
print"Example 11.4, Page:436 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 11 Example 4")
T1=(-30.+273.);#temperature of air at beginning of compression in K
T3=(27.+273.);#temperature of air after cooling in K
r=8.;#pressure ratio
Cp=1.005;#specific heat at constant pressure in KJ/kg K
y=1.4;#expansion constant
m=1.;#air flow rate in kg/s
n1=0.85;#isentropic efficiency for compression process
n2=.9;#isentropic efficiency for expansion process
print("during process 1-2_a")
print("p2/p1=(T2_a/T1)^(y/(y-1))")
print("so T2_a=T1*(p2/p1)^((y-1)/y)in K")
T2_a=T1*(r)**((y-1)/y)
print("theoretical temperature after compression,T2_a=440.18 K")
print("for compression process,")
print("n1=(T2_a-T1)/(T2-T1)")
print("so T2=T1+(T2_a-T1)/n1 in K")
T2=T1+(T2_a-T1)/n1
print("for expansion process,3-4_a")
print("T4_a/T3=(p1/p2)^((y-1)/y)")
print("so T4_a=T3*(p1/p2)^((y-1)/y) in K")
T4_a=T3*(1/r)**((y-1)/y)
print("n2=0.9=(T3-T4)/(T3-T4_a)")
print("so T4=T3-(n2*(T3-T4_a))in K")
T4=T3-(n2*(T3-T4_a))
print("so work during compression,W_C in KJ/s")
print("W_C=m*Cp*(T2-T1)")
W_C=m*Cp*(T2-T1)
print("work during expansion,W_T in KJ/s")
print("W_T=m*Cp*(T3-T4)")
W_T=m*Cp*(T3-T4)
print("refrigeration effect is realized during process,4-1.so refrigeration shall be,")
print("Q_ref=m*Cp*(T1-T4) in KJ/s")
Q_ref=m*Cp*(T1-T4)
Q_ref=Q_ref/3.5
print("Q_ref in ton"),round(Q_ref,2)
W=W_C-W_T
print("net work required(W)=W_C-W_T in KJ/s"),round(W,2)
Q_ref=64.26;
COP=Q_ref/(W_C-W_T)
print("COP="),round(COP,2)
print("so refrigeration capacity=18.36 ton or 64.26 KJ/s")
print("and COP=0.57")
print("NOTE=>In book this question is solve by taking T1=240 K which is incorrect,hence correction is made above according to question by taking T1=-30 degree celcius or 243 K,so answer may vary slightly.")
#cal of COP
#intiation of all variables
# Chapter 11
import math
print"Example 11.5, Page:437 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 11 Example 5")
T1=(7+273);#temperature of refrigerated space in K
T3=(27+273);#temperature after compression in K
p1=1*10**5;#pressure of refrigerated space in pa
p2=5*10**5;#pressure after compression in pa
y=1.4;#expansion constant
Cp=1.005;#specific heat at constant pressure in KJ/kg K
print("for isentropic compression process:")
print("(p2/p1)^((y-1)/y)=T2/T1")
print("so T2=T1*(p2/p1)^((y-1)/y) in K")
T2=T1*(p2/p1)**((y-1)/y)
print("for isenropic expansion process:")
print("(p3/p4)^((y-1)/y)=(T3/T4)=(p2/p1)^((y-1)/y)")
print("so T4=T3/(p2/p1)^((y-1)/y) in K")
T4=T3/(p2/p1)**((y-1)/y)
print("heat rejected during process 2-3,Q23=Cp*(T2-T3)in KJ/kg")
Q23=Cp*(T2-T3)
print("refrigeration process,heat picked during process 4-1,Q41=Cp*(T1-T4) in KJ/kg")
Q41=Cp*(T1-T4)
print("so net work(W)=Q23-Q41 in KJ/kg")
W=Q23-Q41
COP=Q41/W
print("so COP=refrigeration effect/net work="),round(COP,2)
#cal of refrigeration capacity,HP required to run compressor,COP
#intiation of all variables
# Chapter 11
import math
print"Example 11.6, Page:438 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 11 Example 6")
T1=(-10.+273.);#air entering temperature in K
p1=1.*10**5;#air entering pressure in pa
T3=(27.+273.);#compressed air temperature after cooling in K
p2=5.5*10**5;#pressure after compression in pa
m=0.8;#air flow rate in kg/s
Cp=1.005;#specific heat capacity at constant pressure in KJ/kg K
y=1.4;#expansion constant
R=0.287;#gas constant in KJ/kg K
print("for process 1-2")
print("(p2/p1)^((y-1)/y)=T2/T1")
print("so T2=T1*(p2/p1)^((y-1)/y) in K")
T2=T1*(p2/p1)**((y-1)/y)
print("for process 3-4")
print("(p3/p4)^((y-1)/y)=T3/T4")
print("so T4=T3/(p3/p4)^((y-1)/y)=T3/(p2/p1)^((y-1)/y)in K")
T4=T3/(p2/p1)**((y-1)/y)
Q=m*Cp*(T1-T4)
print("refrigeration capacity(Q) in KJ/s="),round(Q,2)
print("Q in ton")
Q=Q/3.5
print("work required to run compressor(w)=(m*n)*(p2*v2-p1*v1)/(n-1)")
print("w=(m*n)*R*(T2-T1)/(n-1) in KJ/s")
n=y;
w=(m*n)*R*(T2-T1)/(n-1)
print("HP required to run compressor"),round(w/0.7457,2)
print("so HP required to run compressor=177.86 hp")
print("net work input(W)=m*Cp*{(T2-T3)-(T1-T4)}in KJ/s")
W=m*Cp*((T2-T3)-(T1-T4))
Q=63.25;#refrigeration capacity in KJ/s
COP=Q/W
print("COP=refrigeration capacity/work=Q/W"),round(COP,2)
#cal of air mass flow rate in cabin,ram air mass flow rate,COP
#intiation of all variables
# Chapter 11
import math
print"Example 11.7, Page:440 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 11 Example 7")
p1=1.2*10**5;#pressure of ram air in pa
p6=p1;
T1=(15.+273.);#temperature of ram air in K
T6=T1;
p7=0.9*10**5;#pressure of ram air after expansion in pa
p3=4.*10**5;#pressure of ram air after compression in pa
p2=p3;
p4=1.*10**5;#pressure of ram air after expansion in second turbine in pa
T5=(25.+273.);#temperature of air when exhausted from cabin in K
T3=(50.+273.);#temperature of compressed air in K
T8=(30.+273.);#limited temperaure of ram air in K
Q=10.*3.5;#refrigeration capacity in KJ/s
Cp=1.005;#specific heat capacity at constant pressure in KJ/kg K
print("for process 1-2,n=1.45")
n=1.45;
print("T2/T1=(p2/p1)^((n-1)/n)")
print("so T2=T1*(p2/p1)^((n-1)/n) in K")
T2=T1*(p2/p1)**((n-1)/n)
print("for process 3-4,n=1.3")
n=1.3;
print("T4/T3=(p4/p3)^((n-1)/n)")
print("so T4=T3*(p4/p3)^((n-1)/n)in K")
T4=T3*(p4/p3)**((n-1)/n)
print("refrigeration effect in passenger cabin with m kg/s mass flow rate of air.")
print("Q=m*Cp*(T5-T4)")
m=Q/(Cp*(T5-T4))
print("m in kg/s="),round(m,2)
print("so air mass flow rate in cabin=0.55 kg/s")
print("let the mass flow rate through intercooler be m1 kg/s then the energy balance upon intercooler yields,")
print("m1*Cp*(T8-T7)=m*Cp*(T2-T3)")
print("during process 6-7,T7/T6=(p7/p6)^((n-1)/n)")
print("so T7=T6*(p7/p6)^((n-1)/n) in K")
T7=T6*(p7/p6)**((n-1)/n)
print("substituting T2,T3,T7,T8 and m in energy balance on intercooler,")
print("m1=m*(T2-T3)/(T8-T7)in kg/s")
m1=m*(T2-T3)/(T8-T7)
print("total ram air mass flow rate=m+m1 in kg/s"),round(m+m1,2)
print("ram air mass flow rate=2.12 kg/s")
print("work input to compressor(W)=m*Cp*(T2-T1)in KJ/s")
m=0.55;#approx.
W=m*Cp*(T2-T1)
COP=Q/W
print("COP=refrigeration effect/work input=Q/W"),round(Q/W,3)
#cal of COP and HP required
#intiation of all variables
# Chapter 11
import math
print"Example 11.8, Page:441 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 11 Example 8")
po=0.9*10**5;#atmospheric air pressure in pa
To=(3.+273.);#temperature of atmospheric air in K
p1=1.*10**5;#pressure due to ramming air in pa
p2=4.*10**5;#pressure when air leaves compressor in pa
p3=p2;
p4=p3;
p5=1.03*10**5;#pressure maintained in passenger cabin in pa
T6=(25.+273.);#temperature of air leaves cabin in K
Q=15.*3.5;#refrigeration capacity of aeroplane in KJ/s
n1=0.9;#isentropic efficiency of compressor
n2=0.8;#isentropic efficiency of turbine
Cp=1.005;#specific heat at constant pressure in KJ/kg K
print("considering index of compression and expansion as 1.4")
y=1.4;
print("during ramming action,process 0-1,")
print("T1/To=(p1/po)^((y-1)/y)")
print("T1=To*(p1/po)^((y-1)/y)in K")
T1=To*(p1/po)**((y-1)/y)
print("during compression process 1-2_a")
print("T2_a/T1=(p2/p1)^((y-1)/y)")
print("T2_a=T1*(p2/p1)^((y-1)/y)in K")
T2_a=T1*(p2/p1)**((y-1)/y)
print("n1=(T2_a-T1)/(T2-T1)")
print("so T2=T1+(T2_a-T1)/n1 in K")
T2=T1+(T2_a-T1)/n1
print("In heat exchanger 66% of heat loss shall result in temperature at exit from heat exchanger to be,T3=0.34*T2 in K")
T3=0.34*T2
print("subsequently for 10 degree celcius temperature drop in evaporator,")
print("T4=T3-10 in K")
T4=T3-10
print("expansion in cooling turbine during process 4-5;")
print("T5_a/T4=(p5/p4)^((y-1)/y)")
print("T5_a=T4*(p5/p4)^((y-1)/y)in K")
T5_a=T4*(p5/p4)**((y-1)/y)
print("n2=(T4-T5)/(T4-T5_a)")
print("T5=T4-(T4-T5_a)*n2 in K")
T5=T4-(T4-T5_a)*n2
print("let the mass flow rate of air through cabin be m kg/s.using refrigeration capacity heat balance yields.")
print("Q=m*Cp*(T6-T5)")
print("so m=Q/(Cp*(T6-T5))in kg/s")
m=Q/(Cp*(T6-T5))
W=m*Cp*(T2-T1)
print("work input to compressor(W)=m*Cp*(T2-T1)in KJ/s"),round(W,2)
print("W in Hp")
W=W/.7457
W=41.37;#work input to compressor in KJ/s
COP=Q/W
print("COP=refrigeration effect/work input=Q/W="),round(COP,2)
print("so COP=1.27")
print("and HP required=55.48 hp")
#cal of COP
#intiation of all variables
# Chapter 11
import math
print"Example 11.9, Page:443 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 11 Example 9")
print("properties of NH3,")
print("at 15 degree celcius,h9=-54.51 KJ/kg,hg=1303.74 KJ/kg,s9=-0.2132 KJ/kg K,sg=5.0536 KJ/kg K")
T1=(-15+273);
h9=-54.51;
hg=1303.74;
s9=-0.2132;
sg=5.0536;
print("and at 25 degree celcius,h3=99.94 KJ/kg,h2=1317.95 KJ/kg,s3=0.3386 KJ/kg K,s2=4.4809 KJ/kg K")
T2=(25+273);
h3=99.94;
h2=1317.95;
s3=0.3386;
s2=4.4809;
print("here work done,W=Area 1-2-3-9-1")
print("refrigeration effect=Area 1-5-6-4-1")
print("Area 3-8-9 =(Area 3-11-7)-(Area 9-11-10)-(Area 9-8-7-10)")
print("so Area 3-8-9=h3-h9-T1*(s3-s9)in KJ/kg")
h3-h9-T1*(s3-s9)
print("during throttling process between 3 and 4,h3=h4")
print("(Area=3-11-7-3)=(Area 4-9-11-6-4)")
print("(Area 3-8-9)+(Area 8-9-11-7-8)=(Area 4-6-7-8-4)+(Area 8-9-11-7-8)")
print("(Area 3-8-9)=(Area 4-6-7-8-4)")
print("so (Area 4-6-7-8-4)=12.09 KJ/kg")
print("also,(Area 4-6-7-8-4)=T1*(s4-s8)")
print("so (s4-s8)in KJ/kg K=")
12.09/T1
print("also s3=s8=0.3386 KJ/kg K")
s8=s3;
print("so s4 in KJ/kg K=")
s4=s8+12.09/T1
print("also s1=s2=4.4809 KJ/kg K")
s1=s2;
print("refrigeration effect(Q)=Area (1-5-6-4-1)=T1*(s1-s4)in KJ/kg")
Q=T1*(s1-s4)
print("work done(W)=Area (1-2-3-9-1)=(Area 3-8-9)+((T2-T1)*(s1-s8))in KJ/kg")
W=12.09+((T2-T1)*(s1-s8))
COP=Q/W
print("so COP=refrigeration effect/work done="),round(COP,2)
print("so COP=5.94")
#cal of COP and piston printlacement
#intiation of all variables
# Chapter 11
import math
print"Example 11.10, Page:445 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 11 Example 10")
Q=2.86*3.5;#refrigeration effect in KJ/s
N=1200;#compressor rpm
n=1.13;#compression index
print("properties of Freon-12,")
print("at -20 degree celcius,P1=1.51 bar,vg=0.1088 m^3/kg,hf=17.8 KJ/kg,h1=178.61 KJ/kg,sf=0.0730 KJ/kg K,s1=0.7082 KJ/kg K,Cpg=0.605 KJ/kg K")
P1=1.51;
T1=(-20+273);
vg=0.1088;
h1=178.61;
s1=0.7082;
s2=s1;
print("at 40 degree celcius,P2=9.61 bar,h3=74.53 KJ/kg,hg=203.05 KJ/kg,sf=0.2716 KJ/kg K,sg=0.682 KJ/kg K,Cpf=0.976 KJ/kg K,Cpg=0.747 KJ/kg K")
P2=9.61;
h3=74.53;
h4=h3;
hg=203.05;
sf=0.2716;
sg=0.682;
Cpf=0.976;
Cpg=0.747;
print("during expansion(throttling)between 3 and 4")
print("h3=h4=hf_40oc=74.53 KJ/kg=h4")
print("process 1-2 is adiabatic compression so,")
print("s1=s2,s1=sg_-20oc=0.7082 KJ/kg K")
print("at 40 degree celcius or 313 K,s1=sg+Cpg*log(T2/313)")
print("T2=313*exp((s1-sg)/Cpg)in K")
T2=313*math.exp((s1-sg)/Cpg)
print("so temperature after compression,T2=324.17 K")
print("enthalpy after compression,h2=hg+Cpg*(T2-313)in KJ/kg")
h2=hg+Cpg*(T2-313)
print("compression work required,per kg(Wc)=h2-h1 in KJ/kg")
Wc=h2-h1
print("refrigeration effect during cycle,per kg(q)=h1-h4 in KJ/kg")
q=h1-h4
print("mass flow rate of refrigerant,m=Q/q in kg/s")
m=Q/q
m=0.096;#approx.
COP=q/Wc
print("COP=q/Wc"),round(COP,5)
print("volumetric efficiency of reciprocating compressor,given C=0.02")
C=0.02;
print("n_vol=1+C-C*(P2/P1)^(1/n)")
n_vol=1+C-C*(P2/P1)**(1/n)
print("let piston printlacement by V,m^3")
print("mass flow rate,m=(V*n_vol*N)/(60*vg_-20oc)")
V=(m*60*vg)*10**6/(N*n_vol)
print("so V in cm^3="),round(V,2)
print("so COP=3.175")
print("and piston printlacement=569.45 cm^3")
#cal of COP and mass flow rate
#intiation of all variables
# Chapter 11
import math
print"Example 11.11, Page:447 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 11 Example 11")
Q=2;#refrigeration effect in KW
print("properties of CO2,")
print("at 20 degree celcius,P1=57.27 bar,hf=144.11 KJ/kg,hg=299.62 KJ/kg,sf=0.523 KJ/kg K,sg_20oc=1.0527 KJ/kg K,Cpf=2.889 KJ/kg K,Cpg=2.135 KJ/kg K")
T1=(20.+273.);#condensation temperature in K
P1=57.27;
h3=144.11;
hg=299.62;
sf=0.523;
sg_20oc=1.0527;
Cpf=2.889;
Cpg=2.135;
print("at -10 degree celcius,P2=26.49 bar,vg=0.014 m^3/kg,hf=60.78 KJ/kg,hg=322.28 KJ/kg,sf=0.2381 KJ/kg K,sg=1.2324 KJ/kg K")
T2=(-10+273);#evaporator temperature in K
P2=26.49;
vg=0.014;
hf=60.78;
h1=322.28;
sf=0.2381;
sg=1.2324;
print("processes of vapour compression cycle are shown on T-s diagram")
print("1-2:isentropic compression process")
print("2-3-4:condensation process")
print("4-5:isenthalpic expansion process")
print("5-1:refrigeration process in evaporator")
print("h1=hg at -10oc=322.28 KJ/kg")
print("at 20 degree celcius,h2=hg+Cpg*(40-20)in KJ/kg")
h2=hg+Cpg*(40.-20.)
print("entropy at state 2,at 20 degree celcius,s2=sg_20oc+Cpg*log((273+40)/(273+20))in KJ/kg K")
s2=sg_20oc+Cpg*math.log((273.+40.)/(273.+20.))
print("entropy during isentropic process,s1=s2")
print("at -10 degree celcius,s2=sf+x1*sfg")
print("so x1=(s2-sf)/(sg-sf)")
x1=(s2-sf)/(sg-sf)
print("enthalpy at state 1,at -10 degree celcius,h1=hf+x1*hfg in KJ/kg")
h1=hf+x1*(h1-hf)
print("h3=hf at 20oc=144.11 KJ/kg")
print("since undercooling occurs upto 10oc,so,h4=h3-Cpf*deltaT in KJ/kg")
h4=h3-Cpf*(20.-10.)
print("also,h4=h5=115.22 KJ/kg")
h5=h4;
print("refrigeration effect per kg of refrigerant(q)=(h1-h5)in KJ/kg")
q=(h1-h5)
print("let refrigerant flow rate be m kg/s")
print("refrigerant effect(Q)=m*q")
m=Q/q
print("m=Q/q in kg/s"),round(m,5)
print("compressor work,Wc=h2-h1 in KJ/kg")
Wc=h2-h1
COP=q/Wc
print("COP=refrigeration effect per kg/compressor work per kg="),round(COP,2)
print("so COP=6.51,mass flow rate=0.01016 kg/s")
print("NOTE=>In book,mass flow rate(m) which is 0.1016 kg/s is calculated wrong and it is correctly solve above and comes out to be m=0.01016 kg/s. ")
#cal of partial pressure of vapour and relative humidity
#intiation of all variables
# Chapter 11
import math
print"Example 11.12, Page:448 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 11 Example 12")
omega=0.016;#specific humidity in gm/gm of air
print("here pressure of atmospheric air(P)may be taken as 1.013 bar")
P=1.013;#pressure of atmospheric air in bar
print("specific humidity,omega=0.622*(Pv/(P-Pv))")
print("so partial pressure of vapour(Pv)in bar")
Pv=P/(1+(0.622/omega))
print("Pv in bar="),round(Pv,4)
Pv=0.0254;#approx.
print("relative humidity(phi)=(Pv/Pv_sat)")
print("from pychrometric properties of air Pv_sat at 25 degree celcius=0.03098 bar")
Pv_sat=0.03098;
phi=Pv/Pv_sat
print("so phi=Pv/Pv_sat"),round(phi,2)
print("in percentage"),round(phi*100,2)
print("so partial pressure of vapour=0.0254 bar")
print("relative humidity=81.98 %")
#cal of partial pressure,humidity ratio,Dew point temperature,density and enthalpy of mixture
#intiation of all variables
# Chapter 11
import math
print"Example 11.13, Page:449 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 11 Example 13")
r=0.6;#relative humidity
P=1.013;#total pressure of mixture in bar
R=0.287;#gas constant in KJ/kg K
Ta=(30+273);#room temperature in K
Cp=1.005;#specific heat at constant pressure in KJ/kg degree celcius
print("at 30 degree celcius from steam table,saturation pressure,Pv_sat=0.0425 bar")
Pv_sat=0.0425;
Pv=r*Pv_sat
print("partial pressure of vapour(Pv)=relative humidity*Pv_sat in bar"),round(Pv,2)
Pa=P-Pv
print("partial pressure of air(Pa)=total pressure of mixture-partial pressure of vapour"),round(Pa,2)
print("so partial pressure of air=0.9875 bar")
omega=0.622*Pv/(P-Pv)
print("humidity ratio,omega in kg/kg of dry air="),round(omega,5)
print("so humidity ratio=0.01606 kg/kg of air")
print("Dew point temperature may be seen from the steam table.The saturation temperature corresponding to the partial pressure of vapour is 0.0255 bar.Dew point temperature can be approximated as 21.4oc by interpolation")
print("so Dew point temperature=21.4 degree celcius")
print("density of mixture(rho_m)=density of air(rho_a)+density of vapour(rho_v)")
print("rho_m=(rho_a)+(rho_v)=rho_a*(1+omega)")
rho_m=P*100*(1+omega)/(R*Ta)
print("rho_m in kg/m^3="),round(rho_m,4)
print("so density = 1.1835 kg/m^3")
T=30;#room temperature in degree celcius
hg=2540.1;#enthalpy at 30 degree celcius in KJ/kg
h=Cp*T+omega*(hg+1.860*(30-21.4))
print("enthalpy of mixture,h in KJ/kg of dry air="),round(h,2)
print("enthalpy of mixture =71.2 KJ/kg of dry air")
#cal of mass of water added and heat transferred
#intiation of all variables
# Chapter 11
import math
print"Example 11.14, Page:449 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 11 Example 14")
print("initial state at 15 degree celcius and 80% relative humidity is shown by point 1 and final state at 25 degree celcius and 50% relative humidity is shown by point 2 on psychrometric chart.")
print("omega1=0.0086 kg/kg of air,h1=37 KJ/kg,omega2=0.01 kg/kg of air,h2=50 KJ/kg,v2=0.854 m^3/kg")
omega1=0.0086;
h1=37.;
omega2=0.01;
h2=50.;
v2=0.854;
print("mass of water added between states 1 and 2 omega2-omega1 in kg/kg of air")
omega2-omega1
print("mass flow rate of air(ma)=0.8/v2 in kg/s")
ma=0.8/v2
print("total mass of water added=ma*(omega2-omega1)in kg/s"),round(ma*(omega2-omega1),6)
print("heat transferred in KJ/s="),round(ma*(h2-h1),2)
print("so mass of water added=0.001312 kg/s,heat transferred=12.18 KW")
#cal of specific humidity and partial pressure of water vapour in mixture
#intiation of all variables
# Chapter 11
import math
print"Example 11.15, Page:451 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 11 Example 15")
P=1.013;#atmospheric pressure in bar
Cp_air=1.005;#specific heat of air at constant pressure in KJ/kg K
Cp_stream=1.86;#specific heat of stream at constant pressure in KJ/kg K
T1=30.;#temperature of first stream of moist air in K
m1=3.;#mass flow rate of first stream in kg/s
T2=35.;#temperature of second stream of moist air in K
m2=2.;#mass flow rate of second stream in kg/s
print("Let temperature after mixing be Toc.For getting final enthalpy after adiabatic mixing the enthalpy of two streams are required.")
print("For moist air stream at 30 degree celcius and 30% relative humidity.")
phi1=0.3;
print("phi1=Pv1/Pv_sat_30oc")
print("here Pv_sat_30oc=0.04246 bar")
Pv_sat_30oc=0.04246;
print("so Pv1=phi1*Pv_sat_30oc in bar")
Pv1=phi1*Pv_sat_30oc
print("corresponding to vapour pressure of 0.01274 bar the dew point temperature shall be 10.5 degree celcius")
Tdp1=10.5;
omega1=0.622*Pv1/(P-Pv1)
print("specific humidity,omega1 in kg/kg of air="),round(omega1,5)
print("at dew point temperature of 10.5 degree celcius,enthalpy,hg at 10.5oc=2520.7 KJ/kg")
hg=2520.7;#enthalpy at 10.5 degree celcius in KJ/kg
print("h1=Cp_air*T1+omega1*{hg-Cp_stream*(T1-Tdp1)}in KJ/kg of dry air")
h1=Cp_air*T1+omega1*(hg-Cp_stream*(T1-Tdp1))
print("for second moist air stream at 35oc and 85% relative humidity")
phi2=0.85;
print("phi2=Pv2/Pv_sat_35oc")
print("here Pv_sat_35oc=0.005628 bar")
Pv_sat_35oc=0.005628;
print("so Pv2=phi2*Pv_sat_35oc in bar")
Pv2=phi2*Pv_sat_35oc
omega2=0.622*Pv2/(P-Pv2)
print("specific humidity,omega2 in kg/kg of air="),round(omega2,5)
print("corresponding to vapour pressure of 0.004784 bar the dew point temperature is 32 degree celcius")
Tdp2=32.;
print("so,enthalpy of second stream,")
print("h2=Cp_air*T2+omega2*{hg+Cp_stream*(T2-Tdp2)}in KJ/kg of dry air")
hg=2559.9;#enthalpy at 32 degree celcius in KJ/kg
h2=Cp_air*T2+omega2*(hg+Cp_stream*(T2-Tdp2))
print("enthalpy of mixture after adiabatic mixing,")
print("=(1/(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2))) in KJ/kg of moist air")
(1./(m1+m2))*((h1*m1/(1+omega1))+(h2*m2/(1+omega2)))
print("mass of vapour per kg of moist air=(1/5)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))in kg/kg of moist air")
(1./5.)*((omega1*m1/(1+omega1))+(omega2*m2/(1+omega2)))
omega=0.00589/(1-0.005893)
print("specific humidity of mixture(omega)in kg/kg of dry air="),round(omega,5)
print("omega=0.622*Pv/(P-Pv)")
Pv=omega*P/(omega+0.622)
print("Pv in bar="),round(Pv,5)
print("partial pressure of water vapour=0.00957 bar")
print("so specific humidity of mixture=0.00593 kg/kg dry air")
print("and partial pressure of water vapour in mixture=0.00957 bar")
#cal of amount of heat added
#intiation of all variables
# Chapter 11
import math
print"Example 11.16, Page:452 \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 11 Example 16")
m1=3;#rate at which moist air enter in heating coil in m^3/s
print("The type of heating involved is sensible heating.Locating satte 1 on psychrometric chart corresponding to 15 degree celcius dbt and 80% relative humidity the other property values shall be,")
print("h1=36.4 KJ/kg,omega1=0.0086 kg/kg of air,v1=0.825 m^3/kg")
h1=36.4;
omega1=0.0086;
v1=0.825;
print("final state 2 has,h2=52 KJ/kg")
h2=52;
print("mass of air(m)=m1/v1 in kg/s")
m=m1/v1
m=3.64;#approx.
print("amount of heat added(Q)in KJ/s")
Q=m*(h2-h1)
print("Q=m*(h2-h1)"),round(Q,2)