Project

OTTO CYCLE USING MATLAB

1.AIM :

TO FIND THERMAL EFFICIECNY AND PLOT PV DIAGRAM FOR OTTO CYCLE USING MATLAB

2.THEORY AND GOVERNING EQUATIONS :

An Otto cycle is an air standard cycle that describes the functioning of a spark ignition engine. The PV diagram of an otto cycle is shown below.

The processes involved are :

Process 1-2: Isentropic compression

Process 2-3: Constant volume heat addition

Process 3-4: Isentropic expansion

Process 4-1: Constant volume heat rejection

swept volume is given by

`pi/4⋅ BORE ^ 2 ⋅ STROKE`

clearance voule is given by

`(sweptvolume )/( r c − 1)`

where rc is compression ratio

For isentropic process

`(p1)/ (p2) = (( v 1)/(v 2))^ γ =constant`

For heat addition and rejection process, from ideal gas equation

`(p 1 ⋅ v 1)/ (t1) = (p 2 ⋅ v 2)/( t 2)`

The thermal effciency is given by

`η = 1 − ( 1 /( r c )^ (γ − 1) )`

3.OBJECTIVES :

Objective is to calculate the thermal efficieny of otto cycle and plot the PV diagram using MATLAB.

4.MATLAB PROGRAM :

The MATLAB program to calculate the thermal efficieny of the engine and plot the PV diagram of otto cycle is shown below.

The explanation is written in form of comment.

clear all
close all
clc


%taking variable input from user

%pressure at state 1(before isentropic compression)
p1=input('enter the pressure at state 1(before isentropic compression) in N/m^2 : ');

%Temperature at state 1(before isentropic compression)
t1=input('enter the temperature at state 1(before isentropic compression) in kelvin : ');

%Temperature at state 3(after constant volume heat addition)
t3=input('Enter the value of temperature at state 3(after heat addition) in kelvin : ');

%Specific heat ratio
gamma=input('Enter the value of gamma : ');


%Taking engine geometric parameters from user

%bore of cylinder
bore=input('Enter the value of bore diameter(in m) : ');

%stroke length
stroke=input('Enter the value of stroke length(in m) : ');

%connecting rod length
con_rod=input('Enter the length of connecting rod(in m) : ');

%compression ratio
cr=input('Enter the value of compression ratio : ');


%calculating the swept volume and clearance volume
v_swept=(pi/4)*bore^2*stroke;
v_clearance=v_swept/(cr-1);

%calculating volume at state 1
v1=v_swept+v_clearance;

%calculating volume at state 2
v2=v_clearance;

%state variables at state point 2
p2=p1*cr^gamma; %pressure
t2=p2*v2*t1/(p1*v1); %temperature

%isentropic compression process calculation
constant_c=p1*v1^gamma;
%calling funcion piston_kinematics()
v_compression= piston_kinematics(bore,stroke,con_rod,cr,180,0);

p_compression=constant_c./v_compression.^gamma;


%state variables at state point 3
v3=v2; %volume
p3=p2*t3/t2; %pressure

%isentropic expansion process calculation
constant_c=p3*v3^gamma;
%calling funcion piston_kinematics()
v_expansion= piston_kinematics(bore,stroke,con_rod,cr,0,180);

p_expansion=constant_c./v_expansion.^gamma;

%state variables at state point 4
v4=v1; %volume
p4=p3*(v3/v4)^gamma; %pressure

%calculating thermal efficieny
effciency = 1-(1/(cr^(gamma-1)))

%plotting the PV diagram
figure(1)
hold on
plot(v1,p1,'marker','x','color','r');
plot(v_compression,p_compression);
plot(v2,p2,'x','color','r');
plot(v3,p3,'x','color','r');
plot(v_expansion,p_expansion);
plot(v4,p4,'marker','x','color','r');
line([v2 v3],[p2 p3]);
line([v4 v1],[p4 p1]);

The code for the function piston_kinematics() is shown below

%function definition and body
function [V]= piston_kinematics(bore,stroke,con_rod,cr,start_crank,end_crank)

a=stroke/2; %crank pin radius
R=con_rod/a;%connecting rod length to crank pin radius ratio


%calculating the swept volume and clearance volume
v_swept=(pi/4)*bore^2*stroke;
v_clearance=v_swept/(cr-1);


%crank angle
theta=linspace(start_crank,end_crank,100); %at TDC

term1=0.5*(cr-1);
term2=R +1 - cosd(theta);
term3=(R^2 - sind(theta).^2).^0.5;

V=(1+ term1*(term2 - term3)).*v_clearance;

end

Explanation:-

Initially the values of state 1 temperature and pressure, state 3 temperature, specific heat ratio (gamma), bore , stroke , connecting rod and compression ratio is taken as an input from user.

Then the values for swept volume and clearance volume are calculated.

volume at state 1 will be sum of swept volume and clearance volume and at state 2 will clearance volume.

Using equation p2/p1=(v1/v2)*gamma, p2 is calculated and by p1*v1/t1=p2*v2/t2 value of t2 is calulated.

In otto cycle volume at state 2 is equal to the volume at state 3 and at state 4 is equal to at state 1.

Pressure at state 3 is calculated using p3=p2*t3/t2 and at state 4 is calculated using

p4=p3*(v3/v4)^gamma .

Theermal efficiency of the otto cycle is given by effciency = 1-(1/(cr^(gamma-1))), where cr is compression ratio.

After obtainig the value at all states the PV diagram can be plotted.

RESULTS:-

Output window:-

PV diagram plot:-

Errors faced:-

Written wrong syntax of the command input().

5.CONCLUSION:

The PV diagram have been plotted and the thermal efficieny of the cycle is 0.6299

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.