Project

PV Diagram Otto Cycle

%OTTO CYCLE SIMULATION

clear all
close all
clc

% State Variables
P1 = 101325;
T1 = 500;   %Kelvin
gamma = 1.4;
T3 = 2000;

% Engine Geometric parameters
bore = 0.1;
stroke = 0.1;
con_rod = 0.15;
cr = 12;

% Calculating swept volume and clearance volume
v_swept = (pi/4)*bore^2*stroke;
v_clearance = v_swept/(cr-1);

V1 = v_swept + v_clearance ;
V2 = v_clearance;

% State Variables at state point 2
% p2v2^gamma = p1v1^gamma 
% p2 = p1*(v1/v2)^gamma = p1 * cr^gamma
P2 = P1*cr^gamma;

% p1v1/t1 = p2v2/t2 | t2 = p2*v2*t1/(p1*v1)
T2 = (P2*V2*T1) / (P1*V1) ;

constant_c = P1*V1^gamma ;
v_comp = piston_kinematics(bore,stroke,con_rod,cr,180,0);
p_comp = constant_c ./ v_comp.^gamma;

% State Variable at state point 3
V3 = V2;

% p3v3/t3 = p2v2/t2 | p3 = p2t3/t2
P3 = P2*T3/T2;

constant_c = P3*V3^gamma ;
v_expan = piston_kinematics(bore,stroke,con_rod,cr,0,180);
p_expan = constant_c ./ v_expan.^gamma;


% State variable at state point 4
V4 = V1;

% p3v3^gamma = p4v4^gamma |  P4 = P3(V3/V4)^gamma
P4 = P3*(V3/V4)^gamma;

figure(1)
hold on
plot(V1,P1,'*','color','r')
plot(v_comp,p_comp)
plot(V2,P2,'*','color','r')
plot([V2 V3],[P2 P3])
plot(V3,P3,'*','color','r')
plot(v_expan,p_expan)
plot(V4,P4,'*','color','r')
plot([V4 V1],[P4 P1])

% figure(2)
% plot([V1 V2 V3 V4 V1],[P1 P2 P3 P4 P1],'color','b')


%






Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.