Indicator diagram of the Otto Cycle using MATLAB
AIM: To develop the indicator diagram of the Otto Cycle using MATLAB
GOVERNING EQUATIONS:
IDEAL GAS EQUATION :
`PV=NRT`
P=Pressue
V=Volume
R=Universal gas constant
N=No of moles
T=Temperature
OBJECTIVES OF THE PROJECT: The main objective of this project is to create a PV diagram of the Otto cycle using MATLAB
I have used the Matlab online for this project
%edit Otto_cycle.m
% CONSTANT VOLUME OR OTTO CYCLE
%Developing Indicator diagram
%Engine geometric parameters
bore=0.1;
stroke_length=0.1;
con_rod=0.15;
gama=1.4;
%compression ratio
cr=8;
%calculating swept volume and clearance volume
%swept volume(V_s) = (pi/4)* d^2 * L
swept_vol=(pi/4)*bore^2*stroke_length;
%clearance volume(V_c)
%compression ratio(cr) = (V_s + V_c)/V_c
clearance_vol=swept_vol/(cr-1);
%state variables at point 1
V1=swept_vol+clearance_vol;
P1=101325;
T1=500;
%state variables at point 2
%compression ratio=v1/v2
V2=V1/cr;
% adiabatic compression >> PV^gama=constant >> P1V1^gama=P2V2^gama
P2=P1*cr^gama;
% using ideal gas equation >> P1V1/T1=P2V2/T2
T2=P2*V2*T1/(P1*V1);
%to connect state points of 1 and 2 >> adiabatic compression
constant_c=P1*V1^gama;
v_compression=vol_variation(bore,stroke_length,con_rod,cr,180,0);
p_compression=constant_c./(v_compression).^gama;
%state variables at point 3
V3=V2;
%T3 is previously known
T3=2300;
P3=P2*(T3/T2);
%to connect state points of 3 and 4 >> adiabatic expansion
constant_c=P3*V3^gama;
v_expansion=vol_variation(bore,stroke_length,con_rod,cr,0,180);
p_expansion=constant_c./(v_expansion).^gama;
%state variables at point 4
V4=V1;
% adiabatic expansion >> PV^gama=constant >> P3V3^gama=P4V4^gama
P4=P3*(V3/V4)^gama;
figure(1)
hold on
%1-2 represents adiabatic compression
plot(V1,P1,'o','color','r')
text(V1,P1,'1');
plot(v_compression,p_compression,'color','g');
plot(V2,P2,'o','color','r')
text(V2,P2,'2');
%2-3 represents heat addition at constant volume
plot(V3,P3,'o','color','r')
text(V3,P3,'3');
plot([V2 V3],[P2 P3],'color','g')
%3-4 represents adiabatic expansion
plot(v_expansion,p_expansion,'color','g');
plot(V4,P4,'o','color','r')
text(V4,P4,'4');
%4-1 represents hear rejection at constant volume
plot([V4 V1],[P4 P1],'color','g')
title('Indicator diagram of Otto Cycle')
ylabel('Pressure')
xlabel('volume')
legend('state','process');
%Calculating thermal efficiency
Thermal_efficiency = 1 - (1/(cr)^(gama-1))
% I wrote a function vol_variation to make the problem easier and call it in the main program
%edit vol_variation.m
function [V]=vol_variation(bore, stroke, con_rod, cr, initial_crank, final_crank)
a= stroke/2;
R=con_rod/a;
v_s=pi/4*bore^2*stroke;
v_c=v_s/(cr-1);
theta= linspace(initial_crank,final_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
AIM: To develop an Indicator diagram of the Otto Cycle using MATLAB
CONCLUSION
1.explanation of the PV diagram:
- Line 1-2 represents adiabatic compression
- Line 2-3 represents heat addition at constant volume
- Line 3-4 represents adiabatic expansion
- Line 3-4 represents heat rejection at constant volume
2. The area under the curve represents work done.
3. The efficiency of the otto cycle depends upon the compression ratio.
4. Calculation of temperature is not required to draw the PV diagram but helps to understand the process at each stage in an easy way
5. Use the debugging tool to sort out and rectify errors.