Project

Understanding the engine kinematics of OTTO Cycle using python programming

AIM:

To understand the engine kinematics of an OTTO Cycle using python programming.

THEORY:

The OTTO Cycle is an air standard cycle of the SI Engine. It is called as the constant volume cycle where the heat additon is carried out at constant volume. The operations which takes place in the cycle are:

  • Process 1-2,Intake: The inlet valve opens, the piston moves to the right, admitting air-fuel mixture into the cylinder at constant pressure.
  • Process 2-3,Compression: Both the valves are closed, the piston compresses the combustible mixture to the minimum volumes.
  • Process 3-4,Combustion: The mixture is ignited by means of a spark, combustion takes place, and there is an increase in temprerature and pressure.
  • Process 4-5,Expansion: The products of combustion do wrk on the piston which move to the right, and the pressure and the temperature of the gases decrease.
  • Process 5-6,Blow down: The exhaust valve opens, and the pressure drops to the initial pressure.
  • Process 6-1,Exhaust: With the exhaust valve open, the piston moves inward to expel the combustion products from the cylinder at constant pressure.

TERMS AND FORMULAS USED:

  • If air is the working fluid in a cycle. It is called as air standard cycle.
  • Top Dead Center(TDC): Top most position of the piston in the cylinder is TDC.
  • Bottom Dead Center(BDC):Bottom most position in a cylinder is the BDC.
  • Stroke: Distance between TDC to BDC is Stroke.
  • Clearance Volume: The minimum volume occupied by the cylinder when the piston is sweeped from TDC to BDC.
  • Stroke Volume: The maximum volume occupied by the cylinder when then piston is sweeped from TDC to BDC.
  • Formula for Stroke Volume:

`Vs = frac{pi}{4}cdotd^2cdotLs`

Where, d = Bore (Internal diameter of the cylinder) or (piston diameter)

Ls = Stroke length

  • Compression ratio (Rc) : It is the ratio of volume before compression and volume after compression. The formula is as stated:

`Rc = frac{V1}{V2}`

`Rc = frac{Vs+Vc}{Vc}`

`Vc = frac{Vs+Vc}{Rc}`

`Vc - frac{Vc}{Rc} = frac{Vs}{Rc}`

`frac{Vc(Rc-1)}{Rc} = frac{Vs}{Rc}`

`Vc = frac{Vs}{Rc-1}`

This is the formula used in the python program to compute the volume of the engine.

  • Petrol engine compression ratio various from 8 to 12.
  • Diesel engine compression ratio various from 15 to 21.

ASSUMPTIONS OF AIR STANDARD CYCLE:

  • When air is a working fluid, it does not undergo any phase change.
  • When air is a working fluid, it obeys all the gas law.
  • All the process in all the cycles are reversible and frictionless.
  • The propertis of air is alwas constant.

Efficiency expression of an OTTO Cycle:

  • 1.Isentropic compression: `pcdotv^gamma= C`

`frac{T2}{T1} = (frac{V1}{V2})^(gamma-1)`

  • 2.Constant Volume Heat Addition:

`Qs = mcdotCvcdot(T3-T2)`

  • Using the equation of state:

`frac{P2cdotV2}{T2} = frac{P3cdotV3}{T3} = rhs`

  • Using this equation we can find the values of P2 and T2.
  • 3.Isentropic expansion

`PcdotV^gamma = C`

  • `frac{T4}{T3} = (frac{V3}{V4})^(gamma-1)`
  • 4.Constant volume heat rejection:

`frac{P3cdotV3}{T3} = frac{P4cdotV4}{T4} = rhs`

  • Using this equation we can find the values of P4 and T4.
  • The thermal efficieny formula is found out as:
  • `eta = frac{1}{Rc^(gamma-1)}`

Governing Equation:

1. `frac{V}{Vc} = 1 +(Rc -1)[ R +1 cos(theta) - (R^2 - sin^2(theta)^frac{1}{2}]`

Here, `theta =` crank angle

R = Length of Connecting rod

Rc = compression ratio

PYTHON CODE:

#Understanding the simulation the OTTO Cycle

#Importing necessary libraries
import math
import matplotlib.pyplot as plt 

#Inputs

p1 = 101325 #(Unit:Pascal)

t1 = 500 #(Unit:Kelvin)

gamma = 1.4

t3 = 2300 #(Unit:Kelvin)

#Geometric Parameters
bore = 0.10 #(Unit:meter)

stroke = 0.1 #(Unit:meter)

con_rod = 0.15 #(Unit:meter)

cr = 12 #(Unit:Compression Ratio)

a = stroke/2 #(a = crank pin)

R = con_rod/a #(Constant)

theta = math.radians(180) #(theta is in radians)

#Volume Computation
v_s = (math.pi/4) * pow(bore,2) * stroke

v_c = v_s/(cr-1)

v1 = v_s + v_c 

#State point 2

v2 = v_c

#p1v1^gamma = p2v2^gamma

p2 = p1*pow(v1,gamma)/pow(v2,gamma)



# p1*v1/t1 = p2*v2/t2 | rhs = p1*v1/t1 | p2*v2/t2 = rhs | t2 = p2*v2/rhs

rhs = p1*v1/t1

t2 = p2*v2/rhs

# State point 3

v3 = v2

#p2*v2/t2 = p3*v3/t3 | rhs = p2*v2/t2 | p3 = rhs*t3/v3

rhs = p2*v2/t2

p3 = rhs*t3/v3

# State point 4

v4 = v1

# p4*v4^gamma = p3*v3^gamma

p4 = p3*pow(v3,gamma)/pow(v4,gamma)

print(p4)

# p3*v3/t3 = p4*v4/t4 | rhs = p3*v3/t3 | t4 = p4*v4/rhs

rhs = p3*v3/t3

t4 = p4*v4/rhs

plt.plot([v1,v2,v3,v4,v1],[p1,p2,p3,p4,p1])
plt.xlabel('VOLUME')
plt.ylabel('PRESSURE')
plt.show()




 

OUTPUT GRAPH:

But this isnt the output that is expected. Instead we have to modify the code to get the exact graph of the OTTO Cycle.

PYTHON CODE:

#Understanding the simulation the OTTO Cycle

#Importing necessary libraries
import math
import matplotlib.pyplot as plt 
import numpy as np 

def engine_kinematics(bore,stroke,con_rod,cr,start_crank,end_crank):

	#Geometric Parameters

	a = stroke/2 #(a = crank pin)

	R = con_rod/a #(Constant)

	theta = math.radians(180) #(theta is in radians)

	#Volume Computation
	v_s = (math.pi/4) * pow(bore,2) * stroke

	v_c = v_s/(cr-1)

	sc = math.radians(start_crank)

	ec = math.radians(end_crank)

	num_values = 50

	dtheta = (ec-sc)/(num_values - 1)

	V = []

	

	for i in range(0,num_values):

		theta = sc + i*dtheta

		#Breaking down the governing equation into 3 parts

		term1 = 0.5*(cr-1)
		term2 = R + 1 - math.cos(theta)
		term3 =   pow(R,2) - pow( math.sin(theta),2)
		term3 = pow(term3,0.5)
		V.append((1 + term1 * (term2 - term3)) * v_c)

	return V 	
		
		

    
#Inputs

p1 = 101325 #(Unit:Pascal)

t1 = 500 #(Unit:Kelvin)

gamma = 1.4

t3 = 2300 #(Unit:Kelvin)

#Engine Parameters

bore = 0.10 #(Unit:meter)

stroke = 0.1 #(Unit:meter)

con_rod = 0.15 #(Unit:meter)

cr = 12 #(Unit:Compression Ratio)



#Volume Computation

v_s = (math.pi/4) * pow(bore,2) * stroke

v_c = v_s/(cr-1)

v1 = v_s + v_c

#State point 2

v2 = v_c

#p1v1^gamma = p2v2^gamma

p2 = p1*pow(v1,gamma)/pow(v2,gamma)

# p1*v1/t1 = p2*v2/t2 | rhs = p1*v1/t1 | p2*v2/t2 = rhs | t2 = p2*v2/rhs

rhs = p1*v1/t1

t2 = p2*v2/rhs

V_compression = engine_kinematics(bore,stroke,con_rod,cr,180,0)

constant = p1*pow(v1,gamma)

P_compression = []

for v in V_compression:
	P_compression.append(constant/pow(v,gamma))

# State point 3

v3 = v2

#p2*v2/t2 = p3*v3/t3 | rhs = p2*v2/t2 | p3 = rhs*t3/v3

rhs = p2*v2/t2

p3 = rhs*t3/v3

V_expansion = engine_kinematics(bore,stroke,con_rod,cr,0,180)

constant = p3*pow(v3,gamma)

P_expansion = []

for v in V_expansion:
	P_expansion.append(constant/pow(v,gamma))

# State point 4

v4 = v1

# p4*v4^gamma = p3*v3^gamma

p4 = p3*pow(v3,gamma)/pow(v4,gamma)

# p3*v3/t3 = p4*v4/t4 | rhs = p3*v3/t3 | t4 = p4*v4/rhs

t4 = p4*v4/rhs

V = engine_kinematics(bore,stroke,con_rod,cr,180,0)

plt.plot([v2,v3],[p2,p3])
plt.plot([v4,v1],[p4,p1])
plt.plot(V_compression,P_compression)
plt.plot(V_expansion,P_expansion)
plt.xlabel('VOLUME')
plt.ylabel('PRESSURE')
plt.savefig('Otto cycle 2')
plt.show()

eta = (1-t1/t2)*100
print("Efficiency = ",eta)

OUTPUT GRAPH:

EFFIECIENY OF THE CYCLE:

RESULT:

From this report we can conclude that the engine kinematics of an OTTO Cycle is understood using python programming.

REFERENCES:

1. P.K. Nag - Engineering Thermodynamics

2. B. Ramnatham - Engineering Thermodynamics.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.