Project

STUDY OF A AIR STANDARD CYCLE USING MATLAB PROGRAMMING

Aim of the Project:

To make a plot of Pressure vs Volume of Otto cycle and calculate the thermal efficiency using MATLAB.

Objectives:

  1. To write a MATLAB program to create a PV diagram of Otto Cycle.
  2. To calculate the thermal efficiency using MATLAB.

Theory:

Otto Cycle:

An Otto cycle is an idealized thermodynamic cycle that describes the functioning of a typical spark ignition piston engine. It is the thermodynamic cycle most commonly found in automobile engines.

The processes are described by:

  1. Process 0–1 a mass of air is drawn into piston/cylinder arrangement at constant pressure.
  2. Process 1–2 is an adiabatic (isentropic) compression of the charge as the piston moves from the bottom dead center (BDC) to top dead center (TDC).
  3. Process 2–3 is a constant-volume heat transfer to the working gas from an external source while the piston is at top dead center. This process is intended to represent the ignition of the fuel-air mixture and the subsequent rapid burning.
  4. Process 3–4 is an adiabatic (isentropic) expansion (power stroke).
  5. Process 4–1 completes the cycle by a constant-volume process in which heat is rejected from the air while the piston is at bottom dead center.
  6. Process 1–0 the mass of air is released to the atmosphere in a constant pressure process.

Fig: P-V diagram of Otto Cycle

Calculation of different parameters of the Otto cycle to be used the MATLAB program:

Engine Geometric Parameters:-

  1. Bore = 0.1m
  2. Stroke = 0.1m
  3. Connecting Rod Length = 0.15m
  4. Compression Ratio (CR) = 12
  5. Swept Volume = (π /4)*Bore2*Stroke
  6. Clearance Volume = Swept Volume / (CR-1)

Given Parameters:

  1. P1 = 101325 Pa
  2. T1 = 500 K
  3. T3 = 2300 K
  4. Gamma (ɣ) = 1.4

Parameters for State Point-1

  • V1 = Swept Volume + Clearance Volume
  • V2= Clearance Volume

Parameters for State Point-2

  • (P2 V2) ɣ = (P1V1) ɣ
  • P2 = P1 (V1/V2) ɣ
  • T2 = P2V2T1 / P1V1

Parameters for State Point-3

  • V3 = V2
  • P3 = P2V2T3/T2V3

Parameters for State Point-4

  • V4 = V1
  • P4 = P3 (V3/V4) ɣ

Calculation of Thermal Efficiency Of Otto Cycle:

  1. Thermal Efficiency = 1-(1/CR (ɣ-1))
  2. % Thermal Efficiency = Thermal Efficiency* 100

Volume Trace = V/ Vc = 1 + ½(CR-1)*[R +1 – Cosϴ – (R2 – Sinϴ2) (1/2) ]

Where,

  • a = Stroke/2
  • R = connecting Rod length/a.

Code for the Function Called engine_kinematics_func (bore, stroke, con_rod, cr, statr_crank, end_crank) :

% Program to create a function to be called in the otto cycle program.

function [V] = engine_kinematics_func(bore, stroke, con_rod, cr, start_crank, end_crank)
 
% Crank Radius
a = stroke/2;
 
R = con_rod/a;
 
% Swept Volume
v_s = pi/4*bore^2*stroke;
 
% Clearance Volume
v_c = v_s/(cr-1);
 
% Crank Angle array over which the graph is plotted
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;
 
% Volume Trace
V = (1 + term1*(term2 - term3)).*v_c;
 
end

Explanation:

  1. To plot the perfect PV diagram we need to plot the curves in between the points.
  2. The curves need to follow the above function based on the Engine’s Piston Kinematics.
  3. The engine kinematics is given by the Volume Trace Formula as we mentioned above.
  4. Using this formula the function “engine_kinematics_func()” is written.
  5. This function depends on the various function inputs like Bore, Stroke, Connecting rod, Compression Ratio (CR), Starting crank angle, and Ending crank angle.
  6. This function is called in the main program according to the compression process and Expansion process while mentioning the correct function inputs.

MATLAB Codes for the main program:

% program to plot the P-V graph of Otto cycle and calculate Thermal Efficiency 
clear all
close all
clc
% Inputs
gamma = 1.4;
t3 = 2300;

% State variables
p1 = 101325;
t1 = 500;

% Engine Geometric Parameters
bore = 0.1;
stroke = 0.1;
con_rod = 0.15;
cr = 12;

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

v1= v_swept+v_clearance;
v2= v_clearance;

%State variables at state point 2
%p2v2^gamma=p1v1^gamma
%p2=p1*(v1/v2)^gamma=p1*cr^gamma
p2=p1*cr^gamma;

%p1v1/t1=p2v2/t2 | t2=p2v2t1/p1v1
t2= p2*v2*t1/(p1*v1);

constant_c = p1*v1^gamma;
v_compression = engine_kinematics_func(bore,stroke,con_rod,cr,180,0);
p_compression = constant_c./(v_compression.^gamma);

%State variables at state-3
v3=v2;
%p3v3/t3=p2v2/t2
p3=p2*v2*t3/(t2*v3);

constant_c = p3*v3^gamma;
v_expansion = engine_kinematics_func(bore,stroke,con_rod,cr,0,180);
p_expansion = constant_c./(v_expansion.^gamma);

% State variables at statepoint-4
v4=v1;
%p3v3^gamma= p4v4^gamma
p4=p3*(v3/v4)^gamma;

%Plotting the curves
figure(1)
hold on
title('Pressure vs Volume')
plot(v1,p1,'*','color','r')
plot(v_compression,p_compression,'color','blue')
plot(v2,p2,'*','color','r')
plot([v2,v3],[p2,p3])
plot(v3,p3,'*','color','r')
plot(v_expansion,p_expansion,'color','green')
plot(v4,p4,'*','color','r')
plot([v4,v1],[p4,p1])
xlabel('Volume')
ylabel('Pressure')

% Calculating the Thermal Efficiency
therm_e=1/cr^(gamma-1)
thermal_efficiency=1-therm_e
thermal_efficiency_percentage=thermal_efficiency*100

Explanation:

  1. First we put the Given input values i.e; Gamma, T3, P1, T1, The Engine geometric parameters like Bore, Stroke, Connecting rod length, Compression ratio.
  2. Then we put calculate the Swept Volume and Clearance Volume using the engine geometric parameters. V1 = Swept volume + Clearance volume
  3. Then The State variables for State -2 are found i.e; V2 = clearance volume.
  4. P2 and T2 are also calculated for state-2.
  5. The values of V_compression and P_compression are calculated using the engine kinematics function.
  6. Then the values for State variables at state point – 3 are calculated.
  7. V3 and P3 are calculated.
  8. V_expansion and P_expansion are calculated using the engine kinematics function.
  9. State variables at state Point-4 are calculated. P4 and V4 are calculated.
  10. While putting the Hold on command the plots for all the four points are written.
  11. The plots for P_compression and V_compression are written after the P1, V1 plot command.
  12. The plots for P_expansion and V_expansion are given after the P3, V3 plot command.

OUTPUT:

Plot for Pressure vs Volume:

Output for Thermal efficiency calculation:

Workspace Values:

Results and Conclusion:

As we can see in the above pictures it clearly shows the outputs of the MATLAB program, the output plot is the correct resemblance of the Otto cycle P-V curve, and the calculation of the thermal efficiency is also correctly shown by the program.

References:

  1. https://www.nuclear-power.net
  2. https://en.wikipedia.org
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.