Project

Otto cycle (plotting pv diagram and finding effeciency)

The inputs for the problem taken to code pv diagram are :

compression ratio = 12

bore = 0.1

stroke = 0.1

connecting rod length = 0.15

cp = 1.01

cv = 0.718

p1 = 100000 bar

t1 = 500 k

t3 = 2300 k

the otto cycle is divided in to 4 parts based on the process undergone;

let the points be 1,2,3,4 which indicate the end points of the process.

Point 1 be the initial start of the compression atroke for angle 180 to 0.

p1 and t1 are already given in the problem.

The initial volume v1 will be the sum of the clearence volume and swept volume.

The swept volume is found out by calculating the suface area of the piston and then multiplying it with the length of the stroke.

The clearance colume is found out by dividing the swept volume by a value equal to (compression ratio -1).

The volume at state point 1 will be equal to the sum of vol. swept and clearance. the volume at state point 4 will be the same.

At the state point 2 ;

The volume at the end of compression at state point 2 qill be equal to the clearance volume.

v2 = vol.clearance.

From the relation PV^gamma = constant , we get p1v1^gamma = p2v2^gamma.

From this relation p2 is calculated, p1,v1,v2 being known

From the relation p1v1/t1 = p2v2/t2 we get the value of t2, since all values except t2 are known.

For tghe state point 3,

the volume v3 will be equal to the volume at point 2 since it is a constant volume gheat addition process.

v3 = v2;

From the relation p2v2/t2 = p3v3/t3, p3 can bve calculated.

since all vales except p3 are known an t3 is given in the problem.

Fro the state point 4;

the volume at state point 4, v4 will be equal to the volume at state point 1.

v4 = v1'

From the relation p3v3^gamma = p4v4^gamma,

p4 is found out since all values are there except p4.

The temperature at this point can also be found by using the relation p3v3/t3 = p4v4/t4.

Now all the values of P,V & T are found out at 4 state points.

Using plot function the state points are marked on the graph.

To join the polints 1 and 2 , 3 and 4 which are adiabatic compression and expansion processes respectively we use a purely geometric relation give by;

Volume/ vol.clearance = 1+0.5(cr-1)(R+1-cosd(theta)-(R^2-sind(theta).^2).^0.5)

The above relation gives the volume at various crank positions.

R is given by ;

R = connecting rod length / a

where, a = stroke / 2

cr is the compression ratio, while theta is the position of the crank.

The program is written as a function, with inputs as stroke, bore, vol.swept, vol. clearance, start crank angle, end crank angle.

the fuction is called in to the main program by giving the respective values.

linspace command is used for theta to take many values between start and end crank angle.

v.compression and v.expansion are found out for various values of theta.

using the relation PV^gamma = constant,

we can find out p.compression and p.expansion.

The v.compression/expansion,p.compression/expansion can be plotted on the graph, which join the points 1,2 & 3,4.

The point 2&3, 4&1 can be plotted using a straight line since the volume is constant.

The thermal efficiency of the otto cycle is givenn by Efficiency = 1 - (1/cr^(gamma-1)).

clear all 
close all
clc


%otto cycle problem
%engine geometric parameters
cr = 12;
bore = 0.1;
stroke = 0.1;
connect_rod = 0.15;

%inputs
gamma = 1.4
t3 = 2300


%Process variables at state1
p1 = 100000
t1 = 500


%heat capacity at constant pressure 
cp = 1.01



%heat capacity at constant volume
cv = 0.718


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

v1 = v_swept+v_clear
v2 = v_clear



%pr0cess variables at state 2 
%p2v2^gamma = p1v1^gamma
%p2 = p1*(v1/v2)^gamma = p1*cr^gamma
p2 = p1*cr^gamma;

constant_c = p1*v1^gamma;
v_compression = engine_kinematics(bore, stroke, connect_rod, cr, v_swept, v_clear, 180, 0);
p_compression = constant_c./v_compression.^gamma;
%p2v2/t2 = p1v1/t1
%t2 = p2v2t1/p1v1

t2 = p2*v2*t1/(p1*v1);



%process variables at state 3
%constant volume process
%v2=v3

v3 = v2;

%p3v3/t3=p2v2/t2
%p3=p2t3/t2


p3 = p2*t3/t2;



constant_c = p3*v3^gamma;
v_expansion = engine_kinematics(bore, stroke, connect_rod, cr, v_swept, v_clear, 0, 180);
p_expansion = constant_c./v_expansion.^gamma;

%process variables at state 4
%constant volume process
%v4=v1

v4 = v1;

%p4v4^gamma = p1v1^gamma
%p4=p1*(v1/v4)^gamma

p4 = p3*(v3/v4)^gamma;

%p4v4/t4=p3v3/t3
%t4=p4v4t3/p3v3


t4 = p4*v4*t3/(p3*v3);



%efficiency of otto cycle E

Effeciency = 1-(1/cr^(gamma-1))




%for the otto cycle plot

figure(1)
hold on
plot(v1,p1,'*','color','r')
plot(v2,p2,'*','color','r')
plot(v_compression,p_compression)
plot(v3,p3,'*','color','r')
plot(v_expansion,p_expansion)
plot(v4,p4,'*','color','r')
plot([v2 v3],[p2 p3])
plot([v4 v1],[p4 p1])
function [V] = engine_kinematics(bore, stroke, connect_rod, cr, v_swept, v_clear, start_crank, end_crank)

a = stroke/2
R = connect_rod/a

theta = linspace(start_crank,end_crank,180)
term1 = 0.5*(cr-1)
term2 = R+1-cosd(theta)
term3 = (R^2-sind(theta).^2).^0.5

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





end

ERRORS :

The were a few errors in the end of the program, while finding out v.compression , since the "." was not used for matrix multiplication or divide functions. Going through the code again and again lead to diagnosis of this.

There were also a few errors in code where * or / were not specified and lead to very unreasonable values of p and v. On checking the plot, I realised that there were mistakes in the code and were rectified.

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.