Air standard cycle (Otto cycle) using MATLAB
AIM- WRITE A CODE THAT CAN SOLVE AN OTTO CYCLE AND MAKE PLOTS FOR IT.
GOVERNING EQUATIONS –
v_swept=`(pi/4)*`bore`^2` `*`stroke
v_c= `"v_swept"/(rc-1)`
where v_swept is the swept volume
and v_c is the clearance volume
rc is the compression ratio
for isentropic process-
`(p1)/(p2) = ((v1)/(v2))^gamma`=constant
& `(p1*v1)/(t1)=(p2*v2)/(t2)`
for tracing ,
`v/"v_c"=[1+(.5*(rc-1))*{(R+1-cos(theta)}-{(R^2-(sintheta)^2}^.5]`
where `theta`is the crank angle .
Thermal efficiency , `eta = 1-(1/(rc)^(gamma-1))`
where rc is the compression ratio.
OBJECTIVES-
- TO create a PV diagram
- Output the thermal efficiency of the engine
PROCEDURE
THEORY-
OTTO CYCLE - The Otto cycle consists of isentropic compression, heat addition at constant volume, isentropic expansion, and rejection of heat at constant volume. In the case of a four-stroke Otto cycle, technically there are two additional processes: one for the exhaust of waste heat and combustion products at constant pressure (isobaric), and one for the intake of cool oxygen-rich air also at constant pressure; however, these are often omitted in a simplified analysis. Even though those two processes are critical to the functioning of a real engine, wherein the details of heat transfer and combustion chemistry are relevant, for the simplified analysis of the thermodynamic cycle, it is more convenient to assume that all of the waste-heat is removed during a single volume change.
The processes involes in otto cycle are
- 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.
INPUTS
HERE THE SOFTWARE I USE IS OCTAVE WHICH IS AN OPEN SOURCE SOFTWARE.
clear all
close all
clc
% point 1
p1=1031325
t1=500
gama=1.4
t3=2300
%engine geometric parameters
bore=.1
stroke=.1
con_rod=.15
rc=12
%calculating swept volume and clearence volume
v_swept=(3.14/4)*bore^2*stroke
v_c= v_swept/(rc-1)
v1=v_swept+v_c
v2=v_c
% point 2
% as we know that p2/p1=(v1/v2)*gama
p2 =p1*rc^gama
% p1*v1/t1=p2*v2/t2
t2=p2*v2*t1/(p1*v1)
%point 4
v3=v2
p3 = p2*t3/t2
% point 4
v4=v1
p4 = p3*(v3/v4)^gama
figure(1)
hold on
plot(v1,p1,'*')
plot(v2,p2,'*')
plot(v3,p3,'*')
plot(v4,p4,'*')
EXPLANATION -
First we have to suppose some values of gama ,t3 , p1 , t1 , bore , stroke , connecting rod , compression ratio .
Then we use the formula for finding swept volume and clearance valume .
By knowing the values of swept and clearance volume we easily find volume at point 1 and point 2
By using equation , p2/p1=(v1/v2)*gama
we can find the value of p2 .
By using eq, p1*v1/t1=p2*v2/t2
we can easily find value of t2
As we know that volume at pt 2 is equal to the volume at pt 3 and at pt 4 is equal to at pt 1
So we can easily find the required values in the cycle .
Now plot the points and use ‘*’ to recognize it on the graph .
But we didn’t get the trace of the graph i.e the behavior .
To know this we create a function which is shown below –
function[V] = ottoformulae(bore,stroke,con_rod,rc,start_point,end_point)
%engine geometric parameters
bore=.1;
stroke=.1;
con_rod=.15;
rc=12;
a=stroke/2;
R=con_rod/a;
v_s=(pi/4)*bore^2*stroke;
v_c=v_s/(rc-1);
theta=linspace(0,180,90);
x=.5*(rc-1);
y=R+1-cosd(theta);
z=(R^2-sind(theta).^2).^.5;
V=(1+x*(y-z)).*v_c;
end
Explanation
To make the graph complete or for tracing we use the formula that act as a function .we can recall this fuction into the the main code which helps to comple the graph .
The modified code is
clear all
close all
clc
% point 1
p1=1031325
t1=500
gama=1.4
t3=2300
%engine geometric parameters
bore=.1
stroke=.1
con_rod=.15
rc=12
%calculating swept volume and clearence volume
v_swept=(3.14/4)*bore^2*stroke
v_c= v_swept/(rc-1)
v1=v_swept+v_c
v2=v_c
constant=p1*v1^gama;
v_comp = ottoformulae(bore,stroke,con_rod,rc,180,0);
p_comp = constant./v_comp.^gama;
% point 2
% as we know that p2/p1=(v1/v2)*gama
p2 =p1*rc^gama
% p1*v1/t1=p2*v2/t2
t2=p2*v2*t1/(p1*v1)
%point 3
v3=v2
p3 = p2*t3/t2
constant=p3*v3^gama
v_exp= ottoformulae(bore,stroke,con_rod,rc,0,180)
p_exp=constant./v_comp.^gama
% point 4
v4=v1
p4 = p3*(v3/v4)^gama
% thermal efficiency
eta = 1-(1/(rc^(gama-1)))
figure(1)
hold on
plot(v1,p1,'*')
plot(v_comp,p_comp)
plot(v2,p2,'*')
plot(v3,p3,'*')
plot(v_exp,p_exp)
plot(v4,p4,'*')
plot([v2 v3],[p2 p3])
plot([v4 v1],[p4 p1])
Explanation –
By using the eq
P1v1^gama =p_comp*v_comp^gama = constant
And using function
We easily trace it into the graph by plotting the values of p_comp and v_comp
It is same for the expansion process
At last put the formula for thermal efficiency
After running the function we get thermal efficiency on the workspace dialogue box
And we see the p-v graph for otto cycle on the dialogue box appear on the screen.
ERROR-
The name of the function and the name of varriable that holds the value in that function will be same .
otherwise it shows error in the main programe and programe didn't run .The screenshot for the error shows in the command window for main programe is shown below
Results-
the final graph is
Thermal efficiency on workspace box is
Conclusion –
Pv graph for otto cycle has been plotted.
Thermal efficienct is 0.62989
PROGRAME 1