Week 2 Air standard Cycle
Air standard Cycle (Otto Cycle)
Aim
- Study of Otto cycle.
- Develop codes in python for Otto cycle simulator.
- Write program to plot P-V diagram for Otto cycle.
- Also write program to calculate thermal efficiency of the Otto cycle.
Objective
- Understand the concept and theory of Otto cycle.
- Write down the calculation program to calculate all the required entities at each state point.
- Write down the function to generate points for reversible adiabatic process.
- Call the function in main program.
- Lastly, type codes to calculate thermal efficiency.
Otto cycle :-
- An Otto cycle is an idealize thermodynamic cycle that is describe the functioning of a typical spark ignition piston engine.
- It is also called as constant volume cycle
- Therefor, this cycle is use for spark ignition(SI) which is use for petrol engine.
The processes which take place in otto cycle are
[1] - process 1-2 - reversible adiabatic (Isentropic) compression.
[2] - process 2-3 - constant volume heat- addition.
[3] - process 3-4 - reversible adiabatic (Isentropic) Expansion.
[4] - process 4-1 - constant volume heat- rejection.
Firstly, we are going to import required library of python that we are going to use in program.
import math
import matplotlib.pyplot as plt
Process description:-
The system is defined to be the mass of air that’s drawn from the atmosphere into the cylinder, compressed by the piston, heated by the spark ignition of the added fuel, allowed to expand as it pushes on the piston, and finally exhausted back into the atmosphere.
Equation to describe relation between crank angel and volume inside the engine cylinder.
`V/V_c = 1 + 1/2 (r_c - 1)[R + 1 - cos theta - (R^2 - sin^2 theta)^(1/2)]`
By using we will going to get volume trace to plot the reversible adiabatic process in the cylinder.
And using above-mentioned equation we first write the function for our program.
def engine_kinematics(bore, stroke, con_rod, cr, start_crank, end_crank):
"""
Engine Kinematics
"""
# Geometric parameters
a = stroke/2
R = con_rod/a
# Volume parameters
V_s = math.pi*(1/4)*pow(bore,2)*stroke
V_c = V_s/(cr-1)
sc = math.radians(start_crank)
ec = math.radians(end_crank)
num_values = 100
dtheta = (ec-sc)/(num_values-1)
V = []
for i in range(0,num_values):
theta = sc + i*dtheta
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
Provide all the engine input parameter in the program such as inlet pressure p1 and temperaturet1 of air, combustion temperature t3
Also, mention the engine cylinder parameters as per exhibited in the figure which is bore diameter of the cylinder, stroke length of the cylinder, connecting rod length and compression ratio of the engine cylinder.
# inputs
p1 = 101325
t1 = 500
gamma = 1.4
t3 = 2300
# geometric parameters
bore = 0.1
stroke = 0.1
con_rod = 0.15
cr = 8
Now, in bit to find out inlet volume of air we need to calculate the dimensions of Displacement volume or swept volume and clearance volume by using piston dimensions.
`V_s = pi/4 xx b o re^2 xx stroke`
`V_c = V_s/(cr-1)`
`V_1 = V_c + V_s`
# volume computation
V_s = (math.pi/4)*pow(bore,2)*stroke
V_c = V_s/(cr-1)
v1 = V_c + V_s
Process 0-1 Intake stroke - Crank angle (0˚-180˚)
A mass of air (working fluid) is drawn into the cylinder, form 0 to 1, at atmospheric pressure (constant pressure) through the open intake valve, while the exhaust valve is closed during this process. The intake valve close at point 1.
Process 1-2 compression stroke - Crank angle (180˚-0˚)
Piston moves from crank end (BDC, bottom dead center) to cylinder head end (TDC, top dead center) as the working gas with initial state 1 is compressed isentropically to state point2, through compression ratio(v1/v2). Mechanically this is the isentropic compression of the air/fuel mixture in the cylinder, also known as the compression stroke. This isentropic process assumes that no mechanical energy is lost due to friction and no heat is transferred to or from the gas, hence the process is reversible. The compression process requires that mechanical work be added to the working gas. Generally the compression ratio is around 9 - 10(V1:V2) for typical engine.
`V_2 = V_c`
`P_2V_2^gamma = P_1V_1^gamma`
`(P_2V_2)/t_2 = (P_1V_1)/(t_1`
:. `t_2 = (P_2V_2t_1)/(P_1*V_1)`
# State point 2
v2 = V_c
# p2v2^gamma = p1v1^gamma
p2 = p1*pow(v1,gamma)/pow(v2,gamma)
# p2v2/t2 = p1v1/t1 | t2 = p2*v2*t1/(p1*v1)
t2 = p2*v2*t1/(p1*v1)
V_compression = engine_kinematics(bore, stroke, con_rod, cr, 180, 0)
#P_compression*V_compression^gamma = constant
constant = p1*pow(v1,gamma)
P_compression = []
for v in V_compression:
P_compression.append(constant/pow(v,gamma))
Process 2-3 Ignition phase - Crank angle
The piston is momentarily at rest at TDC. During this instant, which is known as the ignition phase, the air/fuel mixture remains in a small volume at the top of the compression stroke. Heat is added to the working fluid by the combustion of the injected fuel, with the volume essentially being held constant. The pressure raises and the ratio (P3/p2) is called the “explosion ratio”.
Process 3-4 expansion stroke - Crank angle (0˚-180˚)
The increased high pressure exerts a force on the piston and pushes it towards the BDC. Expansion of the working fluid takes place isentropically work is done by the system on the piston. The volume ration V4/v3 is called the “isentropic expansion ratio” (For the Otto cycle is the same as the compression ratio V1/V3). Mechanically this expansion of the hot gaseous mixture in the cylinder known as expansion(power) stroke.
`V_3 = V_2`
`(P_3V_3)/t_3 = (P_2V_2)/t_2`
:. `P_3 = (P_2V_2t_3)/(t_2V_3)`
# State point 3
v3 = v2
# p3v3/t3 = p2v2/t2 | p3 = p2*v2*t3/(t2*v3)
p3 = p2*v2*t3/(t2*v3)
V_expansion = engine_kinematics(bore, stroke, con_rod, cr, 0, 180)
#P_expansion*V_expansion^gamma = constant
constant = p3*pow(v3,gamma)
P_expansion = []
for v in V_expansion:
P_expansion.append(constant/pow(v,gamma))
Process 4-1 Idealize heat rejection
The piston is momentarily at rest at BDC. The working gas pressure drop instantaneously form point 4 to point 1 during a constant volume process as heat is removed to an idealized external sink that is bought into contact with the cylinder head. In modern internal combustion engines, the heat-sink may be surrounded air (for low powered engines), or a circulating fluid, such as coolant. The gas returned to state 1.
Process 1-0 Exhaust stroke (180˚-0˚)
The exhaust valve opens at point1. As the piston moves from “BDC” (point 1) to “TDC” (point 0) with the exhaust valve opened, the gaseous mixture is vented to the atmosphere and the process starts a new.
`V_4 = V_1`
`P_4V_4^gamma = P_3P_3^gamma`
`(P_4V_4)/t_4 = (P_3V_3)/t_3`
`:. t4 = (P_4V_4t_3)/(P_3V_3)`
# state point 4
v4 = v1
# p4v4^gamma = p3v3^gamma
p4 = p3*pow(v3,gamma)/pow(v4,gamma)
# p4v4/t4 = p3*v3/t3 | t4 = p4*v4*t3/(p3*v3)
t4 = p4*v4*t3/(p3*v3)
Thermal Efficiency for Otto cycle
The thermal efficiency of the any heat engine is defined as the ratio work it does, W, to the heat input at the high temperature, QH
`ɳ_(th) = W/Q_H`
The thermal efficiency, ɳth, represents the function of heat,QH, that is converted to work. Since energy is conserved according to the first law of thermodynamics and energy cannot be converted to work completely, the heat input, QH, must be equal the work done, W, plus the heat that must be dissipated as waste heat QC, into the environment. Therefore we can rewrite the formula for the thermal efficiency as:
`ɳ_(th) = W/Q_H = (Q_H-Q_C)/Q_H =1-Q_C/Q_H`
The heat absorbed occurs during combustion of fuel-air mixture, when the spark occurs, roughly at constant volume. Since during an isochoric process there is no work done by or on the system, the first law of thermodynamics dictates `∆U = ∆Q`. Therefore the heat added and rejected are given by:
`Q_(add) = mC_v (T3 – T2)`
`Q_(out) = mC_v (T4 – T1)`
Substituting these expressions for the heat added and rejected in the expression for thermal efficiency yields:
`ɳ_(th) =1-(T_4-T_1)/(T_3-T_2)`
We can simplify the above expression using the fact that the processes `1 → 2` and from `3 → 4` are adiabatic and for an adiabatic process the following p,V,T formula is valid:
`[V_2/V_1]^K = [T_1/T_2]^(K/(K-1)`
It can be derived that:
`(T_4-T_1)/(T_3-T_2)=[V_2/V_1]^(K-1)`
In this equation, the ratio `V_1/V_2`is known as the compression ratio, CR. When we rewrite the expression for thermal efficiency using the compression ratio, we conclude the air-standard Otto cycle thermal efficiency is a function of compression ratio and `κ = c_p/c_v`.
`ɳ_(th) =1-(T_4-T_1)/(T_3-T_2) →ɳ_(O t t o) = 1 - 1/C _ r^ (k-1)`
Thermal efficiency for Otto cycle –> κ = 1.4
following are the codes to claculate and print Thermal efficiency of the Otto cycle.
# Thermal Efficiency for Otto cycle
eff = 1 - (1/pow(cr,(gamma-1)))
T_eff = eff * 100
print('Thermal Efficiency= %.2f %%' % (T_eff))
Output of above codes:-
Up to this point we calculated all the state point of the P-V diagram and final we can plot the P-V diagram using those state point using following program.
# Plotting for P-V Diagram
plt.plot([v2,v3],[p2,p3])
plt.plot(V_compression,P_compression)
plt.plot(V_expansion,P_expansion)
plt.plot([v4,v1],[p4,p1])
plt.title('Otto Cycle P-V Diagram',size='16',weight='bold')
plt.xlabel('Volume (m$^3$)',size='12',weight='bold')
plt.ylabel('Pressure (pa)', size='12',weight='bold')
plt.grid(color='b',linestyle=':',linewidth='0.5')
plt.text((v4-0.0005),(p3-600000),'Thermal Efficiency= %.2f %%' % (T_eff),size='12',weight='bold',bbox=dict(boxstyle = "square",facecolor = "white"))
# Lable states
plt.plot(v1,p1,'*')
plt.text(v1,p1,'1')
plt.plot(v2,p2,'*')
plt.text(v2,p2,'2')
plt.plot(v3,p3,'*')
plt.text(v3,p3,'3')
plt.plot(v4,p4,'*')
plt.text(v4,p4,'4')
plt.show()
Output plot of the above program:-
Conclusion :-
- Understood the concept of the Otto cycle and found the values of all the state variable.
- Study about Thermal efficiency of the Otto cycle, finally able to print it in the command window.
- Use function of equation which describe relation between crank angel and volume inside the engine cylinder to plot the P-V diagram.
References:-
[1]The internal combustion engine(Otto Cycle) - https://web.mit.edu/16.unified/www/FALL/thermodynamics/notes/node26.html
[2]Otto Cycle - https://www.youtube.com/watch?v=YkUBDmwbCwk
[3]Thermal Efficiency for Otto Cycle-https://www.nuclear-power.net/nuclear-engineering/thermodynamics/thermodynamic-cycles/otto-cycle-otto-engine/thermal-efficiency-for-otto-cycle/#:~:text=When%20we%20rewrite%20the%20expression,%3D%20cp%2Fcv.&text=A%20typical%20gasoline%20automotive%20engine,to%2030%25%20of%20thermal%20efficiency.
Complete Program:-
"""
otto cycle simulator
"""
import math
import matplotlib.pyplot as plt
def engine_kinematics(bore, stroke, con_rod, cr, start_crank, end_crank):
"""
Engine Kinematics
"""
# Geometric parameters
a = stroke/2
R = con_rod/a
# Volume parameters
V_s = math.pi*(1/4)*pow(bore,2)*stroke
V_c = V_s/(cr-1)
sc = math.radians(start_crank)
ec = math.radians(end_crank)
num_values = 100
dtheta = (ec-sc)/(num_values-1)
V = []
for i in range(0,num_values):
theta = sc + i*dtheta
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
t1 = 500
gamma = 1.4
t3 = 2300
# geometric parameters
bore = 0.1
stroke = 0.1
con_rod = 0.15
cr = 8
# volume computation
V_s = (math.pi/4)*pow(bore,2)*stroke
V_c = V_s/(cr-1)
v1 = V_c + V_s
# State point 2
v2 = V_c
# p2v2^gamma = p1v1^gamma
p2 = p1*pow(v1,gamma)/pow(v2,gamma)
# p2v2/t2 = p1v1/t1 | t2 = p2*v2*t1/(p1*v1)
t2 = p2*v2*t1/(p1*v1)
V_compression = engine_kinematics(bore, stroke, con_rod, cr, 180, 0)
#P_compression*V_compression^gamma = constant
constant = p1*pow(v1,gamma)
P_compression = []
for v in V_compression:
P_compression.append(constant/pow(v,gamma))
# State point 3
v3 = v2
# p3v3/t3 = p2v2/t2 | p3 = p2*v2*t3/(t2*v3)
p3 = p2*v2*t3/(t2*v3)
V_expansion = engine_kinematics(bore, stroke, con_rod, cr, 0, 180)
#P_expansion*V_expansion^gamma = constant
constant = p3*pow(v3,gamma)
P_expansion = []
for v in V_expansion:
P_expansion.append(constant/pow(v,gamma))
# state point 4
v4 = v1
# p4v4^gamma = p3v3^gamma
p4 = p3*pow(v3,gamma)/pow(v4,gamma)
# p4v4/t4 = p3*v3/t3 | t4 = p4*v4*t3/(p3*v3)
t4 = p4*v4*t3/(p3*v3)
# Thermal Efficiency for Otto cycle
eff = 1 - (1/pow(cr,(gamma-1)))
T_eff = eff * 100
print('Thermal Efficiency= %.2f %%' % (T_eff))
# Plotting for P-V Diagram
plt.plot([v2,v3],[p2,p3])
plt.plot(V_compression,P_compression)
plt.plot(V_expansion,P_expansion)
plt.plot([v4,v1],[p4,p1])
plt.title('Otto Cycle P-V Diagram',size='16',weight='bold')
plt.xlabel('Volume (m$^3$)',size='12',weight='bold')
plt.ylabel('Pressure (pa)', size='12',weight='bold')
plt.grid(color='b',linestyle=':',linewidth='0.5')
plt.text((v4-0.0005),(p3-600000),'Thermal Efficiency= %.2f %%' % (T_eff),size='12',weight='bold',bbox=dict(boxstyle = "square",
facecolor = "white"))
# Lable states
plt.plot(v1,p1,'*')
plt.text(v1,p1,'1')
plt.plot(v2,p2,'*')
plt.text(v2,p2,'2')
plt.plot(v3,p3,'*')
plt.text(v3,p3,'3')
plt.plot(v4,p4,'*')
plt.text(v4,p4,'4')
plt.savefig('P-V.jpg')
plt.show()
Output Result