# Chapter 2:First Law of Thermodynamics¶

## Example 2.1 Page No.90¶

In [1]:
h1=60		#The heat transfer in the process in kJ
h2=-8		#The heat transfer in the process in kJ
h3=-34		#The heat transfer in the process in kJ
h4=6		#The heat transfer in the process in kJ

#Calculations
Q=h1+h2+h3+h4		#Net work transfer in a cycle in kJ

#Output
print'Net work transfer in a cycle is',round(Q,2),"KJ"

Net work transfer in a cycle is 24.0 KJ


## Example 2.2 Page No. 90¶

In [2]:
Q=-300		#Heat transfer in the system consisting of the gas in kJ
u=0		#Internal energy is constant

#Calculations
W=Q-u		#Work done of the system in kJ

#Output
print'The work done of the system W = %3.0f kJ ',round(W,1),"KJ"

The work done of the system W = %3.0f kJ  -300.0 KJ


## Example 2.3 Page No. 90¶

In [4]:
v1=1.5		#Initial volume of the process in m**3
v2=4.5		#Final volume of the process in m**3
Q=2000		#Amount of heat added in kJ

#Calculations
W=100*((3.5*math.log(v2/v1))+(3*(v2-v1)))	#Amount of work done in kJ
U=Q-W					#The change in internal energy in kJ

#Output
print'The change in internal energy is',round(U,2),"KJ"

The change in internal energy is 715.49 KJ


## Example 2.4 Page No.91¶

In [6]:
h1=35		#Enthalpy of water entering the boiler in kJ/kg
h2=705		#Enthalpy of steam leaving the boiler in kJ/kg
C=0		#Change in kinetic energy is neglected
Z=0		#Change in potential energy is neglected

#Calculations
q=h2-h1		#The heat transfer per kg of steam in kJ/kg

#Output
print'The heat transfer per kg of steam is',round(q,1),"kJ/kg"

The heat transfer per kg of steam is 670.0 kJ/kg


## Example 2.5 Page No. 92¶

In [8]:
Q=-170		#Sum of all heat transfers per cycle in kJ
N=100		#Total number of cycles per min in cycles/min
Q1=0		#Heat developed in a-b process in kJ/min
Q2=21000		#Heat developed in b-c process in kJ/min
Q3=-2100		#Heat developed in c-d process in kJ/min
W1=2170		#Work done in the process a-b in kJ/min
W2=0		#Work done in the b-c process in kJ/min
E3=-36600	#Change in energy in the process in kJ/min

#Calculations
E1=Q1-W1		#Change in energy in process a-b in kJ/min
E2=Q2-W2		#Change in energy in b-c process in kJ/min
W3=Q3-E3		#Work done in the c-d process in kJ/min
Qt=Q*N			#Total heat transfer per min in kJ/min
Q4=Qt-Q1-Q2-Q3		#Heat developed in the process d-a in kJ/min
Et=0			#Total change in energy of the cycle
E4=Et-E1-E2-E3		#Energy in the process d-a in kJ/min
W4=Q4-E4		#Work done in the d-a process in kJ/min
Wn=Qt/60.0		#Net rate of work output in kW

#Output
print'(a)Change in energy in a-b process is',round(E1,2),"kJ/min"
print'(b)Change in energy in b-c process is',round(E2,2),"kJ/min"
print'(c)Work done in the c-d process is',round(W3,2),"kJ/min"
print'(d)Heat developed in the process d-a is',round(Q4,2),"kJ/min"
print'(e)Energy in the process d-a is',round(E4,2),"kJ/min"
print'(f)Work done in the d-a process is',round(W4,2),"kJ/min"
print'(g)Net rate of work output is',round(Wn,2),"kW"

(a)Change in energy in a-b process is -2170.0 kJ/min
(b)Change in energy in b-c process is 21000.0 kJ/min
(c)Work done in the c-d process is 34500.0 kJ/min
(d)Heat developed in the process d-a is -35900.0 kJ/min
(e)Energy in the process d-a is 17770.0 kJ/min
(f)Work done in the d-a process is -53670.0 kJ/min
(g)Net rate of work output is -283.33 kW


## Example 2.6 Page No. 93¶

In [9]:
Q1=50		#Heat developed in the 1-2 process in kJ/kg
U1=20		#Change in energy in the 1-2 process in kJ/kg
Q2=-30		#Heat developed in the 2-3 process in kJ/kg
W2=-40		#Work done in the 2-3 process in kj/kg
U3=-30		#Change in energy in the 3-1 process in kJ/kg
Wt=30		#Net work done per kg of fluid in kJ/kg
m=0.1		#Mass of fluid in the cycle in kg
N=10		#Number of cycles per sec in cycles/sec

#Calculations
W1=Q1-U1	#Work done in the 1-2 process in kJ/kg
U2=Q2-W2	#Change in energy in the 2-3 process in kJ/kg
W3=Wt-W1-W2	#Work done in the 3-1 process in kJ/kg
Q3=W3+U3	#Heat developed in the process in kJ/kg
m1=m*N		#mass flow rate per sec in kg/sec
P=Wt*m1		#Rate of power in kW

#Output
print'(a)Work done in the 1-2 process is',round(W1,1),"kJ/kg"
print'(b)Change in energy in the 2-3 process is',round(U2,1),"kJ/kg"
print'(c)Work done in the 3-1 process is',round(W3,1),"kJ/kg"
print'(d)Heat developed in the processis',round(Q3,1),"kJ/kg"
print'(e)mass flow rate per sec ',round(m1,1), "kg/sec "
print'(f)Rate of power is',round(P,2),"kW"

(a)Work done in the 1-2 process is 30.0 kJ/kg
(b)Change in energy in the 2-3 process is 10.0 kJ/kg
(c)Work done in the 3-1 process is 40.0 kJ/kg
(d)Heat developed in the processis 10.0 kJ/kg
(e)mass flow rate per sec  1.0 kg/sec
(f)Rate of power is 30.0 kW


## Example 2.7 Page No. 94¶

In [3]:
m=3.0		#Mass of substance in the system in kg
P1=500.0		#Initial pressure of the system in kPa
P2=100.0		#Final pressure of the system in kPa
V1=0.22		#Initial volume of the system in m**3
n=1.2		#Polytropic index
Q1=30.0		#Heat transfer for the another process

#Calculations
V2=V1*(P1/P2)**(1/1.2)	#Final volume of the system in m**3
U=3.56*(P2*V2-P1*V1)	#Total change in internal energy in kJ
W1=(P2*V2-P1*V1)/(1-n)	#Work done for the 1-2 process in kJ
Q=U+W1			#Heat developed in the process in kJ
W2=Q1-U		#Work done for the another process in kJ

#Output
print'(a)Total change in internal energy is',round(U,0), "kJ"
print'(b)Work done for the 1-2 process is',round(W1,2), "kJ"
print'(c)Heat developed in the process is',round(Q,0), "kJ"
print'(d)Work done for the another process is',round(W2,0), "kJ"

(a)Total change in internal energy is -92.0 kJ
(b)Work done for the 1-2 process is 129.4 kJ
(c)Heat developed in the process is 37.0 kJ
(d)Work done for the another process is 122.0 kJ


## Example 2.8 Page No. 96¶

In [7]:
m=5		#Mass of the substance in the system in kg
P1=500		#Initial pressure of the system in kPa
P2=100		#Final pressure of the system in kPa
V1=0.22		#Initial volume of the system in m**3
n=1.2		#Polytropic index

#Calculations
V2=V1*(P1/P2)**(1/1.2)	#Final volume of the system in m**3
U=3.5*(P2*V2-P1*V1)	#Change in the internal energy of the system in kJ
W=(P1*V1-P2*V2)/(n-1)	#Work developed in the process in kJ
Q=U+W			#Heat transfer in the process in kJ

#Output
print'Total change in Internal Energy is',round(U,0),"KJ"
print'Non flow work in the process is',round(W,2),"KJ"
print'Heat transfer of the process is',round(Q,0),"KJ"

Total change in Internal Energy is -91.0 KJ
Non flow work in the process is 129.4 KJ
Heat transfer of the process is 39.0 KJ


## Example 2.9 Page No. 97¶

In [30]:
p1=170		#Initial pressure of the fluid in kPa
p2=400		#Final pressure of the fluid in kPa
v1=0.03		#Initial volume in m**3
v2=0.06		#Final volume in m**3

#Calculations
dU=3.15*((p2*v2)-(p1*v1))	#The change in internal energy of the fluid in kJ
#P=a+b*V     #Given relation
A = array([[1,v1],
[1,v2]])
b = array([p1,p2])
X = solve(A, b)
W=(X[0]*(v2-v1))+(X[1]*((v2**2-v1**2)/2.0))	#The work done during the process in kJ
Q=U+W		#The heat transfer in kJ

#Output
print'(a)The direction and magnitude of work is',round(W,2),"KJ"
print'(b)The direction and magnitude of heat transfer is',round(Q,2),"KJ"

(a)The direction and magnitude of work is 8.55 KJ
(b)The direction and magnitude of heat transfer is 68.08 KJ


## Example 2.11 Page No. 99¶

In [8]:
E1=4000		#Enthalpy at entrance in kJ/Kg
E2=4100		#Enthalpy at exit in kJ/kg
V1=50		#Velocity at entrance in m/s
V2=20		#Velocity at exit in m/s
h1=50		#Height at the entrance
h2=10		#Height at the exit
m=1		#mass flow rate to the system in kJ/s
Q=200		#Heat transfer rate to the system in kJ/s
g=9.8		#Gravitational constant in m/s**2

#Calculations
P=m*(((V1**2-V2**2)/(2000.0))+(g*(h2-h1)/1000.0)+(E1-E2))+Q
print'Power capacity of the system ',round(P,0),"KW"

Power capacity of the system  101.0 KW


## Example 2.12 Page No. 101¶

In [9]:
W=135		#Work done by the system in kJ/kg
V1=0.37		#Specific volume of fluid at inlet in m**3/kg
V2=0.62		#Specific volume of fluid at outlet in m**3/kg
P1=600		#Pressure at the inlet in kPa
P2=100		#Pressure at the outlet in kPa
C1=16		#Velocity at the inlet in m/s
C2=270		#Velocity at the outlet in m/s
Z1=32		#Inlet height from floor level in m
Z2=0		#Outlet height from floor level in m
q=-9		#Heat loss between inlet and discharge in kJ/kg
g=9.81		#Gravitational constant in m/s**2

#Calculations
U=((C2**2-C1**2)/2000.0)+(g*(Z2-Z1))/1000.0+(P2*V2-P1*V1)+W-q

#Output
print'Specific Internal Energy decreases by ',round(U,2),"kJ/kg"

Specific Internal Energy decreases by  20.01 kJ/kg


## Example 2.13 Page No. 102¶

In [16]:
m=5		#Rate of fluid flow in the system in kg/s
P1=620		#Pressure at the entrance in kPa
P2=130		#Pressure at the exit in kPa
C1=300		#Velocity at the entrance in m/s
C2=150		#Velocity at the exit in m/s
U1=2100		#Internal energy at the entrance in kJ/kg
U2=1500		#Internal energy at the exit in kJ/kg
V1=0.37		#Specific volume at entrance in m**3/kg
V2=1.2		#Specific volume at exit in m**3/kg
Q=-30		#Heat loss in the system during flow in kJ/kg
Z=0		#Change in potential energy is neglected in m
g=9.81		#Gravitational constant in m/s**2

#Calculations
W=((C1**2-C2**2)/(2*1000))+(g*Z)+(U1-U2)+(P1*V1-P2*V2)+Q
P=W*m#Power capacity of the system in kW

#Output
print'(a)Total work done in the system ',round(W,1),"kJ/kg"
print'(b)Power capacity of the system',round(P,1),"KW"

 (a)Total work done in the system  676.4 kJ/kg
(b)Power capacity of the system 3382.0 KW


## Example 2.14 Page No. 103¶

In [11]:
P1=100		#Pressure at Inlet in kPa
P2=500		#Pressure at Exit in kPa
V1=0.6		#Specific volume at Inlet in m**3/kg
V2=0.15		#Specific volume at Exit in m**3/kg
U1=50		#Specific internal energy at inlet in kJ/kg
U2=125		#Specific internal energy at Exit in kJ/kg
C1=8		#Velocity of air at Inlet in m/s
C2=4		#Velocity of air at Exit in m/s
m=5		#Mass flow rate of air in kg/s
Q=-45		#Heat rejected to cooling water in kW
Z=0		#Change in potential energy is neglected in m
g=9.81		#Gravitational constant in m/s**2

#Calculations
P=m*(((C1**2-C2**2)/(2*1000.0))+(g*Z)+(U1-U2)+(P1*V1-P2*V2))+Q
P1=-P

#Output
print'The power required to drive the compressor',round(-P1,2),"kW"

The power required to drive the compressor -494.88 kW


## Example 2.15 Page No. 104¶

In [19]:
m1=5000		#Steam flow rate in kg/hr
Q1=-250		#Heat loss from the turbine insulation to surroundings in kj/min
C1=40	  	#Velocity of steam at entrance in m/s
h1=2500		#Enthalpy of the steam at entrance in kJ/kg
C2=90		  #Velocity of the steam at the Exit in m/s
h2=2030		#Enthalpy of the steam at exit in kj/kg
Z=0		    #Change in potential energy is neglected in m
g=9.81		#Gravitational constant in m/s**2

#Calculations
m=m1/3600.0	  #Steam flow rate in kg/s
Q=Q1/60.0		#Heat loss from the turbine to the surroundings
P=m*(((C1**2-C2**2)/(2*1000))+(g*Z)+(h1-h2))+Q

#Output
print'The power developed by the turbine is',round(P,1),"KW"

The power developed by the turbine is 643.1 KW


## Example 2.16 Page No. 105¶

In [11]:
c1=16		#Velocity of steam at entrance in m/s
c2=37		#Velocity of steam at exit in m/s
h1=2990		#Specific enthalpy of steam at entrance in kJ/kg
h2=2530		#Specific enthalpy of steam at exit in kJ/kg
Q=-25		#Heat lost to the surroundings in kJ/kg
m1=360000	#The steam flow rate in kg/hr

#Calculations
m=m1/3600.0  #The steam flow rate in kg/s
W=(c1**2-c2**2)/2000.0+(h1-h2)+Q	#Total work done in the system in kJ/kg
P=m*W					                 #Power developed by the turbine in kW

#Output
print'The work output from the turbine is',round(P,1),"kW "
print'NOTE: In the book there is Calculation mistake'

The work output from the turbine is 43444.3 kW
NOTE: In the book there is Calculation mistake


## Example 2.17 Page No.106¶

In [16]:
p1=720		#Pressure at the entrance in kPa
t1=850		#Temperature at the entrance in degree centigrade
c1=160		#Velocity of the gas at entrance in m/s
P2=115		#Pressure at the exit in kPa
t2=450		#Temperature at the exit in degree centigrade
c2=250		#Velocity of the gas at exit in m/s
cp=1.04		#Specific heat of gas at constant pressure in kJ/kg-K

#Calculations
H=cp*(t1-t2)			#Change in Enthalpy of the gas at entrance and exit in kJ/kg
W=((c1**2-c2**2)/(2*1000))+(H)	#External work output of the turbine in kJ/kg

#Output
print'The external work output of the turbine is',round(W,0),"kJ/kg"

The external work output of the turbine is 397.0 kJ/kg


## Example 2.18 Page No. 107¶

In [23]:
p=5000		#Power output of an adiabatic steam turbine in kW
p1=2000		#Pressure at the inlet in kPa
p2=0.15		#Pressure at the exit in bar
t1=400		#temperature at the inlet in degree centigrade
x=0.9		#Dryness at the exit
c1=50		#Velocity at the inlet in m/s
c2=180		#Velocity at the exit in m/s
z1=10		#Elevation at inlet in m
z2=6		#Elevation at exit in m
h1=3248.7		#Enthalpy at the inlet from the steam table corresponding to and 20 bar in kJ/kg
hf=226		#Enthalpy at exit at 0.15 bar from steam tables in kJ/kg
hfg=2373.2	#Enthalpy at exit at 0.15 bar from steam tables in kJ/kg
g=9.81		#Gravitational constant in m/s**2

#Calculations
h2=hf+(x*hfg)  #Enthalpy at the exit in kJ/kg
W=(h1-h2)+((c1**2-c2**2)/(2*1000))+((g*(z1-z2))/1000.0)
m=p/W

#Output
print'(a)The work done per unit mass of the steam flowing through turbine is',round(W,1),"kJ/kg"
print'(b)The mass flow rate of the steam is',round(m,1),"kg/s"

(a)The work done per unit mass of the steam flowing through turbine is 871.9 kJ/kg
(b)The mass flow rate of the steam is 5.7 kg/s


## Example 2.19 Page No. 108¶

In [24]:
p1=1000.0		#Pressure at the inlet in kPa
t1=750.0		#Temperature at the inlet in K
c1=200.0		#Velocity at the inlet in m/s
p2=125.0		#Pressure at the exit in kPa
c2=40.0		 #Velocity at the exit in m/s
m1=1000.0		#Mass flow rate of air in kg/hr
cp=1.053		#Specific heat at constant pressure in kJ/kgK

#Calculations
m=m1/3600.0	#The mass flow rate of air in kg/s
P=p2/p1		#Ratio of the pressure
t2=t1*((p2/p1)**((k-1)/k))	#Temperature of air at exit in K
h=cp*(t2-t1)		#Change in enthalpy of the system in kJ
p=m*(((c2**2-c1**2)/(2*1000))+h)	#Power output of the turbine in kW
p1=-p			#Power output of the turbine in kW

#Output
print'(a)Temperature of air at exit is',round(t2,2)," K "
print'(b)The power output of the turbine is',round(p1,1),"kW"

(a)Temperature of air at exit is 425.37  K
(b)The power output of the turbine is 100.3 kW


## Example 2.20 Page No. 110¶

In [20]:
c1=7		   #Velocity of air at entrance in m/s
c2=5		   #Velocity of air at exit in m/s
p1=100		 #Pressure at the entrance in kPa
p2=700		 #Pressure at the exit in kPa
v1=0.95		#Specific volume at entrance in m**3/kg
v2=0.19		#Specific volume at exit in m**3/kg
u=90		   #  Change in internal energy of the air entering and leaving in kJ/kg
z=0		    #Potential energy is neglected
Q=-58		  #Heat rejected to the surroundings in kW
m=0.5		  #The rate at which air flow in kg/s
g=9.81		 #Gravitational constant in m/s**2

#Calculations
P=m*(((c1**2-c2**2)/(2000.0))+(p1*v1-p2*v2)-u)+(Q)
A=(v1*c2)/(v2*c1)	#From continuity equation the ratio of areas
D=A**(1/2.0)	       #The ratio of inlet pipe diameter to the outlet pipe diameter

#Output
print'(a)The rate of work input to the air is ',round(P,2),"kW"
print'(b)The ratio of inlet pipe diameter to the outlet pipe diameter is ',round(D,2)

(a)The rate of work input to the air is  -121.99 kW
(b)The ratio of inlet pipe diameter to the outlet pipe diameter is  1.89


## Example 2.21 Page No. 112¶

In [21]:
h1=3000		#Enthalpy of the fluid passing at inlet in kJ/kg
h2=2757		#Enthalpy of the fluid at the discharge in kJ/kg
c1=60		#Velocity of the fluid at inlet in m/s
A1=0.1		#Inlet area of the nozzle in m**2
v1=0.187		#Specific volume at inlet in m**3/kg
v2=0.498		#Specific volume at the outlet in m**3/kg
q=0		#Heat loss during the flow is negligable
z=0		#The nozzle is horizontal so change in PE is constant
w=0		#The work done is also negligable

#Calculations
c2=(2*1000*((h1-h2)+(c1**2/2000.0)))**(1/2.0)	#Velocity at the exit in m/s
m=(A1*c1)/v1				#The mass flow rate in kg/s
A2=(m*v2)/c2				#Area at the exit of the nozzle in m**3

#Output
print'(a)The velocity at the exit is',round(c2,1),"m/s"
print'(b)The mass flow rateis',round(m,1),"kg/s"
print'(c)Area at the exit is',round(A2,3),"m**2"

(a)The velocity at the exit is 699.7 m/s
(b)The mass flow rateis 32.1 kg/s
(c)Area at the exit is 0.023 m**2


## Example 2.22 Page No. 113¶

In [25]:
h1=3000		#Specific enthalpy of steam at inlet in kJ/kg
h2=2762		#Specific enthalpy of steam at the outlet in kJ/kg
v1=0.187		#Specific volume of steam at inlet in m**3/kg
v2=0.498		#Specific volume of steam at the outlet in m**3/kg
A1=0.1		#Area at the inlet in m**2
q=0		#There is no heat loss
z=0		#The nozzle is horizontal ,so no change in PE
c1=60		#Velocity of the steam at the inlet in m/s

#Calculations
c2=((2*1000)*((h1-h2)+(c1**2/2000.0)))**(1/2.0)	#Velocity of the steam at the outlet in m/s
m=(A1*c1)/v1				#Mass flow rate of steam in kg/s
A2=(m*v2)/c2				#Area at the nozzle exit in m**2

#Output
print'(a)Velocity of the steam at the outlet is ',round(c2,2), "m/s "
print'(b)Mass flow rate of steam is ',round(m,2),"kg/s "
print'(c)Area at the nozzle exit is',round(A2,3),"m**2"

(a)Velocity of the steam at the outlet is  692.53 m/s
(b)Mass flow rate of steam is  32.09 kg/s
(c)Area at the nozzle exit is 0.023 m**2


## Example 2.23 Page No. 114¶

In [32]:
c1=40		#Velocity of air at the inlet of nozzle in m/s
h=180		#The decrease in enthalpy in the nozzle in kJ/kg

#Calculations
c2=((2*1000)*((h)+(c1**2/(2*1000))))**(1/2.0)	#The exit velocity of air in m/s

#Output
print'The exit velocity of the air is',round(c2,1),"m/s"

The exit velocity of the air is 600.0 m/s


## Example 2.24 Page No. 115¶

In [38]:
#Input data
p1=100		#Pressure at the inlet of the compressor in kPa
p2=500		#Pressure at the outlet of the compressor in kPa
v1=3		#Volume of the air at the inlet of the compressor in m**3/kg
v2=0.8		#Volume of the air at the outlet of the compressor in m**3/kg
c1=25		#The velocity of air at the inlet of the compressor in m/s
c2=130		#The velocity of air at the outlet of the compressor in m/s
z=12		#The height of delivery connection above the inlet in m
g=9.81		#Gravitational constant in m/s**2
n=1.3		#Polytropic index

#Calculations
W=((n)*(p1*v1-p2*v2))/(n-1)	#Workdone for open system polytropic process in kJ/kg
K=((c2**2-c1**2)/2000.0)	#Change in kinetic energy of the system in kJ/kg
P=g*(z)/1000.0      		#Change in potential energy of the system in kJ/kg
w=W-K-P			         #The shaft work of the compressor in kJ/kg

#Output
print'The Shaft work of the compressor ',round(w,1),"kj/kgIt is the power absorbing system"
if w<0:
print'It is the power absorbing system'
else:
print'It is not power absorbing system'

The Shaft work of the compressor  -441.6 kj/kgIt is the power absorbing system
It is the power absorbing system


## Example 2.25 Page No. 117¶

In [40]:
#Input data
m=10		#The rate of fluid compressed adiabatically in kg/s
p1=500		#Initial pressure of the process in kPa
p2=5000		#Final pressure of the process in kPa
v=0.001		#The specific volume of the fluid in m**3/kg

#Calculations
P=m*v*(p2-p1)	#The power required in kW

#Output
print'The power required is',round(P,2),"kW"

The power required is 45.0 kW


## Example 2.26 Page No. 117¶

In [26]:
#Input data
m=2.0		#Mass flow rate of air in kg/s
t1=20		#Initial temperature of the air in degree centigrade
P=-30		#The amount of power consumed in kW
c1=100		#The inlet velocity of air in m/s
c2=150		#The outlet velocity of air in m/s
R=0.287		#The gas constant for air in kJ/kg-K
g=1.4		#It is the adiabatic index
cp=1.005		#Specific heat at constant pressure in kJ/kg-K
q=0		#Heat developed as it is adiabatic condition
z=0		#The change in potential energy is neglected

#Calculations
h=(P/m)+((c2**2-c1**2)/(2*1000))		#The change in enthalpy of the system in kJ/kg
t=h/cp		#The change in temperature of the system in degree centigrade
t2=t1-t		#The exit air temperature in degree centigrade

#Output
print'The exit air temperature is is',round(t2,2),"C"

The exit air temperature is is 28.96 C


## Example 2.27 Page No. 119¶

In [46]:
#Input data
m=0.6		#Mass flow rate of air in kg/s
W=40		#Power required to run the compressor in kW
p1=100		#Initial pressure at the inlet of the compressor in kPa
t1=30		#Initial temperature at the inlet of the compressor in degree centigrade
z=0		#Change in potential energy is neglected
c=0		#Change in kinetic energy is neglected
q=0.4		#Heat lost to the cooling water ,bearings and frictional effects is 40% of input
cp=1.005		#Specific heat at constant pressure in kJ/kg-K

#Calculations
Q=q*W		#Net heat losses from the system in kW
H=W-Q		#Change in total enthalpy of the system in kW
t2=(H/(m*cp))+t1	#The exit air temperature in degree centigrade

#Output
print'The exit air temperature is',round(t2,0),"C"

The exit air temperature is 70.0 C


## Example 2.28 Page No. 120¶

In [34]:
#Input data
m1=100		#Air flow rate in kg/hr
q1=600		#The heat generated by each person in kJ/hr
h1=85		#The enthalpy of air entering the room in kJ/kg
h2=60		#The enthalpy of air leaving the room in kJ/kg
Q1=0.2		#The heat added by each lamp in the room in kW
P1=0.2		#The power consumed by each fan in kW

#Calculations
q=(5*q1)/3600.0	#The heat generated by 5 persons in the room in kW
Q=3*Q1		     #The heat added by three lamps in the room in kW
P=2*P1		     #The power consumed by two fans in the room in kW
m=m1/3600.0		  #Mass flow rate of air in kg/s
H=(q+Q+P)+(m*(h1-h2))	#Heat to be removed by the cooler in kW

#Output
print'The rate at which the heat is to be removed by cooler X is',round(H,1),"kJ/sec"

The rate at which the heat is to be removed by cooler X is 2.5 kJ/sec


## Example 2.29 Page No. 121¶

In [50]:
#Input data
p1=1000		#Pressure at the inlet of the system in kPa
p2=15		#Pressure at the outlet of the system in kPa
v1=0.206		#Specific volume at the inlet of the system in m**3/kg
v2=8.93		#Specific volume at the outlet of the system in m**3/kg
h1=2827		#Specific enthalpy at the inlet of the system in kJ/kg
h2=2341		#Specific enthalpy at the outlet of the system in kJ/kg
c1=20		#Velocity at the inlet of the system in m/s
c2=120		#Velocity at the outlet of the system in m/s
z1=3.2		#Elevation at the inlet of the system in m
z2=0.5		#Elevation at the outlet of the system in m
m=2.1		#The fluid flow rate in kg/s
W=750		#The work output of the device in kW
g=9.81		#Gravitational constant in m/s**2

#Calculations
Q=m*(((c2**2-c1**2)/(2*1000))+((g*(z2-z1)/(1000.0)))+(h2-h1))+W  #The heat loss/gain by the system in kW

#Output
print'The Heat loss by the system is',round(Q,1),"kW"

The Heat loss by the system is -256.0 kW


## Example 2.30 Page No. 122¶

In [40]:
#Input data
t1=15		#The inlet temperature of the air passing through the heat exchanger in degree centigrade
c1=30		#The inlet velocity of air in m/s
t2=800		#The outlet temperature of the air from heat exchanger in degree centigrade
c2=30		#The inlet velocity of air to the turbine in m/s
t3=650		#The outlet temperature of the air from the turbine in degree centigrade
c3=60		#The outlet velocity of the air from turbine in m/s
t4=500		#The temperature at the outlet of the nozzle in degree centigrade
m=2		    #Air flow rate in kg/s
cp=1.005		#Specific heat at constant pressure in kJ/kgK

#Calculations
Qh=m*cp*(t2-t1)	#Rate of heat transfer to the air in the heat exchanger in kJ/s
P=m*((cp*(t2-t3))+((c2**2-c3**2)/2000.0))		#Power output from the turbine in kW
c4=((2*1000)*(cp*(t3-t4))+c3**2)**(1/2.0)		#Velocity of air at exit from nozzle in m/s

#Output
print'(a)Rate of heat transfer to the air in the heat exchanger is',round(Qh,1),"kJ/s"
print'(b)Power output from the turbine is',round(P,1),"kW"
print'(c)Velocity of air at exit from nozzle is',round(c4),"m/s"

(a)Rate of heat transfer to the air in the heat exchanger is 1577.8 kJ/s
(b)Power output from the turbine is 298.8 kW
(c)Velocity of air at exit from nozzle is 552.0 m/s


## Example 2.31 Page No. 123¶

In [31]:
#Input data
p1=400.0		#Initial pressure of the gas in a turbine in kPa
t1=573.0		#Initial temperature of the gas in a turbine in K
p2=100.0		#Final pressure of the gas in a turbine in kPa
V=2.5		  #It is the ratio of final volume to the inlet volume
c2=50.0		#Velocity of the gas at exit in m/s
P=1000.0		#Power developed by the turbine in kW
cp=5.193		#Specific heat of the helium at constant pressure in kJ/kg K
G=8.314		#Gas constant in kNm/kgK
M=4.0		  #Molecular weight of the helium

#Calculations
import math
R=G/M		   #Characteristic gas constant in kNm/kgK
v1=(R*t1)/p1	#Specific volume at the inlet in m**3/kg
v2=V*v1	  	#Specific volume at the outlet in m**3/kg
n=math.log(p2/p1)/math.log(v1/v2)	#Polytropic index
t2=((t1)*((p2/p1)**((n-1)/n)))		#Final temperature of the gas in a turbine in K
w=(n/(n-1))*(R*(t1))*(1-((p2*v2)/(p1*v1)))	#Specific work in kJ/kg
K=c2**2/(2*1000)			#Change in kinetic energy in kJ/kg
Ws=w-K			#Work done by the shaft in kJ/kg
q=Ws+(cp*(t2-t1))+K	#The heat transfer during the process in kJ/kg
m=P/Ws			#Mass flow rate of gas required in kg/s
A2=(m*v2)/c2		#Exit area of the turbine in m**2

#Output
print'(a)The mass flow rate of the gas required is',round(m,3),"kg/s"
print'(b)The heat transfer during the process is',round(q,1), "kJ/kg"
print'(c)Exit area of the turbine is ',round(A2,3),"m**2"

(a)The mass flow rate of the gas required is 0.76 kg/s
(b)The heat transfer during the process is 201.5 kJ/kg
(c)Exit area of the turbine is  0.113 m**2

In [ ]: