PV Diagram of Air Standard Cycle using MATLAB.
AIM
- To visualize PV diagram of air standard cycle.
- Calculate the thermal efficiency of the engine.
Coding to visualize PV diagram and thermal efficiency of the engine is done by using MATLAB.
% PV diagram & Thermal efficiency of Air Standard Cycle.
%Inputs.
bore=.1; %Diameter of engine's cylinder (m).
stroke=.1; %Length from BDC to TDC (m).
con_rod=.15; %Length of connecting rod (m)
cr=12; %compression ratio
gamma=1.4;
p1=101325;
t1=500;
t3=2300;
v_swept=(pi/4)*bore^2*stroke;
v_clearance=v_swept/(cr-1);
v1=v_swept+v_clearance;
v2=v_clearance;
%State variables at poinnt 2(Isentropic comptession).
%p1*v1^gamma=p2*v2^gaama
p2=p1*cr^gamma;
%Ideal gas law, p1v1/t1=p2v2/t2
t2=p2*v2*t1/(p1*v1);
constant_c=p1*v1^gamma;
V_compression=engine_kinematics(bore,stroke,con_rod,cr,180,0);
%P_compression*V_compression^gamma=constant_c
P_compression=constant_c./(V_compression.^gamma);
%State variables at poinnt 3(contant volume heat addition)
v3=v2;
%p2v2/t2=p3v3/t3
p3=p2*t3/t2;
constant_c=p3*v3^gamma;
V_expansion=engine_kinematics(bore,stroke,con_rod,cr,0,180);
%P_expansion*V_expansion^gamma=constant_c
P_expansion=constant_c./(V_expansion.^gamma);
%State variables at poinnt 4(Isentropic expansion).
%p4v4^gamma=p3v3^gamma
v4=v1;
p4=p3*v3^gamma/(v4^gamma);
%p4v4/t4=p3v3/t3
t4=p4*v4*t3/(p3*v3);
Thermal_efficiency_in_percentage = (1-(t1/t2))*100
figure(1)
hold on
plot(V_compression,P_compression,'linewidth',2,'color','r')
plot([v2 v3],[p2 p3],'linewidth',2,'color','b')
plot(V_expansion,P_expansion,'linewidth',2,'color','g')
plot([v4 v1],[p4 p1],'linewidth',2,'color','b')
xlabel('Volume (V)')
ylabel('Pressure (P)')
grid off
Coding of function engine_kinematics is shown below -
%Engine kinematics.
function [V] = engine_kinematics(bore,stroke,con_rod,cr,start_crank,end_crank)
a=stroke/2; %Crank pin radius.
R=con_rod/a;
v_s = pi*bore^2*stroke/4;
v_c = v_s/(cr-1);
%V /v_c = 1+0.5*(cr-1)[R+1-cosd(theta)-(R^2-sind(theta)^2]^0.5.
theta = linspace(0,720,500);
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
- p1,p2,p3,p4 = Presure at state point 1,2,3 and 4 respectively.
- v1,v2,v3,v4 = Volume at state point 1,2,3 and 4 respectively.
- t1,t2,t3,t4= Temprature at state point 1,2,3 and 4 respectively.
- v2=v3 (Constant volume heat addition)
- v4=v1 (Constant volume heat rejection)
Procedure
Step 1: All the values of required inputs like Bore, Stroke, Connecting rod, Compression ratio, p1,t1,t3 were taken into consideration.
Step 2: v1 and v2 were computed by calculating the swept volume(V_swept ) and clearance volume(V_clearance). Where v1 implies Volume at Top Dead Center(TDC) and v2 implies Volume at Bottom Dead Center(BDC).
Step 3: All the state variable at point 2, point3 and point 4 were calculated.
V_compression and V_expansion were calculated by using calling of the function engine_kinematics.
Step 4: Thermal efficiency of the cycle was computed by the formula (1-(t1/t2))*100.
Step 5: PV diagram of the cycle is shown by using plot command.
Error Faced:
Resolved:
The error was resolved by using the element-wise operator between constant_c and / as it is an array.
Results:
1) PV diagram is attached above.
2) Thermal efficiency of the engine carried out to be 62.98 %.