OTTO CYCLE EFFICIENCY AND PV DIAGRAM VISUALISER
Otto cycle efficiency % PROGRAM FOR CALULATING THERMAL EFFICIENCY OF OTTO CYCLE AND TO DISPLAY% P-V DIAGRAM
close all
clear all
clc
% inputs
r = input ('compression ratio of the otto cycle');
p1 = input('pressure at the entry in the cylinder in megapascals');
t1 = input('Temperature at the entry in cylinder(in kelvin)');
h1 =input('heat added at constant volume in kJ/kg');
% Cp = ('specific heat at constant pressure');
% Cv = ('specific heat at constant volume');
Cv=718; g=1.4; R=287;
v1=(R*t1)/p1;
v2=v1/R;r=v1/v2;
p2=p1*((r)^g);
t2=t1*r^(g-1);
v3=v2;
t3=t2+(h1/Cv);
p3=(p2*t3)/t2;
v4=v1;
p4=p3/((r)^g);
t4=t3/(r)^(g-1);
eff=1-(1/(r)^(g-1));
%temperatures at each and every point of the cycle
t1,t2,t3,t4
%pressures at each and every point of the cycle
p1,p2,p3,p4
%volume at each and every point of the cycle
v1,v2,v3,v4
disp('theoritical efficiency of the cycle') eff
% Theoritical plot between varying compression ratio and efficiency
volume=1:1:10; pressure=1:1:10;
plot(pressure,volume)
plot([v1 v2],[p1 p2],[v3 v4],[p3 p4])
xlabel('volume');
ylabel('pressure');
title('Otto Cycle');
grid on