Plotting otto cycle and finding out thermal efficiency using MATLAB
AIM
To plot otto cycle and calculate the thermal efficiency of the cycle using MATLAB
THEORY
The otto cycle is a thermodynamic cycle which describes the changes happening to state variables such as pressure, volume and temperature inside an internal combustion engine.
Given here is a plot of otto cycle which has specific volume in x-axis and pressure in y-axis. Q1 represents the heat added to the gas and Q2 represents the heat rejected by the gas. Four states of the gas is marked as 1, 2, 3, and 4 and it is subjected to the following processes in between these states.
(1)-(2)- Isentropic compression
(2)-(3)- Constant volume heat addition
(3)-(4)- Isentropic expansion
(4)-(5)- Constant volume heat rejection
The thermal efficiency of the cycle can be found out using the following equation
where k=1.4 for air, CR=compression ratio and V2 and V1 are volumes at (2) and (1) respectively.
PROGRAM
clear all
close all
clc
%engine cylinder dimensions are given as input
bore=0.1;
%gamma
Y=1.4;
%compression ratio
CR=10;
%stroke length
stroke=0.15;
%connecting rod length
cr_length=0.2;
%swept volume
v_s=(pi/4)*bore*stroke;
%clearance volume
v_c=v_s/(CR-1);
%input variables at (1)
t1=500;
p1=101325;
v1=v_s+v_c
%input variables at (2)
v2=v_c;
p2=p1*(v1/v2)^Y;
t2=p2*v2*t1/(p1*v1);
%calling function enginekinematics
v_compression=engine_kinematics(bore,stroke,CR,cr_length,180,0);
%P1v1^Y=p2v2^Y= a constant value and let that constant be 'k'
k=p1*v1^Y;
p_compression=k./v_compression.^Y;
%input variables at(3)
v3=v2;
t3=2300;
p3=(p2*t3)/t2;
%input variables at (4)
v4=v1;
p4=p3*(v3/v4)^Y;
t4=p4*v4*t3/(p3*v3);
%calling function enginekinematics again
v_expansion=engine_kinematics(bore,stroke,CR,cr_length,0,180)
j=p3*v3^Y;
p_expansion=j./v_expansion.^Y;
%plotting
figure(1)
hold on
plot(v1,p1,'*','color','r')
plot(v_compression,p_compression)
plot(v2,p2,'*','color','r')
line([v2,v3],[p2,p3],'color','r')
plot(v3,p3,'*','color','r')
plot(v_expansion,p_expansion)
line([v4,v1],[p4,p1],'color','r')
plot(v4,p4,'*','color','r')
xlabel('Volume')
ylabel('Pressure')
%calculating efficiency of the cycle
efficiency=1-(1/(CR)^0.4)
title(['thermal efficiency of the engine is ',num2str(efficiency),' %'])
CHALLENGES I FACED
1. My function engine_kinematics kept returning wrong values and when I checked the function I had missed out a few brackets and I corrected it by giving the brackets.
GRAPH
RESULTS AND CONCLUSION
The graph of the otto cycle was plotted and thermal efficiency was calculated. I was able to understand the role of engine kinematics in determining the efficiency of the engine.