Air Standard Cycle using MATLAB
Aim:- To write a program in MATLAB for Air Standard Cycle.
Governing Equations:-
`[pv]^γ=Constant`
`[p2v2]^γ=[p1v1]^γ`
`v_s=π/4×[bore]^2×stroke`
`v_c=v_s/((cr-1))`
Where,
p = Pressure
v = Volume
t = temperature
`γ` = Adiabatic Index`
`v_s` = swept volume
`v_c` = compression volume
Piston kinematics Equation:-
`V/V_c =1+1/2 (r_c-1)[R+1-cosθ-(R^2-[sin]^2 θ)^(1/2)]`
Objectives of the project:-
- To Create a PV diagram and
- To get output of the thermal efficiency of the engine.
Explanation:-
The ideal Otto cycle comprises of two isentropic (constant entropy) and two constant volume processes. The Otto cycle is an open cycle or non-cyclic process since the fresh air-fuel is mixture is inducted inside the engine during each cycle and the burnt mixture is released to the atmosphere. To understand these processes let us consider piston and cylinder engine air-fuel mixture as the working fluid. Refer the P-V diagram given at the top.
- Air-fuel intake process 1-2: During this process the inlet valve of the engine is open, the piston moves towards the bottom position inducting air-fuel mixture at constant pressure.
- Isentropic compression process 2-3: During this process the inlet and exhaust valves of the engine remain close and the air-fuel mixture, which has been inducted inside the cylinder, is compressed to the minimum volume.
- Combustion of air-fuel mixture at constant volume 3-4: Thereafter, the air-fuel mixture inducted inside the cylinder is combusted by the spark at constant volume; hence these engines are called spark ignition engines. This leads increase in temperature and pressure inside the cylinder.
- Isentropic expansion process 4-5: Due to extremely high pressure, the piston is pushed again towards the bottommost position of the cylinder. It is during this process that the actual work is produced from the engine.
- Constant volume process 5-6: During this process the exhaust valve opens and all the exhaust gases are ready to be released to the atmosphere. The pressure inside the cylinder falls drastically.
- Exhaust process 6-1: During this process the exhaust valve is open and the piston moves upwards and removes all the exhaust gases inside the cylinder at constant pressure.
Thereafter the exhaust valve closes, the piston starts moving in downward direction, the inlet valve opens and fresh air-fuel mixture is inducted. The whole cycle is completed in four strokes of engine, hence it is called four-stroke engine.
- And this analysis is very important to find out the amount of fuel consumed and work produced by it.
- And in this we are going to plot the PV diagram.
Programming using MATLAB:-
Main Code:-
% A program in matlab for air standard cycle
% Objectives:-
% To create a PV diagram and
% To obtain output of the thermal efficiency of the engine
clear all
close all
clc
% The Inputs are:-
gamma = 1.4;
t3 = 2300;
% The state variables at point 1 are:-
p1 = 101325;
t1 = 500;
% The Engine geometric parameters are:-
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
% p2v2^gamma = p1v1^gamma
p2 = p1*cr^gamma;
% p1v1/t1 = p2v2/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,cr,180,0);
P_compression = constant_c./V_compression.^gamma;
% State variables at state point 3
v3 = v2;
% p3v3/t3 = p2v2/t2
p3 = p2*t3/t2;
constant_c = p3*v3^gamma;
V_expansion = engine_kinematics(bore,stroke,con_rod,cr,0,180);
P_expansion = constant_c./V_expansion.^gamma;
% State variables at state point 4
v4 = v1;
% p3v3^gamma = p4v4^gamma
% so p4 = p3(v3/v4)^gamma
p4 = p3*(v3/v4)^gamma;
t4 = p4*v4*t3/p3*v3;
hold on
plot(v1,p1,'*','color','g')
plot(V_compression, P_compression)
plot(v2,p2,'*','color','g')
plot(v3,p3,'*','color','g')
plot(V_expansion, P_expansion)
plot(v4,p4,'*','color','g')
plot([v2 v3],[p2 p3],'color','b')
plot([v4 v1],[p4 p1],'color','b')
xlabel('Volume')
ylabel('Pressure')
% To calculate Thermal Efficiency
th_eff = (1-(1/cr^(gamma-1)))* 100
Function Code:-
% creating a function
function [V] = engine_kinematics(bore, stroke, con_rod, cr, start_crank, end_crank)
a = stroke/2;
r = con_rod/a;
v_swept= pi/4*bore^2*stroke;
v_clearance= v_swept/(cr-1);
theta = linspace(start_crank,end_crank,180);
term1 = 0.5*(cr-1);
term2 = r + 1 - cosd(theta);
term3 = (r^2 - sind(theta)).^0.5;
V = (1 + term1*(term2 - term3)).* v_clearance ;
end
Explanation of the code:-
- First, we have given all the inputs
- And then, state variables at different points
- Then, we wrote a program for calculating the swept and clearance volume.
- Then, we wrote a program for plotting the graph
- And we have also wrote a function for the code
- And finally we calculated the thermal efficiency of the code
- And all the formulaes are mentioned in detail in the code
Output:-
Here is the PV diagram of the Air standard cycle
And the thermal efficiency of the engine is 62.9893.
Conclusion:-
- First we understood the concept of the air standard cycle
- Then based on that, we wrote the program accordingly
- And we have also wrote the function for the code
- And we wrote a program to plot the graph
- And the code has been explained with comments and formulas
- And we have also determined the thermal efficiency of the engine.
So with this, we have successfully completed the program in matlab for Air Standard cycle.