Programming code for Otto cycle to calculate realationship plot diagram of P-V and thermal efficiency using MATLAB
Programming code for Otto cycle to calculate realationship plot diagram of P-V and thermal efficiency using MATLAB
What is otto cycle?
An Otto cycle is an idealized thermodynamic cycle that describes the functioning of a typical spark ignition piston engine. It is the thermodynamic cycle most commonly found in automobile engines.
PROCESS TAKING PLACE WITH RESPECT TO THE OTTO P-V GRAPH
Basic terms used in derivation of air-standard efficiency of Otto cycle:
Total Cylinder Volume:
It is the total volume (maximum volume) of the cylinder in which Otto cycle takes place. In Otto cycle,
Total cylinder volume = V1 = V4 = Vc + Vs (Refer p-V diagram above)
where,
Vc → Clearance Volume
Vs → Stroke Volume
Clearance Volume (Vc):
At the end of the compression stroke, the piston approaches the Top Dead Center (TDC) position. The minimum volume of the space inside the cylinder, at the end of the compression stroke, is called clearance volume (Vc). In Otto cycle,
Clearance Volume, Vc = V2 (See p-V diagram above)
Stroke Volume (Vs):
In Otto cycle, stroke volume is the difference between total cylinder volume and clearance volume.
Stroke Volume, Vs = Total Cylinder Volume – Clearance Volume = V1 – V2 = V4 – V3
Compression Ratio:
Compression ratio (r) is the ratio of total cylinder volume to the clearance volume.
Now that we know the basic terms, let us derive expressions for T2 and T3. These expressions will be useful for us to derive the expression for air-standard efficiency of otto cycle. For finding T2, we take process 1-2 and for finding T3, we take process 3-4.
Process 1-2:
This process is an isentropic (reversible adiabatic) process. For this process, the relation between T and V is as follows:
Process 3-4:
This is also an isentropic process. The relation between T and V in this process is similar to the relation between T and V in process 1-2:
Here,
Air-standard efficiency of Otto cycle:
It is defined as the ratio between work done during Otto cycle to the heat supplied during Otto cycle.
Air-Standard Efficiency (thermal efficiency) of Otto cycle,
From my previous article,
Procedure :
- Use Basic Clear commands to clear memory of workspace, command.
-State variable Inputs for the otto cycle is given
i.e, -Pressure at 1st Node,
-Temperature at 1st Node,
- Temperature at 3rd Node
-Engine Geometric data is given as input along with state variable inputs
-Crank pin Radius =Stroke/2
-Cylinder Bore
-Stroke
-Connecting Rod Length (Rc)
- Ratio of compression(Cr)
-R=Ratio of connecting rod length to crank pin radius
-Theta value
-Input the formulae required for the calculation of data by the matalab
Formulae Submitted:
Crank pin radius, a=Stroke/2
R=ratio of connecting rod length to crank pin radius
R=Rc/a
Volume swept, Vs=(pi/4)*Bore^2*Stroke;
Volume Clearence, Vc=Vs/(Cr-1);
V1=Vs+Vc
V2=Vc
Constant_c=P1*V1^gamma;
V_compression=Kinematics_fn(Bore,Stroke,Rc,Cr,180,0);
P_compression=Constant_c./V_compression.^gamma
P2V2^gamma=P1V1^gamma,a reversible adiabatic expansion of an ideal gas
V1/V2)=Cr
P2=P1*Cr^gamma;
P1V1/T1=P2V2/T2,Ideal gas equation
T2=P2*V2*T1/(P1*V1);
V3=V2, Constant Volume
P3V3/T3=P2V2/T2,Ideal gas equation
P3=P2*T3/T2;
Constant_c=P3*V3^gamma;
V_Expansion=Kinematics_fn(Bore,Stroke,Rc,Cr,0,180);
P_Expansion=Constant_c./V_Expansion.^gamma
V4=V1, Constant Volume
P3V3^gamma=P4V4^gamma,a reversible adiabatic expansion of an ideal gas
P4=P3*(V3/V4)^gamma;
Change of volume in engine cyclinder,
V=(1+0.5.*(Rc-1)*(R+1-cosd(theta))-(R^2-sin(theta).^2).^0.5).*Vc;
Thermal Efficiency of Otto cycle,Eta =1-(1/((V1/V2)^(gamma-1)))
Eta =(1-(1/((V1/V2)^(gamma-1))))*100
- Functional program is used to reduce the length of main program, which helps in transfer of data and keep it simple.
-Functional data and Name is of case sensitive
-Plotting command is added to plot the required graph plotting for the output, here in the case we required for the plot of Pressure Vs Volume Relationship
-Efficiency is derived from the formula of Eta, Calculated by matlab
Main Program:
close all
clear all
clc
% To Create code for creating a PV diagram for Otto cycle
% state variable Inputs
P1=101325;
T1=600;
T3=1600;
gamma=1.5;
Bore=0.05;
Stroke=.1;
Rc=.1;
Cr=14;
a=Stroke/2;
R=Rc/a
theta=linspace(0,180,180)
% Formulas:
Vs=(pi/4)*Bore^2*Stroke;
Vc=Vs/(Cr-1);
% State variable at point 1
V1=Vs+Vc
V2=Vc
Constant_c=P1*V1^gamma;
V_compression=Kinematics_fn(Bore,Stroke,Rc,Cr,180,0);
P_compression=Constant_c./V_compression.^gamma
% State variable at point 2
% P2V2^gamma=P1V1^gamma,
%(V1/V2)=Cr
P2=P1*Cr^gamma;
% P1V1/T1=P2V2/T2,
T2=P2*V2*T1/(P1*V1);
% State variable at point 3
% V3=V2, Constant Volume
V3=V2;
% P3V3/T3=P2V2/T2,
P3=P2*T3/T2;
Constant_c=P3*V3^gamma;
V_Expansion=Kinematics_fn(Bore,Stroke,Rc,Cr,0,180);
P_Expansion=Constant_c./V_Expansion.^gamma
% State variable at point 4
V4=V1;
% P3V3^gamma=P4V4^gamma
P4=P3*(V3/V4)^gamma;
% Change of volume in engine cyclinder,
V=(1+0.5.*(Rc-1)*(R+1-cosd(theta))-(R^2-sin(theta).^2).^0.5).*Vc;
% Thermal Efficiency of Otto cycle,Eta =1-(1/((V1/V2)^(gamma-1)))
Eta =(1-(1/((V1/V2)^(gamma-1))))*100
% To plot PV Relation:
figure(1)
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')
plot([V1 V4],[P1 P4],[V2 V3],[P2 P3],'color','g')
xlabel("Volume")
ylabel("Pressure")
Function Program :
function [V] = Kinematics_fn(Bore,Stroke,Rc,Cr,Start_Crank,End_Crank)
%Crank pin radius, a
a=Stroke/2;
%R=ratio of connecting rod length to crank pin radius
R=.15/a
theta=linspace(Start_Crank,End_Crank,180)
% Volume swept,
Vs=(pi/4)*Bore^2*Stroke;
% Volume Clearence,
Vc=Vs/(Cr-1);
V=(1+0.5.*(Cr-1)*((R+1-cosd(theta))-(R^2-sind(theta).^2).^0.5)).*Vc;
end
Error Occured and Solved:
OUTPUT :
Relation of Pressure Vs Volume
THERMAL EFFICIENCY CALCULATION
CONCLUSION :
The Program by using MATLAB is done, in which the relationship curve diagram for Pressure & Volume is done and Thermal efficiency is calculated as is of 73%
REFERENCES :
http://mechteacher.com/otto-cycle-air-standard-efficiency-derivation/#ixzz6DkkYjcKq
https://en.wikipedia.org/wiki/Otto_cycle
https://www.ques10.com/p/8667/derive-an-expression-for-an-air-standard-efficienc/