In [2]:

```
from __future__ import division
from math import pi
#Variable Declaration:
r1 = 1.2 #L/D ratio:
D = 0.12 #Cylinder diameter(in m):
A = 30*10**(-4) #Area of indicated diagram(in m**2):
k = 20*10**3 #Spring constant(in kN/m**2):
N = 2000 #Rpm of engine:
r = 0.10 #Percentage power lost:
#Calculations:
L = r1*D #Stroke length(in m):
l = L/2 #Length of indicator diagram(in m):
mep = A*k*10**3/l #Mep(in N/m**2):
A2 = pi*D**2/4 #Cross-sectional area of piston(in m**2):
IP = 4*mep*A2*L*N/(2*60) #Total indicated power for 4 cylinders(in W):
FP = r*IP #Fricitional loss(in W):
BP = IP-FP #Brake power available(in W):
nm = BP/IP*100 #Mechanical efficiency:
#Results:
print "Indicated power: ",round(IP,1),"W"
print "Mechanical efficiency: ",round(nm,2),"%"
```

In [4]:

```
from __future__ import division
from math import pi
#Variable Declaration:
A = 40*10**(-4) #Indicator diagram area & length(in m**2 & m):
l = 0.08
D = 0.15 #Bore(in m):
L = 0.20 #Stroke(in m):
N = 100 #Rpm of motor:
#Calculations:
k = 1.5*10**8 #Spring constant(in Pa/m):
mep = A*k/l #Mep(in Pa):
IP = (pi*D**2/4*L*mep*N/60*2)/10**3 #Indicated power(in kW):
#Results:
print "Power required to drive: ",round(IP,2),"kW"
```

In [7]:

```
from __future__ import division
#Variable Declaration:
nm = 0.90 #Mechanical efficiency:
BP = 38 #Rating(in kW):
#Calculations:
IP = BP/nm #Indicated power(in kW):
FP = IP-BP #Fricitional loss(in kW):
BP1 = 0.25*BP #Brake power at quater load(in kW):
nm1 = BP1/(BP1+FP)*100 #Mechanical efficiency:
#Results:
print "Indicated power: ",round(IP,2),"W"
print "Fricitonal power loss: ",round(FP,2),"kw"
print "Mechanical efficiency: ",round(nm1,2),"%"
```

In [9]:

```
from __future__ import division
from math import pi
#Variable Declaration:
m1 = 0.25 #Specific fuel consumption(in kg/kW.h):
pbmep = 1.5*10**3 #Brake mean effective pressure(in kPa):
N = 100 #Speed of engine(in rpm):
D = 0.85 #Bore of cylinder(in m):
L = 2.20 #Stroke(in m):
C = 43*10**3 #Calorific value of diesel(in kJ/kg):
BP = pbmep*L*(pi*D**2/4)*N/60 #Brake power of engine(in kW):
m = m1*BP #Fuel consumption(in kg/hr):
q = m*C/3600 #Heat from fuel(in kJ/s):
nb = BP/q*100 #Brake thermal efficiency:
#Results:
print "Brake power: ",round(BP/100,2),"MW"
print "Fuel consumption rate: ",round(m,2),"kg/hr"
print "Brake thermal efficiency: ",round(nb,2),"%"
```

In [12]:

```
from __future__ import division
from math import pi
#Variable Declaration:
pb = 6*10**2 #Effective pressure(in kPa):
N = 600 #Speed:
m1 = 0.25 #Specific fuel consumption(in kg/kW.h)
D = 0.20 #BOre(in m):
L = 0.30 #Stroke length(in m):
r = 26 #Air fuel ratio:
C = 43*10**3 #Calorific value(in kJ/kg):
R = 0.287 #Gas constant(in kJ/kg.K):
p = 1*10**2 #kPa #Ambient conditions:
T = 300 #K
#Calculation:
nb = 3600/(m1*C)*100 #Brake thermal efficiency:
BP = 4*pb*L*(pi*D**2/4)*N/60 #Brake power(in kW):
ma = m1*BP*r/60 #Air consumption rate(in kg/min):
Va = ma*R*T/p #Volume(in m**3/min):
Vs = pi*(0.3)**2*0.4/4 #Swept volume(in m**3):
nv = Va/(Vs*N/2*4)*100 #Volumetric efficiency:
#Results:
print "Brake thermal efficiency: ",round(nb,2),"%"
print "Brake power: ",round(BP,2),"kW"
print "Volumetric efficiency: ",round(nv,2),"%"
```

In [15]:

```
from __future__ import division
from math import pi,sqrt
#Variable Declaration:
n = 0.7 #Volumetric efficiency
r = 19 #Air fuel ratio:
N = 3000 #Speed(in rpm):
m = 5 #Fuel consumption rate(in litres/hr):
sg = 0.7 #Specific gravity:
s = 500 #Piston speed(in m/min):
p = 6*10**2 #Mep(in kPa):
R = 0.287 #Gas constant(in kJ/kg.K):
nm = 0.8 #Mechanical efficiency:
#Calculations:
L = s/(2*N) #Stroke length(in m):
ma = r*m*sg/60 #Air requirement(in kg/min):
Va = ma*R*288/(1.013*10**2) #Volume of air sucked(in m**3/min):
D = sqrt(Va*4/(pi*L*N*2*n)) #Bore diameter(in m):
IP = p*L*(pi*D**2/4*N*2)/60 #Indicated power(in kW):
BP = IP*nm #Brake power(in kW):
#Results:
print "Brake power: ",round(BP,2),"KW"
```

In [17]:

```
from __future__ import division
from math import pi
#Variable Declaration:
FP = 5 #Friction power(in kW):
N = 3000 #Rpm:
D = 0.20 #Bore(in m):
L = 0.30 #Stroke(in m):
m = 0.15 #Fuel supplied at rate(in kg/min):
F = 20 #Load(in kg):
r = 0.5 #Radius(in m):
C = 43000 #Calorific value of fuel(in kJ/kg):
g = 9.81 #Acceleration due to gravity(in m/s**2):
#Calculations:
BP = 2*pi*N*(F*g*r*10**(-3))/60 #Brake power(in kW):
IP = BP+FP #Indicated power(in kW):
nm = BP/IP #Mechanical efficiency:
BSFC = m*60/BP #BSFC(in kg/kW.hr):
nbth = 3600/(BSFC*C)*100 #Brake thermal efficiency:
nith = nbth/nm #Indicated thermal efficiency:
Pimep = IP/(L*(pi*D**2/4)*N/60) #Indicated mep(in kPa):
Pbmep = Pimep*nm #Brake mep(in kPa):
#Results:
print "Brake power: ",round(BP,2),"KW"
print "Indicated power: ",round(IP,2),"KW"
print "Mechanical efficiency: ",round(nm*100,2),"%"
print "Brake thermal efficiency: ",round(nbth,2),"%"
print "Indicated thermal efficiency: ",round(nith,2),"%"
print "Brake mean effective pressure: ",round(Pbmep,2),"kPa"
print "Indicated mean effective pressure: ",round(Pimep,2),"kPa"
```

In [19]:

```
from __future__ import division
from math import pi
#Variable Declaration:
N = 300 #Speed(in rpm):
BP = 250 #Brake power(in kW):
D = 0.30 #Bore diameter(in m):
L = 0.25 #Stroke length(in m):
m = 1 #Fuel consumption rate(in kg/min):
r = 10 #Air fuel ratio:
C = 43000 #Calorific value of fuel(in kJ/kg):
#Calculations:
Pimep = 0.8*10**3 #Indicated mep(in kPa):
R = 0.287 #Gas constant(in kJ/kg.K):
IP = Pimep*L*(pi*D**2/4)*N*4/60 #Indicated power(in kW):
nm = BP/IP #Mechanical efficiency:
BSFC = m*60/BP #BSFC(in kg/kW.hr):
nbth = 3600/(BSFC*C)*100 #Brake thermal efficiency:
Vs = pi*D**2*L/4 #Swept volume(in m**3):
ma = round(1.013*10**2*Vs/(R*300),2)#Mass of air(in kg):
nv = m*r/(ma*4*N/2)*100 #Volumetric efficiency:
#Results:
print "Indicated power: ",round(IP,2),"kW"
print "Mechanical efficiency: ",round(nm*100,2),"%"
print "Brake thermal efficiency: ",round(nbth,2),"%"
print "Volumetric efficiency: ",round(nv,2),"%"
```

In [21]:

```
from __future__ import division
from math import pi
#Variable Declaration:
k = 25 #Indicator constant(in kN/m**2):
N = 300 #Rpm:
Vs = 1.5*10**(-2) #Swept volume(in m**3):
F = 60 #Load(in kg):
r = 0.5 #Radius(in m):
C = 43000 #Calorific value of fuel(in kJ/kg):
g = 9.81 #Acceleration due to gravity(in m/s**2):
m = 0.12 #Fuel supplied at rate(in kg/min):
Pimep = 10*k #Indicatedmep(in kPa):
IP = Pimep*Vs*N/(2*60) #Indicated power(in kW):
BP = 2*pi*N/(2*60)*(F*g*r)*10**(-3) #Brake power(in kW):
nm = BP/IP #Mechanical efficiency:
#Results:
print "Indicated power: ",round(IP,2),"kW"
print "Brake power: ",round(BP,2),"W"
print "Mechanical efficiency: ",round(nm*100,2),"%"
```

In [23]:

```
from __future__ import division
from math import pi
#Variable Declaration:
k = 25 #Indicator constant(in kN/m**2):
N = 300 #Rpm:
Vs = 1.5*10**(-2) #Swept volume(in m**3):
F = 60 #Load(in kg):
r = 0.5 #Radius(in m):
C = 43000 #Calorific value of fuel(in kJ/kg):
g = 9.81 #Acceleration due to gravity(in m/s**2):
m = 0.12 #Fuel supplied at rate(in kg/min):
Pimep = 10*k #Indicatedmep(in kPa):
IP = Pimep*Vs*N/(2*60) #Indicated power(in kW):
BP = 2*pi*N/(2*60)*(F*g*r)*10**(-3) #Brake power(in kW):
nm = BP/IP #Mechanical efficiency:
#Results:
print "Indicated power: ",round(IP,2),"kW"
print "Brake power: ",round(BP,2),"W"
print "Mechanical efficiency: ",round(nm*100,2),"%"
```

In [25]:

```
from __future__ import division
from math import pi
#Variable Declaration:
N = 1500 #Speed of engine(in rpm):
T = 300 #Brake torque(in Nm):
m = 4 #Fuel consumed(in kg):
m1 = 15 #Cooling water circulated(in kg/min):
C = 42000 #Calorific value of fuel(in kJ/kg):
nm = 0.90 #Mechanical efficiency:
#Calculations:
BP = 2*pi*N*T/(60*10**3) #Brake power(in kW):
BSFC = m*60/(m1*BP) #BSFC(in kg/kW.hr):
IP = BP/nm #Indicated power(in kW):
nith = IP/(m*C/(m1*60))*100#Indicated thermal efficiency:
#Results:
print "Brake power: ",round(BP,2),"W"
print "Brake specific fuel consumption: ",round(BSFC,2),"kg/kW.hr"
print "Indicated thermal efficiency: ",round(nith,2),"%"
```