MATLAB - Air standard Otto cycle thermal efficiency and pv diagram
1. AIM:
To find thermal efficiency and plot PV diagram in Octave 5.2.0
2. GOVERNING EQUATIONS:
p*(v^gamma)=constant
pv/t=constant
where
p-pressure
v-volume
t-temperature
gamma-specific heat ratio
Thermal Efficiency = 1-((t4-t1)/(t3-t2))=1-(1/cr)^(gamma-1)
cr=(swept volume + clearance volume)/clearance volume
where
cr=compression ratio
t1- intake temperature
t2- temperature at the end of compression stroke
t3- temperature at the end of power stroke
t4- temperature at the end of expnsion stroke
3. OBJECTIVE OF THE PROJECT:
- To find the pressure, temperature and volume at each state of the cycle.
- Using them, find the thermal efficiency of the cycle
- Using them, plot the PV diagram for the cycle
4. BODY OF THE CONTENT:
ALGORITHM:
In this, we will use air standard cyclE principle to find otto cycle efficiency and plot respective PV graph.
- clear all, close all, clc commands to clear variable, close figures, clear command screen
- Bore diameter(b), strole length(s), compression ratio(cr), connecting rod length(c), specific hea ratio(gama) were defined.
- Swept volume(swept) and clearance volume found using respective formulas as shown.
- State 1, isentropic compression,
- inputs i.e, p1 and t1 given
- v1 is nothing but swept volume + clearance volume.
- p1*v1^gama value(constant) stored in cons1.
- using this v_comp array(volume at each stage of compression) found by calling piston kinematics function(enginekinematcis_fn) from 180 to 0 degree.
- p_comp(pressure at each stage of compression) found using formula p_comp*v_comp^gama=cons1
- State 2, Constant volume heat addition.
- v2 defined as clearance volume.
- p2 and t2 defined as per formula shown.
- State 3, Isentropic Expansion,
- v3=v2 as constant volume.
- t3 and p3 are calculated by formula as shown.
- p3*v3^gama value(constant) stored in cons2.
- using this v_exp array(volume at each stage of expansion) found by calling piston kinematics function(enginekinematcis_fn) from 0 to 180 degree.
- p_exp(pressure at each stage of expansion) found using formula p_exp*v_exp^gama=cons2
- State 4, Constant volume heat extraction.
- v4 defined as v3.
- p4 and t4 defined as per formula shown.
- Thermal efficiency found using the formula
- efficiency=1-(1/cr)^(gama-1).
- Displayed it using fprintf function.
- For piston kinematics function, enginekinematcis_fn is the name of function. Here the formula for volume during compression/expansion is implemented.
- PV diagram plot
- Given figure name
- Used hold on command to keep figure screen on.
- Plotted each stroke using plot command.
- Labelled each axis
- Switched on grid visiblity
- Legend provide for each stroke.
CODE:
Using matlab coding, the following code is generated:
%IC engine air std otto cycle
clc
clear all
close all
%bore diameter
b=0.1;
%stroke length
s=0.1;
%compression ratio
cr=12;
%connecting rod length
c=0.15;
%specific heat ratio
gama=1.4;
%swept volume = displacement volume
swept=(pi*b^2*s)/4;
%clearance volume(cr=(swept volume+clearance volume)/clearance volume)
clearance=swept/(cr-1);
%STATE 1 isentropic compression = compression stroke
p1=101326; %input
t1=500; %input
v1=swept+clearance;
cons1=p1*v1^gama;
v_comp=enginekinematcis_fn(b,s,c,cr,180,0); %calling fn
p_comp=cons1./v_comp.^gama;
%STATE 2 constant volume heat addition = power stroke
v2=clearance;
p2=p1*cr^gama; %p2 from (p1*v1^gama=p2*v2^gama) and (cr=v1/v2)
t2=p2*v2*t1/(p1*v1); %t2 from ((p1v1/t1)=(p2v2/t2))
%STATE 3 isentropic expansion = expansion stroke
v3=v2;
t3=2000; %input
p3=p2*t3/t2; %p3 from ((p3v3/t3)=(p2v2/t2)) and (v3=v2)
cons2=p3*v3^gama;
v_exp=enginekinematcis_fn(b,s,c,cr,0,180); %calling fn
p_exp=cons2./v_exp.^gama;
%state4 constant volume heat extraction=exhaust stroke
v4=v1;
p4=p3*(v3/v4)^gama; %p4 from (p4*v4^gama=p3*v3^gama)
t4= (p4*cr*t3/p3); %t4 from ((p3v3/t3)=(p4v4/t4)) and v3=v2 and v1=v4 and (cr=v1/v2)
%thermal efficiency
eff=1-(1/cr)^(gama-1);
fprintf("Thermal Efficiency of this otto cycle=%fpercentage\n",eff*100);
%plotting begins
%Naming the figure
figure(1)
%keep the plots on screen
hold on
plot(v_comp,p_comp);
plot([v2,v3],[p2,p3]);
plot(v_exp,p_exp);
plot([v1,v4],[p1,p4]);
%labelling
xlabel('Volume in m^3');
ylabel('Pressure in N/m^2');
%grid visiblity
grid on;
legend('Isentropic compression','Constant volume heat addition','Isentropic expansion','Constant volume heat extraction');
function for piston kinematics
%kinematics
function [v]=enginekinematcis_fn(bore,stroke,con,cor,starta,enda)
a=stroke/2;
r=con/a;
sweptv=(pi*bore^2*stroke)/4;
v_c=sweptv/(cor-1);
ang=linspace(starta,enda,50);
term1=0.5*(cor-1);
term2=r+1-cosd(ang);
term3=sqrt(r^2-sind(ang).^2);
v=(1+term1*(term2-term3)).*v_c;
end
RESULTS
CONCLUSION:
Thus the thermal efficiency of air standard otto cycle is found and respective PV diagram plotted.