Project

Air Standard Cycle

AIM:

To write a program to plot a P-V Diagram and calculate the Thermal Efficiency of Otto Cycle using MATLAB

THEORY:

Otto Cycle is an air standard cycle which approximates the processes in petrol engines. It is based on constant volume heat addition and heat rejection processes, and isentropic compression and expansion. The Otto cycle is the idealized cycle for spark ignition internal combustion engines. The actual P-V diagram for an engine has rounded corners because of the processes of combustion take place at a finite rate. The Ideal Otto cycle has sharp corners because the combustion is considered on and off instantaneously.

The Otto cycle consists of four processes.

Process 1 – 2: Reversible Adiabatic Compression

During this phase the piston will be drawn up, so it can compress the fuel – air mixture that entered the chamber. The compression causes the mixture to increase slightly in pressure and temperature. However, no heat is exchanged. In terms of thermodynamics, this is referred to as an adiabatic process. When the cycle reaches point 2 that is when the fuel is met by the spark plug to be ignited.

Process 2 – 3: Heat Addition at constant volume

This is where combustion occurs to the ignition of fuel by the spark plug. The combustion of the gas is complete at point 3, which results in a highly pressurized chamber that has a lot of heat or thermal energy. In terms of thermodynamics, this is referred to as an isochoric process.

Process 3 – 4: Reversible Adiabatic Expansion

The thermal energy in the chamber as a result of combustion is used to do work on the piston which pushes the piston down increasing the volume of the chamber. This is also known as the power stroke because it is when the thermal energy is turned into motion to power the machine or vehicle.

Process 4 – 1: Heat Rejection at constant volume

All the waste energy is expelled from the engine chamber. As the heat leaves the gas, the molecules lose kinetic energy causing the decrease in pressure. Then the exhaust phase occurs when the remaining mixture in the chamber is compressed by the piston to be rejected out without changing the pressure.

FORMULAS:

Swept volume (`V_s`) – The volume swept by the piston during its motion.

`V_s=π/4×d^2×l` Where, d = diameter or bore of the piston; l = height of the piston.

Clearance Volume (`V_c`) – The volume which is left between the piston and top dead center of the cylinder during the combustion or exhaust stroke.

`V_c=V_s/((r_c-1))` Where, `r_c`= compression ratio; `V_s`= swept volume

Total Volume (`V_T`) – The total volume of the cylinder is the summation of swept volume of the piston and the clearance volume.

`V_T= V_s+ V_c` Where, `V_s`= swept volume; `V_c`= clearance volume

Adiabatic Process – The process which occurs without transferring heat o mass between a thermodynamic system and its surroundings is called as adiabatic process.

`PV^γ=C` Where, P = pressure of the system; V = volume of the system; `γ`= ratio of specific heats of fluids

Combined Gas Law – This law is stated as the volume of a given amount of gas is proportional to the ratio of its temperature and pressure.

`(PV)/T= C` Where, P = pressure; V = volume; T = temperature

Change of volume inside the chamber is given by

`V/V_c =1+1/2 (r_c-1)[R+1-cosθ-(R^2-sin^2⁡θ )^(1/2) ]`

Where, V = volume inside the cylinder when piston is at an angle `θ` ; R = ratio of length of connecting rod to crank pin radius (a); Crank pin radius (a) = stroke length (l) / 2; `V_c`= clearance volume; `r_c`= compression ratio

Thermal Efficiency of Otto Cycle`(η) =1-(1/(r_c^(γ-1) ))`

PROCEDURE:

MAIN PROGRAM

  • Start programming in MATLAB with these three commands, as all the previous calculations are erased.
  • clear: This command clears all the data stored in the workspace previously.
  • close all: This command closes all the previous figures and plots.
  • clc: This command clears the command window.
  • Now starting with the main program. Give inputs for “gamma” i.e. the ratio of specific heats of the fluid used as 1.4 and “t3” as 2300. Here ‘pn’ represents pressure at state point ‘n’, ‘tn’ represents temperature at state point ‘n’ and ‘vn’ represents volume at state point ‘n’ and where ‘n’ can be 1,2,3,4.
  • Now give inputs for pressure at point 1 “p1” as 101325 and temperature “t1” as 500
  • Now give values for engine geometric parameters, “bore” diameter as 0.1, “stroke” length as 0.1, length of connecting rod “con_rod” as 0.15, and compression ratio “cr” as 12
  • Now for calculating the swept volume “v_swept” use the formula “(pi/4)*bore^2*stroke” and clearance volume “v_clearance” use the formula “v_swept/(cr-1)”
  • Now the total volume at point 1 “v1” can be determined by “v_swept + v_clearance” and the volume at point 2 “v2” is same as “v_clearance”
  • Now the variables at point 2 are pressure “p2” is calculated by using the adiabatic process equation and by simplifying it can be written as “p1*cr^gamma” and the other variable is temperature “t2” which can be calculated by using the ideal gas equation, it can be re-written as “p2*v2*t1/(p1*v1)”
  • Now the constant in the adiabatic equation “constant_c” is calculated by “p1*v1^gamma”
  • Now the volume during compression “V_compression” is calculated by calling the “engine_kinematics” function and then pressure “P_compression” is calculated by “constant_c./V_compression.^gamma”
  • Now the variables at state point 3 are calculated volume “v3” is same as “v2”, pressure “p3” is calculated by “p2*t3/t2”
  • Now the constant in the adiabatic equation “constant_c” is calculated by “p3*v3^gamma”
  • Now the volume during expansion “V_expansion” is calculated by calling the “engine_kinematics” function and then pressure “P_expansion” is calculated by “constant_c./V_expansion.^gamma”
  • Now the variables at point 4 are calculated as volume “v4” is same as “v1” and pressure “p4” by “p3*(v3/v4)^gamma”
  • Now the plot is created. For new figure window use “figure (1)”
  • For plotting all the points and curves in a single plot “hold on” is used and when want to close it use “hold off”
  • Now point 1 by “plot(v1,p1,’*’,’color’,’r’)” and curve for it by “plot(V_compression,P_compression,’color’,’b’)” is plotted
  • Now point 2 by “plot(v2,p2,’*’,’color’,’r’)” and curve for it by “plot([v2,v3],[p2,p3],’color’,’b’)”
  • Now point 3 by “plot(v3,p3,’*’,’color’,’r’)” and curve for it by “plot(V_expansion,P_expansion,’color’,’b’)”
  • Now point 4 by “plot(v4,p4,’*’,’color’,’r’)” and curve for it by “plot([v4,v1],p4,p1],’color’,’b’)”
  • Now for labeling x-axis use “xlabel” and for y-axis use “ylabel” and for giving the title use “title” command.
  • Now for calculating the thermal efficiency “thermal_efficiency” of the cycle use the formula “1-(cr^(1-gamma))
  • Save the program and then run by pressing “F5” key.

FUNCTION PROGRAM

  • For the function program the name of the function and the name of the file should be same. Here it is “engine_kinematics”. The function is set such that it asks for some parameters.
  • Now crank pin radius “a” is calculated by “stroke/2”
  • The ratio “R” of connecting rod length to the crank pin radius is given by “con_rod/a”
  • Now the swept volume “v_s” is calculated as “pi/4*bore^2*bore” and the clearance volume “v_c” is calculated as “v_s/(cr-1)
  • Now the angle made by the crank “theta” is given by “linspace(start_crank,end_crank,100)”, through linspace command the values are set with equal gap in this case the number of values is set to be 100
  • Now the formula for determining the volume inside the cylinder is divided into three parts as “term1” is “0.5*(cr-1)” then “term2” as “R+1-cosd(theta)” and then “term3” as “(R^2-sind(theta).^2).^0.5” here dot (.) is used as an element wise operator as the multiplication is done with an array.
  • Finally all the terms are used together to calculate the volume “V” as “(1+term1*(term2-term3))*v_c” and for ending the function use “end” at the end.
  • Save the program with same name as the function name in this case “engine_kinematics”
  • Now the function can be used wherever it is required by calling it with the function name provided the function name and the name of the file by which it is saved should be same.

CODE:

FOR MAIN PROGRAM

% To plot the PV-diagram and calculate the thermal efficiency of Otto cycle
clear 
close all
clc
 
% input variables 
gamma = 1.4   % ratio of specific heats of the fliud
t3 = 2300     % temperature at point 3 in Kelvin
 
% state variables at state point 1
p1 = 101325   % pressure at point 1 in Pascal
t1 = 500      % temperature at point 1 in Kelvin
 
% engine geometric parameters
bore = 0.1;       % diameter of bore in meters
stroke = 0.1;     % length of stroke in meters
con_rod = 0.15;   % length of connecting rod in meters
cr = 12;          % compression ratio
 
% calculating the swept volume and the clearance volume 
v_swept = (pi/4)*bore^2*stroke; % swept volume
v_clearance = v_swept/(cr-1);   % clearance volume
 
v1 = v_swept + v_clearance    % total volume at point 1 in meter^3
v2 = v_clearance              % total volume at point 2 in meter^3
 
% state variables at state point 2
% p2v2^gamma = p1v1^gamma - adiabatic equation
% p2 = p1*(v1/v2)^gamma = p1*cr^gamma
p2 = p1*cr^gamma;       % pressure at point 2 in Pascal
 
% using ideal gas equation
% p1v1/t1 = p2v2/t2 
t2 = p2*v2*t1/(p1*v1)   % temperature at point 2 in Kelvin
 
constant_c = p1*v1^gamma;   %constant - c
V_compression = engine_kinematics(bore, stroke, con_rod, cr,180,0); % calling the function 'engine kinematics' to calculate volume at compression stroke in meter^3 
 
P_compression = constant_c./V_compression.^gamma; % pressure at compression stroke in Pascal
 
% state variables at state point 3
v3 = v2         % volume at point 3 in meter^3
 
% p3v3/t3 = p2v2/t2 - combined gas law equation
p3 = p2*t3/t2       % pressure at point 3 in Pascal
 
constant_c = p3*v3^gamma;
V_expansion = engine_kinematics(bore, stroke, con_rod, cr,0,180);   % calling the function 'engine kinematics' to calculate volume at expansion stroke in meter^3
 
P_expansion = constant_c./V_expansion.^gamma;    % pressure at expansion stroke in Pascal
 
 
% state variables at state point 4
v4 = v1       % volume at point 4 in meter^3
 
% p3v3^gamma = p4v4^gamma - Adiabatic equation
p4 = p3*(v3/v4)^gamma      % pressure at point 4 in Pascal
 
figure (1) % new figure window
hold on % for plotting all the plots in a single plot
% plotting all the points and curves 
plot(v1,p1,'*','color','r')
plot(V_compression,P_compression,'color','b')
plot(v2,p2,'*','color','r')
plot([v2,v3],[p2,p3],'color','b')
plot(v3,p3,'*','color','r')
plot(V_expansion,P_expansion,'color','b')
plot(v4,p4,'*','color','r')
plot([v4,v1],[p4,p1],'color','b')
 
xlabel('Volume')      % labeling x-axis 
ylabel('Pressure')    % labeling y-axis
title('Otto Cycle')   % title
hold off 
 
% thermal efficiency of the cycle
thermal_efficiency = 1 - (cr^(1 - gamma))

FOR FUNCTION

function [V] = engine_kinematics(bore, stroke, con_rod, cr, start_crank, end_crank)
%piston kinematics that tells how the volume changes as the piston moves from TDC to BDC
 
 
% geometric parameters of engine 
 
a = stroke/2; % crank pin radius in meter
R = con_rod/a; % ratio of connecting rod length to crank pin radius
 
% swept and clearance volume
v_s = pi/4*bore^2*bore; % swept volume in meter
v_c = v_s/(cr-1);       % clearance volume in meter
 
 
theta = linspace(start_crank,end_crank,100);
 
% formula for how the volume inside the cylinder changes
 
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; % total volume in meter^3
 
end

RESULTS:

CONCLUSION:

The PV-diagram for all the four processes has been plotted. As it is an ideal PV-diagram therefore it has sharp corners but in actual PV-diagrams corners are round. The thermal efficiency is 0.6299 or 62.99%. It can be seen that the thermal efficiency mainly depend on compression ratio of the engine and the type of fluid used, so it can be concluded that engines with higher compression ratio will have high thermal efficiency.

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.