Project

Simulation of Air-Standard Otto Cycle using MATLAB .

AIM : To write a code that can solve an Otto Cycle and make a plot for it.

OBJECTIVES OF THE PROJECT : The main objectives of the project are as follows;

1) To create a PV diagram

2) To output the thermal efficiency of the engine.

GOVERNING EQUATIONS : The project consists of 4 states, in which the Otto Cycle is performed. The formulae for State - 1 are as followed ;

Vs = (πD^2)/4* L

Where, Vs = Swept Volume, Vc = Clearance Volume, D = Bore, L = Stroke, CR = Compression Ratio

V1 = Vs + Vc

V2 = Vc

Where, V1 = Total Volume, V2 = Vc The formulae for State – 2 are as mentioned below;

〖(P1*V1)〗^γ = (〖P2*V2)〗^γ P2=P1*(〖V1/V2)〗^γ P2=P1*〖(CR)〗^γ

Where, P1= Pressure at state point 1, P2 = Pressure at state point 2

Using Ideal Gas Equation, (P1 * V1 )/T1 = (P2 * V2 )/T2

Therefore, T2 = (P2*V2)/(P1*V1) * T1

Where, T1 and T2 are temperatures at state point 1 and state point 2 respectively. The formulae for State – 3 are as mentioned below;

P3 /P2= T3/T2

The formulae for State – 4 are as mentioned below;

V4 = V1 (〖P3*V3)〗^γ = (P4*V4)^γ P4 = P3 * (V3/V4)^γ

Volume inside the combustion chamber changes frequently and the formula for the same is given by;

V ={ 1 + 1/2 (CR – 1)[ R+1-cosθ-(R^2- 〖sin〗^2 θ)^(1/2) ]} * Vc

Where, R = (C_R)/a, C_R = Connecting Rod, a = Crank Pin Radius, a = Stroke/2

BODY OF THE CONTENT : 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 Otto cycle is a description of what happens to a mass of gas as it is subjected to changes of pressure, temperature, volume, addition of heat, and removal of heat. The mass of gas that is subjected to those changes is called the system. The system, in this case, is defined to be the fluid (gas) within the cylinder. By describing the changes that take place within the system, it will also describe in inverse, the system's effect on the environment. In the case of the Otto cycle, the effect will be to produce enough net work from the system so as to propel an automobile and its occupants in the environment.

The Otto cycle is constructed from:

Top and bottom of the loop: a pair of quasi-parallel and isentropic processes (frictionless, adiabatic reversible).

Left and right sides of the loop: a pair of parallel isochoric processes (constant volume).

The P-V diagram for the Otto Cycle is as followed;

The processes are described by:

  • Process 1–2 is an adiabatic (isentropic) compression of the charge as the piston moves from bottom dead center(BDC) to top dead center (TDC).
  • 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.
  • Process 3–4 is an adiabatic (isentropic) expansion (power stroke).
  • 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.

The Otto cycle consists of isentropic compression, heat addition at constant volume, isentropic expansion, and rejection of heat at constant volume. In the case of a four-stroke Otto cycle, technically there are two additional processes: one for the exhaust of waste heat and combustion products at constant pressure (isobaric), and one for the intake of cool oxygen-rich air also at constant pressure; however, these are often omitted in a simplified analysis. Even though those two processes are critical to the functioning of a real engine, wherein the details of heat transfer and combustion chemistry are relevant, for the simplified analysis of the thermodynamic cycle, it is more convenient to assume that all of the waste-heat is removed during a single volume change.

Simulation of Air-Standard Otto Cycle by using MATLAB : Program to plot a P-V diagram for an Otto Cycle is as follows;

%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;
Comp_Ratio = 12;
%Calculation for Swept Volume and Clearance Volume
V_Swept = (pi/4) * Bore^2 * Stroke;
V_Clearance = V_Swept / (Comp_Ratio - 1);
V1 = V_Swept + V_Clearance;
V2 = V_Clearance;
%State Variables at State Point 2
%P2 * V2^Gamma = P1 * V1^Gamma
%P2 = P1 * (V1 / V2)^Gamma
P2 = P1 * Comp_Ratio^Gamma;
%P1 * V1/T1 = P2 * V2/T2
%T2 = P2 * V2 * T1 / (P1 * V1)
T2 = P2 * V2 * T1 / (P1 * V1);
constant_c = P1 * V1^Gamma;
V_Compression = engine_kinematics(Bore,Stroke,Con_Rod,Comp_Ratio,180,0);
P_Compression = constant_c ./ V_Compression.^Gamma;
%State Variables at State Point 3
V3 = V2;
%P3 * V3 / T3 = P2 * V2 / T2
%P3 = P2 * T3 / T2 
P3 = P2 * T3 / T2;
constant_c = P3 * V3^Gamma;
V_Expansion = engine_kinematics(Bore,Stroke,Con_Rod,Comp_Ratio,0,180);
P_Expansion = constant_c ./ V_Expansion.^Gamma;
%State Variables at State Point 4
V4 = V1;
%P3 * V3^Gamma = P4 * V4^Gamma
%P4 = P3 * (V3 / V4)^Gamma
P4 = P3 * (V3 / V4)^Gamma;
figure(1)
hold on
plot(V1,P1,'*','color','r')
plot(V_Compression,P_Compression)
plot(V2,P2,'*','color','r')
plot([V2,V3],[P2,P3],'color','b')
plot(V3,P3,'*','color','r')
plot(V_Expansion,P_Expansion)
plot(V4,P4,'*','color','r')
plot([V4,V1],[P4,P1],'color','b')
 

%engine_kinematics function code
function [V] = engine_kinematics(Bore,Stroke,Con_Rod,Comp_Ratio,Start_Crank,End_Crank) 
a = Stroke / 2;
R = Con_Rod / a;
V_Swept = (pi/4) * Bore^2 * Stroke;
V_Clearance = V_Swept / (Comp_Ratio - 1);
Theta = linspace(Start_Crank,End_Crank,100);
Term_1 = 0.5 * (Comp_Ratio - 1);
Term_2 = R + 1 - cosd(Theta);
Term_3 = (R^2 - sind(Theta).^2).^0.5;
V = (1 + Term_1 * (Term_2 - Term_3)).* V_Clearance;
end

OUTPUT PLOT (P-V diagram of an Air-Standard Otto Cycle) :

Explanation of the program: 1) Initial stage is to calculate the state points which are bore, stroke, connecting rod length and compression ratio. The code is divided in two different parts one in which we calculate the state point and in other we calculate the volume swept by the piston thought the whole cycle.

2) Here we have to assume some atmospheric condition for pressure and temperature which are required for the calculation of other parameters. From these parameters, we calculate the pressure at state point 2 . For calculation of the temperature at state point 2 we can use Ideal Gas equation. As volume at point 1 is addition of swept volume and clearance volume which is further calculated from the bore, stroke and compression ratio. Similarly, volume at point 2 is nothing but clearance volume.

3) After getting the pressure, temperature and volume at point 1 & 2 we calculate the further state point by assuming the temperature at point 3 which is around 2300 K. We also know that as process 2-3 is constant volume heat addition the volume at point 2 is equals to volume at point. So, again by using Ideal Gas law we can calculate the pressure at point 3 which should be higher of any other pressure point in the Otto Cycle .

4) Considering another isentropic process to calculate the state point 4 where the volume at point 4 is equal to volume at point 1 due constant volume heat rejection process. The rest of all the parameter can be calculated by Ideal Gas equation.

5) After calculating all the points, the function engine kinematics needs to be taken into consideration to calculate the actual volume swept by the piston. This is important because, if we plot all the state point it will show a linear line connection between each of the pressure and volume data which is not suitable.

6) To calculate the swept volume by the piston we are going to call the function called ‘engine_kinematics’ which have one output variable and 6 input parameters which are defined earlier.

V ={1 + 1/2 (CR – 1)[ R+1-cosθ-(R^2- 〖sin〗^2 θ)^(1/2) ]} * V

7) In which R is the ratio of connecting rod length to the crack radius. The above equation will give the swept volume from piston but still we need to calculate the swept volume for compression stroke and expansion stroke so that we can plot in the PV diagram.

8) For the compression stroke we can calculate the volume from the changing the crank angle from 180 to 0. Similarly, we know that PV is constant from which we can calculate the pressure variation for compression stroke. Similar terminology can be used for expansion stroke in which crank angle changes from 0 to 180 degree.

RESULTS : From the above program we have estimated the pressure and volume at each state point and have plotted a P-V diagram for the same. We can clearly observe that the maximum pressure is roughly around 55 MPa and the thermal efficiency of the engine is roughly around 66%. Here the thermal efficiency of the Otto Cycle is a function of compression ratio and ratio of specific heat. As specific heat is constant, the efficiency is directly proportional to the compression ratio only.

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.