OTTO CYCLE SIMULATION USING MATLAB
Otto cycle
The operation of the Otto cycle comprises four processes: adiabatic compression 1 → 2, isochoric heat addition 2 → 3, adiabatic expansion 3 → 4, and isochoric heat removal 4 → 1. Thus, for the Otto cycle, we have V2 = V3, V4 = V1, CR = V1/V3, and PR = p3/p1. The thermal efficiency of the Otto cycle is η=1−T1T2
Applying the first law to the adiabatic
compression process 1 → 2 gives
(T1/T2)=(V1/V2)1−γ.
Thus, Eq may be rewritten as
η=1−V1V21−γ=1−CR1−γ
For the Otto cycle, Tmax = T3 and Tmin = T1. So, from the relation p1V1/T1=p3V3/T3, one finds v4 =v1
PROGRAM TO OBTAIN DATA POINT RELATED TO THE OTTO CYCLE:
clear all
close all
clc
gamma =1.4
%staTE VARIABLE
p1= 101325
t1 =500
t3 =2300
%engine parameter
bore= 0.1;
stroke =0.1;
con_rod=0.15;
cr=12;
%calculating the swept volume
v_swept= (pi/4)*bore^2*stroke;
v_clearence= v_swept/(cr -1);
v1 = v_swept + v_clearence
v2= v_clearence
%state variable point 2
%from p2v2^gamma = p1v1^gamma
%p2 = p1*(v1/v2)^gamma
p2=p1*cr^gamma;
%from p1v1/t1 = p2v2/t2
t2= p2*v2*t1/(p1*v1);
%state point3
v3 = v2
%p3v3/t3 = p2v2/t2
p3 = p2*t3/t2
%state variable at point 4
v4 = v1
%p3v3^gamma = p4v4^gamma
p4 = p3*(v3/v4)^gamma
figure(1)
hold on
plot(v1,p1,'*','color','r')
plot(v2,p2,'*','color','r')
plot(v3,p3,'*','color','r')
plot(v4,p4,'*','color','r')
OUTPUT OF THE PROGRAM:
PROGRAM TO CREATE FUNCTION ENGINE_KINEMATICS TO OBTAIN PV ARIATION:
Function[V]= engine_kinematics(bore,stroke,con_rode,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
PROGRAM TO OBTAIN PRESSURE VOLUME VARIATION:
clear all
close all
clc
gamma =1.4
%staTE VARIABLE
p1= 101325;
t1 =400;
t3 =2500;
%engine parameter
bore= 0.2;
stroke =0.2;
con_rod=0.23;
cr=12;
%calculating the swept volume
v_swept= (pi/4)*bore^2*stroke;
v_clearence= v_swept/(cr -1);
v1 = v_swept + v_clearence
v2= v_clearence
%state variable point 2
%from p2v2^gamma = p1v1^gamma
%p2 = p1*(v1/v2)^gamma
p2=p1*cr^gamma;
%from p1v1/t1 = p2v2/t2
t2= p2*v2*t1/(p1*v1);
constant_c=p1*v1^gamma;
v_comp= engine_kinematics(bore,stroke,con_rod,cr,180,0);
p_comp= constant_c./v_comp.^gamma
%state point3
v3 = v2 ;
%p3v3/t3 = p2v2/t2
p3 = p2*t3/t2 ;
constant_c=p3*v3^gamma;
v_exp= engine_kinematics(bore,stroke,con_rod,cr,0,180);
p_exp= constant_c./v_exp.^gamma;
%state variable at point 4
v4 = v1;
%p3v3^gamma = p4v4^gamma
p4 = p3*(v3/v4)^gamma;
%thermal efficiency
ther_eff 1-(1/(cr^(gamma-1)));
finaleff= ther_eff*100 + "%"
figure(1)
hold on
Grid on
plot(v1,p1,'*','color','r')
plot(v_comp ,p_comp)
plot(v2,p2,'*','color','r')
plot(v3,p3,'*','color','r')
plot(v_exp,p_exp)
plot(v4,p4,'*','color','r')
plot([v3 v2],[p3 p2],'color','b')
plot ([v4 v1],[p4 p1],'color','b')
OUTPUT PLOT:
Code explanation:
1. We first assume some important parameters such as sp. Heat ratio (gamma) and Temperature at state 3 i.e. after heat addition.
2. We also assume initial pressure, temperature, and geometrical parameters.
3. Using the formula of volume of cylinder and clearance volume, we find out the swept and clearance volume.
4. Using governing equation of isentropic process, we thus find out pressure and temperature at state point 2.
5. After this, we call our function to help us to find the compression volume and pressure.
6. Similar thing is done in the case of state 3-4.
7. Thermal efficiency is found out and graph is plotted between pressure and volume.
CONCLUSION:
1. hence we plotted pv diagram of otto cycle.
2. also we find out the thermal efficiency is about 68%