P-V diagram of the Otto Cycle using MATLAB and Its Efficiency
Objective:- Obtain a P-V diagram of an Otto Cycle using matlab program and also to calculate its efficiency.
Engine nomenclature of an otto cycle
- Bore = the diameter of an engine cylinder
- Stroke = the height of an engine cylinder
- Connecting rod = the rod which is used to convert the reciprocating motion of the piston into the rotarty motion of the crank
- Compression Ratio = It is the ratio of the total volume of the cylinder to the clearance volume of the cylinder.
The cycle consist four different process for reversible otto cycle:
1. Isentropic Process for compression from state 1 to state 2
2. Isochoric Process for constant heat addition from state 2 to state 3
3. Isentropic Process for expansion from state 3 to state 4
4. Isochoric Process for constant heat removal from state 4 to state 1
(i) function for the otto cycle
function [V_actual] = otto_engine_kinematics(bore,stroke,connect_rod,cr,start_crank,end_crank)
V1 = (pi*bore^2*stroke)/4;
V2 = V1/(cr-1);
a = stroke/2
R = connect_rod/a
theta = linspace(start_crank,end_crank,100)
term_1 = 0.5*(cr-1);
term_2 = R+1-cosd(theta);
term_3 = (R^2-sind(theta).^2).^0.5
V_actual = (1 + term_1*(term_2 - term_3)).*V2
end
(ii) The matlab program for the PV diagram of an Otto cycle and the Efficiency.
clear all
close all
clc
% write a matlab programm for the pv diagram for the otto cycle
% Engine parameterfor the Otto Cycle
bore = 0.1
stroke = 0.1
connect_rod = 0.15
comp_ratio = 12;
% Inpur data given to the Otto Cycle
Temp1 = 500
P1 = 101325
Temp3 = 2900
gamma = 1.4
% Calculating the Swept Volume,V1
V1 = (pi*bore.^2*stroke)/4;
Constant_C = P1*(V1).^gamma
V_compression = otto_engine_kinematics(bore,stroke,connect_rod,comp_ratio,180,0)
P_compression = (Constant_C)./(V_compression).^gamma;
% Calculating the Clearance Volume,V2
V2 = V1/(comp_ratio-1);
% State Variable at state point 2
% P2V2^gamma = P1V1^gamma
P2 = P1*(comp_ratio).^gamma
% P1V1/T1 = P2V2/T2;
Temp2 = (P2/P1)*(V2/V1)*Temp1
% state variable at state point 3
% P3V3/T3 = P2V2/T2; isochoric process ( V3 = V2)
P3 = (P2/Temp2) * Temp3
V3 = V2
Constant_C = P3*(V3).^gamma
V_expansion = otto_engine_kinematics(bore,stroke,connect_rod,comp_ratio,180,360)
P_expansion = (Constant_C)./(V_compression).^gamma;
% state variable at state point 4
% P3V3^gamma = P4V4^gamma
% V3 = V2 & V1 = V4;
V4 = V1
P4 = P3*(V3/V4).^gamma
figure(1)
hold on
plot(V1,P1,'*','color','r');
plot(V_compression,P_compression)
plot([V_compression V2],[P_compression P2],'color','b')
plot(V2,P2,'*','color','r')
plot(V3,P3,'*','color','r')
plot([V2 V3],[P2 P3],'color','b');
plot(V_expansion,P_expansion)
plot([V4 V1],[P4 P1])
plot(V4,P4,'*','color','r')
xlabel('Volume')
ylabel('Pressure')
figure(2)
plot([V1 V2 V3 V4 V1],[P1 P2 P3 P4 P1],'color','b')
xlabel('Volume')
ylabel('Pressure')
% calculate the thermal efficieny of the otto cycle
% Efficiency = Net output/input
% Efficiency = 1- 1/(comp_ratio).^gamma
efficiency = 1- 1/(comp_ratio).^gamma
The above figure shows the actual P-V diagram of an Otto Cycle.