import math
from numpy import array
#Input data
s = 0.005 #Delay in sec
d = 30. #Bore in cm
N = 600. #Speed in r.p.m
dx = array([10,15,20]) #Bore diameters in cm
#Calculations
t = (s/d)*dx #Time of delay in sec. In textbook, t[1] is given wrong as 0.00025 sec instead of 0.0025 sec
#Output
print 'The delay time for %i cm diameter bore is %3.5f sec \
\nThe delay time for %i cm diameter bore is %3.5f sec \
\nThe delay time for %i cm diameter bore is %3.5f sec'%(dx[0],t[0],dx[1],t[1],dx[2],t[2])
import math
#Input data
d = [15.,60.] #Bore in cm
N = [1600.,400.] #Speed in r.p.m respectively
q = 30. #Injection of oil occupies 30 degrees of crank travel in each case
pc = 30. #Compression pressure in kg/cm**2
d = 0.001 #Delay time in sec
rp = 5. #Rapid combustion period is 5 degree of crank travel
pe = 60. #Compression pressure at the end of rapid compression in kg/cm**2
#Calculations
#For small engine
It1 = (60/N[0])*(q/360) #Injection time in sec
pf1 = ((d/It1)+(rp/pc))*100 #Percent fuel
#For large engine
It2 = (60/N[1])*(q/360) #Injection time in sec
pf2 = ((d/It2)+(rp/pc))*100 #Percent fuel
pr = (pc*(pf2/pf1)) #Pressure rise in kg/cm**2
mp = (pc+pr) #Maximum pressure in kg/cm**2
#Output
print 'Pressure in the large engine is %3.1f kg/cm**2'%(mp)
import math
#Input data
n = 4. #Number of cylinders
d = 105. #Bore in mm
l = 127. #Stroke in mm
BHP = 63. #Brake horse power in h.p
N = 1800. #Speed in r.p.m
t = 15. #Test time in min
mf = 2.75 #Mass of fuel in kg
CV = 11000. #Calorific value in kcal/kg
af = 14.8 #Air fuel ratio
v = 0.805 #Specific volume in m**3/kg
nv = 80. #Volumetric efficiency in percent
J = 427. #Mechanical equivalent of heat in kg.m/kcal
#Calculations
bth = ((BHP*4500)/(J*(mf/t)*CV))*100 #Brake thermal efficiency in percent
Vs = ((3.14/4)*(d/10)**2*(l/10)) #Stroke volume in c.c
Vsw = (Vs*n*(N/2)*t) #Swept volume in c.c
Va = (Vsw*10**-6*(nv/100)) #Volume of air sucked in m**3
wa = (Va/v) #Weight of air sucked in kg
wr = (af*mf) #Weight of air reqired in kg
pei = (wr/wa)*100 #Percentage of air available for combustion
#Output
print 'Brake thermal efficiency is %3.1f percent \
\nThe percentage of air used for combustion is %i percent'%(bth,pei)