Simulating Air Standard Cycle P-V Diagram and Calculating it's Thermal Efficiency using MATLAB.
Objective:
The main objective of this project is to visualize a plot representing P-V diagram of OTTO-Cycle and Calculate the Thermal Efficiency of the cycle.
OTTO-Cycle:
An Otto cycle is an idealized thermodynamic cycle, that describes the functioning of a typical spark ignition piston engine. It is the thermodynamic cycle most commonly found in automobile engines.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 Otto cycle is constructed from:
1. Top and bottom of the loop: a pair of quasi-parallel and isentropic processes (frictionless, adiabatic reversible).
2. Left and right sides of the loop: a pair of parallel isochoric processes (constant volume).
P-V Diagram:
Processes:
- Process 0–1 intake stroke
- Process 1–2 compression stroke
- Process 2–3 ignition phase
- Process 3–4 expansion stroke
- Process 4–1 idealized heat rejection
- Process 1–0 exhaust stroke
The formulas used in this programs are:
1. The volumetric ratio ,
2. The Thermal efficiency formula,
Programs:
1. Funtion() called as Engine_Kinematics:
%Program to write Funtion named Engine Kinematics that will be used in
%otto cycle program and calculating how volume changes when piston is moving.
function [v] = engine_kimenatics(bore, stroke, con_rod, cr, start_crank, end_crank)
%Inputs.
a = stroke/2;
R = con_rod/a;
%calculating swept volume and clearence volume.
v_s = (pi/4)*bore^2*stroke;
v_c = v_s/(cr-1);
%angles of moving crank shaft.
theta = linspace(start_crank,end_crank,100);
%calculating the volume v.
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 of visualizing and calculating OTTO-cycle:
%Program to calculate the thermal efficiency and plotting P-V diagram of
%Otto Cycle.
clear all
close all
clc
%Inputs
gamma = 1.4;
t3 = 2000;
%state variables at state 1
p1 = 101;
t1 = 500;
%Engine Geometric Paramters
bore = 0.1;
stroke = 0.1;
con_rod = 0.15;
cr = 12;
%calculating the swept volume and clearence volume.
v_swept = (pi/4)*(bore^2)*stroke;
v_clearence = v_swept/(cr-1);
v1 = v_swept + v_clearence;
v2 = v_clearence;
%state variables at state point 2.
%p2v2^gamma = p1v1^gamma.
p2 = p1 * cr^gamma;
%Calculating t2.
%p1v1/t1 = p2v2/t2 | t2 = p2v2t1/p1v1.
t2 = p2*v2*t1/(p1*v1);
%calculating Volume and Pressure compressions from point 1 to 2.
constant_c = p1*v1^gamma;
v_compression = engine_kinematics(bore,stroke,con_rod,cr,180,0);
%p_compression*v_compression = constant_c.
p_compression = constant_c./v_compression.^gamma;
%state variables at state point 3.
v3 = v2;
%calculating p3.
%p3v3/t3 = p2v2/t2 | p3 = p2t3/t2.
p3 = (p2*t3)/t2;
%Calculating Volume and Pressure compressions from point 3 to 4.
constant_c = p3*v3^gamma;
v_expansion = engine_kinematics(bore,stroke,con_rod,cr,0,180);
%p_expansion*v_expansion = constant_c.
p_expansion = constant_c./v_expansion.^gamma;
%static variables at state point 4.
v4 = v1;
%calculating p4 and t4 from equations.
%p3v3^gamma = p4v4^gamma
p4 = p3*(v3/v4)^gamma;
%p4v4/t4 = p3v3/t3.
t4 = p4*v4*t3/(p3*v3);
%calculating thermal efficiency of otto_cycl.
term4 = t4-t1;
term5 = t3-t2;
thermal_efficiency = (1-(term4/term5))*100
%plotting the p-V diagram using different plot statements.
figure(1)
hold on
plot(v1,p1,'*','color','b')
plot(v_compression,p_compression,'r')
plot(v2,p2,'*','color','b')
plot(v_expansion,p_expansion,'r')
plot(v3,p3,'*','color','b')
plot(v4,p4,'*','color','b')
plot([v2 v3],[p2 p3],'color','r')
plot([v1 v4],[p1 p4],'color','r')
xlabel('Volume')
ylabel('Pressure')
title('OTTO-Cycle')
Errors:
1. When compiling the program 1, 'engine_kinematics.m', I did not delete the first three lines of the program after adding the function line i.e., 'clear all, close all, clc'. So, I got an error like 'Reference to a cleared variable stroke'. I got through that error by deleting the first three lines.
2. While plotting the p-v diagram, forgot to mention v_compression. I figured it out.
3. In calculating v1, instead of adding v_ swept and v_clearence, I multiplied it and it generated an error. There was no error found but the output was not as expected. I corrected it.
Outputs:
1. The P-V Diagram of OTTO-Cycle.
2. The thermal efficiency calculated in percentage,
Conclusion:
The P-V Diagram is plotted as per the given required inputs, remaining values required are calculated in the program and the Thermal Efficiency is calculated and the value is 62.98 %.