Project

PV diagram for the Otto Cycle &The thermal efficiency of the engine using MATLAB

AIM: Write code that can solve an otto cycle and make plots for it.

OBJECTIVE :

  1. Create a PV diagram for the Otto Cycle.
  2. The thermal efficiency of the engine.

INTRODUCTION:

Otto Cycle:-

The Otto cycle is a cycle of engine operation which requires four strokes of the piston: for induction, compression, ignition, and exhaust. The fuel and air mixture is compressed before combustion is started by an electrical spark.
The basic Otto cycle is made up of four processes:

process 1-2 → Isentropic compression.

process 2-3 → Constant volume heat addition.

process 3-4 → Isentropic expansion and

process 4-1 → Constant volume rejection.

figure: PV diagram for the Otto Cycle

Given Data:

input
gamma = 1.4
t3 = 2300

state variable
p1 = 101325
t1 = 500
Engine geometric parameters
bore = 0.1;
stroke = 0.1;
con_rod = 0.15;
cr = 8;
formula:
v_swept = (pi/4)*bore^2*stroke;
v_clearance = v_swept/(cr-1);

v1 = v_swept + v_clearance
v2 = v_clearance

CODING SECTION
coding-1
Create-Function
function [V] = engine_kinematics(bore, stroke, con_rod, cr, start_crank, end_crank)

a = stroke/2
R = con_rod/a

v_swept = (pi/4)*bore^2*stroke;
v_clearance = v_swept/(cr-1);

theta = linspace(start_crank,end_crank,100);

term1 = 0.5*(cr-1);
term2 = R + 1 - cosd(theta);
term3 = (R^2 - sind(theta).^2).^0.5;

V = (1+term1*(term2 - term3)).*v_clearance

 

end
​

coding-2

PV Diagram for Otto Cycle

clear all
close all
clc

% input
gamma = 1.4
t3 = 2300

% state variable
p1 = 101325
t1 = 500
%Engine geometric parameters
bore = 0.1;
stroke = 0.1;
con_rod = 0.15;
cr = 8;

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

v1 = v_swept + v_clearance
v2 = v_clearance

% state variable 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_compression = engine_kinematics(bore, stroke, con_rod, cr, 180, 0);

P_compression = constant_c./V_compression.^gamma;


% state variable at state point 3
v3 = v2


%p3v3/t3 = p2v2/t2 | p3 = p2*t3/t2

p3 = p2*t3/t2

constant_c = p3*v3^gamma;

V_expansion= engine_kinematics(bore, stroke, con_rod, cr, 0, 180);

P_expansion = constant_c./V_expansion.^gamma;

% state variable at state point 4
v4 = v1

%p4v4^gamma = p3v3^gamma | p4 = p3(v3/v4)^gamma

p4 = p3*(v3/v4)^gamma



figure(1)
hold on 
 
 title('PV Diagram for Otto Cycle'),xlabel('Volume(V)'),ylabel('Pressure(P)')

 plot(V_compression, P_compression,'linewidth',1)

plot([v2,v3],[p2,p3],'linewidth',1)
 
plot(V_expansion, P_expansion,'linewidth',1)
 
plot([v4,v1],[p4,p1],'linewidth',1)

text(v1,p1,'1')
text(v2,p2,'2')
text(v3,p3,'3')
text(v4,p4+0.5*p4,'4')

legend('Isentropic compression','CV Heat addition','Isentropic expansion','CV Heat rejection')
grid on
 
%efficiency

efficieency = (1-(1/cr^(gamma-1)))*100

output

Thermal efficiency

efficiency = (1-(1/cr^(gamma-1)))*100 = 56.4725%

Error facing during executions:

1 unrecognized function c_r because for compression ratio all symbols are cr but only on c_r

2 because I do not define the value of gamma

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.