Stimulation of the Otto cycle
Objective:
The aim of this project is to write the code to stimulate an Otto cycle i.e to calculate the state variables at four different states, plot the PV diagram for the given condition and to calculate the thermal efficiency of the Otto cycle for a specified engine parameter using Matlab.
Theory and Formula:
The air-standard Otto cycle reciprocates IC engines with working fluid as petrol. Generally, this cycle consists of four strokes, 'PV' diagram represents the four processes.
Otto cycle consists of the following four processes:
1-2 - Isentropic compression process.
2-3 - constant volume heat addition process.
3-4 - Isentropic expansion process.
4-1 - Constant volume heat rejection process.
Note:
0-1 - this process is neglected because they cancel out each other(0-1,1-0).
Formulas:
The volume of the cylinder as a function of a crank angle:
`V/V_c =1+1/2 (Cr-1)[R+1-cosθ-√(R^2-〖sin〗^2 ) (θ)]`
where:
a -stroke/2
R - con_rod/a
The thermal efficiency of the Otto cycle:
`η = 1- 1/〖Cr〗^(ϒ-1)`
η - thermal efficiency
Cr – compression ratio
ϒ – 1.4
swept volume:
`v_s=π/4 (bore)^2*(stroke)`
clearance volume:
`v_c=v_s/(Cr-1)`
Procedure:
The characteristics of the PV diagram and thermal efficiency of the Otto cycle is studied and calculated by using Matlab. To carry out the stimulation, I have taken engine parameters (bore,stroke,con_rod,Cr) are fixed, initial pressure(p1=101325pascals) and temperatures (t1=500k,t3=2000) are also fixed. The remaining state variables (pressure, volume, temperature) at various points are calculated by using thermodynamic equations. The volume of the cylinder during the isentropic process (compression and expansion) is calculated by an equation which is the function of the crank angle, for compression crank angle varies from 180 to 0 and for expansion it varies from 0 to 180, The corresponded pressure values are calculated by the isentropic pressure-volume relation(P*V^gamma=c). The thermal efficiency of the Otto cycle is calculated using the above formula. By considering all the parameters the PV diagram is plotted as shown in the figure.
Function code:
function [V]= engine_kinematics(bore,stroke,con_rod,Cr,start_crank,end_crank)
a=0.5*stroke;
R=con_rod/a; %crank radius
v_swept= (pi/4)*(bore)^2*stroke
v_clearance= v_swept/(Cr-1)
theta=linspace(start_crank,end_crank,100)
term1=0.5*(Cr-1);
term2=R+1-cosd(theta);
term3=sqrt(R^2-sind(theta).^2);
V=(1+term1*(term2-term3)).*v_clearance;
end
Main code:
close all
clear all
clc
%inputs
gamma=1.4;
t3= 2000;
%state variables at point 1
p1=101325; % intial pressure(pascals)
t1=500; % intial temperature(k)
% Engine geometric parameters
bore=0.1; % bore radius
stroke=0.1; % length of the stroke
con_rod=0.15; % length of the connecting rod
Cr=9; %Cr- compression ratio for petrol engine(8-10)
% calculate the clearance volume and swept volume
v_swept = (pi/4)*(bore^2)*stroke %swept volume
v_clearance = (v_swept)/(Cr-1) %clearance volume
v1= v_swept+ v_clearance
v2=v_clearance
% state variable at 2
%p2*v2^gamma=p1*v1^gamma | p2=p1*v1^gamma/v2^gamma | p2= p1*Cr^gamma
p2=p1*(Cr^gamma)
%p1*v1/t1=p2*v2/t2 | t2= p2*v2*t1/p1*v1
t2= p2*v2*t1/(p1*v1)
%constant-c
c=p1*(v1^gamma)
V_compression=engine_kinematics(bore,stroke,con_rod,Cr,180,0)
P_compression= c./V_compression.^gamma
%state variable at 3
v3=v2
%p3*v3/t3=p2*v2/t2 | p3= p2*t3/t2
p3= (p2*t3)/t2
c1=p3*(v3^gamma)
V_expansion=engine_kinematics(bore,stroke,con_rod,Cr,0,180)
P_expansion= c1./V_expansion.^gamma
%state variable at 4
v4=v1
%p4*v4^gamma=p3*v3^gamma | p4 = p3*v3^gamma/v4^gamma
p4 = (p3*(v3^gamma))/(v4^gamma)
E = 1-(1/(Cr)^(gamma-1)) % Thermal effiency of the otto cycle
%plotting
figure(1)
hold on
grid on
plot(v1,p1,'*','color','r')
ot = plot(V_compression,P_compression,'linewidth',3,'color','black')
plot(v2,p2,'*','color','r')
plot(v3,p3,'*','color','r')
tt = plot([v2 v3],[p2 p3],'linewidth',3,'color','y')
tf = plot(V_expansion,P_expansion,'linewidth',3,'color','g')
plot(v4,p4,'*','color','r')
fo = plot([v4 v1],[p4 p1],'linewidth',3,'color','b')
xlabel('volume')
ylabel('pressure')
title('Otto Cycle')
legend([ot,tt,tf,fo],'isentropic compression','constant volume Q_a','isentropic expansion','constant volume Q_r')
Errors:
The error is due to the disagree of the matrix dimension. it is rectified by implementing the dot product.
- The other errors have occurred while writing the code are case sensitive errors which are rectified by rewriting the code correctly.
PV diagram of Otto cycle:
Conclusion:
The thermal efficiency of the Otto cycle under the given operating condition of the engine for a given geometric condition is 58.48%