Project

Otto Cycle & Calculation of Air-Standard Efficiency using MATLAB

AIM : Write MATLAB code that can solve an Otto cycle and calculate the Thermal Efficiency.

Governing Equations :

Otto Cycle: The Otto cycle is a set of processes used by spark ignition internal combustion engines.

These engines :-

  • (0-1) Ingest a mixture of fuel and air,
  • (1-2) Compress it,
  • (2-3) Cause it to react, Thus effectively adding heat through converting chemical energy into thermal energy,
  • (3-4) Expand the combustion products, and then
  • (4-5) Eject the combustion products and replace them with a new charge of fuel and air.

Characteristics of the process:

Process 1-2 : Isentropic Compression

Process 2-3 : Constant Volume Heat Addition

Process 3-4 : Isentropic Expansion

Process 4-1 : Constant Volume Heat Removal

The different processes are shown in Figure below:

Formulas :-

For Isentropic Compression or Expansion

`P*V^γ=`constant

`T*V^(γ-1)=`constant

Cylinder :

Swept Volume : `V_S = (π/4)*`bore*stroke

Clearance Volume : `V_C = V_(S )/(r_c-1)`

The change of volume with respect to crank angle :

`V/V_C =1+0.5(r_c-1)[R+1-cos⁡θ-√(R^2-(sin⁡θ*sin⁡θ ) ) ]`

Here,

`R=r_c/a` & a = crank pin radius

`r_c`= Compression Ratio

`θ` = Crank angle

Workflow(Stepwise Explanation) :-

1.The input variables like engine parameters are allocated.

2.The state variables like Pressure ,Volume ,Temperature are given for state point one & temperature of cylinder at combustion is given(i.e t3 is given.)

3.Using the inputs of cylinder parameters volume calculations are done for the engine cylinder.

4.Using the above mentioned formulas the state parameters for 2,3 & 4 are found out.

5.For isentropic compression & expansion curve there is a relation given between Volume of cylinder & crank angle.

6.This is applied to make a function called engine_kinematics, which is called to calculate the volume along the change in crank angle for compression stroke & expansion stroke.

7.After all state parameters are found out, the thermal efficiency is calculated.

8.At the end, plot command is used to plot the otto cycle on P-V diagram.

(A brief explanation is given in the code itself as comments)

Main Code:

close all
clear all
clc

% Otto-Cycle (Air Standard Calculation)
% Pressure in Pascals , Temperature in Kelvin , Volume in cubic meter
% All cyclinder parameters are in meters
%Input data (Engine Specification)
bore = 0.1;
stroke = 0.1;
c_rod = 0.15;
cr = 12;
gamma = 1.4;
t3 = 2300;

% State 1 (Given Data)
p1 = 101325;
t1 = 500;

% Engine Volume Calculations
v_swept = pi*(bore/2)^2*stroke;
v_clearance = v_swept/(cr-1);

% State 1 - Calculation
v1 = v_swept + v_clearance;

% Using Isentropic compression law (P*V^gamma = constant)
c_constant1 = p1*v1^gamma;
v_compression = engine_kinematics(bore,stroke,c_rod,cr,180,360);
p_compression = c_constant1./v_compression.^gamma;

% State 2 
% Equations p1v1^gamma = p2v2^gamma , t1v1^gamma-1 = t2v2^gamma-1
v2 = v_clearance;

p2 = p1*(v1/v2)^gamma;

t2 = t1*(v1/v2)^(gamma-1);

% State 3 (2-3 Constant v)
% t3 is given 

v3 = v2;
p3 = p2*t3/t2;

c_constant2 = p3*v3^gamma;
v_expansion = engine_kinematics(bore,stroke,c_rod,cr,0,180);
p_expansion = c_constant2./v_expansion.^gamma;

% State 4 

v4 = v1;
p4 = p3*(v3/v4)^gamma;
t4 = t3*(v3/v4)^(gamma-1);

% Calculation of Thermal Efficiency of the engine.
t_efficiency = 1 - (1/cr^(gamma-1))


figure(1)
hold on

plot([v1 v2 v3 v4],[p1 p2 p3 p4],'*','color','b')
line([v2 v3],[p2 p3])
line([v4 v1],[p4 p1])

plot(v_compression,p_compression,'color','r')

plot(v_expansion,p_expansion,'color','g')
ylabel("Pressure")
xlabel("Volume")

Function Code:-

% Engine kinematics for piston kinematics
function [v] = engine_kinematics(bore,stroke,c_rod,cr,start_angle,end_angle)

a = stroke*0.5; % Crank Pin Radius
R = cr/a;
theta = linspace(start_angle,end_angle,180); %crank angle

% Calculation

v_s = pi*(bore/2)^2*stroke;
v_c = v_s/(cr-1);

% Splitting main formula into terms
term1 = 0.5*(cr-1);
term2 = R+1-cosd(theta);
term3 = (R^2 - sind(theta).^2).^0.5;

% Relation between crank angle & the chance in the volume in cyclinder
v = (1 + term1*(term2-term3))*v_c;

end

Errors Faced:

By not using the hold on command after plot command, only one curve is shown in the graph screen.

Resolution :Using the hold on command will rectify the error & the desired output will be obtained.

Output Results:-

Otto Cycle on P-V diagram.

Red - Compression

Green - Expansion

Blue - Constant Volume Process

Thermal Efficiency:

Thus the thermal efficiency comes out to be 63%.

Conclusion:

So this is a very simple program to plot the otto cycle & calculate its thermal effficeincy of an SI 4-Stroke engine.

Similary, disel cycle or dual cycle can be performed in a similar manner for different engine parameter & its Air-Standard Efficeincy can also be found out.

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.