Project

Air standard Cycle using Matlab

Aim:-

The objective of this project is to calculate the thermal efficiency of the Otto cycle and plot the PV diagram

Introduction:-

The Otto cycle is a set of processes used by spark-ignition internal combustion engines. These engines a) ingest a mixture of fuel and air, b) compress it, c) cause it to react, thus effectively adding heat through converting chemical energy into thermal energy, d) expand the combustion products, and then e) eject the combustion products and replace them with a new charge of fuel and air. The different processes are shown in Figure 1.

  1. Isentropic compression (compression stroke) – The gas (fuel-air mixture) is compressed adiabatically from state 1 to state 2, as the piston moves from bottom dead centre to top dead centre. The surroundings do work on the gas, increasing its internal energy (temperature) and compressing it. On the other hand, the entropy remains unchanged. The changes in volumes and their ratio (V1 / V2) is known as the compression ratio.
  2. Constant Volume Combustion (ignition phase) – In this phase (between state 2 and state 3) there is a constant-volume (the piston is at rest ) heat transfer to the air from an external source while the piston is at rest at top dead centre. This process is intended to represent the ignition of the fuel-air mixture injected into the chamber and the subsequent rapid burning. The pressure rises and the ratio (P3 / P2) is known as the “explosion ratio”.
  3. Isentropic Expansion (power stroke) – The gas expands adiabatically from state 3 to state 4, as the piston moves from top dead centre to bottom dead centre. The gas does work on the surroundings (piston) and loses an amount of internal energy equal to the work that leaves the system. Again the entropy remains unchanged. The volume ratio (V4 / V3) is known as the isentropic expansion ration, but for Otto cycle, it is equal to the compression ratio.
  4. Constant Volume Heat Rejection (exhaust stroke) – In this phase, the cycle completes by a constant-volume process in which heat is rejected from the air while the piston is at bottom dead centre. The working gas pressure drops instantaneously from point 4 to point 1. The exhaust valve opens at point 4. The exhaust stroke is directly after this decompression. As the piston moves from the bottom dead centre (point 1) to top dead centre (point 0) with the exhaust valve opened, the gaseous mixture is vented to the atmosphere and the process starts again.

In general, the thermal efficiency, of any heat engine is defined as the ratio of the work it does to the heat input at the high temperature.

The thermal efficiency, ηth, represents the fraction of heat, QH, that is converted to work. Since energy is conserved according to the first law of thermodynamics and energy cannot be converted to work completely, the heat input, QH, must equal the work is done, W, plus the heat that must be dissipated as waste heat QC into the environment. Therefore we can rewrite the formula for thermal efficiency as:

The heat absorbed occurs during combustion of fuel-air mixture, when the spark occurs, roughly at constant volume. Since during an isochoric process there is no work done by or on the system, the first law of thermodynamics dictates ∆U = ∆Q. Therefore the heat added and rejected are given by:

Qadd = mcv (T3 – T2)

Qout = mcv (T4 – T1)

Substituting these expressions for the heat added and rejected in the expression for thermal efficiency yields:

simplify the above expression using the fact that the processes 1 → 2 and from 3 → 4 are adiabatic and for an adiabatic process the following p, V, T formula is valid:

It can be derived that:

In this equation, the ratio V1/V2 is known as the compression ratio, CR. When we rewrite the expression for thermal efficiency using the compression ratio, we conclude the air-standard Otto cycle thermal efficiency is a function of compression ratio and κ(gamma) = cp/cv.

An internal combustion engine is classified as a heat engine. It’s called internal because the combustion of the air-fuel mixture occurs inside the engine, in a combustion chamber, and some of the burned gases are part of the new combustion cycle.

An internal combustion engine transforms the thermal energy of the burning air-fuel mixture into mechanical energy. It is called 4 strokes because it takes 4 strokes for the piston to execute a complete combustion cycle. The complete name for an engine which powers a passenger car is 4 stroke piston internal combustion engine, abbreviated ICE (Internal Combustion Engine). Figure 2 shows the components of a basic ic engine

In a piston engine, the bore (or cylinder bore) is the diameter of each cylinder.

The stroke length is how far the piston travels in the cylinder, which is determined by the cranks on the crankshaft.

The connecting rod also called a con rod, is the part of a piston engine which connects the piston to the crankshaft

A complete engine cycle for a 4 stroke ICE has the following phases (strokes):

  1. intake
  2. compression
  3. power (expansion)
  4. exhaust

Code:-

The code for the function is shown below in figure 3

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



end 

A Function contains sequential commands and can accept inputs and return outputs. Named functions must be defined within a program file and not at the command line. The function program has been used to simplify the code and make the code look neater. The equation for the isentropic process below is used but it has been cut down to 3 terms for simplicity.

The code for the simulation is shown below in Figure 4

clear all
close all 
clc

% Inputs
gamma = 1.4
t3 = 2300

% State Variables
p1 = 101325
t1 = 500

% Engine geometric paramters
bore = 0.1;
stroke = 0.1;
con_rod = 0.15;
cr = 12;

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


P_compression = constant_c./V_compression.^gamma;


% State variables at state point 3
v3 = v2

% p3v1/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 variables at state point 4
v4 = v1
%p3v3^gamma = p4v4^gamma | p4 = p3(v3/v4)^gamma
p4 = p3*(v3/v4)^gamma

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







figure(1)
hold on 
plot(v1,p1,'*','color','b')
plot(V_compression, P_compression)
plot(v2,p2,'*','color','r')
plot([v2 v3 ], [p2 p3])
plot(v3,p3,'*','color','g')
plot(V_expansion, P_expansion)
plot(v4,p4,'*','color','y')
plot([v4 v1], [p4 p1])


title('Air Standard Cycle PV Diagram')
xlabel('Volume')
ylabel('Pressure')
grid on

Code Explanation:-

Before writing the code, it's important to start with clear all, close all and clc commands since

Clear all - removes data from the workspace, freeing up system memory

Close all- deletes the current figure or the specified figure

clc - clears all input and output from the Command Window display, giving you a "clean screen

Next step is to define the inputs and variables. Gamma, the temperature at point 3, the pressure at point 1 and the temperature at point 1 were defined. The geometric parameters of the IC engine are also defined (in meters).

So the next step is to calculate the swept and the clearance volume. Then P2 and t2 are calculated using the formula for polytropic processes and the general gas equation

P1V1/T1 = P2V2/T2. The same step is done to calculate all the other stages. The Volume Compression between stages 1-2 is calculated using the function command from figure 3 since it is a compression process the start crank point starts at 180 then volume gets smaller until the endpoint ends at 0. this is the opposite for stage 3-4, the volume expansion is calculated by using the function command since it is an expansion process, the start crank point starts at 0 then volume expands until it hits 180. The graph for the PV diagram is shown in figure 5

Conclusion:-

The thermal efficiency calculated is :

thermal_eff =

   62.9893
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.