Project

Simulation of Otto cycle in Matlab

Otto cycle:

Otto cycle is a gas power cycle that is used in spark-ignition internal combustion engines(modern petrol engines). This cycle was introduced by Dr. Nikolaus August Otto, a German Engineer.

An Otto cycle consists of four processes:

  1. Two isentropic (reversible adiabatic) processes
  2. Two isochoric (constant volume) processes



\"Otto

In the above diagrams,

p →Pressure

V → Volume

T →Temperature

s → Entropy

Vc → Clearance Volume

Vs → Swept Volume

Formula to calculate Efficiency of an Otto cycle:

\"$\\displaystyle

Program for PV diagram:

% Program for pv diagram of otto cycle
clear all
close all
clc
% inputs givens
P1=101.325;
T1=500;
T3=2000;
gamma=1.4 %ratio of Cp and Cv

% Engine geometry parameters
bore=0.1;
stroke=0.1;
con_rod=0.15;
cr=12 % cr=compression ratio
a = stroke/2; % crank pin radius
R = con_rod/a;

% Calcutation of swept volume and clearance volume
v_swept=(pi/4)*bore^2*stroke;
v_clearance=v_swept/(cr-1);
V1=v_swept+v_clearance;

% State variables at point 2
% p1*v1^gamma=p2*v2^gamma as it is isentropic process
P2=P1*cr^gamma
V2=v_clearance
% P1*V1/T1=P2*V2/T2 for ideal gas
T2=(T1*P2*V2)/(P1*V1)
v_compression=engine_kinematics(bore,stroke,con_rod,cr,180,0)
constant_c=P1*V1^gamma
%p_compression*v_compression^gamma=constant_c
p_compression=constant_c ./v_compression.^gamma
% state variables at point 3
V3=V2
% P2*V2/T2=P3*V3/T3 for ideal gas
P3=(P2*T3)/T2

v_expansion=engine_kinematics(bore,stroke,con_rod,cr,0,180)
constant_c=P3*V3^gamma
%p_expansion*v_compression^gamma=constant_c
p_expansion=constant_c ./v_expansion.^gamma

% state variables at point 4
% p3*v3^gamma=p4*v4^gamma as it is isentropic process
V4=V1
P4=P3*(V3/V4)^gamma

figure(1)
hold on

plot(V1,P1,\'*\',\'color\',\'r\')
plot(v_compression,p_compression)
plot(V2,P2,\'*\',\'color\',\'r\')
plot(V3,P3,\'*\',\'color\',\'r\')
plot(v_expansion,p_expansion)
plot(V4,P4,\'*\',\'color\',\'r\')
xlabel(\'volume\')
ylabel(\'pressure\')
grid on
plot([V2,V3],[P2,P3],\'color\',\'b\')

Function Program

function[v]=engine_kinematics(bore,stroke,con_rod,cr,start_crank,end_crank)

% inputs
a=stroke/2;
R=con_rod/a;
v_s=(pi/4)*bore^2*stroke
v_c= v_s/(cr-1)

theta=linspace(start_crank,end_crank,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

Program to calculate efficiency of Otto cycle:

% Program to calculate efficiency of otto cycle
clear all
close all
clc
% inputs givens
P1=101.325;
T1=500;
T3=2000;
gamma=1.4 %ratio of Cp and Cv

% Engine geometry parameters
bore=0.1;
stroke=0.1;
con_rod=0.15;
cr=12 % cr=compression ratio

% Calcutation of swept volume and clearance volume
v_swept=(pi/4)*bore^2*stroke;
v_clearance=v_swept/(cr-1);
V1=v_swept+v_clearance;

% State variables at point 2
% p1*v1^gamma=p2*v2^gamma as it is isentropic process
P2=P1*cr^gamma
V2=v_clearance
% P1*V1/T1=P2*V2/T2 for ideal gas
T2=(T1*P2*V2)/(P1*V1)

% state variables at point 3
V3=V2
% P2*V2/T2=P3*V3/T3 for ideal gas
P3=(P2*T3)/T2

% state variables at point 4
% p3*v3^gamma=p4*v4^gamma as it is isentropic process
V4=V1
P4=P3*(V3/V4)^gamma

% calculate efficiency
efficiency_otto=1-1/cr^(gamma-1)
figure(1)
hold on

Result:

Calculated efficiency of otto cycle=0.47469 i.e. 47.47%










Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.