MATLAB PROGRAM TO SOLVE AN OTTO CYCLE
Introduction
The first successful engine working on this cycle was built by A.Otto. It is also known as constant volume cycle as heat is received and rejected at a constant volume.
The otto cycle consists of two constant volume and two reversible or adiabatic processes.
1.First stage(reversible adiabatic or isentropic compression)
Air is compressed reversibly and adiabaticaly from temperature t1 to temperature t2. in this process, no heat is absorbed and rejected by air.
2.Second stage(constant volume heating)
Air is heated at constant volume and temperaure reaches t2 to t3 while volume remains same.
3.Third stage(reversibly adiabatic or isentropic expansion)
Air is expanded reversibly and adiabaticaly from temperature t3 to temperature t4. in this process, no heat is absorbed and rejected by air.
4.Fourth stage(constant volume cooling)
Air is cooled at constant volume and temperaure reaches from t4 to t1 while volume remains same.
Description
Now to generate a programme to create a PV diagram for otto cycle we need to determine pressure and volume at the respective stages.
The first step to do so is to Assume engine geometric parameteres in accordance to practical parametres of engine working on Otto cycle.
here the engine parametres are as follows:
1) Bore = 0.1 m
2) Stroke = 0.1 m
3) Connecting rod length = 0.15 m
4) Compression Ratio = 7
5) Pressure at stage 1(p1) = 1.01325 Pa
6) Temperature at stage 1(t1) = 500 K
7) Temperature at stage 3(t3) = 2300 K
also to calculate volume at stage 1 (i.e. v1) we need to calculate swept volume and clearance volume and to do so,following formula is used.
v_swept = (pi/4)*bore^2*stroke
v_clearance = v_swept/(cr-1)
now v1 = v_swept+v_clearance
also v2 = v_clearance
after obtaining v1,t1,p1 and cr(compression ratio),the volume,pressure and temperature at other stages can be calculated using following equations:
PV^gamma = constant
PV=mRT
MATLAb programme
clear all
close all
clc
% programme for otto cycle
% inputs
gamma = 1.4
t3 = 2300
% state 1 variables
p1 = 1.01325
t1 = 500
% engine geometric parametres
bore = 0.1;
stroke = 0.1;
con_rod = 0.15;
cr = 7
% calculating swept volume and clearance volume
v_swept = (pi/4)*bore^2*stroke;
v_clearance = v_swept/(cr-1);
v1 = v_swept+v_clearance
v2 = v_clearance
% state 2 variables
%p2v2^gamma=p1v1^gamma
p2 = (p1*v1/v2)^gamma
constant_c = p1*v1^gamma;
v_compression = piston_kinematics(bore,stroke,con_rod,cr,180,0)
p_compression = constant_c./v_compression.^gamma;
% p1v1/t1=p2v2/t2
t2 = p2*v2*t1/(p1*v1)
%state 3 variables
v3=v2
%p3v3/t3=p2v2/t2
p3 = p2*t3/t2
constant_c = p3*v3^gamma;
v_expansion = piston_kinematics(bore,stroke,con_rod,cr,0,180)
p_expansion = constant_c./v_expansion.^gamma;
%state 4 variables
v4=v1
%p3v3^gamma=p4v4^gamma
p4 = p3*v3^gamma/v4^gamma
% thermal efficiency
efficiency = 1-1/cr^(gamma-1)
hold on
plot(v1,p1,'*','color','r')
plot(v_compression,p_compression,'color','b')
plot(v2,p2,'*','color','r')
plot([v2 v3],[p2 p3],'color','b')
plot(v3,p3,'*','color','r')
plot(v_expansion,p_expansion,'color','b')
plot(v4,p4,'*','color','r')
plot([v4 v1],[p4 p1],'color','b')
xlabel('volume (in m^3)')
ylabel('pressure (in Pa)')
grid on
and for the funtion used in this script:
function [v] = piston_kinematics(bore,stroke,con_rod,cr,start_crank,end_crank)
% otto cycle piston kinematics
a = stroke/2
r= con_rod/a
v_s = (pi/4)*bore^2*stroke
v_c = v_s/(cr-1)
theta = linspace(0,180,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
PV diagram :
Conclusion:
1. The Thermal effieciency is calculated to be 0.5408 or 54.08%.
2. The PV diagram clearly shows that changes in isentropic processes are a curve and not straight line.