Engine Kinematics of Otto Cycle Using Matlab
Engine Kinematics of Otto Cycle Using Matlab
AIM:-
1) Create a PV diagram for Otto Cycle
2) Plot all the P-v value in graph
3) Find out Thermal efficiency of the engine
% Otto cycle using mtlab
clear all % Clear all Variables from memory
close all % close all charts and figures
clc % clear command window
% Aim-
% 1)Create a PV diagram for Otto Cycle
% 2)Findout Theraml efficiency of the engine
% Step1 - find out state parameters
% Volume at each state (v1, v2, v3, v4) &
% Pressure at each state (p1, p2, p3, p4)
% Given - Inputs
gamma = 1.4;
% Given - State variables
p1 = 101325 % Presure at state point1 in bar
t1 = 500; % Temperature at state point1 in K
t3 = 2300; % Temperature at state point3 in K
% Given - Engine geometric parameters
bore = 0.1; % Bore diameter of cylinder
stroke = 0.1; % Stroke length of cylinder
con_rod = 0.15; % Length of Connecting Rod
cr = 12; % Compression ratio
% Calculating the swept volume and the clearance volume
% 1) Swept volume using (pi/4)*Diameter^2*length
v_swept = (pi/4)*bore^2*stroke;
% 2) Clearance volume using relation of swept volume and compression ratio
v_clearance = v_swept/(cr-1);
% We can calculate v1 & v2 using swept volume and clearance volume
v1 = v_swept + v_clearance
v2 = v_clearance
% State variable at state point 2
% p2v2^gamma = p1v1^gamma ------- constant adiabatic compression process
% p2 = p1*(v1/v2)^gamma = p1*cr^gamma
p2 = p1*cr^gamma
% p1v1/t1 = p2v2/t2 ------------ The Gas Law
% t2 = p2*v2*t1/(p1*v1)
t2 = p2*v2*t1/(p1*v1);
% Adiabatic compression Processes for an Ideal Gas
constant_c = p1*v1^gamma;
% Call the function for compression volume
v_compression = Engine_kinematics_of_Otto_cycle(bore,stroke,con_rod,cr,180,0);
% calculate compression pressure by using Ideal gas law
p_compression = constant_c./v_compression.^gamma;
% State variables at state point 3
v3 = v2 % Constant volume heat addition process
% p3v3/t3 = p2v2/t2 ------------ The Gas Law
% p3 = p2*t3/t2 ------------ same volume gets cancel
p3 = p2*t3/t2
% Adiabatic Expansion Processes for an Ideal Gas
constant_c = p3*v3^gamma;
% Call the function for Expansion volume
v_Expansion = Engine_kinematics_of_Otto_cycle(bore,stroke,con_rod,cr,0,180);
% calculate Expansion pressure by using Ideal gas law
p_Expansion = constant_c./v_Expansion.^gamma;
%Engine_kinematics_of_Otto_cycle
% State variables at state point 4
v4 = v1 % Constant volume heat rejection process
% p3v3^gamma = p4v4^gamma ------- constant adiabatic compression process
% p4 = p3(v3/v4)^gamma
p4 = p3*(v3/v4)^gamma
% Step3 - Plot state points and p-v diagram
figure(1) % put everything in one figure
hold on % Multiple entities in single plot
% First State point
plot (v1,p1,'*','markersize',5,'markerEdgecolor','r');
text (v1,p1,' 1,','color','m')
% Isentropic Compression Line
plot (v_compression,p_compression,'color','b','linewidth',2);
text(-0.2*10^-4,0.2*10^6,'Isentropic Compression')
% Second State point
plot (v2,p2,'*','markersize',5,'markerEdgecolor','r');
text (v2,p2,' 2','color','m')
% Constant volume heat addition Line
plot ([v2 v3],[p2 p3],'color','g','linewidth',2);
text(-0.4*10^-4,4.3*10^6,'V2=V3')
% Third State point
plot (v3,p3,'*','markersize',5,'markerEdgecolor','r');
text (v3,p3,' 3','color','m')
% Isentropic Expansion Line
plot (v_Expansion,p_Expansion,'color','m','linewidth',2);
text(2*10^-4,1.6*10^6,'Isentropic Expansion')
% Fourth State point
plot (v4,p4,'*','markersize',5,'markerEdgecolor','r');
text (v4,p4,' 4','color','m')
% Constant volume heat Rejection Line
plot ([v4 v1],[p4 p1],'color','g','linewidth',2)
text(9.2*10^-4,0.1*10^6,'V1=V4')
axis([-0.00005 11*10^-4 -0.1*10^6 6*10^6])
title('P-V Diagram for Otto cycle')
xlabel('Volume')
ylabel('Pressure')
% Step4 - Thermal Efficiency of Otto Cycle
%Eta_Otto = 1 - (v2/v1)^gamma-1 = 1 - 1/(cr^(gamma-1))
x = cr^(gamma-1);
Eta_Otto = 1-(1/x)
Therma_Efficiency_of_Otto_Cycle_In_Percentage = Eta_Otto*100
Function Program for Engine Kinematics
% Engine Kinematics
% Step2 - Create function for change in volume while compression and expansion
% Function for engine kinematics and its given entities
function [V] = Engine_kinematics_of_Otto_cycle(bore,stroke,con_rod,cr,start_crank,end_crank)
a = stroke/2;
R = con_rod/a;
% Calculating the swept volume and the clearance volume
% 1) Swept volume using (pi/4)*Diameter^2*length
v_swept = (pi/4)*bore^2*stroke;
% 2) Clearance volume using relation of swept volume and compression ratio
v_clearance = v_swept/(cr-1);
% Mention theta array, changing crank degree
theta = linspace(start_crank,end_crank,100);
% Engine kinematics equation
% v/vc=1+1/2(rc-1)[R+1-cosθ-(R^2-sinθ2)1/2]
% Define each term saperately
% term1 = 1/2(rc-1)
% term1 = R+1-cosθ
% term1 = (R^2-sinθ2)1/2
term1 = 0.5*(cr - 1);
term2 = R + 1 -cosd(theta);
term3 = (R^2 - sind(theta).^2).^0.5;
% Put all terms together accoding to equation
V = (1 +term1*(term2 - term3)).*v_clearance;
% end of the function
end
Output of state points command window
State point values
|
v1 |
= 8.5680e-04 m3 |
|
v2 |
= 7.1400e-05 m3 |
|
v3 |
= 7.1400e-05 m3 |
|
v4 |
= 8.5680e-04 m3 |
|
p1 |
= 101325 pa |
|
p2 |
= 3.2853e+06 pa |
|
p3 |
= 5593140 pa |
|
p4 |
= 1.7251e+05 pa |
Output of thermal efficiency points command window
Thermal efficiency of Otto cycle
|
ɳthermal efficiency of Otto = 62.9893% |
Final Graph Plot for P-V diagram for Otto cycle