Air standard Cycle Using MATLAB
Aim:
To write a code for the PV diagram of the otto cycle and to calculate thermal efficiency of the cycle using MATLAB
Introduction of OTTO cycle
Process (0-1) Air intake piston moves TDC to BDC
Process (1-2)Isentopic compression
Process (2-3)Constant volume heat addition
Process (3-4)Isentopic expansion
Process (4-1)Constant volume heat rejection
Code for PV diagram of OTTO cycle
clear all
close all
clc
p1= 101325;
t1= 500;
t3=2300;
bore= 0.1;
con_rod= 0.15;
cr= 12;
stroke= 0.1;
pi= 22/7;
gamma = 1.4;
vs = pi*bore^2 *stroke/4;
vc = vs/(cr-1);
v1 = vs+vc
v2 = vc
p2 = p1* cr^gamma
t2 = t1* cr^(gamma-1)
const = p1* v1^gamma;
v_compression = engine(bore,stroke,con_rod,cr,180,360);
p_compression = const./v_compression.^gamma;
v3=v2;
p3=p2*t3/t2
const2 = p3* v3^gamma;
v_expansion = engine(bore,stroke,con_rod,cr,0,180);
p_expansion = const2./v_expansion.^gamma;
v4=v1;
p4 = p3* cr^(-gamma);
hold on
plot(v_compression,p_compression)
plot(v_expansion,p_expansion)
plot([v2,v3],[p2,p3])
plot([v4,v1],[p4,p1])
xlabel('VOLUME')
ylabel('PRESSURE')
legend('isentropic compression','constant vol heat addition','isentropic expansion','constant volume heat rejection')
eff = (1-(1/cr^(gamma-1)))*100
Function code
function[v] = engine(bore,stroke,con_rod,cr,start_angle,end_angle)
radi = stroke/2;
n = con_rod/radi;
vs = pi*bore^2 *stroke/4;
vc = vs/(cr-1);
theta = linspace(start_angle,end_angle,end_angle);
term1 = 0.5*(cr-1);
term2 = n+1-cosd(theta);
term3 = (n^2 -sind(theta).^2).^0.5;
v = (1+term1*(term2-term3)).*vc;
end
Initially, pressure and volume for the corresponding state points are calculated by using the formulas and results are plotted. In the graph we get line plot but we need curve in two places (Adiabatic process take place in this two-stage.Adiabatic process must be represented in the form of curve in the PV diagram) so a function is created and inside this we can find different volume values for the different crank angles and the corresponding pressure value from the volume value we can plot the result in curve. The curve would be smoother increasing the value of range in the function(engine).
Output Graph
Thank you