Project

Plotting Air standard Cycle & Calculating thermal efficiency of the Engine using MATLAB

Objective

MATLAB Code to produce PV Diagram and thermal efficiency of Otto cycle.

Calculating the thermal efficiency of the engine.

Engine Input

Engine Bore = 0.1 meter

Stroke Length = 0.1 meter

Connecting Rod Length = 0.15 meter

Compression Ratio = 12

The pressure is 1 ATM at the start of compression with in-cylinder temperature of 500 kelvin.

The temperature of Charges after the combustion is 2300 kelvin.

Solution

The formula used to calculate the variation in volume inside the cylinder during isentropic compression and expansion is:-

`(V/V_C) = 1 + (1/2)(r_c -1)[R+1-costheta - (R^2 - sin^2theta)^(1/2)]`

A separate code is written to calculate the volume inside the cylinder during the isentropic compression and expansion process using the formula mentioned above. That code is coded inside a function that is later called and used as a template with input engine parameters in the main code.

Here is the code to calculate the volume inside the cylinder:-

%calculating volume varition inside cylinder based on crack angle during compression/expansion

function [volume_trace] = engine_kinamatics(bore,stroke,con_rod,cr,start_crank,end_crank)

a = stroke/2;           %crank_pin_radius
R = con_rod/a;          %ratio of connecting rod length to crank pin radius       

swept_vol = pi/4*bore^2*stroke;          %swept volume
clearence_vol = swept_vol/(cr-1);        %clearence volume

%determine how volume inside the combustion chamber changes

theta = linspace(start_crank,end_crank,100);        % combustion cycle

term1 = 0.5*(cr-1);
term2 = R + 1 -cosd(theta);
term3 = (R^2 - sind(theta).^2).^0.5;

%formula which calculate volume varition inside cylinder based on crack angle during compression/expansion

volume_trace = (1 + term1*(term2 - term3)).*clearence_vol;   

end

This function is used to call in the main code in order to plot the PV diagram and calculate thermal efficiency.

Main Code

%Plotting PV diagrama and calculating Thermal Efficiency of otto cycle

clear all
close all
clc

%input
gamma = 1.4;
T3 = 2300; %temperature of charge at end of combustion is known

%state variable at point 1
   
P1 = 101325;   %1 ATM before starting of compression
T1 = 500;     % innitial temperatre 500 kelvin

%engine parameters
bore = 0.1;
stroke = 0.1;
con_rod = 0.15;
cr = 12;          %compression ratio

%calculation for swept 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 variable point 2 - ISENTROPIC COMPRESSION 
%P1*V1^GAMMA = P2*V2^GAMMA = constant

P2 = P1*(cr)^gamma;

%ideal gas law p1*v1/t1 = p2*v2/t2 = constant

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

constant_1 = P1*V1^gamma;
v_compression = engine_kinamatics(bore,stroke,con_rod,cr,180,0); %for compression stroke, connecting rod goes from 0 to 180 degree

p_compression = constant_1./v_compression.^gamma;

%state variable point 3 - Consant volume of combustion process
V3 = V2;

%P3 using ideal gas law
%p2*v2/t2 = p3*v3/t3
P3 = P2*T3/T2;

constant_2 = P3*V3^gamma;
v_expansion = engine_kinamatics(bore,stroke,con_rod,cr,0,180); %for expansion stroke, connecting rod goes from 0 to 180 degree

p_expansion = constant_2./v_expansion.^gamma;

%state variable point 4 - isentropic expansion

V4 = V1; %constant volume process

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

%Exhaust Temperature
%ideal gas law p3*v3/T3 = p4*v4/T4 = constant
T4 = (P4*V4*T3)/(P3*V3);

% calculating thermal efficiency
%etta = workdone / heat supplied 
%workdone = heat supplied - heat rejected
%etta = heat supplied - heat rejected) / heat supplied
%heat supplied is during state 2 to 3
%heat rejected is during stae 4 to 1

etta = (1 - ((T4-T1)/(T3-T2)))*100;   %THERMAL EFFICIENCY

efficiency = ['Thermal Efficiency of the cycle is : ',num2str(etta),' %.'];

disp(efficiency)

%PLOTTING

figure(1)    %open up a figure window
hold on
plot(V1,P1,'.','color','r')
plot(v_compression, p_compression,'color','r')
plot(V2,P2,'.','color','r')
plot(v_expansion, p_expansion,'color','r')
plot(V3,P3,'.','color','r')
line([V2 V3], [P2 P3],'color','r','linewidth',1.5)
plot(V4,P4,'.','color','r')
line([V4 V1], [P4 P1],'color','r','linewidth',1.5)
xlabel('V')
ylabel('P')

OUTPUT & RESULTS

PV Diagram

The thermal efficiency of the cycle is ~ 63 %

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.