Otto Cycle PV Diagram
Title: Matlab Program for Otto Cycle PV Diagram
Objective: To execute a matlab program wherein to create a PV diagram for Otto cycle ( Petrol engine). Also, to determine the thermal efficiency of the cycle.
Matlab Program:
a) Main Program
clear all
close all
clc
%% state variable
p1= 101325;
t1=500;
gamma= 1.4;
t3=2300;
%% Engine geometric parameters
bore=0.85; %bore dia.
stroke=0.1; % stroke length
con_rod= 0.15; % connencting rod length
cr=12; % compression ratio
%% claculations
vs= (pi/4)*bore^2*stroke;
vc= vs/(cr-1);
v1= vc+vs;
v2= vc;
% @ point 2
p2= p1*cr^gamma;
t2= p2*v2*t1/(p1*v1);
const=p1*v1^gamma;
v_comp = Eengine_kinematics( bore, stroke, con_rod, cr, 180, 0);
p_comp = const./v_comp.^gamma;
% @ point 3
v3=v2;
p3=p2*t3/t2;
const=p3*v3^gamma;
v_exp = Eengine_kinematics( bore, stroke, con_rod, cr, 0, 180);
p_exp = const./v_exp.^gamma;
% @ point 4
v4=v1;
p4= p3*(v3/v4)^gamma;
t4= p4*cr*t3/p3;
%% Calculation for thermal efficiency
Nthermal= 1-(1/(cr-1)^(gamma-1))
%% plotting
figure(1)
hold on
plot (vc, p1, 'o', 'color', 'g')
plot(v1,p1,'*','color','r')
plot(v2,p2,'*','color','b')
plot(v3,p3,'*','color','g')
plot(v4,p4,'*','color','r')
plot([vc v1],[p1 p1])
plot(v_comp, p_comp)
plot([v2,v3],[p2,p3])
plot(v_exp,p_exp)
plot( [v4,v1], [p4,p1])
title('PV diagram for Otto cycle' )
legend('clearence volume','point 1', 'point 2','point 3', 'point 4', 'suction phase/exhaust phase', 'adiabatic(isentropic) compression', 'ignition phase','adiabatic(isentropic) expansion', 'heat rejection' )
dim = [.5 .15 .3 .3];
str = ['Thermal Efficiency is ', num2str(Nthermal) ];
annotation('textbox',dim,'String',str,'FitBoxToText','on');
xlabel( 'volume')
ylabel( 'pressure')
axis( [ 0 0.065 -0.8140000000001e+06 6.1140000000001e+06])
B) Function
function [v]=Eengine_kinematics( bore, stroke, con_rod, cr, start_crank, end_crank)
a= stroke/2;
R= con_rod/a;
theta = linspace ( start_crank, end_crank, 100);
vs= (pi/4)*bore^2*stroke;
vc= vs/(cr-1);
term1= 0.5*(cr-1);
term2 = R+1-cosd( theta);
term3= (R^2- sind(theta).^2).^0.5;
v= (1+ term1*(term2-term3)).*vc;
end
Results:
Conclusion: The PV Diagram for the Otto Cycle is represented in the figure along with different stages / strokes. Also, the Thermal efficiency of the cycle is found to be 0.61678 or 61.678 %.