#given
bsfc=0.3 #The brake specific fuel consumption in kg/kWh
bp=250 #The brake power in kW
N=1500 #Number of cycles per min in rpm
CA=15 #Crank angle in degrees
pi1=30 #The pressure of air in the cylinder at the beginning of the injection in bar
pi2=60 #The pressure of air in the cylinder at the end of the injection in bar
pf1=220 #The fuel injection pressure at the beginning in bar
pf2=550 #The fuel injection pressure at the end in bar
Cd=0.65 #The coefficient of discharge for the injector
df=850 #The density of the fuel in kg/m**3
p1=1.013 #The atmospheric pressure in bar
n=4.0 #The number of orifices used in the nozzle
x=6.0 #Number of cylinders
#Calculations
import math
mf=bsfc*bp/60.0
F=(mf/(N/2.0))*(1/x)
s=(CA/360.0)/(N/60.0)
mf1=F/s
p1=pf1-pi1
p2=pf2-pi2
pa=(p1+p2)/2.0
Af=(mf1/(Cd*(2*df*pa*10.0**5)**(1/2.0)))*10**6
do=((Af/n)*(4/math.pi))**(1/2.0)
#Output
print"The nozzle area required per injection = " ,round(Af,3),"mm**2"
print"The diameter of the orifice = ",round(do,3), "mm"
#given
bp=30 #The brake power of the engine in kW
N=3000 #The engine speed in rpm
bsfc=0.28 #The brake specific fuel consumption in kg/kWh
Api=35
p2=160 #The pressure at which fuel is injected in bar
CA=28 #The crank angle in degrees
p1=35 #The pressure in the combustion chamber in bar
Cv=0.92 #The coefficient of velocity
#Calculations
import math
S=141.5/(131.5+Api)
df=S*1000
D=(CA/360.0)/(N/60.0)
F=(bsfc*bp)/((N/2.0)*60)
mf=F/D
Cf=Cv*((2*(p2-p1)*10**5)/df)**(1/2.0)
Af=(mf/(df*Cf))*10**6
d=(4*Af/math.pi)**(1/2.0)
#Output
print"The velocity of injection of the fuel = ",round(Cf,1),"m/s "
print"The diameter of the fuel orifice = ",round(d,3)," mm "
#given
d=0.8*10**-3 #The diameter of an orifice in m
A=1.65*10**-6 #The cross sectional area in m**2
Cd=0.9 #The discharge coefficient of the orifice
Cp=0.85 #The coefficient of the passage
p1=170 #The injection pressure in bar
p2=25 #The compression pressure of the discharge in bar
df=850 #The density of the fuel in kg/m**3
#Calculations
Q=((145/(22.931*10.0**9))**(1/2.0))*10**6
p=170-(2.161*10**9*(Q/10.0**6)**2)
Cf=Cd*((2*(p-p2)*10**5)/df)**(1/2.0)
#Output
print"The discharge of fuel through the injector = ",round(Q,1),"cm**2/s"
print"The jet velocity through the orifice = ",round(Cf,1)," m/s"
#given
s=20 #Spray penetration in cm
t1=15.7 #The spray penetration of 20 cm in ms
pi1=150 #The injection pressure in bar
pi2=450.0 #The injection pressure to be used in bar
p2=15 #The combustion chamber pressure in bar
d1=0.34 #The diameter of the orifice in mm
s1=20 #The penetration for an orifice in cm
d2=0.17 #If the diameter of the orifice in cm
t11=12 #The spray penetration in ms
#Calculations
t2=(t1*(pi1-p2)**(1/2.0))/(pi2-p2)**(1/2.0)
s2=d2*(s1/d1)
t21=t11*(d2/d1)
#Output
print"(a) The time required for the spray to penetrate = ",round(t2,3),"ms"
print"(b) The spray penetration of the orifice = ",round(s2,3),"cm"
print"The time required for the spray to penetrate = ",round(t21,3),"ms"
#given
v=6.5 #The volume of fuel in the barrel in cc
d=0.3 #The dimeter of fuel pipe line in cm
l=65 #The length of the fuel pipe line in cm
vi=2.5 #The volume of fuel in the injection valve in cc
K=78.5*10**-6 #The coefficient of compressibility of the oil per bar
p1=1 #The atmospheric pressure in bar
p2=180 #The pressure due to pump in bar
v3=0.1 #The pump displacement necessary for the fuel in cc
e=0.75 #The effective stroke of the plunger in cm
#Calculations
import math
V1=v+((math.pi*d**2)/4.0)*l+vi
V=K*V1*(p2-p1)
T=(V)+v3
L=T*(4/math.pi)*(1/(e**2))
#Output
print"(a) The total displacement of the plunger = ",round(T,3),"cc"
print"(b) The effective stroke of the plunger = ",round(L,3),"cm"
#given
n=4.0 #Number of cylinders
N=2500 #The engine speed in rpm
P=90 #The power produced by the engine in kW
bsfc=0.28 #The brake specific fuel consumption in kg/kWh
v=3.5 #The volume of fuel in the barrel in cc
vp=2.5 #Volume of fuel in the pipe line in cc
vi=2.0 #The fuel inside the injector in cc
p1=280.0 #The average injection pressure in bar
p2=30.0 #The compression pressure of air during injection in bar
df=850.0 #The density of the fuel in kg/m**3
K=80*10**-6 #The coefficient of compressibility of fuel per bar
pi=1.0 #The pressure with which fuel enter into the barrel in bar
#Calculations
import math
F=(bsfc*P)/((N/2.0)*60)
F1=F/n
Vf=(F1/df)*10**6
V1=v+vp+vi
V=K*V1*(p1-math.pi)
Vp=Vf+V
W=((1/2.0)*(p1-math.pi)*10**5*V*10**-6)+((p1-p2)*10**5*Vf*10**-6)
P1=(W*N)/(2*60*1000) #Power lost per cylinder in kW
P2=P1*4 #Total power lost for pumping the fuel in kW
#Output
print"The displacement volume of one plunger per cycle = ",round(Vp,3),"cc"
print"Total power lost for pumping the fuel = ",round(P2,3),"kW"
#given
v1=0.3 #Velocity of the pump plunger in m/s
l=0.575 #The length of the fuel pipe in m
A=1/20.0 #The cross sectional area of pipe to the plunger cylinder
a=1/40.0 #The area of nozzle hole to the pipe
p1=27.6 #Initial pressure in the line in bar
p2=27.6 #The compression pressure of the engine
K=17830*10**5 #The bulk modulus of fuel in N/m**2
df=860.0 #The density of the fuel in kg/m**3
#Calculations
Vs=(K/df)**(1/2.0)
t=l/Vs
Vp=(1/A)*v1
p=((K/Vs)*Vp)/10.0**5
pi=p+p1
po=p1+p
vc=Vp-(a*((2*(po-p2))/df)**(1/2.0))
pr=26.8 #By trial , Pressure
Vc=pr*(Vs/(K/10.0**5))
po1=p1+p+pr
vo=a*((2*(po1-p2)*10**5)/df)**(1/2.0)
#Output
print"(a)The velocity of the pressure disturbance = ",round(Vs,0),"m/s"
print"(b) The time taken by the disturbance to travel through the pipe line = ",round(t,4)," s"
print"(c) The velocity at the pump end of the pipe line as the plunger moves = ",round(Vp,2)," m/s"
print"The pressure at the pump end of pipe line as the plunger moves = ",round(pi,2),"bar"
print"(d)The magnitude of the first reflected pressure = ",round(pr,2),"bar"
print"The magnitude of the first reflected velocity wave =",round(Vc,2),"m/s"
print"(e)The pressure at the oriface end of the pipe line after the first reflection = ",round(po1,1),"bar"
print"The velocity at the oriface end of the pipe line after the first reflection = ",round(vo,2)," m/s "