Air Standard Cycle or Otto Cycle Simulation using MATLAB
OBJECTIVE:
The objective of this project is to simulate a P-V diagram of Air Standard Cycle or Otto Cycle and finding the thermal efficiency of the engine using MATLAB.
THEORY:
- OTTO CYCLE:
The Otto cycle was developed by German engineer Nikolaus Otto in 1876. This cycle is very similar to the Diesel cycle, except that the Otto cycle forms the basis of a spark-ignition (S.I.) engine, which requires a spark to begin combustion of fuel.
The Otto cycle is a description of what happens to a mass of gas as it is subjected to changes of pressure, temperature, volume, addition of heat, and removal of heat. The mass of gas that is subjected to those changes is called the system. The system, in this case, is defined to be the fluid (gas) within the cylinder. By describing the changes that take place within the system, it will also describe in inverse, the system's effect on the environment. In the case of the Otto cycle, the effect will be to produce enough net work from the system so as to propel an automobile and its occupants in the environment.
P-V Diagram of Otto Cycle:
- Process 0–1 a mass of air is drawn into piston/cylinder arrangement at constant pressure.
- Process 1–2 is an adiabatic (isentropic) compression of the charge as the piston moves from bottom dead centre (BDC) to top dead centre (TDC).
- Process 2–3 is a constant-volume heat transfer to the working gas from an external source while the piston is at top dead centre. This process is intended to represent the ignition of the fuel-air mixture and the subsequent rapid burning.
- Process 3–4 is an adiabatic (isentropic) expansion (power stroke).
- Process 4–1 completes the cycle by a constant-volume process in which heat is rejected from the air while the piston is at bottom dead centre.
- Process 1–0 the mass of air is released to the atmosphere in a constant pressure process.
- ENGINE GEOMETRY:
1) Bore: The Bore is basically engine cylinder diameter in mm.
2) Stroke: The Stroke is the distance between Top Dead Centre(TDC) and Bottom Dead Centre(BDC) in mm.
3) Connecting Rod Length(Con-Rod): As the name stats it is basically the length of the connecting rod in mm.
4) Compression Ratio(Cr): The compression ratio is the ratio of the volume of the cylinder and the combustion chamber when the piston is at the bottom, and the volume of the combustion chamber when the piston is at the top.
`C_r=(V_s+V_c)/V_c`
5) Swept Volume(Vs): It is the total volume swept by the piston during its motion between TDC and BDC.
`V_s=(pi/4)*(bore)^2*stroke`
6) Clearance Volume(Vc): It is the volume obtained in the combustion chamber during the combustion stroke were the piston is very close to the TDC of the IC engine.
`V_c=V_s / (cr-1)`
7) Crank Angle(`theta`): It is the angle obtained when the crankshaft rotates during the piston motion from either TDC to BDC or BDC to TDC in degrees.
- THERMAL EFFICIENCY:
Thermal efficiency, ηth, of any heat engine is defined as the ratio of the work it does, W, to the heat input at the high temperature, QH.
`eta_(th)= W/Q_h`
PROGRAM:
- MAIN PROGRAM:
%Inputs
gamma=1.4
t3= 2600
%state variables
p1= 101325
t1= 700
%Engine geometric parameters
bore= 0.25;
stroke= 0.25;
con_rod= 0.3;
cr= 10;
% calculating the swept volume and clearance volume
v_swept= (pi/4)*bore^2*stroke;
v_clearance=v_swept/(cr-1);
v1= v_swept + v_clearance
v2= v_clearance
%state variables at state point 2
%p2v2^gamma= p1v1^gamma
%p2=p1*(v1/v2)^gamma = p1*cr^gamma
p2= p1*cr^gamma;
%p1v1/t1 = p2v2/t2| t2=p2*v2*t1/(p1*v1)
t2=p2*v2*t1/(p1*v1);
constant_c= p1*v1^gamma;
V_compression= engine_kinematics(bore,stroke,con_rod,cr,180,0);
P_compression = constant_c./V_compression.^gamma;
%state variables at state point 3
v3= v2
%p3v3/t3=p2v2/t2| p3=p2*t3/t2
p3=p2*t3/t2
constant_c= p3*v3^gamma;
V_expansion= engine_kinematics(bore,stroke,con_rod,cr,0,180 );
P_expansion = constant_c./V_expansion.^gamma;
%state variables at state point 4
v4= v1
%p3v3^gamma= p4v4^gamma | p4= p3*(v3/v4)^gamma
p4= p3*(v3/v4)^gamma
%p4v4/t4=p3v3/t3 | t4= (p4*v4*t3)/(p3*v3)
t4= (p4*v4*t3)/(p3*v3);
%thermal_efficiency= 1-((t4-t1)/(t3-t2))
thermal_efficiency= 1-((t4-t1)/(t3-t2))
figure(1)
hold on
plot(v1,p1,'*','color','r')
plot(V_compression, P_compression)
plot(v2,p2,'*','color','r')
plot(v3,p3,'*','color','r')
plot(V_expansion, P_expansion)
plot(v4,p4,'*','color','r')
plot([v2 v2],[p2 p3])
plot([v1 v1],[p4 p1])
xlabel('v')
ylabel('p')
figure(2)
plot([v1 v2 v3 v4],[p1 p2 p3 p4],'color','b')
- FUNCTION CALLING PROGRAM OR SUB-PROGRAM:
function [V] = engine_kinematics(bore, stroke, con_rod, cr, start_crank, end_crank)
a= stroke/2;
R= con_rod/a;
v_s= pi/4*bore^2*stroke;
v_c= v_s/(cr-1);
theta= linspace(start_crank,end_crank,100);
term1= 0.5*(cr-1);
term2= R+1 - cosd(theta);
term3= (R^2-sind(theta).^2).^0.5;
V=(1+ term1*(term2 - term3)).*v_c;
end
- EXPLANATION:
1) First we are inputting the values of gamma as it is a constant and t3 as should be more than 2000K.
2) We are then providing inputs for the first state variables p1 and t1.
3) Engine geometry parameters like bore, stroke, connecting rod length and compression ratio are also been inputted.
4) Then we are calculating the Swept Volume and Clearance Volume. From there, we can obtain the values of v1 and v2.
5) The 2nd state variables are given. We know that `(p_2v_2)^gamma = (p_1v_1)^gamma` from this relation we can find p2.
6) Once p2 is computed t2 can be computed used the formula `(p_1v_1)/t_1 = (p_2v_2)/t_2`.
7) After that we are writting a sub program and in it we are calling function engine_kinematics so that we can get a clear curve during the compression and expansion process.
8) In the sub program after the function is defined, we are typing in the engine geometric parameters and naming the function as V.
9) We are also defining how volume changes in an IC engine using diffferent terms such as term1, term2 and term3.
10) We are finding out the value of V using these terms and we are ending the function then jumping into the main program.
11) In the main program we are again calling the function of engine_kinematics for compression process and hence we are computing P_compression and V_compression.
12) We know v2=v3 due constant volume heat addition, with that relation we are finding p3.
13) We are again calling the function of engine_kinematics for expansion process and hence we are computing P_expansion and V_expansion.
14) We know v4=v1 due constant volume heat rejection, with that relation we are finding p4 and then we are also find t4 to compute the thermal efficiency of the system.
15) The thermal efficiency of Ottto cycle is
`etath= 1- ((T_4-T_1)/(T_3-T_2))`
16) After we compute the thermal efficiency of Otto Cycle, we plot the curve for otto cycle.
17) First, we plot the points p1v1,p2v2,p3v3 &p4v4, then we plot the connecting curves for the plotting and finally we plot the points for constant volume heat which will basically be the straight lines parallel to yaxis.
18) After that we label the xaxis and yaxis
FINDING AND CORRECTING ERRORS IN THE PROGRAM:
1) Initially, I had run then program and found the first error as plot command for plotting the straight for constant volume processes. I then, found the error and corrected it.
2) The next error I found was that, I was not finding the output for thermal efficiency in the command window as soon as I ran the program. Then I found that, I added a semicolon(;) which the output for that particular line is not displayed in the command or output window.
RESULTS:
The output graph is plotted between P which is pressure and V which is volume, thus the thermal efficiency of the system is also found out to be 0.6019 which basically 60.19% which is nearer to theoretical value.