Project

Air standard cycle

Aim:

To write a program in MATLAB to plot an otto cycle and calculate its thermal efficiency.

Objective:

  • To solve the different state variables of otto cycle.
  • To plot a P-V diagram.
  • To calculate the thermal efficiency of an otto cycle.

Theory:

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 processes are described as:

  • Process 0–1 a mass of air is drawn into piston/cylinder arrangement at constant pressure.
  • Process 1–2 is an adiabatic (isentropic) compression of the charge as the piston moves from bottom dead centre (BDC) to top dead centre (TDC).
  • 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 (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.

Governing equations:

  • Compression ratio : Vs+Vc/Vc

Where Vs=swept volume=(pi/4)*d^2*L

Where d=bore

L=stroke

Vc=clearance volume

  • Volume change inside the cylinder due to various processes :
  • For isoentropic process, P*V^gamma=constant.
  • Thermal efficiency of otto cycle=1-(1/cr^(gamma-1))

where cr=compression ratio=10 (assumed)

gamma=specific heat of air=1.4

Assumptions:

  • The initial pressure P1 and temperature T1 is assumed to be 101325 pascal and 500 kelvin.
  • The maximum temperature inside the engine cylinder. T3 is assumed to be 2300 kelvin.

Code:

%To calculate the state variables in an otto cycle and to calculate its thermal efficiency
clear all
close all
clc
%Input variables

%gamma for air=1.4
gamma=1.4;
%maximum temperature inside engine cylinder unit-kelvin
T3=2300;

%State variables at state point 1

%Atmospheric pressure unit-pascal
P1=101325;
%Temperature unit-kelvin (assumed)
T1=500;

%Engine geometric parameters
bore=0.1; %bore length unit=metre
stroke=0.1; %stroke length unit=metre
con_rod=0.15; %connecting rod length unit=metre
cr=10; %compression ratio

%Calculating swept and clearance volume
V_swept=(pi/4)*bore^2*stroke;
V_clearance=V_swept/(cr-1);

V1=V_swept+V_clearance;
V2=V_clearance;

%State variable at state point 2

%P2*V2^gamma=P1*V1^gamma | P2=P1*(V1/V2)^gamma | P2=P1*cr^gamma
P2=P1*(cr^gamma);

%P1*V1/T1=P2*V2/T2 | T2=(P2*V2*T1)/(P1*V1)
T2=(P2*V2*T1)/(P1*V1);

C_const=P1*(V1^gamma);
V_compression=engine_kinematics(bore,stroke,con_rod,cr,180,0);
P_compression=C_const./(V_compression.^gamma);


%State variable at state point 3

V3=V2;

%P3*V3/T3=P2*V2/T2 | P3=(P2*V2*T3)/(T2*V3)
 P3=(P2*V2*T3)/(T2*V3);
 
 C_const=P3*(V3^gamma);
 V_expansion=engine_kinematics(bore,stroke,con_rod,cr,0,180);
 P_expansion=C_const./(V_expansion.^gamma);
 
%State variable at state point 4

V4=V1;

%P3*V3^gamma=P4*V4^gamma | P4=P3*(V3/V4)^gamma
P4=P3*(V3/V4)^gamma;

%Calculating thermal efficiency
therm_eff=(1-(1/(cr)^(gamma-1)))*100;
fprintf('The thermal efficiency of the otto cycle is : %f percentage',therm_eff);

%plotting state variables
hold on
plot(V1,P1,'*','color','r')
text(V1,P1,'Point 1')
plot(V_compression,P_compression,'linewidth',3)
plot(V2,P2,'*','color','r')
text(V2,P2,'Point 2')
plot(V3,P3,'*','color','r')
line([V2 V3],[P2 P3],'linewidth',3)
plot(V_expansion,P_expansion,'linewidth',3)
text(V3,P3,'point 3')
plot(V4,P4,'*','color','r')
text(V4,P4,'point 4')
line([V4 V1],[P4 P1],'linewidth',3)

Code for function engine kinematics:

%Function for engine kinematics
function [V]=engine_kinematics(bore,stroke,con_rod,cr,start_crank,end_crank)
  %Crank pin radius
  a=stroke/2;
  %Crank radius
  r=con_rod/a;
  
  %calculating swept volume and clearance volume
  V_swept=(pi/4)*bore^2*stroke;
  V_clearance=V_swept/(cr-1);
  
  %how volume changes inside a engine cylinder
  
  %making linearly spaced vector of crank angle
  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;
  
endfunction

Outputs:

Conclusion:

Thus we plotted the P-V diagram from the given assumed information and the thermal efficiency was found to be 60.2 %

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.