Project

Plotting Otto cycle using octave

AIM:

To write a program in MATLAB/Octave to plot Air standard cycle-Otto cycle.

OBJECTIVES:

  1. To write a program in MATLAB/Octave to plot Air standard cycle-Otto cycle.
  2. To find the thermal efficiency of Otto cycle.

THEORY:

The Otto cycle is an ideal air standard cycle for the gasoline (petrol) engine and high speed engines .In an actual engine, the working substance becomes the air-fuel mixture and heat transfer processes are replaced by combustion process and exhaust process.

Fig.1 represents the P-V diagram for Otto cycle and Fig.2 represents operations of Otto cycle.

PROCESS: The Otto cycle consist of four processes:

Process 1-2 : Isentropic compression

In this process, adiabatic compression of the charge takes place as piston moves from bottom dead centre (BDC) to top dead centre (TDC).

Process 2-3: Reversible constant volume heat addition

In this process, heat is transferred at constant volume to the working fluid while the piston is at top dead centre.

Process 3-4: Isentropic expansion

This is also known as power stroke. In this stroke the piston moves from top dead centre (TDC) to bottom dead centre.

Process 4-1: Reversible constant volume heat rejection.

In this process, reversible constant volume heat rejection takes place while the piston is at bottom dead centre (BDC) .

The above processes are clearly represented in Fig.1 and Fig.2

IMPORTANT TERMS AND FORMULAS:

  1. Clearance volume`(v_c) :`Clearance volume is the between the cylinder head and the piston top when the piston is at top dead centre (TDC). In Fig.2, volume at state 2 is clearance volume.
  2. Swept Volume `(v_s):`It is the volume between the top dead centre (TDC) and bottom dead centre (BDC). As piston moves from dead centre to another, it sweeps this volume therefore it is known as swept volume.

Now from Fig.1, It is clearly seen that

`v_s = v_(1 )- v_c`

Where `v_1 =`Volume at state 1 (Total volume)

`v_c=`Clearance Volume

3. Compression ratio`(c_r):`It is the ratio of maximum to minimum volume in the cylinder of the internal combustion engine. Mathematically,

`c_r = v_1/v_2 = (v_c+v_s)/v_c = 1 + v_s/v_c`

4. Thermal efficiency`(η) = 1- 1/c_r^(y-1)`

Where`c_(r )=`compression ratio and y (gamma) = ratio of specific heats

For air, the ratio of specific heat (gamma) is assumed to be constant and thus the efficiency of Otto cycle is the function of compression ratio only.

INPUT PARAMETERS:

Bore: 0.10 m

Stroke: 0.10m

Connecting rod: 0.15m

Compression ratio: 12

Ratio of specific heat, gamma(y) = 1.4

GIVEN STATE VARIABLES:

Temperature at state point 1(`t_1`) = 500 K

Pressure at state point 1(`p_1`) = 101325 pa

Temperature at state point 3(`t_3`) = 2300 K

PROCEDURE TO CALCULATE OUTPUT PARAMETERS:

Swept Volume (`v_s`): `3.14/4*bb"bore"^2* stroke`

Clearance volume `(v_c):``v_s/c_(r-1)`

Where,

`v_s`= Swept volume

`c_r`= Compression Ratio

State variables at point 1:

  • `v_1= v_s+v_c`
  • `v_2= v_c`

State variables at point 2:

Process 1-2 is adiabatic compression which follows the relation `pv^y=c,`

Therefore,

  • `p_2= p_1*(v_1/v_2 ) = p_1*c_r^y`
  • `t_2 = (c_r^(y-1))*t_1`

State variables at point 3:

  • `v_3= v_2`
  • `(p_3*v_3)/t_3 = (p_2*v_2)/t_2 ∴ p_3= (p_2*t_3)/t_2`

States variables at point 4:

  • `v_4 = v_1`

Also process 3-4 is adiabatic expansion which follows the relation `pv^y=c.`

Therefore,

  • `p_4 = p_3* (v_3/v_4 )^y`
  • `t_4= (p_4*t_1)/p_1`

Volume at any intermediate point during compression and expansion stroke is given by:

  • `v/v_c = 1 + 1/2 (c_r-1) [ R + 1 - cos⁡θ - (R^2- (sin⁡θ)^2)^(1/2) ]`

Therefore,

`v = (1 + 1/2 (c_r-1) [R + 1 - cos⁡θ - (R^2- (sin⁡θ)^2)^(1/2) ] ) * v_c`

Where,

`v_c` = Clearance volume

`c_r` = Compression ratio

R= Connecting rod `/a` (a=Stroke`/2`)

`θ =` = Crank angle

PROGRAM: To plot the p-v diagram for Otto cycle and to calculate the thermal efficiency for the same.

PROGRAMMING LANGUAGE: Octave

%Program to plot p-v diagram for otto cycle and to calculate the thermal 
%efficiency for the same.

%inputs
%ratio of specific heats
gamma=1.4

%Given state variables (Pressure (in pascal) at point 1,temperature (in kelvin) 
%at point 1 and point 3 respectively
p1=101325
t1=500
t3=2300


%Engine geometries parameters
bore=0.1;
stroke=0.1;
con_rod=1.5;
cr=10;

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

%Total volume or volume at point 1
v1=v_c+v_s;

%volume at point 2
v2=v_c

%Calculation of compression volume and compression pressure at any intermediate 
%point of isentropic compression process (process 1-2) 
v_compression=engine_kinematics1(0.1,0.1,0.1,10,0,180);
constant1=p1*v1.^gamma;
p_compression=constant1./v_compression.^gamma;

%state variables at point 2

p2= p1*cr^gamma;
t2= cr^(gamma-1)*t1;

%states variables at point 3
v3=v2;
p3=p2*t3/t2;
constant2=p3.*v3.^gamma

%Calculation of expansion volume and expansion pressure at any intermediate 
%point of isentropic expansion process (process 3-4) 
v_expansion=engine_kinematics1(0.1,0.1,0.15,10,180,360);
p_expansion=constant2./v_expansion.^gamma;

%states variables at point 4
v4=v1;
p4=p3*(v3/v4)^gamma;
t4 = t3*p4*v4/(p3*v3);

%plotting p-v diagram for otto cycle
figure(1)
hold on

%Plotting states variables at point 1,2,3 and 4 respectively
plot(v1,p1,'*','color','r')
plot(v2,p2,'*','color','g')
plot(v3,p3,'*','color','b')
plot(v4,p4,'*','color','k')

%plotting different processes of otto cycle
plot(v_compression,p_compression,'color','r','linewidth',2,";Adiabatic compression;")
plot([v_c v_c],[p2 p3],'color','g','linewidth',2,";Constant volume heat addition;")
plot((v_expansion),(p_expansion),'color','b','linewidth',2,";Adiabatic Expansion;")
plot([v1 v1],[p4 p1],'color','k','linewidth',2,";Constant volume heat rejection;")

%labelling the Axes
xlabel('volume');
ylabel('pressure');

%Providing Title to the graph
title('P-V Diagram of Otto cycle')



%calculating thermal efficiency 
thermal_efficiency = 1 - 1./(cr.^(gamma - 1));
fprintf('Thermal Efficiency of the cycle is: %f',thermal_efficiency*100)

CALLING FUNCTION ‘engine_kineamatics1’:

The variation of combustion chamber volume as a function of crank angle is given by:

`v = (1 + 1/2 (c_r-1) [R + 1 - cos⁡θ - (R^2- (sin⁡θ)^2)^(1/2) ] ) * v_c`

Where,

`v_c`= Clearance volume

`c_r`=Compression ratio

R = Connecting rod`/a` (a= Stroke`/2)`

`θ =` Crank angle

With this formula, we can find the volume at any intermediate point during compression and expansion stroke in Otto cycle

For the ease of programming, the above formula is broken down into three terms:

term1: `1/2 (c_r-1)`

term2: `R + 1 - cos⁡θ`

term3: `(R^2- (sin⁡θ)^2)^(1/2)`

Now, the function ‘engine_kinematics1’is created such that it can be called from the main program.

%Function to calculate volume at any intermediate point during adiabatic
%compression and adiabatic expansion process in otto cycle
clear all
close all
clc

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

 a=stroke/2;
 R=con_rod/a;
 
 %Swept volume and Clearance volume respectively
 v_s=(pi/4)*bore^2*stroke;
 v_c=v_s/(cr-1);
 
 %Crank angle
 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

PROCEDURE:

Input parameters, state variables which are already known and piston geometry parameters are provided.

%Program to plot p-v diagram for otto cycle and to calculate the thermal 
%efficiency for the same.

%inputs
%ratio of specific heats
gamma=1.4

%Given state variables (Pressure (in pascal) at point 1,temperature (in kelvin) 
%at point 1 and point 3 respectively
p1=101325
t1=500
t3=2300


%Engine geometries parameters
bore=0.1;
stroke=0.1;
con_rod=1.5;
cr=10;

Swept volume, Clearance volume and total volume is calculated.

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

%Total volume or volume at point 1
v1=v_c+v_s;

%volume at point 2
v2=v_c

Compression volume and compression pressure at intermediate points during compression stroke in Otto cycle are calculated. After that states variables at point 2 and point 3 are calculated.

%Calculation of compression volume and compression pressure at any intermediate 
%point of isentropic compression process (process 1-2) 
v_compression=engine_kinematics1(0.1,0.1,0.1,10,0,180);
constant1=p1*v1.^gamma;
p_compression=constant1./v_compression.^gamma;

%state variables at point 2

p2= p1*cr^gamma;
t2= cr^(gamma-1)*t1;

%states variables at point 3
v3=v2;
p3=p2*t3/t2;
constant2=p3.*v3.^gamma

Expansion volume and expansion pressure at intermediate points during expansion stroke in Otto cycle are calculated. After that, states variables at point 4 are calculated.

%Calculation of expansion volume and expansion pressure at any intermediate 
%point of isentropic expansion process (process 3-4) 
v_expansion=engine_kinematics1(0.1,0.1,0.15,10,180,360);
p_expansion=constant2./v_expansion.^gamma;

%states variables at point 4
v4=v1;
p4=p3*(v3/v4)^gamma;
t4 = t3*p4*v4/(p3*v3);

States variables at point 1, 2, 3 and 4 are plotted. After that, various processes of Otto cycle which includes adiabatic compression process, constant volume heat addition process, adiabatic expansion process and constant volume heat rejection process are plotted respectively.

%plotting p-v diagram for otto cycle
figure(1)
hold on

%Plotting states variables at point 1,2,3 and 4 respectively
plot(v1,p1,'*','color','r')
plot(v2,p2,'*','color','g')
plot(v3,p3,'*','color','b')
plot(v4,p4,'*','color','k')

%plotting different processes of otto cycle
plot(v_compression,p_compression,'color','r','linewidth',2,";Adiabatic compression;")
plot([v_c v_c],[p2 p3],'color','g','linewidth',2,";Constant volume heat addition;")
plot((v_expansion),(p_expansion),'color','b','linewidth',2,";Adiabatic Expansion;")
plot([v1 v1],[p4 p1],'color','k','linewidth',2,";Constant volume heat rejection;")

Axes are labelled and title to the graph is provided.

%labelling the Axes
xlabel('volume');
ylabel('pressure');

%Providing Title to the graph
title('P-V Diagram of Otto cycle')

Thermal efficiency of the Otto cycle is calculated and result is printed.

%calculating thermal efficiency 
thermal_efficiency = 1 - 1./(cr.^(gamma - 1));
fprintf('Thermal Efficiency of the cycle is: %f',thermal_efficiency*100)

RESULT:

OUTPUT GRAPH

Thermal Efficiency is found to be 60.189%.

CONCLUSION:

  • P-V diagram for Otto cycle is plotted using the program written in Octave.
  • Thermal efficiency of Otto cycle for the given parameter is found to be 60.189%.
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.