Air standard Cycle (otto cycle) simulator using matlab
1.Aim:
To write a program in matlab to plot the pv diagram for ottocycle and to calculate the efficiency of the engine.
2.Objective of the program:
The main objective is to draw a pv diagram and to calculate the effeciency.
`V/(Vc) = 1 + 1/2 (rc-1) [R + 1-costheta-(R^2-sin^2 theta)]^(1/2)`
The above equation is seprated into two equations for convinence and the value of v is find in the program2.
In the otto cycle 1-2 is compression cycle
2-3 is heat addition procecss
3-4 is expansion cycle
4-1 is heat reduction cycle
Engine geometric parameters:
bore =0.1
stroke =0.1
connection rod length =0.15
compression ratio =12
To plot the pv diagram the values of v1,v2,v3,v4 and p1,p2,p3,p4 are required.
These values are find as of follows:
In 1-2 (Compression cycle)
p1 =101325
t1 =500
above are known values
v1 =swept volume + Clearance volume
where,
swept volume = (π4)">(π4)(π4) * bore^2 * stroke
clearance volume = swept volume / (compression ratio -1)
In 2-3 (Heat addition)
we know that,
(p1v1)γ=(p2v2)γ">(p1v1)γ=(p2v2)γ(p1v1)γ=(p2v2)γ
hence p2 = p1 * cr^gamma
v2 = Clearance volume
we know that,
p1v1/t1 = p2v2/t2
hence t2 = p2 * v2 *t1 / (p1* v1)
In 3-4 Isentropic expansion process
v3 = v2
t3 = 2300
p3 = p2 * (t3/t2)
In 4-1 heat reduction procecss
v4 = v1
p4 = p3 * (v3/v4)^gamma
By finding the pressure and volume values at all the 4 states the pv diagram can be drawn
Effeciency:
Effeciency = workdone / Heat added
where work done = heat added - heat rejected
then, Effeciency = (Heat added - Heat rejected) / (Heat added)
= 1 - (Heat rejected / Heat added)
= 1 - [(t4-t1)/(t3-t2)] where, (t4/t1) = (t3/t2)
= 1- (t1/t2)
3.Coding:
program 1:
% Program to plot PV and to find the efficiency
%inputs
g = 1.4;
t3 = 2300;
% Engine geometric parameters
bore = 0.1;
stroke = 0.1;
connecting_rod = 0.15;
cr = 12;
% Calculating the Swept_volume and Clearance_volume
v_swept = (pi/4) * bore^2 * stroke;
v_clearance = v_swept/(cr-1);
% Variables at point 1
v1 = v_swept + v_clearance;
% (p1 and t1 areknown values)
p1 = 101325;
t1 = 500;
% Variables at point 2
v2 = v_clearance;
p2 = p1 * cr^g;
t2 = p2 * v2 * t1 / (p1*v1);
constant_c = p1*v1^g;
v_compression = engine_kinematics(bore,stroke,connecting_rod,cr,180,0)
p_compression = constant_c./v_compression.^g;
% Variables at point 3
v3 = v2;
p3 = p2 * t3/t2;
constant_c = p3*v3^g;
v_expansion = engine_kinematics(bore,stroke,connecting_rod,cr,0,180);
p_expansion = constant_c./v_expansion.^g;
% Variables at point 4
v4 = v1;
p4 = p3*(v3/v4)^g;
% Plotting the pv graph
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 v3],[p2 p3],'color', 'b')
plot([v4 v1],[p4 p1],'color', 'r')
xlabel('volume')
ylabel('pressure')
% Finding Efficiency
E =(1- (t1/t2))*100
Program 2: Called funtion
% Program for calling the engine_kinematics (used to determine values for
% v_compression and v_expansion)
function [v] = engine_kinematics(bore, stroke, connecting_rod, cr, start_crank, end_crank)
a = stroke/2;
R = connecting_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
4.Output:
pv_diagram:
Effeciency:
5.Conlusion:
Thus the pv diagram is plotted and the effeciency value is calculated.