Air standard cycle using MAtlab
Aim:
Construct the PV Diagram for the OTTO cycle using matlab by considering all the process associated to it.
Theory:
The Otto Cycle is named after Nikolaus Otto (1832–1891, German) who is credited as the first creator of a petroleum fuel based internal combustion engine operating under a four stroke cycle. Otto’s engine work during the eve of the industrial revolution was a critical development leading to the dawn of the automotive industry in the late 19th century. The Otto Cycle involves four engine strokes. A stroke is defined as a process in which the cylinder’s piston moves up to the top of the engine or down to the bottom of the engine. The cycle begins with the intake stroke in which fresh reactants (fuel and air) are drawn into the engine’s cylinder by a downward-expanding piston motion. The second stroke is compression in which the piston moves from the bottom to top of the engine thereby reducing the volume of the fuel and air. Compressing the reactants before burning them allows for greater work and power to be extracted from the following combustion process. When the piston is near the top of its stroke combustion begins and expansion of the burned gases continues into the expansion stroke. The last of the four strokes is the exhaust stroke in which the burned products of combustion are pushed out of the engine in order to make space for the next cycle’s intake stroke.
Today the Otto Cycle is frequently associated with an ideal cycle analysis of automotive spark ignition gasoline internal combustion. This ideal cycle assumes that the combustion process occurs instantaneously at constant volume. To a first order this Otto Cycle analysis can provide insights into how engine efficiency is affected by changing operating and design parameters. Engines operating under the Otto Cycle are the principal power-plants used in automobiles worldwide at the present time, although in some regions of the world the Diesel Cycle is a very close second in automotive applications. Engines operating under the Otto cycle are relatively inexpensive to manufacture and provide reasonable power to weight ratios with good efficiencies. In recent years engine design improvements coupled with exhaust after-treatment have resulted in vehicles that produce very low levels of pollutants.
The schematic PV diagram for an Otto Cycle is as shown
There are basically four Process
1-2 Constant Volume Heat addition
2-3 Isentropic Compression
3-4 Constant volume heat Rejection
4-1 Isentropic expansion
The actual p–V diagram for an engine has rounded corners because of the processes of combustion take place at a finite rate. The Otto cycle has sharp corners because the ‘combustion’ is switched on and off instantaneously. It can be seen from Fig. 3.10 that the area of the Otto cycle is larger than that of the actual cycle, and this has to be taken into account when analysing engine cycles – the actual engine cycle will always produce less work output than the Otto cycle.
A typical engine ‘cycle’ is defined in Fig. 3.11. It consists of a compression stroke (Fig. 3.11(a)), followed by a period of combustion close to top dead centre (tdc) (Fig. 3.11(b)) and then by expansion (Fig. 3.11(c)). These two strokes form the power producing processes, but afterwards the products of combustion have to be replaced by fresh air. This is symbolised in Fig. 3.11(d), where the exhaust valve is open at the beginning of the exhaust stroke. In a four-stroke engine the piston executes two complete revolutions of the crankshaft, and uses two strokes while the gas is pushed out by the piston on the up stroke, and then the intake valve is opened to enable air to be induced. In a two-stroke engine the intake and exhaust strokes occur at the end and the beginning of the expansion and compression strokes, respectively. These processes are called the gas exchange processes, and are one of the main reasons why real engines are not heat engines. The other reason is the combustion process, when the air is used to burn the fuel. This process of combustion means that the fluid in the engine cannot undergo a cycle.
Based on the above mentioned process the these will be the various position on to which the engine undergoes.
Ideal gas laws
Ideal gas laws are derived from the approximation that gas molecules behave like hard spheres. This approximation is true for most gases at low pressures or elevated temperatures, for example, at atmospheric conditions. Real gas behavior at higher pressures and lower temperatures is frequently represented by modifications of the ideal gas laws. Thus, the ideal gas laws are a good starting place for calculations of gas properties.
Boyle’s Law states that constant temperature (T), the volume (V) of a fixed mass of an ideal gas is inversely proportional to the absolute pressure (P). That is,
Charles’ Law states that constant pressure (P), the volume (V) of a given mass of an ideal gas is directly proportional to the absolute temperature (T)
These two laws may be combined to give the ideal (or perfect) gas law, an equation of state:
All these equation is used for the calculation of state variables
Procedure:
- The state variable such as pressure, temperature and Volume at end of each process is being calculated using the ideal gas laws
- Then these points are plotted using the plot command and pointer is used to mark as these are individual points.
- The below-mentioned code explains the process flow of the PV diagram for OTTO CYCLE. In order to plot this we require state variables at end of process and state variables include P, V and T. All these will be found out using the IDEAL GAS EQUATIONS related to the associated process. After determining the values these are plotted.
- Note: In addition to plot function used astrix "*" or circle"o" any one of markers as shown to plot the points on graph
6.After the use markers to plot the in the curve. We cannot us a mere plot or line command to join these line. To calculate the curve or volume variation during the process we use engine kinematics equations. In this, the volume variation is found out by varying the crank angle. This result is used to connect the curve during expansion and compression during the adiabatic process.
- The constant volume process is joined using straight line we line command as shown in the code.
Program:
function [v_compression]= engine(r_b,l,l_conrod,cr,start_angle,end_angle)
%Function to plot the curve in btw the points%
a=l/2;
R=l_conrod/a
v_swept=(pi/4)*r_b^2*l; %equation to calculate the swept vol for the gasoline engine(nothing but base areaX height)%
v_clearance= v_swept/(cr-1); %Clearance volue calculation%
theta=linspace(start_angle,end_angle,100)
term1=(cr-1)/2
term2= 1+R-cosd(theta);
term3=(R^2-sind(theta).^2).^0.5
v_compression=(1+ term1*(term2-term3))*v_clearance;
end
Here in this code, we can see that we have created a function to evaluate the engine Kinematics. The usage of calling a function will make us the main code length and with a single line we can make the function result appear on the main code and we use the same to compute the values at compression and expansion.
clear all
clc
close all
%initial conditions%
r=1.4;%gamma value
p1=101325; %atmospheric pressure in pascal 1bar= 10^5 Pa%
t1=500; %temperature in kelvin%
t3=2000;% temp at end of compression
%Find the initial volume consider an endine with follwing system parameters%
r_b=0.1; %Bore radius
l=0.15; %Stroke length
cr=12;%Compression Ratio
l_conrod= 0.15;
v_swept=(pi/4)*r_b^2*l %equation to calculate the swept vol for the gasoline engine(nothing but base areaX height)%
v_clearance= v_swept/(cr-1); %Clearance volue calculation%
v1=v_swept+v_clearance %state one volume%
v2=v_clearance %state 2 volume at the end of compression stroke%
%state variable at point 2
%p1*v1^r=p2*v2^r%p2=p1*(v1/v2)^r
p2=p1*(v1/v2)^r
%t2=p2*v2*t1/(p1*v1) pi*v1/t1=p2*v2/t2 ideal gas eqn
t2=p2*v2*t1/(p1*v1)
constant=p1*v1^r;
[v_compression]= engine(r_b,l,l_conrod,cr,180,0)
[p_compression]= constant./v_compression.^r
%State 3%
v3=v2
p3=(p2*t1)/t2
constant=p3*v3^r;
[v_expansion]= engine(r_b,l,l_conrod,cr,0,180);
[p_expansion]= constant./v_expansion.^r;
%state 4%
v4=v1
p4=p3*(v3/v4)^r
t4= p4*v4*t3/(p3*v3)
%hold on
%plot(t1,p1,'*', 'color','r')
%plot(t2,p2,'*','color','r')
%plot(t3,p3,'*','color','r')
%plot(t4,p4,'*','color','r')
%line([v2 v3],[p2 p3])
%line([v1 v4],[p1 p4])
%hold off
hold on
plot(v1,p1,'*', 'color','r')
plot(v_compression,p_compression)
plot(v2,p2,'*','color','r')
plot(v3,p3,'*','color','r')
plot(v_expansion,p_expansion)
plot(v4,p4,'*','color','r')
line([v2 v3],[p2 p3],'color','c')
line([v4 v1],[p4 p1],'color','m')
title('PV Diagram Otto Cycle')
xlabel('Volume')
ylabel('Pressure')
hold off
Result
The above shown figure describes the Otto cycle processes . Here inorder to plot the curve the engine kinematics is used. The project can be extented of plotting TS diagram for the same Otto cycle.