Matlab Program to output PV diagram & Efficiency Of Otto Cycle
Aim:
To produce PV diagram & Efficiency for Otto Cycle
Introduction
The Otto cycle is an air-standard cycle which describes the processes in petrol engine. It constitutes two isentropic & two constant volume processes namely,
- Isentropic Compression
- Constant Volume Heat Absorption
- Isentropic Expansion
- Constant Volume Heat Rejection
Program Description:
Firslty the Pressure and Temperature values for state 1 and Temperature alone for state 3 is given as program input. The engine parameters like Bore diameter, Stroke length, Connecting Rod length, Compression Ratio are also Input. The clearance and swept volume is evaluated using equations given below.
The values of Pressure, Temperature and Volume are found using thermodynamic relations.
The four points are plotted for the corresponding four states with Pressure and Volume as the Y and X axes respectively. Both the constant Volume processes can be plotted using straight lines, but this is not the case when it comes to isentropic processes. An additional function is written to evaluate the values of Volume throughout the isentropic processes and is called into the main program. Similiarly varying values of Pressure are found from the above and the pressure velocity values are plotted into the graph.
Main Program:
clear all
close all
clc
%Start Of Program
%Engine Parameters
bore=0.1;
stroke=0.1;
conrod=0.15;
cr=12;
v_swept=(pi/4)*bore^2*stroke;
v_clear= (v_swept/(cr-1));
gamma=1.4;
%Variables at state1
p1=101325;
t1=500;
t3=2300;
v1=v_swept+v_clear;
v2=v_clear;
%Variables at state2
%p1v1^gamma=p2v2^gamma
p2=p1*cr^gamma;
t2=p2*v2*t1/(p1*v1);
con=p1*v1^gamma;
v_comp=engine_kin(bore,stroke,conrod,cr,180,0);
p_comp=con./v_comp.^gamma;
%Variables at state3
%p2v2^gamma=p3v3^gamma
v3=v2;
p3=t3*p2/t2;
con=p3*v3^gamma;
v_exp=engine_kin(bore,stroke,conrod,cr,0,180);
p_exp=con./v_exp.^gamma;
%Variables at state4
%p3v3^gamma=p4v4^gamma
v4=v1;
p4=p3*(v3/v4)^gamma;
t4=p4*v4*t3/(p3*v3);
Value=1-((t4-t1)/(t3-t2));
display('Efficiency Of Otto cycle is')
display(Value);
figure(1)
hold on
plot(v1,p1,'*','color','r')
%Plotting Volume vs pressure curve for compression
plot(v_comp,p_comp)
plot(v2,p2,'*','color','g')
plot([v2,v3],[p2,p3],'color','b')
plot(v3,p3,'*','color','b')
%Plotting Volume vs pressure curve for expansion
plot(v_exp,p_exp)
plot(v4,p4,'*','color','c')
plot([v4,v1],[p4,p1],'color','r')
%Labelling X & Y Axes
xlabel('Volume')
ylabel('Pressure')
%End Of Program
Function:
%Function
function[V]=engine_kin(bore,stroke,conrod,cr,stca,endca)
%Engine Parameters
a=stroke/2;
R=conrod/a;
v_swept=(pi/4)*bore^2*stroke;
v_clear= (v_swept/(cr-1));
theta=linspace(stca,endca,720);
term1=0.5*(cr-1);
term2=R+1 -cosd(theta);
term3=(R^2 - sind(theta).^2).^0.5;
V=(1+term1*(term2-term3)).*v_clear;
end
Sample Results:
Results:
The results of the program are PV diagram and efficiency of the Ottocycle for the given values. The Output of the above written program is 0.6299 which evaluates to approximately 63%.