# Chapter 18 : Testing and Performance¶

## Example 18.1 Page No : 353¶

In :
import math

#Given:
n  =  4.      #Number of cylinders
d_o  =  7.5      #Diameter of orifice in cm
Cd  =  0.6      #Coefficient of discharge for orifice
d  =  11.
l  =  13.      #Bore and stroke in cm
N  =  2250.      #Engine speed in rpm
bp  =  36.      #Brake power in kW
m_f  =  10.5      #Fuel consumption in kg/hr
CV  =  42000.      #Calorific value in kJ/kg
deltaP_o  =  4.1      #Pressure drop across orifice in cm of water
P  =  1.013      #Atmospheric pressure in bar
T  =  15+273      #Atmospheric temperature in K
g  =  9.81      #Accelaration due to gravity in m/s**2
#Solution:
#(a)
eta_bt  =  bp*3600/(m_f*CV)      #Brake thermal efficiency
#(b)
A  =  math.pi/4*d**2*10**-4      #Area of cylinder in m**2
bmep  =  bp*1000/(n*l/100*A*N/(2*60))      #Brake mean effective pressure in Pascal
#(c)
rho_w  =  1000      #Mass density of water in kg/m**3
deltaP_o  =  rho_w*g*deltaP_o/100      #Pressure drop across orifice in N/m**2
R  =  0.287      #Specific gas consmath.tant in kJ/kgK
rho_a  =  P*10**5/(R*10**3*T)      #Mass density of air in kg/m**3
A_o  =  math.pi/4*d_o**2*10**-4      #Area of orifice in m**2
m_a  =  Cd*A_o*math.sqrt(2*deltaP_o*rho_a)      #Air inhaled in kg/s
V_s  =  (math.pi/4)*d**2*l*n*N/(2*60)*10**-6      #Swept volume in m**3/s
eta_vol  =  m_a/V_s      #Volumetric efficiency

#Results:
print " a)Brake thermal efficiency, eta_bt   =   %.3f"%(eta_bt)
print " b)Brake mean effective pressure, bmep   =   %.3f bar"%(bmep*10**-5)
print " c)Volumetric efficiency, eta_vol   =   %.3f"%(eta_vol)

 a)Brake thermal efficiency, eta_bt   =   0.294
b)Brake mean effective pressure, bmep   =   3.885 bar
c)Volumetric efficiency, eta_vol   =   0.898


## Example 18.2 Page No : 358¶

In :
import math

#Given:
d  =  24.
l  =  48.      #Bore and stroke in cm
D_b  =  1.25      #Effective diameter of the brake wheel in m
P  =  1236.      #Net load on brake in N
N  =  77.      #Average engine explosions in min
N1  =  226.7      #Average speed at output shaft in rpm
imep  =  7.5      #Indicated mean effective pressure in bar
Vg1  =  13.      #Gas used in m**3/hr
T1  =  15.+273
P1  =  771.      #Temperature and pressure of the gas in K and mm of mercury
T2  =  0+273
P2  =  760.      #Normal temperature and pressure (N.T.P.) in K and mm of mercury
CV  =  22000.      #Calorific value of the gas in kJ/m**3
m_w  =  625.      #Mass of cooling water used in kg/hr
T1_w  =  25+273.
T2_w  =  60.+273      #Inlet and outlet temperature of cooling water in K

#Solution:
#(a)
T  =  P*D_b/2      #Brake torque delivered in Nm
bp  =  2*math.pi*N1/60*T      #Brake power in W
ip  =  imep*10**5*l*math.pi/4*d**2*N/60*10**-6      #Indicated power in W
eta_m  =  bp/ip      #Mechanical efficiency
#(b)
Vg2  =  (P1/P2)*(T2/T1)*Vg1      #Gas consumption at N.T.P. in m**3/hr
#(c)
eta_it  =  ip/1000*3600/(Vg1*CV)      #Indicated thermal efficiency
#Heat balance sheet
Q1  =  Vg2/60*CV      #Heat supplied in kJ/min
Q_bp  =  bp/1000*60      #Heat equivalent to brake power in kJ/min
cp  =  4.1868      #Specfic heat of water in kJ/kgK
Q_w  =  m_w/60*cp*(T2_w-T1_w)      #Heat in cooling water in kJ/min
Q_r  =  Q1-Q_bp-Q_w      #Heat to exhaust, radiation in kJ/min

#Results:
print " a)The mechanical efficiency of the engine, eta_m   =   %.1f percent"%(eta_m*100)
print " b)The gas consumption at N.T.P.   =   %.1f m**3/hr"%(Vg2)
print " c)The indicated thermal efficiency, eta_it   =   %.1f percent"%(eta_it*100)
print "   Heat balance sheet\t Heat supplied by the gas   =   %.1f kJ/min, %d percent"%(Q1,Q1/Q1*100)
print "\t Heat equivalent to b.p.   =   %.1f kJ/min, %.1f percent"%(Q_bp,Q_bp/Q1*100)
print "\t Heat in cooling water   =   %.1f kJ/min, %.1f percent"%(Q_w,Q_w/Q1*100)
print "\t Heat to exhaust, radiation   =   %.1f kJ/min, %.1f percent"%(Q_r,Q_r/Q1*100)

 a)The mechanical efficiency of the engine, eta_m   =   87.7 percent
b)The gas consumption at N.T.P.   =   12.5 m**3/hr
c)The indicated thermal efficiency, eta_it   =   26.3 percent
Heat balance sheet	 Heat supplied by the gas   =   4583.8 kJ/min, 100 percent
Heat equivalent to b.p.   =   1100.3 kJ/min, 24.0 percent
Heat in cooling water   =   1526.4 kJ/min, 33.3 percent
Heat to exhaust, radiation   =   1957.0 kJ/min, 42.7 percent


## Example 18.3 Page No : 363¶

In :
import math

#Given:
d  =  18.
l  =  36.      #Bore and stroke in cm
N  =  285.      #Average engine speed in rpm
T  =  393.      #Brake torque delivered in Nm
imep  =  7.2      #Indicated mean effective pressure in bar
m_f  =  3.5      #Fuel consumption in kg/hr
m_w  =  4.5      #Mass of cooling water used in kg/min
deltaT_w  =  36.      #Cooling water temperature rise in degreeC
A_F  =  25.      #Air-fuel ratio
T2  =  415.+273      #Exhaust gas temperature in K
P  =  1.013      #Atmospheric pressure in bar
T1  =  21.+273      #Room temperature in K
CV  =  45200.      #Calorific value in kJ/kg
p  =  15.      #Perentage of hydrogen contained by the fuel
R  =  0.287      #Specific gas consmath.tant in kJ/kgK
cv  =  1.005
cp  =  2.05      #Specific heat for dry exhaust gases and superheated steam in kJ/kgK

#Solution:
#(a)
ip  =  imep*10**2*l*math.pi/4*d**2*N/(2*60)*10**-6      #Indicated power in kW
ip  =  round(10*ip)/10
eta_it  =  ip*3600/(m_f*CV)      #Indicated thermal efficiency
#(b)
m_a  =  m_f*A_F/60      #Mass of air inhaled in kg/min
m_a  =  round(100*m_a)/100
V_a  =  m_a*R*T1/(P*100)      #Volume of air inhaled in m**3/min
V_s  =  (math.pi/4)*d**2*l*10**-6*N/2      #Swept volume in m**3/min
eta_vol  =  V_a/V_s      #Volumetric efficiency
#Heat balance sheet
Q1  =  m_f/60*CV      #Heat input in kJ/min
bp  =  2*math.pi*N/60*T*10**-3      #Brake power in W
Q_bp  =  bp*60      #Heat equivalent to brake power in kJ/min
cp_w  =  4.1868      #Specific heat of water in kJ/kgK
Q_w  =  m_w*cp_w*deltaT_w      #Heat in cooling water in kJ/min
m_e  =  m_a+m_f/60      #Mass of exhaust gases in kg/min
#Since, 2 mole of hydrogen gives 1 mole of water on combine with 1 mole of oxygen
#Thus, 1 mole of hydrogen gives 1/2 mole or 9 unit mass of water
m_h  =  m_f/60*p/100      #Mass of hydrogen in kg/min
m_s  =  9*m_h      #Mass of steam in exhaust gases in kg/min
m_d  =  m_e-m_s      #Mass of dry exhaust gases in kg/min
Q_d  =  m_d*cv*(T2-T1)      #Heat in dry exhaust gases in kJ/min
lv  =  2256.9      #Latent heat of vapourisation of water in kJ/kg
Q_s  =  m_s*((373-T1)+lv+cp*(T2-373))      #Heat in steam in exhaust gases in kJ/min
Q_r  =  Q1-Q_bp-Q_w-Q_d-Q_s      #Heat in radiation in kJ/min

#Results:
print " a)The indicated thermal efficiency, eta_it   =   %.1f percent"%(eta_it*100)
print " b)The volumetric efficiency, eta_vol   =   %.1f percent"%(eta_vol*100)
print "   Heat balance sheet\t Heat input   =   %.1f kJ/min, %d percent"%(Q1,Q1/Q1*100)
print "\t Heat equivalent to b.p.   =   %.1f kJ/min, %.1f percent"%(Q_bp,Q_bp/Q1*100)
print "\t Heat in cooling water   =   %.1f kJ/min, %.1f percent"%(Q_w,Q_w/Q1*100)
print "\t Heat in dry exhaust gases   =   %.1f kJ/min, %.1f percent"%(Q_d,Q_d/Q1*100)
print "\t Heat in steam in exhaust gases   =   %.1f kJ/min, %.1f percent"%(Q_s,Q_s/Q1*100)
print "\t Heat in radiation   =   %.1f kJ/min, %.1f percent"%(Q_r,Q_r/Q1*100)

 a)The indicated thermal efficiency, eta_it   =   35.7 percent
b)The volumetric efficiency, eta_vol   =   93.2 percent
Heat balance sheet	 Heat input   =   2636.7 kJ/min, 100 percent
Heat equivalent to b.p.   =   703.7 kJ/min, 26.7 percent
Heat in cooling water   =   678.3 kJ/min, 25.7 percent
Heat in dry exhaust gases   =   570.0 kJ/min, 21.6 percent
Heat in steam in exhaust gases   =   234.8 kJ/min, 8.9 percent
Heat in radiation   =   449.8 kJ/min, 17.1 percent


## Example 18.4 Page No : 368¶

In :
import math

#Given:
n  =  4.      #Number of cylinders
d_o  =  5.      #Diameter of orifice in cm
Cd  =  0.6      #Coefficient of discharge for orifice
d  =  10.5
l  =  12.5      #Bore and stroke in cm
N  =  1200.      #Engine speed in rpm
T  =  147.      #Brake torque delivered in Nm
m_f  =  5.5      #Fuel consumption in kg/hr
CV  =  43100.      #Calorific value in kJ/kg
deltaP_o  =  5.7      #Head across orifice in cm of water
P1  =  1.013      #Atmospheric pressure in bar
T1  =  20.+273      #Atmospheric temperature in K
g  =  9.81      #Accelaration due to gravity in m/s**2

#Solution:
#(a)
bp  =  2*math.pi*N/60*T*10**-3      #Brake power in kW
eta_bt  =  bp*3600/(m_f*CV)      #Brake thermal efficiency
#(b)
A  =  math.pi/4*d**2*10**-4      #Area of cylinder in m**2
bmep  =  bp*1000/(n*l/100*A*N/(2*60))      #Brake mean effective pressure in N/m**2
#(c)
rho_w  =  1000      #Mass density of water in kg/m**3
deltaP_o  =  rho_w*g*deltaP_o/100      #Pressure drop across orifice in N/m**2
R  =  0.287      #Specific gas consmath.tant in kJ/kgK
rho_a  =  P1*10**5/(R*10**3*T1)      #Mass density of air in kg/m**3
rho_a  =  round(10*rho_a)/10
A_o  =  math.pi/4*d_o**2*10**-4      #Area of orifice in m**2
V_a  =  Cd*A_o*math.sqrt(2*deltaP_o/rho_a)      #Air inhaled in m**3/s
V_s  =  (math.pi/4)*d**2*l*n*N/(2*60)*10**-6      #Swept volume in m**3/s
eta_vol  =  V_a/V_s      #Volumetric efficiency

#Results:
print " a)Brake thermal efficiency, eta_bt   =   %.1f percent"%(eta_bt*100)
print " b)Brake mean effective pressure, bmep   =   %.2f bar"%(bmep*10**-5)
print " c)Volumetric efficiency, eta_vol   =   %.1f percent"%(eta_vol*100)

 a)Brake thermal efficiency, eta_bt   =   28.1 percent
b)Brake mean effective pressure, bmep   =   4.27 bar
c)Volumetric efficiency, eta_vol   =   83.1 percent


## Example 18.5 Page No : 373¶

In :
import math

#Given:
n  =  6.      #Number of cylinders
d  =  7.5
l  =  9.      #Bore and stroke in cm
R_b  =  38.      #Torque arm radius of the brake wheel in cm
P1  =  324.      #Net load when all cylinders operating on brake in N
N  =  3300.      #Engine speed in rpm
P2  =  245.      #Net load when each cylinder is inoperative in N
m_f  =  .3      #Fuel consumption in kg/min
CV  =  42000.      #Calorific value in kJ/kg
m_w  =  65.      #Mass of cooling water used in kg/min
deltaT_w  =  12.      #Cooling water temperature rise in degreeC
m_a  =  14.      #Mass of air blown in kg/min
T1_a  =  10.+273
T2_a  =  55.+273      #Inlet and outlet temperature of air blown in K

#Solution:
bp  =  2*math.pi*N/60*(P1*R_b/100)*10**-3      #Brake power when all the cylinders operating in kW
bp1  =  2*math.pi*N/60*(P2*R_b/100)*10**-3      #Brake power when each cylinder is inoperative in kW
ip  =  n*(bp-bp1)      #Total ip of the engine in kW
A  =  math.pi/4*d**2*10**-4      #Area of cylinder in m**2
bmep  =  ip*1000/(n*l/100*A*N/(2*60))      #Brake mean effective pressure in N/m**2
#Heat balance sheet
Q1  =  m_f*CV      #Heat input in kJ/min
Q_bp  =  bp*60      #Heat equivalent to brake power in kJ/min
cp_w  =  4.1868      #Specfic heat of water in kJ/kgK
Q_w  =  m_w*cp_w*deltaT_w      #Heat in cooling water in kJ/min
cp_a  =  1.005      #Specific heat of air in kJ/kgK
Q_a  =  m_a*cp_a*(T2_a-T1_a)      #Heat to ventilating air in kJ/min (Wrong in book)
Q_e  =  Q1-Q_bp-Q_w-Q_a      #Heat to exhaust and other losses in kJ/min

#Results:
print " a)The indicated mean effective pressure, bmep   =   %.1f bar"%(bmep*10**-5)
print "   Heat balance sheet\t Heat input   =   %d kJ/min, %d percent"%(Q1,Q1/Q1*100)
print "\t Heat equivalent to b.p.   =   %d kJ/min, %.1f percent"%(Q_bp,Q_bp/Q1*100)
print "\t Heat in cooling water   =   %d kJ/min, %.1f percent"%(Q_w,Q_w/Q1*100)
print "\t Heat to ventilating air   =   %d kJ/min, %.1f percent"%(Q_a,Q_a/Q1*100)
print "\t Heat to exhaust and other losses   =   %d kJ/min, %.2f percent"%(Q_e,Q_e/Q1*100)
#Heat to ventilating air is wrong in book

 a)The indicated mean effective pressure, bmep   =   9.5 bar
Heat balance sheet	 Heat input   =   12600 kJ/min, 100 percent
Heat equivalent to b.p.   =   2552 kJ/min, 20.3 percent
Heat in cooling water   =   3265 kJ/min, 25.9 percent
Heat to ventilating air   =   633 kJ/min, 5.0 percent
Heat to exhaust and other losses   =   6148 kJ/min, 48.80 percent


## Example 18.6 Page No : 378¶

In :
import math

#Given:
N  =  450.      #Engine speed in rpm
P  =  450.      #Net load on brake in N
imep  =  2.9      #Indicated mean effective pressure in bar
m_f  =  5.4      #Fuel consumption in kg/h
deltaT_w  =  36.1      #Cooling water temperature rise in degreeC
m_w  =  440.      #Mass of cooling water used in kg/h
A_F  =  31.      #Air-fuel ratio
T1_g  =  20.+273
T2_g  =  355.+273      #Inlet and outlet temperature of exhaust gases blown in K
P1  =  76.      #Atmospheric pressure in cm of Hg
d  =  22.
l  =  27.      #Bore and stroke in cm
D_b  =  1.5      #Effective diameter of the brake wheel in m
CV  =  44000.      #Calorific value in kJ/kg
p  =  15.      #Percentage of hydrogen by mass contained by the fuel
R  =  0.287      #Specific gas consmath.tant in kJ/kgK
cp_g  =  1.005
cp_s  =  2.05      #Specific heat for dry exhaust gases and superheated steam in kJ/kgK

#Solution:
ip  =  imep*10**2*l*math.pi/4*d**2*N/(60)*10**-6      #Indicated power in kW
eta_it  =  ip*3600/(m_f*CV)      #Indicated thermal efficiency
bp  =  2*math.pi*N/60*(P*D_b/2)*10**-3      #Brake power in kW
bp  =  round(10*bp)/10
bsfc  =  m_f/bp*1000      #Brake specific fuel consumption in gm/kWh
V_s  =  (math.pi/4)*d**2*l*10**-6*N      #Swept volume in m**3/min
m_a  =  m_f*A_F/60      #Mass of air inhaled in kg/min
P1  =  1.0132      #Atmospheric pressure equivalent to 76 cm of Hg in bar
T1  =  293      #Atmospheric temperature in K
V_a  =  m_a*R*T1/(P1*100)      #Volume of air inhaled in m**3/min
V_a  =  round(100*V_a)/100
eta_vol  =  V_a/V_s      #Volumetric efficiency
#Heat balance sheet
Q1  =  m_f/60*CV      #Heat input in kJ/min
Q_bp  =  bp*60      #Heat equivalent to brake power in kJ/min
cp_w  =  4.1868      #Specfic heat of water in kJ/kgK
Q_w  =  m_w/60*cp_w*deltaT_w      #Heat in cooling water in kJ/min
m_e  =  m_a+m_f/60      #Mass of exhaust gases in kg/min
#Since, 2 mole of hydrogen gives 1 mole of water on combine with 1 mole of oxygen
#Thus, 1 mole of hydrogen gives 1/2 mole or 9 unit mass of water
m_h  =  m_f/60*p/100      #Mass of hydrogen in kg/min
m_s  =  9*m_h      #Mass of steam in exhaust gases in kg/min
m_d  =  m_e-m_s      #Mass of dry exhaust gases in kg/min
Q_d  =  m_d*cp_g*(T2_g-T1_g)      #Heat in dry exhaust gases kJ/min
lv  =  2256.9      #Latent heat of vapourisation of water in kJ/kg
Q_s  =  m_s*((373-T1_g)+lv+cp_s*(T2_g-373))      #Heat in steam in exhaust gases in kJ/min
Q_r  =  Q1-Q_bp-Q_w-Q_d-Q_s      #Heat in radiation in kJ/min

#Results:
print " a)The indicated thermal efficiency, eta_it   =   %.1f percent"%(eta_it*100)
print " b)Brake specific fuel consumption   =   %.1f gm/kWh"%(bsfc)
print " c)The volumetric efficiency, eta_vol   =   %.1f percent"%(eta_vol*100)
print "   Heat balance sheet\t Heat input   =   %.1f kJ/min, %d percent"%(Q1,Q1/Q1*100)
print "\t Heat equivalent to b.p.   =   %.1f kJ/min, %.1f percent"%(Q_bp,Q_bp/Q1*100)
print "\t Heat in cooling water   =   %.1f kJ/min, %.1f percent"%(Q_w,Q_w/Q1*100)
print "\t Heat in dry exhaust gases   =   %.1f kJ/min, %.1f percent"%(Q_d,Q_d/Q1*100)
print "\t Heat in steam in exhaust gases   =   %.1f kJ/min, %.1f percent"%(Q_s,Q_s/Q1*100)
print "\t Heat in radiation   =   %.1f kJ/min, %.1f percent"%(Q_r,Q_r/Q1*100)

 a)The indicated thermal efficiency, eta_it   =   33.8 percent
b)Brake specific fuel consumption   =   339.6 gm/kWh
c)The volumetric efficiency, eta_vol   =   50.2 percent
Heat balance sheet	 Heat input   =   3960.0 kJ/min, 100 percent
Heat equivalent to b.p.   =   954.0 kJ/min, 24.1 percent
Heat in cooling water   =   1108.4 kJ/min, 28.0 percent
Heat in dry exhaust gases   =   928.7 kJ/min, 23.5 percent
Heat in steam in exhaust gases   =   347.4 kJ/min, 8.8 percent
Heat in radiation   =   621.4 kJ/min, 15.7 percent


## Example 18.7 Page No : 383¶

In :
import math
from numpy import array,sum

#Given:
n  =  12.      #Number of cylinders
def f(W):
return  W*N/180      #Power law of engine

d  =  38.
l  =  50.      #Bore and stroke in cm
N  =  200.      #Engine speed in rpm
Wall1  =  2000.
Wall2  =  2020.      #Brake loads when all cylinders are firing in N
Wn  =  array([1795 ,1814, 1814, 1795, 1804, 1819, 1800, 1824, 1785, 1804, 1814, 1795])      #Brake load when cylinder number 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 are out in N
#Solution:
W  =  (Wall1+Wall2)/2      #Average of brake loads when all cylinders are firing in N
bp  =  f(W)      #Total brake power in kW
ipn  =  bp-f(Wn)      #Indicated power of cylinders number 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 in kW
ip  =  sum(ipn)      #Total indicated power equal to sum of individual in kW
eta_m  =  bp/ip      #Mechanical efficiency
A  =  math.pi/4*d**2*10**-4      #Area of cylinder in m**2
bmep  =  bp*1000/(n*l/100*A*N/(60))      #Brake mean effective pressure in Pascal

#Results:
print " The brake mean effective pressure, bmep   =   %.2f bar"%(bmep*10**-5)
print " The mechanical efficiency, eta_m   =   %.1f percent"%(eta_m*100)

 The brake mean effective pressure, bmep   =   9.85 bar
The mechanical efficiency, eta_m   =   81.8 percent


## Example 18.8 Page No : 388¶

In :
import math

#Given:
n  =  6.      #Number of cylinders
def  f(W):
return  W*N/20000         #Power law of engine
d  =  95.
l  =  120.      #Bore and stroke in mm
N  =  2400.      #Engine speed in rpm
C_H  =  83./17      #Carbon Hydrogen ratio by mass in fuel
d_o  =  30.      #Diameter of orifice in mm
Cd  =  0.6      #Orifice coefficient of discharge
P  =  550.      #Net load on brake in N
P1  =  750.      #Ambient pressure in mm of Hg
T1  =  25.+273      #Ambient temperature in K
deltaP_o  =  14.5      #Head over orifice in cm of Hg
s  =  0.831      #Specific gravity of fuel
t  =  19.3      #Time to use 100 cc fuel in s
V_f  =  100.      #Volume of fuel used in t seconds in cc

#Solution:
#(a)
bp  =  f(P)      #Brake power at brake load in kW
A  =  math.pi/4*d**2*10**-6      #Area of cylinder in m**2
bmep  =  bp*1000/(n*l/1000*A*N/(2*60))      #Brake mean effective pressure in Pascal
#(b)
T  =  bp*1000/(2*math.pi*(N/60))      #Brake torque in Nm
#(c)
rho_f  =  s*1000      #Fuel density in kg/m**3
m_f  =  V_f*10**-6/t*3600*rho_f      #Fuel flow rate in kg/hr
bsfc  =  m_f/bp      #Brake specific fuel consumption in kg/kWh
#(e)
R  =  0.287      #Specific gas consmath.tant in kJ/kgK
P1  =  P1/760*1.01325      #Ambient pressure in bar
rho_a  =  P1*10**5/(R*10**3*T1)      #Mass density of air in kg/m**3
deltaP_o  =  13.6*1000*9.81*deltaP_o/100      #Pressure drop across orifice in N/m**2
A_o  =  math.pi/4*d_o**2*10**-6      #Area of orifice in m**2
V_a  =  Cd*A_o*math.sqrt(2*deltaP_o/rho_a)      #Air inhaled in m**3/s
V_s  =  (math.pi/4)*d**2*l*n*N/(2*60)*10**-9      #Swept volume in m**3/s
eta_vol  =  V_a/V_s      #Volumetric efficiency
#(d)
pH  =  17.
pC  =  pH*C_H      #Percentage of Hydrogen and Carbon in fuel
pO  =  23.3      #Percentage of Oxygen in air
H  =  1.
C  =  12.
O  =  16.      #Atomic masses of Hydrogen, Carbon, Oxygen in gm
mO2  =  pC/100*(2*O/C)+pH/100*(O/(2*H))      #Oxygen required in kg/kg of fuel
m_a  =  mO2/(pO/100)      #Mass of air in kg/kg of fuel
A_F_t  =  m_a      #Theoritical air fuel ratio
m_a_act  =  V_a*rho_a      #Actual air mass flow rate in kg/s
A_F_act  =  m_a_act/m_f*3600      #Actual air fuel ratio
P_e  =  (A_F_act-A_F_t)/A_F_t*100      #Percentage excess air

#Results:
print " a)The brake mean effective pressure, bmep   =   %.3f bar"%(bmep*10**-5)
print " b)The brake torque, T   =   %.1f Nm"%(T)
print " c)The brake specific fuel consumption, bsfc   =   %.3f kg/kWh"%(bsfc)
print " d)The percentage excess air   =   %.1f percent"%(P_e)
print " e)The volumetric efficiency, eta_vol   =   %.1f percent"%(eta_vol*100)

 a)The brake mean effective pressure, bmep   =   6.466 bar
b)The brake torque, T   =   262.6 Nm
c)The brake specific fuel consumption, bsfc   =   0.235 kg/kWh
d)The percentage excess air   =   36.6 percent
e)The volumetric efficiency, eta_vol   =   75.6 percent


## Example 18.9 Page No : 393¶

In :
import math

#Given:
n  =  6.      #Number of cylinders
d  =  125.;l  =  190.      #Bore and stroke in mm
pC  =  82./100;pH2  =  18./100      #Composition of Carbon and Hydrogen in petrol
pCO2  =  11.19/100;pO2  =  3.61/100;pN2  =  85.2/100      #Composition of Carbon di oxide, Oxygen, Nitrogen in dry exhaust
P1  =  1.      #Pressure of mixture entering the cylinder in bar
T1  =  17.+273      #Temperature of mixture entering the cylinder in K
m_f  =  31.3      #Mass of the petrol used in kg/hr
N  =  1500.      #Engine speed in rpm
m  =  1.;T  =  0.+273;P  =  1.013;V  =  0.773      #Mass, temperature, pressure, volume, of air in kg, K, bar, m**3
p  =  23./100      #Composition of Oxygen in air by mass

#Solution:
C  =  12.      #Atomic mass of Carbon(C)
H  =  1.      #Atomic mass of Hydrogen(H)
O  =  16.      #Atomic mass of Oxygen(O)
N2  =  14.      #Atomic mass of Nitrogen(N)
A_F_s  =  (pC*2*O/C+pH2*O/(2*H))/(p)      #Stoichiometric air fuel ratio
#Stoichiometric equation of combustion of fuel (petrol)
#   0.82/12[C] + 0.18/2[H2] + [0.21[O2] + 0.79[N2]]*x   =   a[CO2] + b[CO] + c[H2O] + d1[N2]
#Equating coefficients
a  =  pC/C;c  =  pH2/(2*H)      #On balancing C and H
d1  =  pN2/pCO2*a      #On taking composition of CO2 and N2 in exhaust
x  =  d1/0.79      #On balancing N
m_a  =  (p*2*O)+((1-p)*2*N2)      #Mass of air per mole air in kg/mole
A_F_act  =  x*m_a      #Actual air fuel ratio
P_e  =  (A_F_act-A_F_s)/A_F_s*100      #Percentage excess air
R_a  =  P*100*V/(m*T)      #Specific gas consmath.tant for air in kJ/kgK
V_a  =  A_F_act*R_a*T1/(P1*100)      #Volume of air in m**3
#Given, rho_f   =   3.35 * rho_a, V_f   =   1/3.35 * V_a
V_f  =  V_a/A_F_act*1/3.35      #Volume of fuel in m**3/kg of fuel
V_m  =  V_a+V_f      #Total volume of mixture in m**3/kg of fuel
V_m1  =  V_m*m_f/60      #Mixture aspirated in m**3/min
V_s  =  (math.pi/4)*d**2*l*n*N/2*10**-9      #Swept volume in m**3/s
eta_v  =  V_m1/V_s*100      #Volumetric efficiency in percent

#Results:
print " The mass of air supplied per kg of petrol, m_a   =   %.2f kg/kg of fuel"%(A_F_act)
print " The percentage excess air   =   %.1f percent"%(P_e)
print " The volume of mixture per kg of petrol, V_m   =   %.2f m**3/kg fuel"%(V_m)
print " The volumetric efficiency of the engine, eta_v   =   %.0f percent"%(eta_v)

 The mass of air supplied per kg of petrol, m_a   =   19.05 kg/kg of fuel
The percentage excess air   =   20.8 percent
The volume of mixture per kg of petrol, V_m   =   16.09 m**3/kg fuel
The volumetric efficiency of the engine, eta_v   =   80 percent


## Example 18.10 Page No : 398¶

In :
import math

#Given:
d  =  27.
l  =  45.      #Bore and stroke in cm
D_b  =  1.62      #Effective diameter of the brake wheel in m
t  =  38.5      #Duration of test in min
N  =  8080.
N1  =  3230.      #Number of revolutions and explosions
P  =  903.      #Net load on brake in N
imep  =  5.64      #Indicated mean effective pressure in bar
Vg1  =  7.7      #Gas used in m**3
T1  =  27.+273      #Temperature of the gas in K
deltaP1  =  135.      #Pressure difference of gas above atmospheric pressure in mm of water
Patm  =  750.      #Atmospheric pressure in mm of Hg
CV  =  18420.      #Calorific value of the gas in kJ/m**3 at N.T.P.
m_w  =  183.      #Mass of cooling water used in kg
deltaT_w  =  47.      #Cooling water temperature rise in degreeC

#Solution:
P1  =  Patm+deltaP1/13.6      #Gas pressure in mm of Hg
P1  =  P1/750      #Gas pressure in bar
T2  =  0+273;P2  =  1.013      #Normal temperature and pressure (N.T.P.) in K and bar
Vg2  =  (P1/P2)*(T2/T1)*Vg1      #Gas consumption at N.T.P. in m**3
Q1  =  Vg2/t*CV      #Heat supplied in kJ/min
T  =  P*D_b/2      #Brake torque delivered in Nm
bp  =  2*math.pi*(N/t*1/60)*(T)*10**-3      #Brake power in kW
bp  =  round(10*bp)/10
Q_bp  =  bp*60      #Heat equivalent to brake power in kJ/min
A  =  math.pi/4*d**2*10**-4      #Area of cylinder in m**2
ip  =  imep*10**2*l/100*A*(N1/t*1/60)      #Indicated power in kW
ip  =  round(10*ip)/10
Q_ip  =  ip*60      #Heat equivalent to indicated power in kJ/min
fp  =  ip-bp      #Frictional power in kW
Q_fp  =  fp*60      #Heat equivalent to frictional power in kJ/min
cp  =  4.1868      #Specfic heat of water in kJ/kgK
Q_w  =  m_w/t*cp*(deltaT_w)      #Heat in cooling water in kJ/min
Q_e  =  Q1-Q_bp-Q_w      #Heat to exhaust, radiation in kJ/min
eta_it  =  Q_ip/Q1      #Indicated thermal efficiency
eta_bt  =  Q_bp/Q1      #Brake thermal efficiency

#Results:
print " The indicated thermal efficiency, eta_it   =   %.1f percent"%(eta_it*100)
print " The brake thermal efficiency, eta_bt   =   %.1f percent"%(eta_bt*100)
print "   Heat balance sheet\t Heat supplied by the gas   =   %d kJ/min, %d percent"%(Q1,Q1/Q1*100)
print "\t Heat equivalent to b.p.   =   %d kJ/min, %.1f percent"%(Q_bp,Q_bp/Q1*100)
print "\t Heat in cooling water   =   %d kJ/min, %.1f percent"%(Q_w,Q_w/Q1*100)
print "\t Heat to exhaust, radiation   =   %d kJ/min, %.1f percent"%(Q_e,Q_e/Q1*100)

 The indicated thermal efficiency, eta_it   =   36.3 percent
The brake thermal efficiency, eta_bt   =   28.8 percent
Heat balance sheet	 Heat supplied by the gas   =   3353 kJ/min, 100 percent
Heat equivalent to b.p.   =   966 kJ/min, 28.8 percent
Heat in cooling water   =   935 kJ/min, 27.9 percent
Heat to exhaust, radiation   =   1451 kJ/min, 43.3 percent


## Example 18.11 Page No : 403¶

In :
#Given:
Li  =  100.      #Length of indicator diagram in mm
Ai  =  2045.      #Area of indicator diagram in mm**2
Pi  =  2./10      #Pressure increment in cylinder from indicator pointer in bar/mm
d  =  100.;l  =  100.      #Bore and stroke in mm
N  =  900.      #Engine speed in rpm
eta_m  =  75.      #Mechanical efficiency in percent

#Solution:
Hi_av  =  Ai/Li      #Mean height of indicator diagram in mm
imep  =  Hi_av*Pi      #Mean effective pressure in bar
ip  =  imep*100*math.pi/4*d**2*l*N/(2*60)*10**-9      #Indicated power in kW
bp  =  ip*eta_m/100      #Brake power in kW

#Results:
print " The mean effective pressure, mep   =   %.2f bar"%(imep)
print " The indicated power, ip   =   %.2f kW"%(ip)
print " The brake power, bp   =   %.2f kW"%(bp)

 The mean effective pressure, mep   =   4.09 bar
The indicated power, ip   =   2.41 kW
The brake power, bp   =   1.81 kW


## Example 18.12 Page No : 408¶

In :
from scipy.optimize import fsolve
import math

#Given:
n  =  6.      #Number of cylinders
bp  =  110.      #Brake power in kW
N  =  1600.      #Engine speed in rpm
CV  =  43100.      #Calorific value in kJ/kg
pC  =  86.2/100;pH2  =  13.5/100;pNC  =  0.3/100      #Composition of Carbon, Hydrogen and non combustibles in fuel
eta_v  =  78.      #Volumetric efficiency in percent
eta_it  =  38.      #Indicated thermal efficiency in percent
eta_m  =  80.      #Mechanical efficiency in percent
MS  =  110.      #Mixture strength in percent
l_d  =  1.5      #Stroke bore ratio (l/d)
v_a  =  0.772      #Specific volume of air in m**3/kg
p_m  =  23.1/100;p_v  =  20.8/100      #Composition of Oxygen in air by mass and volume

#Solution:
C  =  12.      #Atomic mass of Carbon(C)
H  =  1.      #Atomic mass of Hydrogen(H)
O  =  16.      #Atomic mass of Oxygen(O)
N2  =  14.      #Atomic mass of Nitrogen(N)
A_F_s  =  (pC*2*O/C+pH2*O/(2*H))/p_m      #Stoichiometric air fuel ratio
A_F_act  =  (1+MS/100)*A_F_s      #Actual air fuel ratio
Ma  =  (p_m*2*O)+((1-p_m)*2*N2)      #Molecular mass of air per mole air in kg/mole
#Stoichiometric equation of combustion of fuel (petrol)
#   0.862/12[C] + 0.135/2[H2] + [p_v[O2] + (1-p_v)[N2]]*x   =   a[CO2] + b[H2O] + c[O2] + d[N2]
#Equating coefficients
a  =  pC/C;b  =  pH2/(2*H)      #On balancing C and H
x  =  A_F_act/Ma      #Moles of air
c  =  p_v*x-a-b/2      #On balancing O
d  =  (1-p_v)*x      #On balancing N
pCO2  =  a/(a+c+d);pO2  =  c/(a+c+d);pN2  =  d/(a+c+d)      #Composition of Carbon di oxide, Oxygen, Nitrogen in dry exhaust
ip  =  bp/eta_m*100      #Indicated power in kW
m_f  =  ip/(eta_it/100*CV)*60      #Mass of fuel in kg/min
m_a  =  m_f*A_F_act      #Mass of air in kg/min
V_a  =  m_a*v_a      #Volume of air in m**3/min
V_s  =  V_a/eta_v*100      #Swept volume in m**3/min
V_s  =  V_s/(n*N/2)      #Swept volume in m**3
def  f(d):      #Defining a function, f of unknown bore, d
l  =  l_d*d      #Stroke in terms of bore
return  math.pi/4*d**2*l-V_s

d  =  fsolve(f,1)
l  =  l_d*d      #Stroke in m

#Results:
print " The volumetric composition of dry exhaust gas, \tCO2   =   %.2f percent \
\nO2   =   %.2f percent\
\nN2   =   %.2f percent"%(pCO2*100,pO2*100,pN2*100)
print " The bore of the engine, d   =   %.2f cm The stroke of the engine, l   =   %.2f cm"%(d*100,l*100)

 The volumetric composition of dry exhaust gas, 	CO2   =   6.99 percent
O2   =   11.21 percent
N2   =   81.80 percent
The bore of the engine, d   =   13.94 cm The stroke of the engine, l   =   20.91 cm


## Example 18.13 Page No : 413¶

In :
import math

#Given:
d  =  150.;l  =  250.      #Bore and stroke in mm
Li  =  50.      #Length of indicator diagram in mm
Ai  =  450.      #Area of indicator diagram in mm**2
ISR  =  1.2      #Indicator spring rating in mm
N  =  420.      #Engine speed in rpm
T  =  217.      #Brake torque delivered in Nm
m_f  =  2.95      #Fuel consumption in kg/hr
CV  =  44000.      #Calorific value in kJ/kg
m_w  =  0.068      #Mass of cooling water used in kg/s
deltaT_w  =  45.      #Cooling water temperature rise in K
cp  =  4.1868      #Specfic heat capacity of water in kJ/kgK

#Solution:
Hi_av  =  Ai/Li      #Mean height of indicator diagram in mm
imep  =  Hi_av/ISR      #Mean effective pressure in bar
ip  =  imep*100*math.pi/4*d**2*l*N/(2*60)*10**-9      #Indicated power in kW (Error in book)
bp  =  2*math.pi*(N/60)*(T)*10**-3      #Brake power in kW
eta_m  =  bp/ip      #Mechanical efficiency (Error in book)
eta_bt  =  bp*3600/(m_f*CV)      #Brake thermal efficiency
bsfc  =  m_f/bp      #Brake specific fuel consumption in kg/kWh (Error in book)
#Energy balance
Power_f  =  m_f/3600*CV      #Power in fuel in kW
Power_w  =  m_w*cp*deltaT_w      #Power to cooling water in kW
Power_e  =  Power_f-bp-Power_w      #Power to exhaust, radiation in kW

#Results:
print " The mechanical efficiency, eta_m   =   %d percent"%(eta_m*100)
print " The brake thermal efficiency, eta_bt   =   %.1f percent"%(eta_bt*100)
print " The specific fuel consumption, bsfc   =   %.3f kg/kWh"%(bsfc)
print "   Energy balance\t Power in fuel   =   %.1f kW, %d percent"%(Power_f,Power_f/Power_f*100)
print "\t Brake power   =   %.2f kW, %.1f percent"%(bp,bp/Power_f*100)
print "\t Power to cooling water   =   %.1f kW, %.1f percent"%(Power_w,Power_w/Power_f*100)
print "\t Power to exhaust, radiation   =   %.1f kW, %.1f percent"%(Power_e,Power_e/Power_f*100)
#Answers in the book are wrong

 The mechanical efficiency, eta_m   =   82 percent
The brake thermal efficiency, eta_bt   =   26.5 percent
The specific fuel consumption, bsfc   =   0.309 kg/kWh
Energy balance	 Power in fuel   =   36.1 kW, 100 percent
Brake power   =   9.54 kW, 26.5 percent
Power to cooling water   =   12.8 kW, 35.5 percent
Power to exhaust, radiation   =   13.7 kW, 38.0 percent


## Example 18.14 Page No : 418¶

In :
import math

#Given:
n  =  6.      #Number of cylinders
d  =  70.
l  =  100.      #Bore and stroke in mm
V_c  =  67.      #Clearance volume in cm**2
N  =  3960.      #Engine speed in rpm
m_f  =  19.5      #Fuel consumption in kg/hr
T  =  140.      #Brake torque delivered in Nm
CV  =  44000.      #Calorific value in kJ/kg
g  =  1.4      #Specific heat ratio for air (gamma)

#Solution:
bp  =  2*math.pi*N/60*T*10**-3      #Brake power in kW
A  =  math.pi/4*d**2*10**-6      #Area of cylinder in m**2
bmep  =  bp*1000/(n*l/1000*A*N/(2*60))      #Brake mean effective pressure in Pascal
eta_bt  =  bp*3600/(m_f*CV)      #Brake thermal efficiency
V_s  =  (math.pi/4)*d**2*l/1000      #Swept volume of one cylinder in cm**3
r  =  (V_s+V_c)/V_c      #Compression ratio
eta  =  1-1/r**(g-1)      #Air standard efficiency
eta_r  =  eta_bt/eta      #Relative efficiency

#Results:
print " a)The brake power, bp   =   %d kW"%(bp)
print " b)The brake mean effective pressure, bmep   =   %.2f bar"%(bmep*10**-5)
print " c)The brake thermal efficiency, eta_bt   =   %.1f percent"%(eta_bt*100)
print " d)The relative efficiency, eta_r   =   %.1f percent"%(eta_r*100)

 a)The brake power, bp   =   58 kW
b)The brake mean effective pressure, bmep   =   7.62 bar
c)The brake thermal efficiency, eta_bt   =   24.4 percent
d)The relative efficiency, eta_r   =   45.6 percent


## Example 18.15 Page No : 423¶

In :
import math

#Given:
d  =  178.;l  =  330.      #Bore and stroke in mm
N  =  400.      #Engine speed at full load in rpm
wmep  =  6.2      #Working loop mep in bar
pmep  =  0.35      #Pumping loop mep in bar
mep_dc  =  0.62      #Mean effective pressure from the dead cycles in bar
N_f  =  47.      #Number of firing strokes at no load in rpm

#Solution:
imep  =  wmep-pmep      #Net indicated mean effective pressure per cycle in bar
N_d  =  N/2-N_f      #Number of dead cycles at no load in rpm
ip1  =  imep*100*l*math.pi/4*d**2*N_f/60*10**-9      #Indicated power at no load in kW
pp_dc  =  mep_dc*100*l*math.pi/4*d**2*N_d/60*10**-9      #Pumping power of dead cycles when no load in kW
fp  =  ip1-pp_dc      #Friction power in kW
ip  =  imep*100*l*math.pi/4*d**2*N/(2*60)*10**-9      #Indicated power at full load in kW
bp  =  ip-fp      #Brake power at full load in kW
eta_m  =  bp/ip      #Mechanical efficiency at full load

#Results:
print " The brake power at full load, b.p.   =   %.2f kW"%(bp)
print " The mechanical efficiency at full load, eta_m   =   %.1f percent"%(eta_m*100)

 The brake power at full load, b.p.   =   13.55 kW
The mechanical efficiency at full load, eta_m   =   84.6 percent


## Example 18.16 Page No : 428¶

In :
import math

#Given:
d  =  200.;l  =  250.      #Bore and stroke in mm
imep  =  4.5*10**5      #Indicated mean effective pressure in N/m**2
m_f  =  7.      #Fuel consumption in kg/hr
CV  =  43500.      #Calorific value in kJ/kg
N  =  180.      #Engine speed in rpm

#Solution:
#(a)
ip  =  imep*l*math.pi/4*d**2*N/60*10**-9*10**-3      #Indicated power in kW
#(b)
eta_it  =  ip*3600/(m_f*CV)      #Indicated thermal efficiency

#Results:
print " a)The indicated power, ip   =   %.1f kW"%(ip)
print " b)The indicated thermal efficiency, eta_it   =   %.1f percent"%(eta_it*100)

 a)The indicated power, ip   =   10.6 kW
b)The indicated thermal efficiency, eta_it   =   12.5 percent