Code to create PV diagram and Thermal Efficiency of Otto Cycle
Aim
To write code that can solve an otto cycle and make plots for it.
i. To code should create a PV diagram,
ii. To produce output the thermal efficiency of the engine.
Introduction
Otto Cycle
The Otto cycle is a description of what happens to a mass of gas as it is subjected to changes of pressure, temperature, volume, addition of heat, and removal of heat. The mass of gas that is subjected to those changes is called the system.
Process in Otto Cycle
Process 0–1 a mass of air is drawn into piston/cylinder arrangement at constant pressure.
Process 1–2 is an adiabatic or isentropic compression of the charge as the piston moves from bottom dead centre (BDC) to top dead centre (TDC) shown in Figure 1.1
Figure 1.1
Process 2–3 is a constant-volume heat transfer to the working gas from an external source while the piston is at top dead centre. This process is intended to represent the ignition of the fuel-air mixture and the subsequent rapid burning.
Process 3–4 is an adiabatic or isentropic expansion (power stroke).
Process 4–1 completes the cycle by a constant-volume process in which heat is rejected from the air while the piston is at bottom dead centre.
Process 1–0 the mass of air is released to the atmosphere in a constant pressure process.
Process explained in Figure 1.2
Figure 1.2
Otto cycle will change in Pressure,Volume And Temperatue in each process,first we need to know about some basic about pressure,volume and temperature.
Pressure
Pressure is the force applied perpendicular to the surface of an object per unit area over which that force is distributed.
p=F/A
where, p is the pressure,
F is the magnitude of the normal force,
A is the area of the surface on contact.
Volume
Volume is the quantity of three-dimensional space enclosed by a closed surface, for example, the space that a substance (solid, liquid, gas, or plasma) or shape occupies or contains. Volume is often quantified numerically using the SI derived unit, the cubic metre. The volume of a container is generally understood to be the capacity of the container.
Temperature
Temperature is the manifestation of thermal energy, present in all matter, which is the source of the occurrence of heat, a flow of energy, when a body is in contact with another that is colder.
Isentropic
An isentropic process is a thermodynamic process, in which the entropy of the fluid or gas remains constant. It means the isentropic process is a special case of an adiabatic process in which there is no transfer of heat or matter.
Bottom Dead Center(BDC) is the point at which the piston of an engine is nearest to the axis of the crankshaft.
Top Dead Center, sometimes referred to as TDC, is the point in which the piston in the number one cylinder position of your engine is at its highest point on the compression stroke.
Swept Volume
Swept volume is the displacement of one cylinder. It is the volume between top dead center (TDC) and bottom dead center (BDC). As the piston travels from top to bottom, it "sweeps" its total volume. This measurement can be listed in cubic inches or cubic centimeters.
Clearance Volume
Clearance volume is a volume between the cylinder head and the piston top when the piston is at top dead center (TDC). It can also be defined as the volume of cylinder that is not swept by the piston. Each time the piston goes up, it compress the fuel air mixture in the clearance volume before ignition takes place.
Equations
I. process 0 to 1 it will suck the air and fuel mixture into the cyclinder chamber so let as assume that volume at stage 1(v1) equal to sum of swept volume and clearance volume. Fuel and the air mixture will be fulled in clearance volume.
(v1 = volume of swept + volume of clearance)
II. process 1 to 2 isentropic compression will occured so there will be change in volume and pressure, So we the compression will take place till the top dead center, then left space will be filled with fuel and air mixture which is knows as clearance volume.
(v2= volume of clearance)
III. Process 2 to 3 constant volume of heat addition will takes place, so volume remains same for this process.but the pressure will increase rapidly.
(v2=v3)
IV. Process 3 to 4 isentropic expansion will takes in this process Where pressure decrease with increase in volume
V. Process 4 to 1 constant volume heat rejection will takes place where the volume will remains same
(V4=V1).
My Inputs
gamma value for air = 1.4
Initial Pressure(p1) = 101325
Initial Temperature(t1) = 300
Temperature at process of heat addition(t3) = 2800
Bore = 0.0875
Stroke = 0.11
Connecting rod length = 0.2
Compression Ratio = 18
Program
Calling Function
function [volume] = formula_isentropic(bore,stroke,con_rod,cr,start_angle,end_angle,number_of_plot)
a = stroke/2;
R = con_rod/a;
v_sewpt = pi/4*bore^2*stroke;
v_clearance = v_sewpt/(cr-1);
theta = linspace(start_angle,end_angle,number_of_plot);
line1 = 0.5*(cr-1);
line2 = R+1 - cosd(theta);
line3 =(R^2 - sind(theta).^2).^0.5;
volume = (1+line1*(line2 - line3)).*v_clearance;
end
Main Program
clear all
close all
clc
%Input
p1 = 101325
t1 = 300
t3 = 2800
gamma = 1.4
bore = 0.0875
stroke = 0.11
con_rod = 0.2
cr = 18
%Equation
%stage 1(Swept = Length move by the piston)
%(clearance = space left in top for compression)
v_swept = (pi/4)*bore^2*stroke;
v_clearance = v_swept/(cr-1);
%volume 1(Suction held fuel filled with swept + clearance) = v_swept + v_clearance
v1 = v_swept + v_clearance;
%volume 2(Compression will be held only filled in clerance) = v_clearance
v2 = v_clearance;
%stage 2(Where p1v1^gamma = p2v2^gamma)
%p2 = p1(v1/v2)^gamma
%where (v1/v2 = cr) compression ration = (swept+clearance)/clearance
p2 = p1*cr^gamma;
%to find T2 (p1v1/t1 = p2v2/t2)
t2 = p2*v2*t1/(p1*v1);
%isentropic Compression
constant_c = p1*v1^gamma;
volume_compression = formula_isentropic(bore,stroke,con_rod,cr,180,0,200);
P_compression = constant_c./volume_compression.^gamma;
%stage 3 compression will takesplace so volume will remaince same(v2 = v3)
v3 = v2;
%Where (p3v3/t3 = p2v2/t2);v3=v2 we can ignore that
p3 = p2*t3/t2;
%isentropic Expansion
constant_c = p3*v3^gamma;
volume_expansion = formula_isentropic(bore,stroke,con_rod,cr,0,180,200);
P_expansion = constant_c./volume_expansion.^gamma;
%stage 4 where exhaust will open
%so volume will be the same with initial volume(v4 = v1)
v4 = v1;
%we know that (p3v3^gamma = p4v4^gamma)
p4 = p3*(v3/v4)^gamma;
%to find T4 (p3v3/t3 = p4v4/t4)
t4 = p4*v4*t3/(p3*v3)
%To find Thermal Efficiency; Thermal Efficiency = 1-((t4-t1)/(t3-t2))
Thermal_Efficiency_using_temperature = 1-((t4-t1)/(t3-t2))
Thermal_Efficiency_using_cr = 1-(cr)^(1-gamma)
%plotting Thermal Efficiency using multiple numbers,
compr_ratio = linspace(8,16,10)
engine_efficiency = 1-(compr_ratio).^(1-gamma)
%plotting
figure(1)
hold on
xlabel('Volume')
ylabel('Pressure')
plot(volume_compression,P_compression)
plot(volume_expansion,P_expansion)
plot([v2 v3],[p2 p3])
plot([v4 v1],[p4 p1])
figure(2)
hold on
xlabel('compression ratio')
ylabel('Thermal Efficiency')
plot(compr_ratio,engine_efficiency)
Detailing
Main Program
First let us consider all the point which volume, temperature and pressure.
At Stage One: we will be defining the value for initial volume, initial temperature and initial pressure.
At Stage Two: From ideal gas equation PV/T = Constant; This equation has been used through out the isentropic compression to find volume,temperature and pressure at stage two.
At Stage Three: In this process volume is going to be constant from that we will solve other parameters like pressure and temperature
At Stage Four: From ideal gas equation PV/T = Constant; This equation has been used through out the isentropic expansion to find volume,temperature and pressure at stage four.Which repeat the stage two with cange in parameters.
At Stage Isentropic Expansion and Isentropic Compression: In this process Function is used where Functions operate on variables within their own workspace, which is also called the local workspace, separate from the workspace you access at the MATLAB command prompt which is called the base workspace.
Functions can accept more than one input arguments and may return more than one output arguments.
Function Program
In this function program we are defining the volume trace formula which derived only for geomentrical purpose.
Where V =volume of compression or expansion
rc = compression ratio
r = connection rod/a
Where a is known as half the value of stroke,so
a = stroke /2
Adding small calculation on this function program to reduce the complexity of main program,
Results
Figure 1.3 shows the relationship between the change in volume and pressure for otto cycle.
Figure 1.3
Figure 1.4 show the result of thermal efficiency using temperature and using compression ration formulas
Figure 1.4
Figure 1.5 shows the relationship between the compression ration with respect to thermal efficiency.
Figure 1.5
Conclusion
- PV diagram has done with matlab code for otto cycle,
- And the thermal efficiency for my input is 68%.