otto cycle
Introduction:this assignment explains the thermodynamic process that happens during a otto cycle. the diffrent process are represented using equations and plotted.
close all
clear all
clc
%p-v plot of otto cycle
%inputs
bore=0.1;
stoke=0.1;
con_rod=0.15;
cr=12;
r=stoke/2;
R=con_rod/r;
vs=(pi/4)*bore^2*stoke;
vc=vs/(cr-1);
gamma=1.4;
t3=2500;
%state variables
%1-2 isentropic compression
v1=vs+vc;
p1=101325;
constant_c1=p1*v1^gamma;
v_compression=volume_trace(bore,stoke,con_rod,0,180,cr);
p_compression=(constant_c1./v_compression.^gamma);
v2=vc;
t1=(273+34);
p2=(p1*v1^gamma)/v2^gamma;
t2=t1/(p1/p2)^((gamma-1)/gamma);
%2-3 constant volume heat addition
v3=v2;
p3=(p2/t2)*t3;
%3-4 isentropic expansion
v4=v1;
constant_c2=p3*v3^gamma;
v_expansion=volume_trace(stoke,bore,con_rod,180,360,cr);
p_expansion=(constant_c2./v_expansion.^gamma);
p4=p3*(v3/v4)^gamma;
t4=t3/(p3/p4)^((gamma-1)/gamma);
hold on
plot(v1,p1,'*','color','r')
plot(v_compression,p_compression,'linewidth',3)
plot(v2,p2,'*','color','b')
plot(v3,p3,'*','color','y')
plot(v_expansion,p_expansion,'linewidth',3)
plot(v4,p4,'*','color','r')
axis([ 0.000051400 0.00095680 101300 9901500.79805])
plot([v2,v3],[p2,p3],[v4,v1],[p4,p1])
xlabel('volume (m^3)')
ylabel('pressure (pascal)')
Explanation
First we're declaring the inputs that is various parameters of a ic engine which runs on otto cycle(si engine). then we are determining the state variables at various process which is taking place
1-2 isentropic compression(reversible adiabatic process)
2-3 constant volume heat addition
3-4 isentropic expansion
4-1 constant volume heat rejection
in this above process 2-3 and 4-1 are straight lines due to the constant volumes
but in the other two process the pressure and volume changes differently
which is calclated with a function known as volume_trace
% volume trace
function [v]=volume_trace(bore,stoke,con_rod,start_crank,end_crank,cr)
a=stoke/2
R=con_rod/a
vs=(pi/4)*bore^2*stoke;
vc=vs/(cr-1);
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)).*vc;
plot(theta,v)
endfunction
this function explains the volume change with the change in theta value
thus accordingly graphs are generated
the error that i faced while working with this assignment
1)iwasn't able to call a function then i asked help from my support engineer ,the problem was iwant having the same name for my function and file name
2)scale values in the graph ,initially the graph was like this