Air standard Cycle
Aim:
To plot a P-V diagram of an Otto cycle and find the thermal efficiency by using Matlab Tool.
Formulae:
- Swept Volume (`Vswept``: `pi/4*d^2*L`
- clearance volume (`Vc`): `(Vs)/(gamma-1)`
- compression Ratio (`r`)= `(V2)/(V1)`
- Thermal Efficiency of an engine (`eta``o`): `1-1/(r)^(gamma-1)`
- Adiabatic process:`pv^gamma=c`
- where
`d`=Bore diameter (m)
`L`= Stroke Length (m)
Governing equation used to plot the P-V diagram is
`V/(Vc)=1+1/2(r-1)[R+1-cosd (theta)-((R^2-sin^2 (theta))^(1/2)]`
Body of the content:
Theoretical plot of P-V and T-S diagram of Otto cycle is

where
- P = Pressure
- V= volume
- T=Temperature
- P=Pressure
- S=entropy
Note: Assumed required values to generate P-V diagram and to find the Thermal efficiency.
- P1=101325 Pa
- T1=500k
- T3=2300k
- r=12
- `gamma`=1.4
- Bore diameter (d)=0.1m
- Stroke Length (L)=0.1m
- Length of Connecting rod (R)=0.15m
Matlab code:
- Program used to plot a P-V diagram of an Otto cycle and find the thermal efficiency by using Matlab Tool is
%function code
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_c=V_swept/(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
%otto cycle
clear all
close all
clc
%inputs
gamma=1.4
%pressure at state point 1 (Pa)
P1=101325
%temperature at state point 1 (k)
T1=500
%temperature at state point 3 (k)
T3=2300
%engine geometric parameters (meters)
bore=0.1;
stroke=0.1;
con_rod=0.15;
%compression ration
cr=12;
%thermal efficiency of engine
neta=(1-1/(cr)^(gamma-1))*100
%calculating the swept volume and the clearence 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
%P2*V2^gamma=P1*V1^gamma
%P2=P1*(V1/V2)^gamma=P1*cr^gamma
P2=P1*cr^gamma;
%P1*V1/T1=P2*V2/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;
%P3*V3/T3=P2*V2/T2 | P3=P2*T3/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;
%P3*V3^gamma =P4*V4^gamma | P4=P3*(V3/V4)^gamma
P4=P3*(V3/V4)^gamma;
hold on
plot(V_compression,P_compression,'linewidth',3)
plot([V2 V3],[P2 P3],'linewidth',3)
plot(V_expansion,P_expansion,'linewidth',3)
plot([V4 V1],[P4 P1],'linewidth',3)
legend('Compression','Addition','Expansion','Heat_Rejection')
xlabel('volume')
ylabel('pressure')
grid on
Procedure:
- of otto cycle and also to calculate the Thermal Efficiency of Engine
- Initially I have defined the finction code by using the governing equation.
- In the main code initially I have defined the inputs required.
- Next, I have calculated the swept valume and clearence volume.
- Next, I have calculated the thermal efficiency of engine.
- Next, I have defind the state variables at each state points using Adiabatic relation. Through that we got vaules of Temperature, Pressure and volume at all points.
- After calculating all the required values, I have plotted the graph of pressure and volume.
- Finally I have saved & run the code.
Output:

The above graph shows the P-V diagram of Otto cycle created by Matlab Tool

- Thermal Efficiency of engine is `eta`=62.98%`
Conclusion:
Hence the Thermal efficiency is solved and P-V diagram of otto cycle is plotted.