All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Aim: To create a MATLAB Program to solve an OTTO Cycle and make its plots. Also to calculate the thermal efficiency of the Engine. Theory: The Otto Cycle is an idealized thermodynamic cycle consisting of a set of processes used by Spark Ignition (SI) internal combustion engines. It describes how heat engines turn…
Jibin Jafar
updated on 06 Feb 2024
Aim:
To construct a MATLAB Program to solve an OTTO Cycle and make plots for it. Also to calculate the thermal efficiency of the Engine.
Theory:
The Otto cycle is an idealized thermodynamic cycle consisting of a set of processes used by Spark Ignition (SI) internal combustion engines. It describes how heat engines turn gasoline into motion. These engines would ingest a mixture of fuel and air, compress it and cause it to react, thus effectively adding heat through converting chemical energy into thermal energy. These expanded combustion products are ejected and replaced them with new charge of fuel and air. The Otto Cycle provides the energy for most transportation and was essential for the modern world [1].
The PV diagram of the ideal Otto cycle is shown in figure 1. It explains how the changes in pressure and volume of the working fluid (gasoline and air mixture) change due to combustion which powers the movements of a piston, creating heat, to provide motion of vehicle [2].
Figure 1: The ideal Otto cycle [3].
The different process in the Figure 1 are [4]:
Process 5 → 1: mass of air is drawn into piston/cylinder arrangement at constant pressure.
Process 1 → 2: adiabatic (isentropic) compression of the charge as the piston moves from bottom dead center (BDC) to top dead center (TDC).
Process 2 → 3: constant volume heat transfer to the working gas from an external source while piston is at top dead center. This process is intended to represent the ignition of the air-fuel mixture and the subsequent rapid burning.
Process 3 → 4: adiabatic (isentropic) expansion (power stroke).
Process 4 → 1: constant volume process in which heat is rejected from the air while the piston is at the bottom dead center.
Process 1 → 5: mass of air is released to the atmosphere in a constant pressure process.
The actual cycle does not have the sharp transitions between the different processes and the ideal cycle might be as sketched in Figure 2.
Figure 2: Sketch of an actual Otto Cycle [2].
Efficiency of an Ideal Otto Cycle
It is defined as the ratio between work done during Otto cycle to the heat supplied during Otto cycle.
ηth=WorkHeat Inputηth=WorkHeat Input
ηth=Heat Supplied - Heat RejectedHeat Inputηth=Heat Supplied - Heat RejectedHeat Input
ηth=mCv(T3-T2)-mCv(T4-T1)mCv(T3-T2)ηth=mCv(T3−T2)−mCv(T4−T1)mCv(T3−T2)
ηth=1-T4-T1T3-T2ηth=1−T4−T1T3−T2 ... ... ... ... ... ... ... ... ... ... ... ...(i)
Process 1 → 2 is an isentropic (reversible adiabatic) process. For this process, the relation between T and V is as follows:
T2T1=(V1V2)γ-1=rγ-1T2T1=(V1V2)γ−1=rγ−1 [sinceV1V2=r][sinceV1V2=r]
T2=T1⋅rγ-1T2=T1⋅rγ−1 ... ... ... ... ... ... ... ... ... ... ... ... ... ... ..(ii)
Similarly, Process 3 → 4 is also an isentropic process. Therefore,
T3=T4⋅rγ-1T3=T4⋅rγ−1... ... ... ... ... ... ... ... ... ... ... ... ... ... ...(iii)
Subtituting (ii) and (iii) in (i). We get thermal efficiency as,
ηth=1-1rγ-1ηth=1−1rγ−1
is the equation for Thermal efficiency of an Otto Cycle.
Relation between Crank Angle and Volume inside Crank Chamber
VVc=1+12(rc-1)[R+1-cosθ-(R2-sin2θ)12]VVc=1+12(rc−1)[R+1−cosθ−(R2−sin2θ)12]
where, VV is the volume inside crank chamber, VcVc is the clearance volume, rcrc is the compression ratio, and RR is the ratio of length of connecting rod to the crank pin radius.
Objectives:
Engine Parameters:
Bore = 0.1 m
Stroke = 0.1 m
Length of connecting rod, con_rod = 0.15 m
Compression ratio, cr = 12
Crank pin radius, a = Stroke/2 [unit: m]
MATLAB Program to solve Otto Cycle:
% OTTO Cycle
clear all
close all
clc
% Engine Parameters
bore = 0.1;
stroke = 0.1;
con_rod = 0.15; %connectin rod length
cr = 12; %compression ratio
a = stroke/2; %crank pin radius
R = con_rod/a;
% Specific heat ratio
gamma = 1.4;
�lculating the swept colume 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 Variables at point 1
p1 = 101325;
t1 = 500; %assumption, in Kelvin
% State Variables at point 2
p2 = p1*(cr^gamma);
t2 = p2*v2*t1/(p1*v1); %Ideal gas equation
% Explanation: process 1->2, isentropic process
% p1.v1^gamma = p2.v2^gamma; cr=v1/v2
% Process 1 to 2, Isentropic compression
v_compression = volume_calculation(cr,R,v_clearance,180,0);
c_12 = p1*(v1^gamma);
p_compression = c_12./(v_compression).^gamma;
% State Variables at point 3
v3 = v2;
t3 = 2300; %assuming maximum temp of combustion process as 2300K
p3 = p2*(t3/t2); %Ideal gas equation (v2=v3)
% State Variables at point 4
v4 = v1;
p4 = p3*(v3/v4)^gamma;
% Explanation: process 3->4, isentropic process
% p3.v3^gamma = p4.v4^gamma;
% Process 3 to 4, Isentropic expansion
v_expansion = volume_calculation(cr,R,v_clearance,0,180);
c_34 = p3*(v3^gamma);
p_expansion = c_34./(v_expansion).^gamma;
hold on;
plot(v_compression,p_compression,'color','b','linewidth',1.2);
plot([v2 v3],[p2 p3],'color','m','linewidth',1.2);
plot(v_expansion,p_expansion,'color','g','linewidth',1.2);
plot([v4 v1],[p4 p1],'color','r','linewidth',1.2);
legend('Process 1 to 2: Isentropic Compression','Process 2 to 3: Constant volume heat addition','Process 3 to 4: Isentropic Expansion','Process 4 to 1: Constant volume heat rejection');
text(v1,p1-0.05e6,'1');
text(v2,p2,'2');
text(v3,p3,'3');
text(v4,p4+0.08e6,'4');
xlabel('Volume, m^3');
ylabel('Pressure, Pa');
title('PV diagram of an Otto Cycle');
�lculation of Thermal efficiency
eff = 1-(1/(cr^(gamma-1)));
fprintf('Thermal Efficiency is %2.4f%% n',eff*100); %to print thermal efficiency
Each step of the function is explained with comments.
Further explanation
For isentropic processes (Process 1 to 2 and process 3 to 4), the volume for each process is calculated by a function, 'volume_calculation' with inputs as cr, R, v_clearance, start_theta and end_theta. The start_theta and end_theta are basically the initial and final value of the angle possessed by the crank shaft for those isentropic process. For compression, the value ranges from 180 to 360 degree while for expansion process it varies from 0 to 180.
The function volume_calculation with it's input argument return the value found to the varaible (here, v_compression and v_expansion) when it is called. The function volume_calculation is defined below:
function [V] = volume_calculation(cr,R,v_clearance,start_theta,end_theta)
% Volume Calculation
theta = linspace(start_theta,end_theta,180);
V = (1+(0.5*(cr-1)*(R+1-cosd(theta)-(R^2-(sind(theta)).^2).^0.5)))*v_clearance;
The text command in the main code has alloted the exact co-ordinate value for points 2 and 3. But the co-ordinate points for points 1 and 4 has been sligthly moved up and down from it's actual value so as to make sure that the points 1 and 4 marked on the plot using the text command does not collide or touch each other, so that each point will be properly visible on the graph. This happened since the points 1 and 4 are very close to each other.
Output of the Program:
The MATLAB program to plot the PV diagram of an Otto cycle has been coded successfully and it's required graph has been obtained.
The obtained PV diagram is,
The Thermal efficieny of the Otto cycle has been found as 62.9893%.
The screenshot of the command window showing the thermal efficiency is shown below:
References:
[1] https://www.grc.nasa.gov/WWW/K-12/airplane/otto.html
[2] https://energyeducation.ca/encyclopedia/Otto_cycle
[3] https://web.mit.edu/16.unified/www/FALL/thermodynamics/notes/node26.html
[4] https://en.wikipedia.org/wiki/Otto_cycle
[5] https://www.sciencedirect.com/topics/engineering/otto-cycle
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
MATLAB Project: Genetic Algorithm
Aim: To write a code in MATLAB to optimise the stalagmite function and find the global maxima of the function. Theory: A genetic algorithm (GA) is a method for solving both constrained and unconstrained optimization problems based on a natural selection process that mimics biological evolution [1].…
06 Feb 2024 09:06 AM IST
MATLAB Project: Solving second order ODEs [Simple Pendulum]
Aim:To write a MATLAB program to solve the second order differential equation and to simulate the pendulum motion. Theory:A differential equation is an equation with a function and one or more of its derivatives [1].y+dydx=5x: It is a differential equation with the function y and its derivative dydx.…
06 Feb 2024 09:02 AM IST
MATLAB Project: Air Standard Cycle
Aim: To create a MATLAB Program to solve an OTTO Cycle and make its plots. Also to calculate the thermal efficiency of the Engine. Theory: The Otto Cycle is an idealized thermodynamic cycle consisting of a set of processes used by Spark Ignition (SI) internal combustion engines. It describes how heat engines turn…
06 Feb 2024 08:57 AM IST
MATLAB Project: Curve Fitting
Aim: To write MATLAB code to fit a linear and cubic polynomial for the Cp data, and plot the linear and cubic fit curves along the raw data points. Theory: Curve fitting is the process of constructing a curve, or mathematical function, that has the best fit to a series of data points, possibly subject to constraints…
06 Feb 2024 08:47 AM IST
Related Courses
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.