Project

VISUALIZATION OF OTTO CYCLE USING MATLAB

AIM:

To simulate Otto cycle in MATLAB (by calculating and plotting the state variables at each of the state points).

OBJECTIVE:

  • To create a Pressure Volume diagram (PV diagram) of Otto cycle
  • To estimate the thermal efficiency of Otto cycle

INTRODUCTION:

Otto cycle is an idealised thermodynamic cycle that describes the functioning of typical Spark Ignition engine. It is an air standard cycle consisting of 4 processes:

Process 1-2: ISENTROPIC COMPRESSION

The piston moves from bottom dead centre (BDC) to top dead centre (TDC) position. Air undergoes reversible adiabatic (isentropic) compression. Volume of air decreases from V1 to V2 and pressure increases from p1 to p2. Temperature increases from T1 to T2. As this an isentropic process, entropy remains constant (i.e., s1=s2).


Process 2-3: CONSTANT VOLUME HEAT ADDITION

Piston remains at top dead centre for a moment. Heat is added at constant volume (V

2 = V3) from an external heat source. Temperature increases from T2 to T3, pressure increases from P2 to P3 and entropy increases from S2 to S3.

Process 3-4: ISENTROPIC EXPANSION

In this process, air undergoes isentropic (reversible adiabatic) expansion. The piston is pushed from top dead centre (TDC) to bottom dead centre (BDC) position. Here, pressure decreases fro P3 to P4, volume rises from V3 to V4, temperature falls from T3 to T4 and entropy remains constant (S3=S4).


Process 4-1: CONSTANT VOLUME HEAT REJECTION

The piston rests at BDC for a moment and heat is rejected at constant volume (V4=V1). In this process, pressure falls from P4 to P1, temperature decreases from T4 to T1 and entropy falls from S4 to S1.

ASSUMPTIONS:

  • The working fluid is considered to be pure dry air (perfect gas).
  • No mechanical losses like friction occur during the process i.e., the processes are reversible.
  • The combustion process is replaced by a heat addition process.
  • There are no suction or exhaust strokes [exhaust process is replaced by a heat rejection process such that the working fluid comes back to its initial state.
  • The specific heat (and gamma) remain constant at all temperatures
  • There are no heat losses.

PROCESS:

The project is split into 2 parts:

PART 1: To capture the piston kinematics and calculate the volume at any given crank angle. This can be used to calculate the volume at each point (or instant) during adiabatic compression or expansion process.

The formula to calculate the volume at any given crank angle is given by the formula:

`V/(Vc)=1+1/2(cr-1)[R+1-cos(theta)-sqrt(R^2-sin^2(theta)]]`

Where Vc is clearance volume

Theta is crank angle in deg

cr is compression ratio

R is the raio of connecting rod length to crank pin radius

PART 2:

In this part, the state variables (pressure, temperature and volume) are calculated at each of the 4 points using the formulae:

P V^gamma = constant

PV/T = constant

Then the first program is called to calculate the instantaneous volume at compression and expansion processes. Then the P-V diagram is plotted and thermal efficiency of the cycle by using the formula

`eta=1-1/r^(gamma-1)`

where r is the compression ratio

`gamma` is the specific heat ratio

CODE:

PART 1:

%Function for Piston Kinematics
function [V] = pist_kinematics(bore,stroke,con_rod,cr,gamma,start_crank,end_crank)
  crank_rad=stroke/2
  R=con_rod/crank_rad
  
  theta=linspace(start_crank,end_crank,300)
  
  %Swept volume and clearance volume
  V_swept=pi*bore*bore*stroke/4
  V_clearance=V_swept/(cr-1)

  %Volume Caculation
  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

endfunction

A function called pist_kinematics is created. The inputs for the function are bore, stroke, length of connectong rod, compression ratio, gamma value and the range of crank angle for which the volume needs to be measured. The output of the function is the volume array for all the crank angle degrees.

PART 2:

%State points Otto cycle

%engine geometry
bore=0.28
stroke=0.3
con_rod=0.6
cr=12.5

%Inputs
gamma=1.3
T3=2300

%state variables
P1=101325
T1=300

%Swept volume and clearance volume
V_swept=pi*bore*bore*stroke/4
V_clearance=V_swept/(cr-1)

%State points calculation
V1=V_swept+V_clearance
V2=V_clearance

%Evaluating constant value
c1=P1*(V1^gamma)

%Compression volume trace
V_compression=pist_kinematics(bore,stroke,con_rod,cr,gamma,180,0)
P_compression=c1./(V_compression.^gamma)

P2=P1*((V1/V2)^gamma)
T2=P2*V2*T1/(P1*V1)

V3=V2
P3=P2*T3/T2

%Expansion volume trace
c2=P3*(V3^gamma)
V_expansion=pist_kinematics(bore,stroke,con_rod,cr,gamma,0,180)
P_expansion=c2./(V_expansion.^gamma)

V4=V1
P4=P3*((V3/V4)^gamma)
T4=P4*V4*T3/(P3*V3)

%plotting state points
figure(1)
hold on
plot(V1,P1,'.')
plot(V2,P2,'.')
plot(V3,P3,'.')
plot(V4,P4,'.')

%plotting the lines
plot(V_compression,P_compression)
plot([V2 V3],[P2 P3])
plot(V_expansion,P_expansion)
plot([V4 V1],[P4 P1])
legend('Isentropic Compression','Constant volume heat abosrption','Isentropic expansion','Connstant Volume Heat rejection')
xlabel('Volume')
ylabel('Pressure')
grid on

%Thermal efficiency calculation
eff=1-(1/(cr^(gamma-1)))

In this program, the engine geometry and gamma values are defined.

Swept vaolume is calcuated by the formula `Swept Volume = pi/4*d^2*l`

where d is the bore

l is the strpoke of the engine

`Vc = (Vs) /(r-1)`

where Vc is clearance volume

Vs is swept volume

AT point 1:

Volume V1=Vc +Vs

P1 and T1 are the inputs defined.

Constant C1 is given by `C1=P1*V1^gamma`

At point 2:

Volume V2 = Vc (clearance vol)

Pressure P2 is given by

`P2=P1*((V1)/(V2))^gamma`

Temperature T2 is given by the ideal gas eqn

`(P1*V1)/(T1)=(P2*V2)/(T2)`

The Volume trace from 1 to 2 is obtained by calling the function pist_kinematics and giving the theta values from 180 deg to 0 deg (BDC to TDC)

The pressure trace is obtained by the formula: `Pcomp=(C1)/(Vcomp)`

At point 3:

V2=V3

T3 is an input

P3 is calculated by the ideal gas eqn

`(P3*V3)/(T3)=(P2*V2)/(T2)`

At point 4:

V1=V4

Pressure P4 is given by

`P4=P3*((V3)/(V4))^gamma`

Temperature T4 is given by the ideal gas eqn

`(P3*V3)/(T3)=(P4*V4)/(T4)`

The Volume trace from 3 to 4 is obtained by calling the function pist_kinematics and giving the theta values from 0 deg to 180 deg (TDC to BDC)

Constant C2 is given by `C2=P3*(V3)^gamma`

The pressure trace is obtained by the formula: `Pexp=(C2)/(Vexp)`

Then the state points 2-3 and 1-4 are joined by straight lines (as it is a constant volume process)

The required plots are obtained.

RESULTS:

The efficiency of otto cycle is 0.531265.

DISCUSSION:

The P-V diagram for Otto cycle is plotted. It is evident from the thermal efficiency formula that efficiency of Otto cycle is directly related to the compression ratio. As the compression ratio increases, the thermal efficiency also increases.

There is a small code written below to show the effect of compression ratio on thermal efficiency.

%Effect of compression ratio on thermal efficiency
%Compression ratio array
r=[8 9 10 11 12 13 14 15]
%Assuming gamma = 1,4
gamma=1.4
%Inputting thermal efficiency formula
eff=1-(1./(r.^(gamma-1)))

%Plotting Compression ratio vs thermal efficiency
plot(r,eff,'r')
plot(r,eff,'r')
xlabel('Compression ratio')
ylabel('Thermal efficiency')
title('Effect of compression ratio on thermal efficiency')

The result for this looks like:

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.