An Otto Cycle P-V plot and calculation of thermal efficiency using Matlab program
Aim - Write a Matlab program for the PV plot and calculation for thermal efficiency of Otto Cycle
Description- Otto Cycle - Otto Cycle is a idealized thermodynamic cycle, that describes the functioning of a typical spark ignition piston engine. The Otto cycle is the name of the cycle used in spark ignition internal combustion engine such as hydrogen and gasoline fuelled automobile engine. The Otto cycle consists of following processes-
- Process 0-1 a mass of air is drawn into piston/cylinder arrangement at constant pressure.
- Process 1-2 is an adiabatic(isentropic) compression of the charge as the piston moves from bottom dead centre(BDC) to top dead centre(TDC)
- Process 2-3 is a constant volume heat addition to the working gas from an external source while the piston is at top dead centre. This process is intended to represent the ignition of the fuel-air mixture & the subsequent rapid burning.
- Process 3-4 is a adiabatic(isentropic) expansion (power stroke).
- Process 4-1 completes the cycle by a constant-volume process in which heat is rejected from the air while the piston is at bottom dead centre.
- Process 1-0 the mass of air is released th the atmosphere in a constant pressure proces
Following are the various plots of the Otto Cycle-
Efficiency of the cycle- The theoretical efficiency of the Otto cycle deoends on the compression ratio and the specific heat ratio γ of the gas in the combustion chamber.
Compression ratio(r) is the ratio of the volume of the cylinder & the combustion chamber when the piston is at the bottom, & the volume of the combustion chamber when the piston at the top.For better fuel efficiency & fuel economy automobiles are to be designed with higher compression ratio. However, the compression ratio of Otto cycle engines is limited by the need to prevent the uncontrolled combustion known as knocking. Modern engines have compression ratio in the range of 8 to 11, resulting in ideal efficiency of 56% to 61%.
r = Vmax/Vmin = V1/V2
Specific Heat Ratio(γ) of a gas is the ratio of specific heat at constant pressure Cp to the specific heat at constant volume Cv.
γ = Cp/Cv
The heat supplied to the working fluid during constant-volume heating(combustion) = Qin = Cv(T3-T2)
The heat rejected from the working fluid during constant-volume cooling(exhaust)= Qout = Cv(T4-T1)
Efficiency(η) = Wnet/Qin = 1-Qout/Qin
Now by applying various property relation in the different process we get

Matlab Program
% PV plot of Otto Cycle using Matlab
clear all
close all
clc
%Inputs
gamma = 1.4;
t3 = 2600;
%State Variables
p1 = 101325;
t1 = 400;
%Engine Geometric Parameters
bore = 0.1;
stroke = 0.2;
con_rod = 0.20;
cr = 12;
% Calculating swept volume & 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 pf state 2
%p2*v2^gamma = p2*v2^gamma
%p2 = p1*(v1/v2)^gamma = p1*cr^gamma
p2 = p1*cr^gamma;
%p1*v2/t1 = p2*v2/t2 | t2 = p2*v2*t1/(p1*v1)
t2 = p2*v2*t1/(p1*v1);
constant_c = p1*v1^gamma;
V_compression = Piston_Kinematics(bore,stroke,con_rod,cr,0,180);
P_compression = constant_c./V_compression.^gamma;
% State Variables at state point 3
v3 = v2;
%p3v3/t3 = p2v2/t2 | p3 = p2*t3/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_compression.^gamma;
% State Variables of state point 4
v4 = v1;
% p3v3^gamma = p4v4^gamma | p4 = p3(v3/v4)^gamma
p4 = p3*(v3/v4)^gamma;
t4 = p4 * cr* t3/p3;
%Thermal Efficiency
Thermal_efficiency = 1-(1/(cr-1)^(gamma-1));
% Plotting
figure(1)
hold on
plot(v1,p1,'color','r')
plot(V_compression,P_compression,'color','r')
plot(v2,p3,'color','r')
plot(v3,p3,'color','r')
plot([v2,v3],[p2,p3],'color','b')
plot(V_expansion,P_expansion,'color','g')
plot(v4,p4,'color','r')
plot([v4,v1],[p4,p1],'color','k')
grid on
title('P-V Diagram of Otto Cycle')
xlabel('Volume (m^3)')
ylabel('Pressure (Pa)')
and for the function used in the 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
Results- The above program generates the following plots
Conclusion
- The thermal efficiency was calculated to be 61.68%.
- P-V diagram clearly shows that changes in isentropic processes are a curve not a straight line.