Project

PV DIAGRAM OF AIR STANDARD CYCLE USING OCTAVE

AIM:

A PROGRAM IN OCTAVE TO CREATE THE PV DIAGRAM OF AN OTTO CYCLE AND FIND IT’S THERMAL EFFECIENCY

INTRODUCTION:

Otto cycle is an ideal thermodynamic cycle commonly used to define an automotive petrol engine. For theoretical purpose the working medium in the engine is taken as air. Using programming we can easily do theoretical analysis of internal combustion engine.

GOVERNING EQUATIONS:

Fig.1. Air Standard Otto cycle

Here,

Process 1-2: Isentropic Compression

Process 2-3: Heat supply at constant volume

Process 3-4: Isentropic Expansion

Process 4-1: Heat rejection at constant volume

The four main strokes of an engine are:

-Intake Stroke: The movement of piston from top to bottom which leads in the fresh charge inside the cylinder.

-Compression Stroke: The movement of piston from bottom to top compressing the fuel mixture before the action of spark plug.

-Power Stroke: After the action of spark plug on compressed fuel, the energy released moves the piston down delivering the power generated to the engine.

-Exhaust Stroke: After the power is delivered, the residual gases are removed by movement of piston from bottom to top.

Based on above processes we derive following equations:

1) Swept Volume

`Vs = π/4 × BORE ^2 × STROKE`

2) Clearance Volume

`Vc = (Vs) / (Cr-1)`

3) Volume Trace

`V/( Vc) = 1 + ½ (Cr-1) [ R + 1 –cos'theta’ - (R^2 – sin'theta’)]`

4) Isentropic Process

`PV^gamma = CONSTANT`

5) Combined gas equation

`(PV)/T = CONSTANT`

6) Volumes

Total volume `V1 = Vc + Vs`

Volume at state2 `V2 = Vc`

7) Thermal Efficiency

`eta = 1 - ((V2)/(V1))^gamma – 1 = 1 - ((V3)/(V4))^gamma – 1 = 1 – 1/(Cr)^gamma-1`

Where,

Cr = Compression Ratio

R = Length of connecting rod / Crank Radius

Crank Radius(a) = stroke / 2

gamma = Ratio of Specific Heat (Cp / Cv)

OBJECTIVES:

1) TO CREATE A PV DIAGRAM OF OTTO CYCLE IN OCTAVE

2) TO DETERMINE THE THERMAL EFFICIENCY OF THE OTTO CYCLE

Let us assume the values,

-Initial values of pressure(P1) and temperature(T1) are known.

-The temperature after the combustion process (T3) is also known

-Square Engine (bore = stroke = 0.1 m)

-Connecting rod length = 0.15 m

-Cr = 15 m

-gamma = 1.4

-P1 = 1 atm = 1.01325 bar

-T1 = 500 K

-T3 = 2300 K

PROGRAM:

OCTAVE PROGRAM 1- FUNCTION PROGRAM

function [V] = engine_kinematics(bore,stroke,con_rod,Cr,start_crank,end_crank)
  % Crank Radius
  a = stroke/2;
  R = con_rod/a;
  
  % Swept Volume
  Vs = (pi/4)*bore^2*stroke;
  
  % Clearance Volume
  Vc = Vs/(Cr-1);
  
  % Linearly spaced vector for theta value
  theta = linspace(start_crank,end_crank,100);
  
  % Defining indivisual terms of main equation
 term1 = 0.5*(Cr-1); 
 term2 = R + 1-cosd(theta);
 term3 = (R^2-sind(theta).^2).^0.5;
  
  % Volume trace
  V = (1 + term1*(term2 - term3)).*Vc
endfunction

Explanation:

Line1- Function finds variation of volume with respect to theta

Line2&3- Defining variable parameters crank radius

Line4&5- Formula for swept volume and clearance volume

Line6- Creating linearly spaced vector for theta values

Line7- Defining term1 of main equation

Line8- Defining term2 of main equation

Line9- Defining term3 of main equation

Line10- Defining main equation i.e. calculating the volume vector

Line11- The ‘endfunction’ closes the function

The variation of Volume dependent upon the crank angle

Give the name of the function same as program name

OCTAVE PROGRAM 2- MAIN PROGRAM

% Otto cycle_engine kinematics
clear all
close all
clc

% Assumed Input variable
gamma = 1.4;
T3 = 2300;

% State variables at point 1
P1 = 1.01325;
T1 = 500;

% Engine geometry parameter
bore = 0.1;
stroke = 0.1;
con_rod = 0.15;
Cr = 15;

% Calculating the swept volume and clearance volume
Vs = (pi/4)*bore^2*stroke;
Vc = Vs/(Cr-1);

% Total volume  at point 1
V1 = Vs + Vc;

% Volume at point 2
V2 = Vc;

% State variable at point 2
% P2V2^gamma = P1V1^gamma
% P2 = P1*(V1/V2)^gamma = P1*Cr^gamma
P2 = P1*Cr^gamma;

% Isentropic process
constant_c = P1*V1^gamma;

% Using 'function' element operator
V_compression = engine_kinematics(bore,stroke,con_rod,Cr,180,0);
P_compression = constant_c./V_compression.^gamma;

% Combined gas equation
% P1V1/T1 = P2V2/T2 
T2 = P2*V2*T1/(V1*P1);

% State variable at point 3
V3 = V2;
% P3V3/T3 = P2V2/T2
P3 = P2*T3/T2;
constant_c = P3*V3^gamma;
 V_expansion = engine_kinematics(bore,stroke,con_rod,Cr,0,180);
 P_expansion = constant_c./V_expansion.^gamma;
 
% State variable at point 4
V4 = V1;
% P3V3^gamma = P4V4^gamma
P4 = P3*(V3/V4)^gamma;

% Plotting PV diagram
figure(1)
hold on
% For 1-2
plot(V1,P1,'*','color','r')
plot(V_compression,P_compression)
plot(V2,P2,'*','color','r')
% For straight line 2-3
plot([V2 V3],[P2 P3],'color','b')
% For 3-4
plot(V3,P3,'*','color','r')
plot(V_expansion,P_expansion)  
plot(V4,P4,'*','color','r')
% For straight line 4-1
plot([V4 V1],[P4 P1],'color','k')

% Adding titles
xlabel('Volume in m^3');
ylabel('Pressure in Pa');
title('PV DIAGRAM OF OTTO CYCLE');
grid on;
grid minor;

% Thermal Efficiency
n = ((1 - (1/Cr^(gamma - 1)))*100);
% Printing therrmal efficiency
fprintf('Thermal efficiency of otto cycle: %f percent',(n));

Explanation:

Common commands used in starting of program-

Clear all command for clearing workspace

Close all command for closing plots and figures in background

Clc command for clearing the command window

% Assumed Input variable

Line1- Assumed value of gamma = 1.4

Line2- Assumed value of temperature at state 3 = 2300 K

Line3- Assumed value for pressure at state 1 as 1 atm

Line4- Assumed value for temperature at state 1 = 500 K

% Engine geometry parameter

Line1&2- We have assumed Square engine thus (bore = stroke=0.1)

Line3- Assumed value for Connecting Rod is 0.15

Line4- Assumed value for Compression Ratio is 45 m

Line5- We have given formula for swept and clearance volume

Line6- The total volume at state 1 is sum of swept volume and clearance volume

Line7- Volume at state 2 is equal to clearance volume

Line8- Pressure formula given for state 2

Line9- Isentropic process (P1V1^gamma = constant)

% Using function element operator

Line1- Function is recalled for V_compression to describe the variation of volume with respect to crank angle

Line2- We have P_compression from PV^gamma= constant

Line3- From combined gas law, we get formula for temperature at state 2

Line4- Volume at state 3 is equal to volume at state 2

Line5- Likewise we get formula for pressure at state 3

Line6- Function is recalled for V_expansion to describe the variation of volume with respect to crank angle

Line7- Volume at state 4 is equal to state 1

Line8- Likewise we get formula for pressure at state 4

% Plotting PV diagram

Line1- The figure(1) command makes the existing figure to current figure

Line2- To make the previous figure stay on the plot

Line3- For the curve between point 1 and point 2, we give plot command to join the two points i.e. state at 1 and 2.

Line4- For straight line between state point 2 and 3

Line5- For the curve between point 3 and point 4, we give plot command to join the two points i.e. state at 3 and 4.

Line6- For straight line between state point 4 and 1

% Adding titles

Line1- We provide label to x-axis in volume in m^3

Line2- We provide label to y-axis in pressure in Pa

Line3- We provide title on the graph

Line4- The command shows grid lines on the graph

Line5- Grid minor command makes the line neat and small

% Thermal Efficiency

Line1- We have provided ‘eta’ formula for thermal efficiency

Line2- To display the output value of thermal efficiency

Fig.1.1. Command window output

Fig.1.2. Thermal Efficiency output

Fig.1.3. Workspace output

Fig.1.4. PV Diagram

CONCLUSION: THE OTTO CYCLE WAS STUDIED AND WAS PLOTTED USING OCTAVE PROGRAMMING. IT IS OBSERVED THAT EFFICIENCY VARIES INVERSELY WITH COMPRESSION RATIO.

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.