AIR STANDARD CYCLE
AIM: Write a code that can solve an otto cycle and make plots for it.
OBJECTIVE:
- Write a program in Matlab to create a PV diagram.
- Calculate Thermal efficiency of the engine.
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 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 process (frictionless, adiabatic reversible).
- Left and right sides of the loop: a pair of parallel isochoric process (constant volume).
Processes
- Process 1–2 is an adiabatic (isentropic) compression of the charge as the piston moves from bottom dead centre (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.
PROGRAM
To give required inputs and by using basic thermodynamic formulas type the code and save the required output and to make a adiabatic curve by calling it as the "function [V]".
CODE FOR "FUNCTION[V]"
CODE FOR "function[V]"
function [V] = engine_kinematics_of_piston (bore, stroke, con_rod, cr, start_crank, end_crank)
% Crank pin radius
a = stroke/2;
% Ratio of connecting rod and crank pin radius
R = con_rod/a;
% Swept volume and Clearance volume calculations
v_s = pi/4*bore^2 *stroke;
v_c = v_s/(cr-1);
% Creating array for different theta
theta = linspace(start_crank, end_crank);
% Combustion volume calculation
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
PROCEDURE FOR PROGRAM "function[V]"
- In the function code the inputs are taken for the "function[V]" and assigned value for the output array.
- Calculating the Swept volume and Clearance volume.
- Creating an array for values of theta by using linspace command.
- Calculating the combustion volume by dividing each term and naming it as term1, term2, and term3.
`V=1+1/2 (C_r-1) [R+1-costheta-(R^2-sin^2theta)^0.5]`
`term1=1/2 (C_r-1)`
`term2=R+1-costheta`
`term3=(R^2-sin^2theta)^0.5`
CODE FOR P-V DIAGRAM and THERMAL EFFICIENCY
% P-V Diagram and Thermal efficiency of Otto cycle
clear all
close all
clc
% Inputs
gamma = 1.4
t3 = 2000
% state variables
p1 = 101325
t1 = 600
% Engine geometric parameters
bore = 0.1;
stroke = 0.1;
con_rod = 0.15;
cr = 7;
% 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
% p2v2^gamma = p1v1^gamma
% p2 = p1*(v1/v2)^gamma = p1*cr^gamma
p2 = p1*cr^gamma;
% p1v1/t1 = p2v2/t2 | t2 = p2*v2*t1/(p1v1)
t2 = p2*v2*t1/(p1*v1)
constant_c = p1*v1^gamma
v_compression = engine_kinematics_of_piston(bore,stroke,con_rod,cr,180,0)
p_compression = constant_c./v_compression.^gamma
% state variables at state point 3
v3 = v2
p3 = p2*t3/t2
constant_c = p3*v3^gamma
v_expansion = engine_kinematics_of_piston(bore,stroke,con_rod,cr,0,180)
p_expansion = constant_c./v_expansion.^gamma
% state variable at state point 4
v4 = v1
% p3v3^gamma = p4v4^gamma | p4 = p3(v3/v4)^gamma
p4 = p3*(v3/v4)^gamma
% Thermal Efficiency
thermal_efficiency = (1-(1/cr^(gamma-1)))*100
figure(1)
hold on
plot (v_compression,p_compression, 'linewidth', 2)
plot ([v2 v3], [p2 p3], 'linewidth', 2)
plot (v_expansion,p_expansion,'linewidth', 2)
plot ([v4 v1], [p4 p1], 'linewidth',2)
legend('Compression', 'Heat addition', 'Expansion', 'Heat rejection')
xlabel('Volume')
ylabel('Pressure')
grid on
PROCEDURE FOR PROGRAM P-V DIAGRAM AND THERMAL EFFICIENCY
- To start with clear all, close all and clc command is used to clear the windows.
- Input the values for gamma and and temperature at point 3.
- Define the values of state variables and engine geomentric parameters.
- Calculate the swept volume and the clearance volume and v1 and v2.
- Write program to calculate the state variables at point2 that is p2 and v2.
- Now, write program for V_compression and P_compression.
- Write program to calculate the state variables at point3 that is p3 and v3.
- Now, write program for V_expansion and P_expansion.
- Calculate the values of state variables at point4.
- Write program for Thermal efficiency.
`Thermal-efficiency=(1-1/(cr^(gamma-1)))*100`
11. Using plot command plot the P-V diagram.
No errors are faced while writting the program for P-V diagram and thermal efficiency for otto cycle.
RESULTS
1. P-V DIAGRAM

2. THERMAL EFFICIENCY
Thermal efficiency of otto cycle is 54.0483
