VISUAL REPRESENTATIOM OF OTTO CYCLE USING MATLAB
AIM: Simulation of otto cycle in p-v graph using MATLAB
OBJECTIVE:
- Plot the p_v diagram of otto cycle using MATLAB.
- Determine the thermal efficiency.
THEORY:
Otto cycle is the perfect expamle of thermodynamic cycle .it explains when mass of gas goes through change in pressure ,volume,heat addition ,heat rejection.otto cycle commonly used in automobiles.
from fig:
- 1-2 its is an isentropic compression where volume decreased v1 to v2 , pressure increased p1 to p2, temperature also increased t1 to t2.
- 2-3 its is heat addition process where volume is constant v2=v3,it aslo called power stroke.
- 3-4 its is an isentropic expension where volume is increased v3 to v4,pressure is decreased p3 to p4.
- 4-1 it is heat rejection where volume is constant v4=v1.it also power exhaust stroke
- Suction: Piston is moving downward with crankshaft.Revolved by the power generated by the electric motor . where inlet valve is open,exhaust value is closed. Downward movement of piston suck air-fuel mixture from carburator through open inlet valve
- Compression: piston moving in upward direction.Ignition and compression takes place in this stroke it causes heat is easier for petrol to burn ignited by the spark produced by spark plug.both inlet valve and out let is closed in this stroke.
- Power:Expansion of gas due to the heat of combustion exerted pressure in the cylinder and piston.Piston is moved downward and doing useful works.Both the valve remain closed.
- Exhaust: During this stroke inlet valve is closed and exhaust valve is open.Piston moves upward direction exhales through exhaust valve. Some quantity of gases remains in the clearance which will dilute the fresh incoming charge.
FORMULA:
1) v_s=(pi/4)*bore^2*stroke ( volume sweft)
2) gas eq:(p1*v1)/(t1)=(p1*v1)/(t1)
3) thermal efficiency:`1-(1/(cr^(gamma-1)))`
4)volume eqn:
v/v_c=1+1/2(r_c-1)[R+1-costheta-(R^2-sin^2theta)^0.5]
Programme on otto cycle to plot p-v diagram in MATLAB:
clear all
close all
clc
%inputs
gamma=1.4;
t3=2300;
%varibles
p1=101325;
t1=500;
%engine parameters
bore=0.1;
stroke=0.1;
con_rod=0.15;
cr=12;
%calculating the swept volume 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 variables at state point 2
%p2v2^gamma=p1v2^gamma
%p2 = p1*(v1/v2)^gamma=p1*cr^gamma
p2= p1*cr^gamma;
%p1v1/t1=p2v2/t2 | t2=p2*v2*t1/(p1*v1)
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 state piont 3
v3=v2;
%p3v3/t3=p2v2/t2 | p3=p2*t3/t2
p3=p2*t3/t2;
constant_c= p3*v3^gamma;
V_expension=engine_kinematics(bore,stroke,con_rod,cr,0,180)
P_expension=constant_c./V_expension.^gamma;
% state variables at state point 4
v4=v1;
%p3p4gamma = p4v4^gamma | p4= p3(v3/v4)^gamma
p4= p3*(v3/v4)^gamma;
figure(1)
hold on
plot(v1,p1,'*','color','r')
plot(V_compression,P_compression)
plot(v2,p2,'*','color','r')
plot(v3,p3,'*','color','r')
plot(V_expension,P_expension)
plot(v4,p4,'*','color','r')
line([v1,v4],[p1,p4],'color','b')
line([v2,v3],[p2,p3],'color','b')
xlabel('volume')
ylabel('pressure')
%thermal_efficiency of otto cycle
thermal_efficiency=(1-(1/cr^(gamma-1)))*100
%thermal_efficiency of otto cycle: 62.98%
funtion :
function [V] = engine_kinematics(bore,stroke,con_rod,cr,start_crank,end_crank)
a = stroke/2;
R = con_rod/a;
theta=linspace(start_crank,end_crank,100);
v_s = (pi/4)*bore^2*stroke;
v_c = v_s/(cr-1);
term1 = 0.5*(cr-1);
term2 = R+1-cosd(theta);
term3 = (R^2-sind(theta).^2).^0.5;
V=(1+term1*(term2-term3)).*v_c
end
function are work like templates ,we used function to reduced the programming lenght and not meshed the programme.function is call in V_compression and V_expansion.
Graphical representation of p-v diagram in MATLAB:
Value of thermal efficiency : 62.98%
VALUES OF OUTPUTS:
CONCULSION: By using function get the value of all the outputs ,plot p-v diagram and thermal efficiency