AIR STANDARD CYCLE ANALYSIS USING MATLAB
AIR STANDARD CYCLE ANALYSIS
AIM:To plot the pv diagram and find the efficiency of air standard cycle using MATLAB.
THEORY:The air standard cycle used in this is otto cycle. It has two isentropic process and two constant volume process.
For isentropic process 1-2&3-4
p1v1^n = p2v2^n
where n=gamma=specific heat ratio
Variable inputs assumed: n=gamma=1.2
Highest value of temperature i.e. T3=3000K
Variables at point 1: P1=101325Pa
T1=600K
Engine Geometric Parameters: bore=.3 Connecting Rod length=.45
stroke=.3 Compression Ratio(cr) =15
Formulas Used: 1. PV^gamma=constant
2. PV/T=constant
3.Swept Vol=pi/4*bore^2*stroke
4.Clearance Vol=swept vol/(cr-1)
5.V/Vc=1+1/2(CR−1) [R+1−cos(θ)−(R2−sin2(θ))1/2]
where theta is the crank angle
6.Thermal Efficiency=ηth=1−1/CR^(γ−1)
Step By Step Procedure:
1.First of all in matlab i have assigned the values of assumed variables.
2.Then with the help of formulas and the values i obtained the variables for diff points.
3. For the simplicity of the program i have made a function so that program does not look ugly or complex.
4.At last calculated the value of efficiency.
5.Finally the plot is obtained for pressure and volume.
MATLAB CODE:
clear all
close all
clc
%input values assumed
gamma=1.2;
t3=3000;
%state variables at point 1
p1=101325;
t1=600;
%engine geometric parameters
bore=.3;
stroke=.3;
con_rod=.45;
cr=15;
%calculating swept vol and clearance vol
v_swept=(pi/4)*bore^2*stroke;
v_clearance=v_swept/(cr-1);
v1=v_swept+v_clearance;
v2=v_clearance;
%state variables at state point 2
%p1v1^gamma=p2v2^gamma
p2=p1*cr^gamma
%p1v1/t1=p2v2/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;
%state variables at point 3
v3=v2;
%p3v3/t3=p2v2/t2
p3=p2*v2*t3/(t2*v3)
constant_c=p3*v3^gamma;
V_expansion=engine_kinematics(bore,stroke,con_rod,cr,0,180);
P_expansion=constant_c./V_expansion.^gamma;
%state variables at point 4
v4=v1;
%p3v3^gamma=p4v4^gamma
p4= p3*(v3/v4)^gamma
%thermal efficiency
thermal_eff = 1-(1/(cr^(gamma-1)));
efficiency = thermal_eff*100;
fprintf('Finally the efficiency is:%7.2f%%\n',efficiency)
figure(1)
hold on
plot(v1,p1,'*r')
plot(V_compression,P_compression)
plot(v2,p2,'*r')
plot(v3,p3,'*r')
plot(V_expansion,P_expansion)
plot(v4,p4,'*r')
plot([v2,v3],[p2,p3],'color','b') %This is used for joining lines
plot([v4,v1],[p4,p1],'color','b')
xlabel('Volume')
ylabel('Pressure')
title('P-V diagram')
%For making the program simple i made a function called engine kinematics so that program does not
%look ugly
function [V]=engine_kinematics(bore,stroke,con_rod,cr,start_crank,end_crank)
a=stroke/2;
R=con_rod/a;
v_s=(pi/4)*bore^2*stroke;
v_c=v_s/(cr-1);
theta=linspace(start_crank,end_crank,100);
term1=.5*(cr-1);
term2=R+1-cosd(theta);
term3=(R^2-sind(theta).^2).^.5;
V=(1+term1*(term2-term3)).*v_c;
end
Plot Obtained:
Errors: I want to display the efficiency with the percent sign so i have used the function display for this but this shows me error.But by using the printf function i have resolved the issue.
Result: 1. Pv diagram is obtained.
2. The efficiency is 41.82%