Project

Otto Cycle and Piston Kinematics

AIM: Air Standard Cycles are an integral part of thermodynamics. These cycles provide us with the closest approximation to the standard engines. There are many types of Air Standard Cycles to study. Diesel cycle, Otto cycle, Dual cycle are to name some. But here Otto cycle is focussed on. Based on the methods described later in this project, one can develop analysis programs for any type of cycle.

GOVERNING EQUATIONS: Prior to the study the Otto cycle, knowledge of some basic thermodynamics Equations and laws becomes rudimentary.

Isentropic process: Isentropic process is an idealized process which is both adiabatic and reversible. So the internal energy of the system remains constant throughout this process. Also, the entropy of the system remains constant in this thermodynamic process. The basic equation of this process concerning 'pressure' and 'volume' is:

`P*V^gamma=constant`,

where P is pressure (in pascal) and V is volume (in m^3) and the number followed by the State variable represents the state point.

This implies that `P1*V1^gamma=P2*V2^gamma`

According to Ideal Gas Law, `(P1*V1)/(T1)=(P2*V2)/(T2)`,

where T is temperature (in kelvin)

There are mainly two types of volumes under consideration while studying piston kinematics. These are: Swept volume (v_s) and Clearance volume (v_c); Sum of these two volumes make up the total volume of the cylinder.

Compression ratio (cr) is defined as the ratio of the total volume to the clearance volume.

Therefore, cr = `(v_s + v_c)/v_c` And since compression ratio is a ratio of volumes, it is a dimensionless quantity.

So v_c can be written in terms of v_s and cr as: `v_c = v_s/(cr-1)`

According to Piston Kinematics, the volume inside the cylinder can be calculated instantaneously as a function of Compression ratio (cr), stroke length, Connecting rod length, Crank angle (theta) and clearance volume:

`V=1+0.5( cr-1)[R+1-cos(theta)-(R^2-sin(theta)^2)^0.5]`,

where R=2*Connecting rod length/stroke

The efficiency of any system is simply defined as the ratio of output to the input. Efficiency of thermal system (Otto cycle) is governed by the following equation:

`eta = 1-((T1)/(T2))`

Given Parameters: T1= 500K and T3= 2000K; gamma for air is taken as 1.4; Compression ratio = 12; bore= 0.1; stroke= 0.1; length of the connecting rod= 0.15

OBJECTIVE: To analyze the Otto cycle for this specified engine, a Matlab script is developed in this project. The objective is to calculate the state variables at every point in the Otto cycle and to obtain a P-V Diagram representing the calculations and state variables precisely and lastly to calculate the thermal efficiency of the specified engine.

Matlab Code to achieve our desired results and to analyze the Otto cycle for the specified Engine:

Firstly, function definition that would be used in the main code:

function [V] = engine_kinematics_otto(bore, stroke, con_rod, cr, start_crank, end_crank)

a=stroke/2;
R=con_rod/a;
v_s= (pi/4)*bore^2*stroke;
v_c= v_s/(cr-1);

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

Main Code:

% Air standard Cycles- Otto Cycle, Diesel Cycle, Dual Cycle and more
% This code is to analyse a basic Otto cycle
% Assume t3=2000k is given to us

% Inputs
gamma= 1.4;
t3= 2000;

% 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 the 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
% p2*v2^gamma=p1*v1^gamma
% p2= p1*(v1/v2)^gamma = p1*cr^gamma
p2=p1*cr^gamma;
% p1v1/t1= p2v2/t2
t2=p2*v2*t1/(p1*v1);

constant_c=p1*v1^gamma;
V_compression=engine_kinematics_otto(bore, stroke, con_rod, cr, 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*v2*t3/(t2*v3);

constant_c= p3*v3^gamma;
V_expansion= engine_kinematics_otto(bore, stroke, con_rod, cr, 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;


% Plotting
figure(1)
hold on
plot(v1,p1,'*','color','r')
plot(V_compression,P_compression)
plot(v2,p2,'*','color','r')
plot(v3,p3,'*','color','r')
plot([v3 v2],[p3 p2])
plot(V_expansion,P_expansion)
plot(v4,p4,'*','color','r')
plot([v4 v1],[p4 p1])
xlabel('Volume (m^3)')
ylabel('Pressure (Pa)')

% Incorrect plot --> connecting dots with straight lines
% figure(2)
% plot([v1 v2 v3 v4],[p1 p2 p3 p4])

% For computing Efficiency
% efficiency= (t2-t1)/t2 = 1- t1/t2
efficiency= 1- (t1/t2)

Step by Step Explanation and Working of the codes mentioned above:

First, explaining the main code. Function definition code would be explained later when it would be called in the main code.

Declaring the basic inputs like gamma, which we know is 1.4 for polyatomic gas and t3 (temperature at the state point 3) = 2000K. Then, we know the state variables at the start of the cycle, declaring them. After that, Engine geometric parameters are crucial for the calculations. Basic parameters are known to us like compression ratio, bore (diameter of the cylinder), length of stroke and length of the connecting rod. Now, since we have declared what we knew, its time to calculate our unknown parameters using the known parameters declared above in the code. As mentioned in the Governing Equations section, swept volume, clearance volume and total volume are determined.

Now for state variables at state point 2, process 1 to 2 is isentropic compression, so applying the governing equation for this law yields 'p2' (pressure at state point 2). For the temperature at this point, apply Ideal gas law. So this gives us the state variables at state point 2 with the volume being equal to the clearance volume, as is clear from the fig above. And similarly, we can find the state variables at the state point 4 if state point 3 variables are known to us as process 3 to 4 is isentropic expansion. For state point 3, volume remains constant because process 3 to 4 is heat addition at constant volume. So 'v3' is already known to us. Since 't3' is given to us in the problem statement, we can directly use Ideal gas law to find 'p3'. While calculating for state point 4, 'v4' is equal to 'v1' as process 4 to 1 is heat extraction at constant volume.

Now coming to the function code:

The function does nothing but defines the volume in the cylinder as described in the Governing Equations section. In the function, first, the variables needed to compute the volume are defined. Then a range of theta or theta vector (crank angle) is defined from 0 to 180 degrees. Since the expression for the volume is long and it would be complex for the person to read in the code at once, so it is divided into three terms named as: 'term1', 'term2', 'term3'. And accordingly, the expression for volume in terms of these new terms is written. Remember that these terms are created only for the sake of simplicity. And this is the function that would be called in the main code.

Had this function not been defined, there would be just straight lines connecting the 4 state points, determined earlier in this section. So the exact function of volume between the state point 1 and 2 and state points 3 and 4 need to be defined. Hence this function is called after determining the state variables at state point 2. But note that to plot the volume on P-V diagram, continuous pressure function between state points 1 and 2 is also required. And this function can be calculated easily in terms of the volume function by using the equation of isentropic process. Since 'p1 and 'v1' are known, so the 'constant_c' can also be determined. And the required pressure function can be calculated in terms of this constant and the volume function. Call this function to be P_compression and volume function as V_compression as process 1 to 2 is isentropic compression. The same process is followed and applied for process 3 to 4. And here pressure and volume functions are named as P_expansion and V_expansion as process 3 to 4 is isentropic expansion.

Now for plotting:

Firstly all the coordinates for state points (1,2,3 and 4) are plotted with a marker '*', which are nothing but the state variables (pressure and volume) at the respective state points. Now for the lines between those points is easy as we already know the required volume function and the pressure function. So just input the function (for compression) after the plot function of coordinates of state point 1 and the expansion function after state point 3. Straight lines are made easily by normally inputting the coordinates of the required state point (from one state point to the other state point). After that x label (label for X-axis), which is "Volume (in m^3)" and y label(label for Y-axis), which is "Pressure (in Pa)" are added.

Calculating Efficiency:

Now that all the Otto cycle analyzation has been done, the overall efficiency of this engine is to be found. It is easily calculated by the formula mentioned in the Governing Equation section, as a function of 't1' and 't2'.

Errors faced during the execution of the codes:

  • When I finished writing the function code in the editor window, after saving it, I tried to plot the volume for the half of the cycle. But I got an error because I did not consider the scope of the variable defined as an output variable in the function block in the editor window. So I first defined the volume function in a newly created variable in the function window and then input it in the plot function

Plot obtained:

The similar error I faced with theta:

So I defined theta first, and then I was able to execute the command successfully.

CONCLUSION: After analyzing the Otto cycle through a Matlab script, we can use this concept to develop more and more intense codes for other Air Standard cycles or even for other thermodynamic processes for that matter. But still, there is a need that more intense work should be done on this topic.

One should note that the processes considered in this project are completely ideal. So there are some errors in the results as compared to the results for the actual engine.

So more work is needed to make it more autonomous and pragmatic.

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.