Air standard cycle using Matlab
AIM:
To write a program in matlab to create a PV diagram of an otto cycle and to calculate its thermal efficiency.
OBJECTIVE:
1)To calclulate various states of otto cycle and to plot the PV diagram.
2)To calculate thermal efficiency
THEORY:
An Otto cycle is an idealized thermodynamic cycle that describes the functioning of a typical spark ignition piston engine.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.It is widely used in automoblile engines.
(Image from google)
EQUATIONS OR FORMULAE:
1)Thermal efficiency of otto cycle=1-(1/cr^(gamma-1)
where cr=compression ratio=12 (Assumption)
gamma=specific heat of air=1.4
2)Swept volume=(pi/4)*d^2*L
Where d=bore
L=stroke
3)Clearance volume=swept volume/(cr-1)
4)Isentropic process
PV^gamma=constant
5)Ideal gas equation
PV/T=constant
6)Volume change in combustion chamber
V/Vc=1+1/2(cr-1)[R+1-cos(theta)-(R^2-sin(theta)^2)^1/2]
ASSUMPTION VALUES:
1)The initial pressure P1 and temperature T1 is assumed to be 101325 pascal(1atm) and 500 kelvin.
2) T3 is assumed to be 2300 kelvin.
ENGINE GEOMETRIC PARAMETER VALUES:
bore = 0.1 m
stroke = 0.1 m
con_rod = 0.15 m
cr = 12
PROGRAM EXPLANATION:
1)First, we write a function program(engine_kinematics) where a specified function is mentioned which covers all the parameters and the variables.The name of the program should be saved with the function name.
2)This program consists of finding the volume change inside the combustion chamber with respect to crank angle.
3)After finishing the program, we apply this program in the main program(ottocycle)
4)In the main program we calculate the different states of P and V of the otto cycle.
5)The function program is called for the states 1-2 and 3-4 because they constitute a different process.(isentropic compression or expansion).
6)After the equations are provided, PV diagram is plotted and thermal efficiency is calculated
Engine kinematics(function program)
%engine kinematics
function [V]=engine_kinematics(bore,stroke,con_rod,cr,start_crank,end_crank)
a=stroke/2;
r=con_rod/a;
V_swept=(pi/4)*bore^2*stroke;
V_clearance=V_swept/(cr-1);
% volume change inside a engine cylinder
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_clearance;
end
Ottocycle(main program):
clear all
close all
clc
%variables
p1=1;
t1=500;
%inputs
gamma=1.4;
t3=2300;
%engine geometric parameters
bore=0.1;
stroke=0.1;
con_rod=0.15;
cr=12;
%calculating swept and clearance volume
s_v=(pi/4)*bore^2*stroke;
c_v=s_v/(cr-1);
v1=s_v+c_v
v2=c_v
%variables at state 2(p1*v1^gamma=p2*v2^gamma)
p2=p1*cr^gamma
%by ideal gas law((p1*v1)/t1=(p2*v2)/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;
%variables at state 3
v3=v2
%by ideal gas law(v3 is not taken since v3=v2)
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;
%variables at state 4
v4=v1
p4=p3*(v3/v4)^gamma
figure(1)
hold on
plot(v1,p1,'*','color','g')
plot(V_compression,P_compression)
plot(v2,p2,'*','color','g')
plot(v3,p3,'*','color','g')
line([v2 v3],[p2 p3])
plot(V_expansion,P_expansion)
plot(v4,p4,'*','color','g')
line([v4 v1],[p4 p1])
xlabel('volume')
ylabel('pressure')
%Calculation of thermal efficiency
n = (1 - (1/cr^(gamma-1)))*100;
fprintf('Thermal Efficiency of Otto Cycle: %f percent', n);
OUTPUT:
The thermal efficiency of otto cycle is found out to be 62.989283 percent.
ERRORS FACED WHILE PROGRAMMING:
Some syntax errors was faced.Rectified it.
RESULT:
Thus the PV diagram of ottocycle is plotted and the thermal efficiency is found out.