Project

MATLAB PROGRAM FOR SIMULATING OTTO CYCLE

AIM:-

To write a MATLAB program for simulating an Air standard Otto cycle and calculating its efficiency

OBJECTIVE:-

To plot a P-V graph in MATLAB

To calculate the Thermal efficiency of the cycle

INTRODUCTION:- 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 program in MATLAB is to simulate an Otto cycle.

The assumptions that are made in an Air standard cycles are as follows:-

1)The working fluid is air which follows the perfect gas law i.e PV=nRT.

2)The specific heat of air does not vary with temperature.

3)The mass of air in the cycle remains fixed i.e the engine operates as a closed system, so that working fluid is restored to its initial state at the end of each cycle. Thus, there are no intake and exhaust process.

4)Heat addition and rejection takes place with the help of external heat reservoir, due to heat transfer.

5)All the processes are internally reversible and compression and expansion process are isentropic.

6)The working fluid is homogeneous throughout and no chemical reaction takes place.

GOVERNING EQUATION:-

PROCESSES:-

Process(1-2):-It is an Isentropic compression process where the piston moves from bottom dead centre (BDC) to top dead centre (TDC) thereby compressing the working fluid

Process(2-3):-It is a constant volume Heat addition process where heat is transferred from an external source to the working fluid.

Process(3-4):-It is an Isentropic expansion process where the piston moves from top dead centre (TDC) to bottom dead centre (BDC) thereby completing the expansion process

Process(4-1):-It is a constant volume heat rejection process where heat is expelled by the working fluid to the surrounding.

FORMULAS USED:-

For ISENTROPIC Process we will use

`P*V^γ=Constant`

Where P=pressure of Ideal gas

V=volume of Ideal gas

γ=`(C_p)/(C_v)`

C_p=specific heat at constant pressure

C_v=specific heat at constant volume

`(P*V)/T=Constant`

`V/(V_c)=1+1/2*(c_r-1)*[R+1-cos(theta)-(R^2-(sin(theta))^2)^0.5]`

where V=volume of compression or expansion

`V_c`=clearance volume

`c_r=compression ratio`

`R=c_r/a`

a=crank pin radius

`eta=1-1/c_r^(gamma-1)`

where `eta`=thermal efficiency of otto cycle

PROGRAM:-

%plotting otto cycle
%engine parameters
bore=0.1;
stroke=0.1;
con_rod=0.15;
cr=12;
gamma=1.4;

%Efficiency of otto cycle is given by Eotto=1-1/cr^(gamma-1)
TERM1=gamma-1;
TERM2=cr^TERM1;
TERM3=1/TERM2;
Eotto=1-TERM3;

%calculating volume and clearance volume
k=1/(cr-1);
v_s=pi/4*bore^2*stroke;
v_c=k*v_s;
v1=v_s+v_c;
v2=v_c;
cr=v1/v2;

%state variables at 1
p1=101325;
t1=500;
t3=2000;

%state variables at 2
%Governing equation will be p1*v1^gamma=p2*v2^gamma
p2=p1*(v1/v2)^gamma;
t2=t1*cr^gamma;
constant1=p1*v1^gamma;
V_compression=engine_kinematics(bore,stroke,con_rod,cr,0,180);
P_compression=constant1./V_compression.^gamma;

%state variables at 3
%Governing equation will be p2*v2/t2=p3*v3/t3
v3=v2;
p3=p2*t3/t2;
constant2=p3*v3^gamma;

%state variables at 4
%Governing equation will be p3*v3^gamma=p4*v4^gamma
v4=v1;
p4=(v3/v4)^gamma*p3;
V_expansion=engine_kinematics(bore,stroke,con_rod,cr,180,0);
P_expansion=constant2./V_expansion.^gamma;

%plotting
figure(1)
hold on
xlabel('volume')
ylabel('pressure')
plot([v2,v3],[p2,p3],'linewidth',1.5,'color','r')
plot(V_compression,P_compression,'linewidth',1.5,'color','b')
plot([v4,v1],[p4,p1],'linewidth',1.5,'color','r')
plot(V_expansion,P_expansion,'linewidth',1.5,'color','b')

OUTPUT:-

GRAPH:-

PROGRAM FOR SOLVING PISTON KINEMATICS EQUATION

function [V]=engine_kinematics(bore,stroke,con_rod,cr,start_crank,end_crank)
%inputs
%engine parameters
a=stroke/2
R=con_rod/a
k=1/(cr-1);

%swept and clearance volume
v_s=pi/4*bore^2*stroke;
v_c=k*v_s;
v1=v_s+v_c;
v2=v_c;
cr=v1/v2;

%engine kinematics
theta=linspace(start_crank,end_crank,100)
term1=(cr-1).*0.5
term2=R+1-cosd(theta)
term3=(R^2-sind(theta).^2).^0.5
V=(1+term1*(term2-term3)).*v_c
end

OUTPUT:-

The piston kinematics will be solved by calling the function i.e engine kinematics and the right P-V diagram will be achieved

ERRORS MADE:-

I did not mentioned the dot(.) operator while dividing by 'V'

CONCLUSION:-

From this program we can compare different Otto cycles and their thermal efficiency to get a better and desired product.

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.