Air standard cycle
AIM: To write MATLAB code that can solve or check the engine kinematics of an engine operating on the OTTO cycle and make plots for it. Create a PV diagram and also output the thermal efficiency of the engine.
DESCRIPTION: The Otto cycle is the ideal cycle for the spark-ignition reciprocating engines, and it consists of four internally reversible processes:
- isentropic compression,
- constant-volume heat addition,
- isentropic expansion, and
- constant-volume heat rejection.
Figure: Otto cycle (P-v diagram)
GOVERNING EQUATIONS:-
The ratio of the maximum volume formed in the cylinder to the minimum
(clearance) volume is called the compression ratio r of the engine:
r = `v_max/v_min =(displacement \ volume)/(cIearance\ volume)`
To find the efficiency of the cycle T3 and T4 are needed.
Process 1-2:
This process is an isentropic process. Therefore
`T_2/T_1 =(V_1/V_2 )^(γ-1) = r^(γ-1)`
Process 3-4:
This is also an isentropic process. Therefore
`T_3/T_4 =(V_3/V_4 )^(γ-1) = r^(γ-1)`
Air-standard efficiency of the Otto cycle:
The thermal efficiency of the ideal Otto cycle under the cold air standard wnet
assumptions are:
`eta_(th=w/q =1-(T_4-T_1)/(T_3-T_2 )`
On simplification
`eta_(th= 1-1/r^(γ-1)`
The relationship between crank angle and volume inside the crank chamber is: -
`V/V_c =1+0.5*(r-1)*[R+1-cos〖θ-(R^2-〖sinθ〗^2 )^0.5 〗]`
OBJECTIVES OF THE PROJECT
- To write a code that can solve or check the engine kinematics of an engine operating on the OTTO cycle and make plots for it. Create a PV diagram and also output the thermal efficiency of the engine.
Figure 2: Flow of the project
Code
First of all, a separate function is made for engine kinematics
function [V] = engine_kinematics_otto(bore, stroke, connecting_rod, compression_ratio, start_crank, end_crank)
%defining the parameters of engine
a = stroke/2;
R = connecting_rod/a;
v_s = (pi/4)*bore^2*stroke;
v_c = v_s/(compression_ratio-1);
theta = linspace(start_crank,end_crank,100);
% here x,y,z are the three variables of equations
x = 0.5*(compression_ratio-1);
y = R + 1 -cosd(theta);
z = (R^2 - sind(theta).^2).^0.5;%elementwise
V = (1 + x*(y - z)).*v_c;
end
main code
clear all
close all
clc
% Input values
gamma = 1.4;
t3 = 2500;
% State Variables
p1 = 101325;
t1 = 300;
% Engine design parameters
bore = 0.15;
stroke = 0.15;
connecting_rod = 0.25;
compression_ratio = 14;
% Calculating the swept volume and the clearance volume
v_swept = (pi/4)*bore^2*stroke;
v_clearance = v_swept/(compression_ratio-1);
v1 = v_swept + v_clearance;
v2 = v_clearance;
% State variable at point 2
% p2v2^gamma = p1v1^gamma
% p2 = p1*(v1/v2)^gamma = p1*cr^gamma
p2 = p1*compression_ratio^gamma;
% p1v1/t1 = p2v2/t2 | t2 = (p2*v2*t1)/(p1*v1)
t2 = (p2*v2*t1)/(p1*v1);
constant_c = p1*v1^gamma;
V_compression = engine_kinematics_otto(bore, stroke, connecting_rod, compression_ratio, 180, 0);
P_compression = constant_c./V_compression.^gamma;
% State variable at point 3
v3 = v2 ;
% p3v3/t3 = p2v2/t2 | p3 = (p2*t3)/(t2)
p3 = (p2*t3)/(t2);
constant_c = p3*v3^gamma;
V_expansion = engine_kinematics_otto(bore, stroke, connecting_rod, compression_ratio, 0, 180);
P_expansion = constant_c./V_expansion.^gamma;
% State variable at state point 4
v4 = v1;
% p3v3^gamma = p4v4^gamma | p4 = p3(v3/v4)^gamma
p4 = p3*(v3/v4)^gamma;
% p4v4/t4 = p3v3/t3 | t4 = (p4*v4*t3)/(p3*v3)
t4 = (p4*v4*t3)/(p3*v3);
figure(1)
hold on
plot(v1,p1,'*','color','r')
plot(V_compression,P_compression,'color','g')
plot(v2,p2,'*','color','r')
plot(v3,p3,'*','color','r')
plot(V_expansion, P_expansion,'color','g')
plot(v4,p4,'*','color','r')
plot([v2 v3],[p2 p3],'color','g')
plot([v1 v4],[p1 p4],'color','g')
xlabel('Volume')
ylabel('Pressure')
title('OTTO CYCLE')
% Thermal efficiency
term1 = t4-t1;
term2 = t3-t2;
Thermal_efficiency = (1-(term1/term2))*100
Explanation of code
- A function is written for the following equation to find V:
- In the main code the Input values are given (gamma, t3, engine parameters, etc)
- Equations for swept volume and clearance volume are written.
- p2,t2, and t3 are calculated using the isentropic condition.
- Plot command is used for plotting the P-V diagram.
- Thermal efficiency is calculated using the following equation:
Conclusions
- Thermal efficiency is calculated in an effective manner by using MATLAB 18.0.
Figure 3: output in the command window
- P-V diagram is plotted using the plot command
Figure 4: P-V diagram of the Otto cycle using MATLAB