Otto Cycle P vs V graph and also its thermal efficiency
function [V] = engine_kinematics(bore,stroke,con_rod,cr,startc,endc)
a=stroke/2;
R=con_rod/a;
Vs=pi/4*bore^2*stroke;
theta=linspace(startc,endc,720)
Vc=Vs/cr-1;
t1=0.5*(cr-1);
t2=R+1-cosd(theta);
t3=(R^2-sind(theta).^2).^0.5;
V=(1+t1*(t2-t3)).*Vc;
end
*****************************************
close all
clear all
clc
bore=0.1;stroke=0.1;
con_rod=0.15;
t3-2000;
r=1.4;
cr=12;
P1=101325;
T1=500;
Vc=pi/4*bore^2*stroke;
Vs=Vc/cr-1;
% For 1-2
V1=Vs;
V2=Vc;
P2=P1/cr^r;
T2=P2*V2*T1/(P1*V1);
constant_c=P1*V1^r;
V_comp=engine_kinematics(bore,stroke,con_rod,cr,180,0)
P_comp=constant_c/V_comp.^r;
% For 2-3
V3=V2;
P3=P2*T3/T2;
% For 3-4-Isentropic Expansion
V4=V1
P4=P3*cr^-r;
T4=P4*V4*T3/(P3*V3);
constant_c=P4*V4^r;
V_exp=engine_kinematics(bore,stroke,con_rod,cr,0,180)
P_exp=constant_c/V_exp.^r;
% For Thermal Efficiency
Thermal_Efficiency=1-(1/cr^r-1)
% For plotting
figure 1
grid on
plot(V1,P1,\'*\',\'color\',\'r\')
plot(V2,P2,\'*\',\'color\',\'r\')
plot(V_comp,P_comp)
plot(V3,P3,\'*\',\'color\',\'r\')
plot(V4,P4,\'*\',\'color\',\'r\')
plot(V_exp,P_exp)
plot([V2 V3][P2 P3],\'color\',\'r\',\'linewidth\',\'2\')
plot([V4 V1][P4 P1],\'color\',\'r\',\'linewidth\',\'2\')
hold on
xlabel(\'Volume\')
ylabel(\'Pressure\')
title(\'P vs V graph for Otto Cycle\')