Chapter 3:First Law of Thermo Dynamics

example 3.1;pg no:76

In [2]:
#cal of work done on system
#intiation of all variables
# Chapter 3
print"Example 3.1, Page:46  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 1")
import scipy
from scipy import integrate

def fun1(x):
	y=x*x
	return y

p=689.;#pressure of gas in cylinder in kpa
v1=0.04;#initial volume of fluid in m^3
v2=0.045;#final volume of fluid in m^3
W_paddle=-4.88;#paddle work done on the system in KJ
print("a> work done on piston(W_piston)in KJ can be obtained as")
print("W_piston=pdv")
#function y = f(v), y=p, endfunction
def fun1(x):
	y=p
	return y

W_piston=scipy.integrate.quad(fun1,v1,v2) 
print("b> paddle work done on the system(W_paddle)=-4.88 KJ")
print("net work done of system(W_net)in KJ")
print("W_net=W_piston+W_paddle")
print("so work done on system(W_net)=1.435 KJ")
Example 3.1, Page:46  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 1
a> work done on piston(W_piston)in KJ can be obtained as
W_piston=pdv
b> paddle work done on the system(W_paddle)=-4.88 KJ
net work done of system(W_net)in KJ
W_net=W_piston+W_paddle
so work done on system(W_net)=1.435 KJ

example 3.2;pg no:

In [7]:
#cal of heat required
#intiation of all variables
# Chapter 3
print"Example 3.2, Page:76  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 2")
m=0.5;#mass of gas in kg
u1=26.6;#internal energy of gas at 200 degree celcius
u2=37.8;#internal energy of gas at 400 degree celcius
W=0;#work done by vessel in KJ
print("as the vessel is rigid therefore work done shall be zero")
print("W=0")
print("from first law of thermodynamics,heat required(Q)in KJ")
print("Q=U2-U1+W=Q=m(u2-u1)+W")
Q=m*(u2-u1)+W
print("so heat required ="),round(Q,2)
Example 3.2, Page:76  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 2
as the vessel is rigid therefore work done shall be zero
W=0
from first law of thermodynamics,heat required(Q)in KJ
Q=U2-U1+W=Q=m(u2-u1)+W
so heat required = 5.6

example 3.3;pg no:77

In [9]:
#cal of "heat should be removed
#intiation of all variables
# Chapter 3
print"Example 3.3, Page:77  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 3")
m=50;#rate at which carbon dioxide passing through heat exchanger in kg/hr
T2=800;#initial temperature of carbon dioxide in degree celcius
T1=50;#final temperature of carbon dioxide in degree celcius
Cp=1.08;#specific heat at constant pressure in KJ/kg K
print("by steady flow energy equation")
print("q+h1+C1^2/2+g*z1=h2+C2^2/2+g*z2+w")
print("let us assume changes in kinetic and potential energy is negligible,during flow the work interaction shall be zero")
print("q=h2-h1")
print("rate of heat removal(Q)in KJ/hr")
print("Q=m(h2-h1)=m*Cp*(T2-T1)")
Q=m*Cp*(T2-T1)
print("heat should be removed at the rate=KJ/hr"),round(Q)
Example 3.3, Page:77  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 3
by steady flow energy equation
q+h1+C1^2/2+g*z1=h2+C2^2/2+g*z2+w
let us assume changes in kinetic and potential energy is negligible,during flow the work interaction shall be zero
q=h2-h1
rate of heat removal(Q)in KJ/hr
Q=m(h2-h1)=m*Cp*(T2-T1)
heat should be removed at the rate=KJ/hr 40500.0

example 3.4;pg no:77

In [ ]:
#cal of work done by surrounding on system
#intiation of all variables
# Chapter 3
print"Example 3.4, Page:77  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 4")
v=0.78;#volume of cylinder in m^3
p=101.325;#atmospheric pressure in kPa
print("total work done by the air at atmospheric pressure of 101.325 kPa")
print("W=(pdv)cylinder+(pdv)air")
print("0+p*(delta v)")
print("work done by air(W)=-p*v in KJ")
W=-p*v
print("so work done by surrounding on system=KJ"),round(-W,2)

example 3.5:pg no:77

In [10]:
#cal of heat,work interaction and change in internal energy
#intiation of all variables
# Chapter 3
print"Example 3.5, Page:77  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 5")
m=5;#mass of gas in kg
p1=1*10**3;#initial pressure of gas in KPa
V1=0.5;#initial volume of gas in m^3
p2=0.5*10**3;#final pressure of gas in KPa
n=1.3;#expansion constant
print("given p*v^1.3=constant")
print("assuming expansion to be quasi-static,the work may be given as")
print("W=m(p*dv)=(p2*V2-p1*V1)/(1-n)")
print("from internal energy relation,change in specific internal energy")
print("deltau=u2-u1=1.8*(p2*v2-p1*v1)in KJ/kg")
print("total change,deltaU=1.8*m*(p2*v2-p1*v1)=1.8*(p2*V2-p1*V1)in KJ")
print("using p1*V1^1.3=p2*V2^1.3")
V2=V1*(p1/p2)**(1/1.3)
print("V2=in m^3"),round(V2,2)
print("take V2=.852 m^3")
V2=0.852;#final volume of gas in m^3
print("so deltaU in KJ")
deltaU=1.8*(p2*V2-p1*V1)
W=(p2*V2-p1*V1)/(1-n)
print("and W in KJ"),round(W,2)
print("from first law")
deltaQ=deltaU+W
print("deltaQ=KJ"),round(deltaQ,2)
print("heat interaction=113.5 KJ")
print("work interaction=246.7 KJ")
print("change in internal energy=-113.2 KJ")
Example 3.5, Page:77  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 5
given p*v^1.3=constant
assuming expansion to be quasi-static,the work may be given as
W=m(p*dv)=(p2*V2-p1*V1)/(1-n)
from internal energy relation,change in specific internal energy
deltau=u2-u1=1.8*(p2*v2-p1*v1)in KJ/kg
total change,deltaU=1.8*m*(p2*v2-p1*v1)=1.8*(p2*V2-p1*V1)in KJ
using p1*V1^1.3=p2*V2^1.3
V2=in m^3 0.85
take V2=.852 m^3
so deltaU in KJ
and W in KJ 246.67
from first law
deltaQ=KJ 113.47
heat interaction=113.5 KJ
work interaction=246.7 KJ
change in internal energy=-113.2 KJ

example 3.6;pg no:78

In [11]:
#cal of heat,workinternal energy change
#intiation of all variables
# Chapter 3
print"Example 3.6, Page:78  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 6")
p1=1;#initial pressure of gas in MPa
v1=0.05;#initial volume of gas in m^3
p2=2;#final pressure of gas in MPa
n=1.4;#expansion constant
print("final state volume(v2)in m^3")
v2=((p1/p2)**(1/1.4))*v1
print("v2="),round(v2,2)
print("take v2=0.03 m^3")
v2=0.03;#final volume of gas in m^3
print("now internal energy of gas is given by U=7.5*p*v-425")
print("change in internal energy(deltaU)in KJ")
print("deltaU=U2-U1=7.5*p2*v2-7.5*p1*v1")
deltaU=7.5*10**3*(p2*v2-p1*v1)
print("deltaU=7.5*10^3*(p2*v2-p1*v1)"),round(deltaU,2)
print("for quasi-static process")
print("work(W) in KJ,W=p*dv")
W=((p2*v2-p1*v1)/(1-n))*10**3
print("W=(p2*v2-p1*v1)/(1-n)")
print("from first law of thermodynamics,")
print("heat interaction(deltaQ)=deltaU+W")
deltaQ=deltaU+W
print("heat=50 KJ")
print("work=25 KJ(-ve)")
print("internal energy change=75 KJ")
print("if 180 KJ heat transfer takes place,then from 1st law,")
print("deltaQ="),round(deltaQ,2)
print("since end states remain same,therefore deltaU i.e change in internal energy remains unaltered.")
W=180-75
print("W=KJ"),round(W,2)
Example 3.6, Page:78  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 6
final state volume(v2)in m^3
v2= 0.0
take v2=0.03 m^3
now internal energy of gas is given by U=7.5*p*v-425
change in internal energy(deltaU)in KJ
deltaU=U2-U1=7.5*p2*v2-7.5*p1*v1
deltaU=7.5*10^3*(p2*v2-p1*v1) 75.0
for quasi-static process
work(W) in KJ,W=p*dv
W=(p2*v2-p1*v1)/(1-n)
from first law of thermodynamics,
heat interaction(deltaQ)=deltaU+W
heat=50 KJ
work=25 KJ(-ve)
internal energy change=75 KJ
if 180 KJ heat transfer takes place,then from 1st law,
deltaQ= 50.0
since end states remain same,therefore deltaU i.e change in internal energy remains unaltered.
W=KJ 105.0

example 3.7;pg no:79

In [12]:
#cal of work and heat
#intiation of all variables
# Chapter 3
print"Example 3.7, Page:79  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 7")
M=16;#molecular weight of gas
p1=101.3;#initial pressure of gas in KPa
p2=600;#final pressure of gas in KPa
T1=(273+20);#initial temperature of gas in K
R1=8.3143*10**3;#universal gas constant in J/kg K
Cp=1.7;#specific heat at constant pressure in KJ/kg K
n=1.3;#expansion constant
T2=((p2/p1)**(n-1/n))
print("characteristics gas constant(R)in J/kg K")
R=R1/M
print("R="),round(R,2)
print("take R=0.520,KJ/kg K")
R=0.520;#characteristics gas constant in KJ/kg K
Cv=Cp-R
print("Cv=inKJ/kg K"),round(Cv,2)
y=Cp/Cv
print("y="),round(y,2)
y=1.44;#ratio of specific heat at constant pressure to constant volume
print("for polytropic process,v2=((p1/p2)^(1/n))*v1 in m^3")
T2=T1*((p2/p1)**((n-1)/n))
print("now,T2=in K")
print("work(W)in KJ/kg")
W=R*((T1-T2)/(n-1))
print("W="),round(W,2)
W=257.78034;#work done in KJ/kg
print("for polytropic process,heat(Q)in KJ/K")
Q=((y-n)/(y-1))*W
print("Q="),round(Q,2)
Example 3.7, Page:79  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 7
characteristics gas constant(R)in J/kg K
R= 519.64
take R=0.520,KJ/kg K
Cv=inKJ/kg K 1.18
y= 1.44
for polytropic process,v2=((p1/p2)^(1/n))*v1 in m^3
now,T2=in K
work(W)in KJ/kg
W= -257.78
for polytropic process,heat(Q)in KJ/K
Q= 82.02

example 3.8;pg no:80

In [13]:
#cal of exit velocity
#intiation of all variables
# Chapter 3
import math
print"Example 3.8, Page:80  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 8")
T1=(627+273);#initial temperature of air in nozzle in K
T2=(27+273);#temperature at which air leaves nozzle in K
Cp=1.005*10**3;#specific heat at constant pressure in J/kg K
C2=math.sqrt(2*Cp*(T1-T2))
print("applying steady flow energy equation with inlet and exit states as 1,2 with no heat and work interaction and no change in potential energy")
print("h1+C1^2/2=h2+C2^2/2")
print("given that C1=0,negligible inlet velocity")
print("so C2=sqrt(2(h1-h2))=sqrt(2*Cp*(T1-T2))")
print("exit velocity(C2)in m/s"),round(C2,1)
Example 3.8, Page:80  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 8
applying steady flow energy equation with inlet and exit states as 1,2 with no heat and work interaction and no change in potential energy
h1+C1^2/2=h2+C2^2/2
given that C1=0,negligible inlet velocity
so C2=sqrt(2(h1-h2))=sqrt(2*Cp*(T1-T2))
exit velocity(C2)in m/s 1098.2

example 3.9;pg no:80

In [14]:
#cal of heat transferred to atmosphere
#intiation of all variables
# Chapter 3
print"Example 3.9, Page:80  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 9")
W=-200;#shaft work in KJ/kg of air
deltah=100;#increase in enthalpy in KJ/kg of air
Q1=-90;#heat transferred to water in KJ/kg of air
print("work interaction,W=-200 KJ/kg of air")
print("increase in enthalpy of air=100 KJ/kg of air")
print("total heat interaction,Q=heat transferred to water + heat transferred to atmosphere")
print("writing steady flow energy equation on compressor,for unit mass of air entering at 1 and leaving at 2")
print("h1+C1^2/2+g*z1+Q=h2+C2^2/2+g*z2+W")
print("assuming no change in potential energy and kinetic energy")
print("deltaK.E=deltaP.=0")
print("total heat interaction(Q)in KJ/kg of air")
Q=deltah+W
print("Q="),round(Q,2)
Q2=Q-Q1
print("Q=heat transferred to water + heat transferred to atmosphere=Q1+Q2")
print("so heat transferred to atmosphere(Q2)in KJ/kg of air"),round(Q2,2)
Example 3.9, Page:80  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 9
work interaction,W=-200 KJ/kg of air
increase in enthalpy of air=100 KJ/kg of air
total heat interaction,Q=heat transferred to water + heat transferred to atmosphere
writing steady flow energy equation on compressor,for unit mass of air entering at 1 and leaving at 2
h1+C1^2/2+g*z1+Q=h2+C2^2/2+g*z2+W
assuming no change in potential energy and kinetic energy
deltaK.E=deltaP.=0
total heat interaction(Q)in KJ/kg of air
Q= -100.0
Q=heat transferred to water + heat transferred to atmosphere=Q1+Q2
so heat transferred to atmosphere(Q2)in KJ/kg of air -10.0

example 3.10;pg no:81

In [15]:
#cal of water circulation rate
#intiation of all variables
# Chapter 3
print"Example 3.10, Page:81  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 10")
n=500;#total number of persons
q=50;#heat requirement per person in kcal/hr
h1=80;#enthalpy of hot water enter in pipe in kcal/kg
h2=45;#enthalpy of hot water leaves the pipe in kcal/kg
g=9.81;#acceleartion due to gravity in m/s^2
deltaz=10;#difference in elevation of inlet and exit pipe in m
print("above problem can be solved using steady flow energy equations upon hot water flow")
print("Q+m1*(h1+C1^2/2+g*z1)=W+m2*(h2+C2^2/2+g*z2)")
print("here total heat to be supplied(Q)in kcal/hr")
Q=n*q
print("so heat lost by water(-ve),Q=-25000 kcal/hr")
Q=-25000#heat loss by water in kcal/hr
print("there shall be no work interaction and change in kinetic energy,so,steady flow energy equation shall be,")
print("Q+m*(h1+g*z1)=m*(h2+g*z2)")
print("so water circulation rate(m)in kg/hr")
print("so m=Q*10^3*4.18/(g*deltaz-(h1-h2)*10^3*4.18")
m=Q*10**3*4.18/(g*deltaz-(h1-h2)*10**3*4.18)
m=m/60
print("water circulation rate=(m)in kg/min"),round(m,2)
Example 3.10, Page:81  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 10
above problem can be solved using steady flow energy equations upon hot water flow
Q+m1*(h1+C1^2/2+g*z1)=W+m2*(h2+C2^2/2+g*z2)
here total heat to be supplied(Q)in kcal/hr
so heat lost by water(-ve),Q=-25000 kcal/hr
there shall be no work interaction and change in kinetic energy,so,steady flow energy equation shall be,
Q+m*(h1+g*z1)=m*(h2+g*z2)
so water circulation rate(m)in kg/hr
so m=Q*10^3*4.18/(g*deltaz-(h1-h2)*10^3*4.18
water circulation rate=(m)in kg/min 11.91

example 3.11;pg no:81

In [16]:
#cal of steam suppling rate
#intiation of all variables
# Chapter 3
print"Example 3.11, Page:81  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 11")
v1=50;#velocity of steam entering injector in m/s
v2=25;#velocity of mixture leave injector in m/s
h1=720;#enthalpy of steam entering injector in kcal/kg
h2=24.6;#enthalpy of water entering injector in kcal/kg
h3=100;#enthalpy of steam leaving injector in kcal/kg
h4=100;#enthalpy of water leaving injector in kcal/kg
deltaz=2;#depth from axis of injector in m
q=12;#heat loss from injector to surrounding through injector
g=9.81;#acceleration due to gravity in m/s^2
print("let mass of steam to be supplied per kg of water lifted be(m) kg.applying law of energy conservation upon steam injector,for unit mass of water lifted")
print("energy with steam entering + energy with water entering = energy with mixture leaving + heat loss to surrounding")
print("m*(v1^2/2+h1*10^3*4.18)+h2*10^3*4.18+g*deltaz=(1+m)*(h3*10^3*4.18+v2^2/2)+m*q*10^3*4.18")
print("so steam suppling rate(m)in kg/s per kg of water")
m=((h3*10**3*4.18+v2**2/2)-(h2*10**3*4.18+g*deltaz))/((v1**2/2+h1*10**3*4.18)-(h3*10**3*4.18+v2**2/2)-(q*10**3*4.18))
print("m="),round(m,3)
print("NOTE=>here enthalpy of steam entering injector(h1)should be taken 720 kcal/kg instead of 72 kcal/kg otherwise the steam supplying rate comes wrong.")
Example 3.11, Page:81  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 11
let mass of steam to be supplied per kg of water lifted be(m) kg.applying law of energy conservation upon steam injector,for unit mass of water lifted
energy with steam entering + energy with water entering = energy with mixture leaving + heat loss to surrounding
m*(v1^2/2+h1*10^3*4.18)+h2*10^3*4.18+g*deltaz=(1+m)*(h3*10^3*4.18+v2^2/2)+m*q*10^3*4.18
so steam suppling rate(m)in kg/s per kg of water
m= 0.124
NOTE=>here enthalpy of steam entering injector(h1)should be taken 720 kcal/kg instead of 72 kcal/kg otherwise the steam supplying rate comes wrong.

example 3.12;pg no:82

In [17]:
#cal of  work done by atmosphere
#intiation of all variables
# Chapter 3
print"Example 3.12, Page:82  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 12")
p=1.013*10**5;#atmospheric pressure in pa
deltav=0.4;#change in volume in m^3
print("here let us assume that the pressure is always equal to atmospheric presure as ballon is flexible,inelastic and unstressed and no work is done for stretching ballon during its filling figure shows the boundary of system before and after filling ballon by firm line and dotted line respectively.")
print("displacement work, W=(p.dv)cylinder+(p.dv)ballon")
print("(p.dv)cylinder=0,as cylinder is rigid")
print("so work done by system upon atmosphere(W)in KJ, W=(p*deltav)/1000")
W=(p*deltav)/1000
print("and work done by atmosphere=KJ"),round(W,2)
Example 3.12, Page:82  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 12
here let us assume that the pressure is always equal to atmospheric presure as ballon is flexible,inelastic and unstressed and no work is done for stretching ballon during its filling figure shows the boundary of system before and after filling ballon by firm line and dotted line respectively.
displacement work, W=(p.dv)cylinder+(p.dv)ballon
(p.dv)cylinder=0,as cylinder is rigid
so work done by system upon atmosphere(W)in KJ, W=(p*deltav)/1000
and work done by atmosphere=KJ 40.52

example 3.13;pg no:82

In [18]:
#cal of capacity of generator
#intiation of all variables
# Chapter 3
print"Example 3.13, Page:82  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 13")
Qadd=5000;#heat supplied in boiler in J#s
Wt=.25*Qadd
print("work done by turbine(Wt)in J#s is 25% of heat added i.e"),
print("Wt="),round(Wt,2)
print("heat rejected by condensor(Qrejected)in J#s is 75% of head added i.e")
Qrejected=.75*Qadd
print("Qrejected="),round(Qrejected,2)
print("and feed water pump work(Wp)in J#s is 0.2% of heat added i.e")
Wp=0.002*Qadd
print("Wp=(-)"),round(Wp,2)
W=(Wt-Wp)/1000
print("capacity of generator(W)=in Kw"),round(W,2)
Example 3.13, Page:82  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 13
work done by turbine(Wt)in J#s is 25% of heat added i.e Wt= 1250.0
heat rejected by condensor(Qrejected)in J#s is 75% of head added i.e
Qrejected= 3750.0
and feed water pump work(Wp)in J#s is 0.2% of heat added i.e
Wp=(-) 10.0
capacity of generator(W)=in Kw 1.24

example 3.14;pg no:83

In [19]:
#cal of velocity at exit of nozzle
#intiation of all variables
# Chapter 3
import math
print"Example 3.14, Page:83  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 14")
T1=(27+273);##ambient temperature in K
T2=(750+273);##temperature of heated air inside heat exchanger in K
T3=(600+273);##temperature of hot air leaves turbine in K
T4=(500+273);##temperature at which air leaves nozzle in K
Cp=1.005;##specific heat at constant pressure in KJ#kg K
C2=50;##velocity of hot air enter into gas turbine in m#s
C3=60;##velocity of air leaving turbine enters a nozzle in m#s
print("in heat exchanger upon applying S.F.E.E with assumption of no change in kinetic energy,no work interaction,no change in potential energy,for unit mass flow rate of air,")
print("h1+Q1_2=h2")
print("Q1_2=h2-h1")
print("so heat transfer to air in heat exchanger(Q1_2)in KJ")
Q1_2=Cp*(T2-T1)
print("Q1_2="),round(Q1_2,2)
print("in gas turbine let us use S.F.E.E,assuming no change in potential energy,for unit mass flow rate of air")
print("h2+C2^2#2=h3+C3^2/2+Wt")
print("Wt=(h2-h3)+(C2^2-C3^2)/2")
print("so power output from turbine(Wt)in KJ#s")
Wt=Cp*(T2-T3)+(C2**2-C3**2)*10**-3/2
print("Wt="),round(Cp,2)
print("applying S.F.E.E upon nozzle assuming no change in potential energy,no work and heat interactions,for unit mass flow rate,")
print("h3+C=h4+C4^2/2")
print("C4^2#2=(h3-h4)+C3^2/2")
print("velocity at exit of nozzle(C4)in m#s")
C4=math.sqrt(2*(Cp*(T3-T4)+C3**2*10**-3/2))
print("C4="),round(C4,2)
Example 3.14, Page:83  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 14
in heat exchanger upon applying S.F.E.E with assumption of no change in kinetic energy,no work interaction,no change in potential energy,for unit mass flow rate of air,
h1+Q1_2=h2
Q1_2=h2-h1
so heat transfer to air in heat exchanger(Q1_2)in KJ
Q1_2= 726.61
in gas turbine let us use S.F.E.E,assuming no change in potential energy,for unit mass flow rate of air
h2+C2^2#2=h3+C3^2/2+Wt
Wt=(h2-h3)+(C2^2-C3^2)/2
so power output from turbine(Wt)in KJ#s
Wt= 1.0
applying S.F.E.E upon nozzle assuming no change in potential energy,no work and heat interactions,for unit mass flow rate,
h3+C=h4+C4^2/2
C4^2#2=(h3-h4)+C3^2/2
velocity at exit of nozzle(C4)in m#s
C4= 14.3

example 3.15;pg no:85

In [20]:
#cal of total work done by ai
#intiation of all variables
# Chapter 3
import math
print"Example 3.15, Page:85  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 15")
T1=400;##initial temperature of gas in K
R=8.314;##gas constant in 
print("for constant pressure heating,say state changes from 1 to 2")
print("Wa=p1*dv")
print("Wa=p1*(v2-v1)")
print("it is given that v2=2v1")
print("so Wa=p1*v1=R*T1")
print("for subsequent expansion at constant temperature say state from 2 to 3")
print("also given that v3/v1=6,v3/v2=3")
print("so work=Wb=p*dv")
print("on solving above we get Wb=R*T2*ln(v3#v2)=R*T2*log3")
print("temperature at 2 can be given by perfect gas consideration as,")
print("T2/T1=v2/v1")
print("or T2=2*T1")
print("now total work done by air W=Wa+Wb=R*T1+R*T2*log3=R*T1+2*R*T1*log3 in KJ")
W=R*T1+2*R*T1*math.log(3)
print("so W in KJ="),round(W,2)
Example 3.15, Page:85  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 15
for constant pressure heating,say state changes from 1 to 2
Wa=p1*dv
Wa=p1*(v2-v1)
it is given that v2=2v1
so Wa=p1*v1=R*T1
for subsequent expansion at constant temperature say state from 2 to 3
also given that v3/v1=6,v3/v2=3
so work=Wb=p*dv
on solving above we get Wb=R*T2*ln(v3#v2)=R*T2*log3
temperature at 2 can be given by perfect gas consideration as,
T2/T1=v2/v1
or T2=2*T1
now total work done by air W=Wa+Wb=R*T1+R*T2*log3=R*T1+2*R*T1*log3 in KJ
so W in KJ= 10632.69

example 3.16;pg no:85

In [21]:
#cal of work done by gas
#intiation of all variables
# Chapter 3
print"Example 3.16, Page:85  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 16")
Pi=0.5*10**6;##initial pressure of gas in pa
Vi=0.5;##initial volume of gas in m^3
Pf=1*10**6;##final pressure of gas in pa
print("NOTE=>this question contain derivation which cannot be solve using scilab so we use the result of derivation to proceed further ")
print("we get W=(Vf-Vi)*((Pi+Pf)/2)")
print("also final volume of gas in m^3 is Vf=3*Vi") 
Vf=3*Vi
W=(Vf-Vi)*((Pi+Pf)/2)
print("now work done by gas(W)in J"),round(W,2)
Example 3.16, Page:85  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 16
NOTE=>this question contain derivation which cannot be solve using scilab so we use the result of derivation to proceed further 
we get W=(Vf-Vi)*((Pi+Pf)/2)
also final volume of gas in m^3 is Vf=3*Vi
now work done by gas(W)in J 750000.0

example 3.17;pg no:87

In [22]:
#cal of 
#intiation of all variables
# Chapter 3
print"Example 3.17, Page:87  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 17")
Cp_H2=14.307;##specific heat of H2 at constant pressure in KJ#kg K
R_H2=4.1240;##gas constant for H2 in KJ#kg K
Cp_N2=1.039;##specific heat of N2 at constant pressure in KJ#kg K
R_N2=0.2968;##gas constant for N2 in KJ#kg K
T1=(27+273);##ambient temperature in K
v1=0.5;##initial volume of H2 in m^3
p1=0.5*10**6;##initial pressure of H2 in pa 
v2=0.25;##final volume of H2 in m^3 
p2=1.324*10**6;##final pressure of H2 in pa
print("with the heating of N2 it will get expanded while H2 gets compressed simultaneously.compression of H2 in insulated chamber may be considered of adiabatic type.")
print("adiabatic index of compression of H2 can be obtained as,")
print("Cp_H2=")
y_H2=Cp_H2/(Cp_H2-R_H2)
print("y_H2=Cp_H2/(Cp_H2-R_H2)"),round(y_H2,2)
print("adiabatic index of expansion for N2,Cp_N2=R_N2*(y_N2#(y_N2-1))")
y_N2=Cp_N2/(Cp_N2-R_N2)
print("y_N2="),round(y_N2,2)
print("i>for hydrogen,p1*v1^y=p2*v2^y")
print("so final pressure of H2(p2)in pa")
p2=p1*(v1/v2)**y_H2
print("p2="),round(p2,2)
print("ii>since partition remains in equlibrium throughout hence no work is done by partition.it is  a case similar to free expansion ")
print("partition work=0")
print("iii>work done upon H2(W_H2)in J,")
W_H2=(p1*v1-p2*v2)/(y_H2-1)
print("W_H2="),round(W_H2,2)
print("work done upon H2(W_H2)=-2*10^5 J")
W_N2=2*10**5;##work done by N2 in J
print("so work done by N2(W_N2)=2*10^5 J ")
print("iv>heat added to N2 can be obtained using  first law of thermodynamics as")
print("Q_N2=deltaU_N2+W_N2=>Q_N2=m*Cv_N2*(T2-T1)+W_N2")
print("final temperature of N2 can be obtained considering it as perfect gas")
print("therefore, T2=(p2*v2*T1)#(p1*v1)")
print("here p2=final pressure of N2 which will be equal to that of H2 as the partition is free and frictionless")
print("p2=1.324*10^6 pa,v2=0.75 m^3")
v2=0.75;##final volume of N2 in m^3
T2=(p2*v2*T1)/(p1*v1)
print("so now final temperature of N2(T2)in K="),round(T2,2)
T2=1191.6;##T2 approx. equal to 1191.6 K
m=(p1*v1)/(R_N2*1000*T1)
print("mass of N2(m)in kg="),round(m,2)
m=2.8;##m approx equal to 2.8 kg
Cv_N2=Cp_N2-R_N2
print("specific heat at constant volume(Cv_N2)in KJ/kg K,Cv_N2="),round(Cv_N2)
print("heat added to N2,(Q_N2)in KJ")
Q_N2=((m*Cv_N2*1000*(T2-T1))+W_N2)/1000
print("Q_N2="),round(Q_N2,2)
Example 3.17, Page:87  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 17
with the heating of N2 it will get expanded while H2 gets compressed simultaneously.compression of H2 in insulated chamber may be considered of adiabatic type.
adiabatic index of compression of H2 can be obtained as,
Cp_H2=
y_H2=Cp_H2/(Cp_H2-R_H2) 1.4
adiabatic index of expansion for N2,Cp_N2=R_N2*(y_N2#(y_N2-1))
y_N2= 1.4
i>for hydrogen,p1*v1^y=p2*v2^y
so final pressure of H2(p2)in pa
p2= 1324078.55
ii>since partition remains in equlibrium throughout hence no work is done by partition.it is  a case similar to free expansion 
partition work=0
iii>work done upon H2(W_H2)in J,
W_H2= -200054.06
work done upon H2(W_H2)=-2*10^5 J
so work done by N2(W_N2)=2*10^5 J 
iv>heat added to N2 can be obtained using  first law of thermodynamics as
Q_N2=deltaU_N2+W_N2=>Q_N2=m*Cv_N2*(T2-T1)+W_N2
final temperature of N2 can be obtained considering it as perfect gas
therefore, T2=(p2*v2*T1)#(p1*v1)
here p2=final pressure of N2 which will be equal to that of H2 as the partition is free and frictionless
p2=1.324*10^6 pa,v2=0.75 m^3
so now final temperature of N2(T2)in K= 1191.67
mass of N2(m)in kg= 2.81
specific heat at constant volume(Cv_N2)in KJ/kg K,Cv_N2= 1.0
heat added to N2,(Q_N2)in KJ
Q_N2= 2052.89

example 3.18;pg no:88

In [23]:
#cal of amount of work available
#intiation of all variables
# Chapter 3
print"Example 3.18, Page:88  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 18")
p1=0.5*10**6;#initial pressure of air in pa
p2=1.013*10**5;#atmospheric pressure in pa
v1=2;#initial volume of air in m^3
v2=v1;#final volume of air in m^3
T1=375;#initial temperature of air in K
Cp_air=1.003;#specific heat at consatnt pressure in KJ/kg K
Cv_air=0.716;#specific heat at consatnt volume in KJ/kg K
R_air=0.287;#gas constant in KJ/kg K
y=1.4;#expansion constant for air
print("let initial states and final states of air inside cylinder be given by m1,p1,v1,,T1 and m2,p2,v2,T2 respectively.it is case of emptying of cylinder")
print("initial mass of air(m1)in kg")
m1=(p1*v1)/(R_air*1000*T1)
print("m1="),round(m1,2)
print("for adiabatic expansion during release of air through valve from 0.5 Mpa to atmospheric pressure")
T2=T1*(p2/p1)**((y-1)/y)
print("T2=in K"),round(T2,2)
print("final mass of air left in tank(m2)in kg")
m2=(p2*v2)/(R_air*1000*T2)
print("m2="),round(m2,2)
print("writing down energy equation for unsteady flow system")
print("(m1-m2)*(h2+C^2/2)=(m1*u1-m2*u2)")
print("or (m1-m2)*C^2/2=(m1*u1-m2*u2)-(m1-m2)*h2")
print("kinetic energy available for running turbine(W)in KJ")
print("W=(m1*u1-m2*u2)-(m1-m2)*h2=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2")
print("W=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2")
W=((m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2)/1000
print("amount of work available=KJ"),round(W,2)
Example 3.18, Page:88  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 18
let initial states and final states of air inside cylinder be given by m1,p1,v1,,T1 and m2,p2,v2,T2 respectively.it is case of emptying of cylinder
initial mass of air(m1)in kg
m1= 9.29
for adiabatic expansion during release of air through valve from 0.5 Mpa to atmospheric pressure
T2=in K 237.64
final mass of air left in tank(m2)in kg
m2= 2.97
writing down energy equation for unsteady flow system
(m1-m2)*(h2+C^2/2)=(m1*u1-m2*u2)
or (m1-m2)*C^2/2=(m1*u1-m2*u2)-(m1-m2)*h2
kinetic energy available for running turbine(W)in KJ
W=(m1*u1-m2*u2)-(m1-m2)*h2=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2
W=(m1*Cv_air*1000*T1-m2*Cv_air*1000*T2)-(m1-m2)*Cp_air*1000*T2
amount of work available=KJ 482.67

example 3.19;pg no:89

In [24]:
#cal of final pressure and temperature
#intiation of all variables
# Chapter 3
print"Example 3.19, Page:89  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 19")
p1=0.5*10**6;#initial pressure of air in pa
v1=0.5;#initial volume of air in m^3
T1=(27+273);#initial temperature of air in K
p2=1*10**6;#final pressure of air in pa
v2=0.5;#final volume of air in m^3
T2=500;#final temperature of air in K
R=8314;#gas constant in J/kg K
Cv=0.716;#specific heat at constant volume in KJ/kg K
print("using perfect gas equation for the two chambers having initial states  as 1 and 2 and final states as 3")
n1=(p1*v1)/(R*T1)
print("n1="),round(n1,2)
n2=(p2*v2)/(R*T2)
print("now n2="),round(n2,2)
print("for tank being insulated and rigid we can assume,deltaU=0,W=0,Q=0,so writing deltaU,")
deltaU=0;#change in internal energy
print("deltaU=n1*Cv*(T3-T1)+n2*Cv*(T3-T2)")
print("final temperature of gas(T3)in K")
T3=(deltaU+Cv*(n1*T1+n2*T2))/(Cv*(n1+n2))
print("T3="),round(T3,2)
print("using perfect gas equation for final mixture,")
print("final pressure of gas(p3)in Mpa")
p3=((n1+n2)*R*T3)/(v1+v2)
print("p3="),round(p3,3)
print("so final pressure and temperature =0.75 Mpa and 409.11 K")
Example 3.19, Page:89  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 19
using perfect gas equation for the two chambers having initial states  as 1 and 2 and final states as 3
n1= 0.1
now n2= 0.12
for tank being insulated and rigid we can assume,deltaU=0,W=0,Q=0,so writing deltaU,
deltaU=n1*Cv*(T3-T1)+n2*Cv*(T3-T2)
final temperature of gas(T3)in K
T3= 409.09
using perfect gas equation for final mixture,
final pressure of gas(p3)in Mpa
p3= 750000.0
so final pressure and temperature =0.75 Mpa and 409.11 K

example 3.20;pg no:90

In [25]:
#cal of heat transfer
#intiation of all variables
# Chapter 3
print"Example 3.20, Page:90  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 20")
v1=0;#initial volume of air inside bottle in m^3
v2=0.5;#final volume of air inside bottle in m^3
p=1.0135*10**5;#atmospheric pressure in pa
W=p*(v1-v2)
print("printlacement work,W=p*(v1-v2)in N.m"),round(W,2)
print("so heat transfer(Q)in N.m")
Q=-W
print("Q=-W"),round(Q,2)
Example 3.20, Page:90  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 20
printlacement work,W=p*(v1-v2)in N.m -50675.0
so heat transfer(Q)in N.m
Q=-W 50675.0

example 3.21;pg no:90

In [26]:
#cal of time duration for which turbogenerator can be run
#intiation of all variables
# Chapter 3
print"Example 3.21, Page:90  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 21")
p1=35.*10**5;#initial pressure of air in pa
v1=0.3;#initial volume of air in m^3
T1=(313.);#initial temperature of air in K
p2=1.*10**5;#final pressure of air in pa
v2=0.3;#final volume of air in m^3
y=1.4;#expansion constant
R=0.287;#gas constant in KJ/kg K
Cv=0.718;#specific heat at constant volume in KJ/kg K
Cp=1.005;#specific heat at constant pressure in KJ/kg K
print("here turbogenerator is fed with compressed air from a compressed air bottle.pressure inside bottle gradually decreases from 35 bar to 1 bar.expansion from 35 bar to 1 bar occurs isentropically.thus,for the initial and final states of pressure,volume,temperatureand mass inside bottle being given as p1,v1,T1 & m1 and p2,v2,T2 & m2 respectively.it is transient flow process similar to emptying of the bottle.")
print("(p2/p1)^((y-1)/y)=(T2/T1)")
print("final temperature of air(T2)in K")
T2=T1*(p2/p1)**((y-1)/y)
print("T2="),round(T2,2)
print("by perfect gas law,initial mass in bottle(m1)in kg")
m1=(p1*v1)/(R*1000.*T1)
print("m1="),round(m1,2)
print("final mass in bottle(m2)in kg")
m2=(p2*v2)/(R*1000.*T2)
print("m2="),round(m2,2)
print("energy available for running turbo generator or work(W)in KJ")
print("W+(m1-m2)*h2=m1*u1-m2*u2")
W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2
print("W="),round(W,2)
print("this is maximum work that can be had from the emptying of compresssed air bottle between given pressure limits")
print("turbogenerator actual output(P1)=5 KJ/s")
P1=5;#turbogenerator actual output in KJ/s
print("input to turbogenerator(P2)in KJ/s")
P2=P1/0.6
print("time duration for which turbogenerator can be run(deltat)in seconds")
deltat=W/P2
print("deltat="),round(deltat,2)
print("duration=160 seconds approx.")
Example 3.21, Page:90  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 21
here turbogenerator is fed with compressed air from a compressed air bottle.pressure inside bottle gradually decreases from 35 bar to 1 bar.expansion from 35 bar to 1 bar occurs isentropically.thus,for the initial and final states of pressure,volume,temperatureand mass inside bottle being given as p1,v1,T1 & m1 and p2,v2,T2 & m2 respectively.it is transient flow process similar to emptying of the bottle.
(p2/p1)^((y-1)/y)=(T2/T1)
final temperature of air(T2)in K
T2= 113.34
by perfect gas law,initial mass in bottle(m1)in kg
m1= 11.69
final mass in bottle(m2)in kg
m2= 0.92
energy available for running turbo generator or work(W)in KJ
W+(m1-m2)*h2=m1*u1-m2*u2
W= 1325.42
this is maximum work that can be had from the emptying of compresssed air bottle between given pressure limits
turbogenerator actual output(P1)=5 KJ/s
input to turbogenerator(P2)in KJ/s
time duration for which turbogenerator can be run(deltat)in seconds
deltat= 159.05
duration=160 seconds approx.

example 3.22;pg no:91

In [27]:
#cal of network,heat transferred from system
#intiation of all variables
# Chapter 3
import math
print"Example 3.22, Page:91  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 22")
p1=1.5*10**5;#initial pressure of air in pa
T1=(77+273);#initial temperature of air in K
p2=7.5*10**5;#final pressure of air in pa
n=1.2;#expansion constant for process 1-2
R=0.287;#gas constant in KJ/kg K
m=3.;#mass of air in kg
print("different states as described in the problem are denoted as 1,2and 3 and shown on p-V diagram")
print("process 1-2 is polytropic process with index 1.2")
print("(T2/T1)=(p2/p1)^((n-1)/n)")
print("final temperature of air(T2)in K")
T2=T1*((p2/p1)**((n-1)/n))
print("T2="),round(T2,2)
print("at state 1,p1*v1=m*R*T1")
print("initial volume of air(v1)in m^3")
v1=(m*R*1000*T1)/p1
print("v1="),round(v1,2)
print("final volume of air(v2)in m^3")
v2=((p1*v1**n)/p2)**(1/n)
print("for process 1-2,v2="),round(v2,2)
print("for process 2-3 is constant pressure process so p2*v2/T2=p3*v3/T3")
print("v3=v2*T3/T2 in m^3")
print("here process 3-1 is isothermal process so T1=T3")
T3=T1;#process 3-1 is isothermal
v3=v2*T3/T2
print("during process 1-2 the compression work(W1_2)in KJ")
print("W1_2=(m*R*(T2-T1)/(1-n))")
W1_2=(m*R*(T2-T1)/(1-n))
print("work during process 2-3(W2_3)in KJ,")
print("W2_3=p2*(v3-v2)/1000")
W2_3=p2*(v3-v2)/1000
print("work during process 3-1(W3_1)in KJ")
p3=p2;#pressure is constant for process 2-3
W3_1=p3*v3*math.log(v1/v3)/1000
print("W3_1="),round(W3_1,2)
print("net work done(W_net)in KJ")
W_net=W1_2+W2_3+W3_1
print("W_net=W1_2+W2_3+W3_1"),round(W_net,2)
print("net work=-71.27 KJ")
print("here -ve workshows work done upon the system.since it is cycle,so")
print("W_net=Q_net")
print("phi dW=phi dQ=-71.27 KJ")
print("heat transferred from system=71.27 KJ")
Example 3.22, Page:91  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 22
different states as described in the problem are denoted as 1,2and 3 and shown on p-V diagram
process 1-2 is polytropic process with index 1.2
(T2/T1)=(p2/p1)^((n-1)/n)
final temperature of air(T2)in K
T2= 457.68
at state 1,p1*v1=m*R*T1
initial volume of air(v1)in m^3
v1= 2.01
final volume of air(v2)in m^3
for process 1-2,v2= 0.53
for process 2-3 is constant pressure process so p2*v2/T2=p3*v3/T3
v3=v2*T3/T2 in m^3
here process 3-1 is isothermal process so T1=T3
during process 1-2 the compression work(W1_2)in KJ
W1_2=(m*R*(T2-T1)/(1-n))
work during process 2-3(W2_3)in KJ,
W2_3=p2*(v3-v2)/1000
work during process 3-1(W3_1)in KJ
W3_1= 485.0
net work done(W_net)in KJ
W_net=W1_2+W2_3+W3_1 -71.28
net work=-71.27 KJ
here -ve workshows work done upon the system.since it is cycle,so
W_net=Q_net
phi dW=phi dQ=-71.27 KJ
heat transferred from system=71.27 KJ

example 3.23;pg no:93

In [28]:
#cal of work available from turbine
#intiation of all variables
# Chapter 3
print"Example 3.23, Page:93  \n \n"
print("Engineering Thermodynamics by Onkar Singh Chapter 3 Example 23")
Cp=1.005;#specific heat at constant pressure in KJ/kg K
Cv=0.718;#specific heat at constant volume in KJ/kg K
y=1.4;#expansion constant 
p1=40*10**5;#initial temperature of air in pa
v1=0.15;#initial volume of air in m^3
T1=(27+273);#initial temperature of air in K
p2=2*10**5;#final temperature of air in pa
v2=0.15;#final volume of air in m^3
R=0.287;#gas constant in KJ/kg K
print("initial mass of air in bottle(m1)in kg ")
m1=(p1*v1)/(R*1000*T1)
print("m1="),round(m1,2)
print("now final temperature(T2)in K")
T2=T1*(p2/p1)**((y-1)/y)
print("T2="),round(T2,2)
T2=127.36;#take T2=127.36 approx.
print("final mass of air in bottle(m2)in kg")
m2=(p2*v2)/(R*1000*T2)
print("m2="),round(m2,2)
m2=0.821;#take m2=0.821 approx.
print("energy available for running of turbine due to emptying of bottle(W)in KJ")
W=(m1*Cv*T1-m2*Cv*T2)-(m1-m2)*Cp*T2
print("W="),round(W,2)
print("work available from turbine=639.27KJ")
Example 3.23, Page:93  
 

Engineering Thermodynamics by Onkar Singh Chapter 3 Example 23
initial mass of air in bottle(m1)in kg 
m1= 6.97
now final temperature(T2)in K
T2= 0.0
final mass of air in bottle(m2)in kg
m2= 0.82
energy available for running of turbine due to emptying of bottle(W)in KJ
W= 639.09
work available from turbine=639.27KJ