Otto Cycle
AIM: To write a program to solve the Otto cycle in MATLAB and calculate the thermal efficiency.
THEORY: An Otto cycle is an idealized thermodynamic cycle that describes the functioning of a typical spark ignition piston engine. It is the thermodynamic cycle that is most commonly found in automobile engines.
An ideal Otto cycle has the following P-V and T-S diagrams.
Fig 1 - P-V diagram Fig 2 – T-S diagram
An ideal Otto cycle has the following processes:
- Process 0–1 a mass of air is drawn into piston at constant pressure.
- Process 1–2 is an adiabatic (isentropic) compression in which the piston moves from the 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 TDC. 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 BDC.[1]
- Process 1–0 the mass of air is released to the atmosphere in a constant pressure
Engine geometry parameters and its value needed in the calculation of the program are:
- Bore diameter = 0.1m
- Stroke length = 0.1m
- Connecting rod length = 0.15m
- Compression ratio = 10
Others parameters needed are:
- Gamma(cp/cv) = 1.4
- P1 = 101325Pa
- T1 = 500K
- T3 = 2300K
Thermal Efficiency for Otto Cycle
In general, the thermal efficiency, ηth, of any heat engine is defined as the ratio of the work it does, W, to the heat input at the high temperature, QH.
W = (heat addition) - (heat rejection)
= (T3-T2) – (T4-T1)
QH = (heat addition)
= (T3-T2)
Variation of volume with respect to theta is given by:
PROGRAM
1) Main program
clear all;
close all;
clc;
% Inputs
gamma = 1.4;
% State variables
p1 = 101325; %(Pa)
t1 = 500; %(K)
t3 = 2300; %(K)
% Engine geometric parameters
bore = 0.1;
stroke = 0.1;
conn_rod = 0.15;
cr = 10;
% Calculation of 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 varaiable at state pt 2
% Pressure
% p2=p1*(v1/v2)^gamma=p1*cr^gamma
p2 = p1*cr^gamma;
% Temperature
% p1v1/t1=p2v2/t2
t2 = p2*v2*t1/(p1*v1);
% Calculation for tracing of curve during compression between pt 1 and pt 2
const_c = p1*v1^gamma;
v_compression = engine_kinematics(bore,stroke,conn_rod,cr,180,0);
p_compression = const_c./v_compression.^gamma;
% State variable at pt 3
% Volume
v3 = v2;
% Pressure
p3 = p2*t3/t2;
% Calculation for tracing of curve during expansion between pt 3 and pt 4
const_c = p3*v3^gamma;
v_expansion = engine_kinematics(bore,stroke,conn_rod,cr,180,0);
p_expansion = const_c./v_expansion.^gamma;
% State variable at pt 4
% Volume
v4 = v1;
% Pressure
p4 = p3*(v3/v4)^gamma;
% temperature
t4 = p4*v4*t3/(p3*v3);
% Generating plots
figure(1)
hold on
xlabel('Volume');
ylabel('Pressure');
plot(v1,p1,'*','color','r');
plot(v_compression,p_compression,'color','b');
plot(v2,p2,'*','color','r');
plot([v2 v3],[p2 p3],'color','b');
plot(v3,p3,'*','color','r');
plot(v_expansion,p_expansion,'color','b');
plot(v4,p4,'*','color','r');
plot([v4 v1],[p4 p1],'color','b');
% Calculation of thermal efiiciency
n_th = 1-(t4-t1)/(t3-t2)
2) User defined function program
% A user defined function for calculation of variation of volume with
% respect to theta.
function [V]=engine_kinematics(bore,stroke,conn_rod,cr,start_crank,end_crank)
a=stroke/2;
R=conn_rod/a;
v_s=pi/4*bore^2*stroke;
v_c=v_s/(cr-1);
% For generating 180 different values of theta
theta=linspace(start_crank,end_crank,180);
% The formula to calculate the variation of volume is broken into 3 parts
term1=0.5*(cr-1);
term2=R+1-cosd(theta);
term3=(R^2-sind(theta).^2).^0.5;
% All 3 terms are combined to get the final result
V=(1+term1*(term2-term3))*v_c;
end
OUTPUT
1) Workspace
2) Command Window (showing thermal efficiency)
The thermal efficiency is found to be 0.6019, which is 60.19%
3) P-V diagram
EXPLANATION
- clear all, close all, clc are written for clearing the workspace, command window, and also to close any open plots.
- Input parameters like state variables and engine geometric parameters are given.
- Calculation of swept volume and clearance volume is given by the following formula:
Swept volume = (π/4)*(bore)2*stroke
Clearance volume = v_swept/(compression ratio - 1)
In the program, v1 is the volume at BDC and v2 is the volume at TDC.
V1 = Swept volume + Clearance volume
V2 = Clearance volume
- Process 1-2 is an isentropic process, hence the applicable formula is
PVgamma = constant
With the help of this formula, I have calculated the pressure at pt. 2.
- All processes follow the ideal gas equation. Hence temperature at pt. 2 is calculated.
- The calculation for tracing of the curve during compression between pt. 1 and 2 is done using a user-defined function ‘engine_kinematics’. This function takes 7 parameters and gives the variation of volume with respect to theta. The function is explained in detail, later after the explanation of the main program.
This function gives the variation of volume at isentropic compression and saved in an array of
v_compression’. Then ‘p_compression’ is calculated using the formula PVgamma=Constant.
- Then state variables at pt. 3 is calculated.
v3 = v2, which is the volume at the TDC.
Since this is a constant volume process, so pressure at pt. 3 is calculated using formula p3*v3=p2*v2.
- The calculation for tracing of the curve during expansion between pt. 3 and pt. 4 is done using the function ‘engine_kinematics’. From this function all values of volume between pt. 3 and 4 are saved in ‘v_expansion’. Then pressure is calculated using formula PVgamma=Constant and saved in ‘p_expansion’.
- Then state variables at pt. 4 are calculated.
v4 = v1, which is the volume at the TBDC.
- Process 4-1 is the isentropic expansion process. Hence using the formula PVgamma=Constant, p4 is calculated.
- Using the ideal gas equation, t4 is calculated.
- Then plots are created using the above-calculated values. 4 plots are used to denote v1, v2, v3, v4, p1, p2, p3, and p4 using red ‘*’. The other 4 plots are used to connect all the four coordinates using relevant curves.
- Thermal efficiency is calculated using the formula:
and saved as n_th.
- The user-defined function ‘engine_kinematics’ is defined to calculate the precise location of each coordinate at an isentropic process. This function takes 7 parameters as input and results in an array as an output. In this ‘linspace’ is used to calculate the 180 values of theta between ‘start_crank’ and ‘end_crank’.
- This complex formula is broken into 3 terms.
term1=0.5*(compression ratio -1)
term2=R+1-cos (theta)
term3=(R2-sin (theta)2)0.5
- All terms are combined and saved in ‘V’. When this function is called, then it gives values saved in ‘V’ as an output.
Errors
1) Error 1
t4 was defined later as t4 = p4*v4*t3/(p3*v3)
2) Error 2
Appropriate brackets ware used later.
CONCLUSION
This program helps in understanding the variation of volume inside the piston cylinder of an Otto cycle.
Thermal efficiency can be calculated by this program.
The curve can be generated smoother by providing a higher number of loops in user-defined function ‘engine_kinematics’.
REFERENCES
- Fig 1 and 2 is taken from Wikipedia
https://en.wikipedia.org/wiki/Otto_cycle
- [1] This information has been taken from Wikipedia.