Air Standard Cycle
- Programe for ploting the (PV) diagram.
clear all
close all
clc
%input
gamma=1.4
t3=2300
%state variable
p1=101325
t1=500
%engine geometric parameters
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 variable 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/(p1*v1)
t2=p2*v2*t1/(p1*v1);
constant_c=p1*v1^gamma;
v_compression=piston_otto_cycle(bore,stroke,con_rod,cr,180,0);
p_compression=constant_c./v_compression.^gamma;
% state varibale for state point 3
v3=v2
%|p3=p2*t3/t2
p3=p2*t3/t2
constant_c=p3*v3^gamma;
v_expansion=piston_otto_cycle(bore,stroke,con_rod,cr,0,180)
p_expansion=constant_c./v_expansion.^gamma;
%state variable at state point 4
v4=v1
%|p4=p3*(v3/v4)^gamma
p4=p3*(v3/v4)^gamma
figure(1)
hold on
plot(v1,p1,'*','color','r')
plot(v_compression,p_compression,'color','r')
plot(v2,p2,'*','color','r')
plot(v3,p3,'*','color','r')
plot(v_expansion,p_expansion,'color','r')
plot(v4,p4,'*','color','r')
plot([v2 v3],[p2 p3],'color','b')
plot([v4 v1],[p4,p1],'color','b')
xlabel('volume')
ylabel('pressure')
- EXPLANATION
- Starting the programe with (clear all,close all,clc)for clearing the screen.
- We have given the input and the starting variable such as (gamma,t3,p1,v1) as shown in the programe.
- Put the engine geometry parameter (bore,stroke,con_rod,cr).
- In the 1st stage we have v1 and v2 as the swept volume ,and the clearance volume.
- In the state 2 we have t2 which is showed as .
t2=p2×v2×t1÷(p1×v1)
- We are now providing the function for proper ploting of (PV) diagram.
function [v]=piston_otto_cycle(bore,stroke,con_rod,cr,start_crank,end_crank)
a=stroke/2;
R=con_rod/a;
v_s=pi/4*bore^2*stroke;
v_c=v_s/(cr-1);
theta=linspace(start_crank,end_crank,100);
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
- In this we have defined the (V) for the given equation whis is subdivided in the different terms as (term1 ,term2,term3).
- Put this in the equation of (v) as shown in the programe.
- Now we call this (V) function in our otto cycle programe as a compression in stage 2,and same for the expansion process.
- Same as for the stage variable 3 and 4 as.
p4=p3×〖v3÷v4〗^γ
- Now plot the values of each state of (1,2,3,4).
- We get our desired output as a (PV) diagrame.
- ERRORS
- As shown in the error we have used the undefined line as used the upper case (V) so we used the (v) as this was defined previously.
- As shown the stroke is not defined so we used command window and used v_compression=piston_otto_cycle(0.1,0.10,0,12,180,0) and defined the values of all (bore,stroke,con_rod,cr).
- Programe for getting output of thermal efficiency.
clear all
close all
clc
%thermal efficiency of an otto cycle
cr=linspace(0,10,100);
gamma=1.5;
%efficiency
etta=1-1./(cr).^(gamma-1);
%plot
plot(cr,etta,'linewidth',1,'color','r');
grid on
xlabel('compression ratio')
ylabel('thermal efficiency')
- For calculating the thermal efficiency we used the following programe.
- Result