Project

Create a PV Diagram of Otto Cycle using Matlab

Aim:

To create a PV Diagram of Otto Cycle and to make plots of the Otto Cycle.

Description:

1. Otto Cycle:

The otto cycle describes the working of the engine in occordance to the mass of gas when it subjects to pressure, volume and temperature. It describes how the heat energy turns gasoline into motion. It is four strokes that happens in the engine 1. Suction Stroke 2. Compression Stroke 3. Power Stroke 4.Exhaust Stroke

2. Engine Geometric Parameters Required:

  • Bore
  • Stroke
  • Connecting Rod Length
  • Compression Ratio

Formulas Required for the Otto Cycle:

`v/vc = 1+1/2(rc-1)[R+1-cos θ-(R^2-sin^2 θ)^0.5`

Where, V - Volume of the Cylinder

rc - Compression Ratio

Thermal Efficiency:

`(1-1/cr^(gamma-1))100`

where, cr - Compression Ratio

Program:

1. Program for Calling the Function:

function [v] = engine_kinematics(bore, stroke, con_rod, cr, start_crank, end_crank)

a = stroke/2
R = con_rod/a

v_s = (pi/4)*bore^2*stroke;
v_c = v_s/(cr-1);

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_c;

end

2. Program for the plot of Otto Cycle:

% Otto Cycle

% Input
gamma = 1.4;
t3 = 2300;

% State Variables
p1 = 101325; 
t1 = 500;

% Engine Parameters
bore = 0.1;
stroke = 0.1;
con_rod = 0.15;
cr = 12;

% Calculating the 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 Period 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)

constant_c = p1*v1^gamma;
V_compression = engine_kinematics(bore, stroke, con_rod, cr, 180, 0);
P_compression = constant_c./V_compression.^gamma;

        
% State Variables at State Period 3
v3 = v2

% p3v3/t3 = p2v2/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 Variables at State Period 4
v4 = v1

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

% Thermal Efficiency
thermal_efficiency = (1-1/cr^(gamma-1))*100;

figure(1)
hold on 
plot (v1,p1,'*','color','r')
plot (V_compression, P_compression)
plot (v2,p2,'*','color','r')
plot (v3,p3,'*','color','r')
plot (V_expansion, P_expansion)
plot (v4,p4,'*','color','r')
plot ([v1 v1], [p1 p4])
plot ([v2 v2], [p2 p3])
xlabel('Volume')
ylabel('Pressure')

Explanation of the Program:

  • The known values such as temperature, pressure at the start of the cycle is taken as the input values.
  • The engine parameters are necessary for the completing the plot of the otto cycle.
  • The temperature, pressure and volume is neccessary to be calculated at each cycles to plot the graph of the otto cycle.
  • The swept volume and the clearance volume is calculated by the following formulas 'v_swept = (pi/4)*bore^2*stroke' and 'v_clearance = v_swept/(cr-1)'
  • The volume and pressure in all the cycles are calculated by using the relative formulas in the program.
  • The thermal efficiency of the cycle is calculated by using the formula 'thermal_efficiency = (1-1/cr^(gamma-1))*100'
  • The plots are then obtained for the cycle but the curve for both the suction and power stroke must be plotted.
  • For plotting this curve a seperate function is created to satisfy the following equation, 'v = (1+term1*(term2-term3)).*v_c'.
  • The function program created is then introduced in the main program to obtain the plot of the otto cycle.

Output:

The Plot of the Otto Cycle:

Thermal Efficiency:

The thermal efficiency of the otto cycle is = 62.9893

Errors faced while Programming:

  • The most common error will be in the fomulation of the program.
  • The formula is complicated and errors may occur when inputs on the formulas work.
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.