MATLAB PROGRAMMING A CODE THAT CAN SOLVE AN OTTO CYCLE AND MAKE PLOTS FOR IT.
1.AIM:
- Writing a code that can solve an otto cycle and make plots for it.
2.GOVERNING EQUATIONS :
- In this equation, the ratio V1/V2is known as the compression ratio, CR. When we rewrite the expression for thermal efficiency using the compression ratio, we conclude the air-standard Otto cycle thermal efficiency is a function of compression ratio and κ = cp/cv.
3.OBJECTIVES OF THE PROJECT :
- The code should create a PV diagram.
- The output the thermal efficiency of the engine should be mentioned.
4.CONTENT OF THE PROJECT :
- MATLAB CODE
clear all close all clc %programme for otto cycle %inputs gamma = 1.4 t3 = 2300 %state 1 variables p1=1.01325 t1=600 %engine geometric parameters bore = 0.1; stroke = 0.1; con_rod = 0.15 cr = 8 %calculating 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 2 variables %p2v2^gamma=p1v1^gamma p2 = (p1*v1/v2)^gamma constant_c = p1*v1^gamma; v_compression = piston_kinematics(bore,stroke,con_rod,cr,180,0) p_compression = constant_c./v_compression.^gamma; % p1v1/t1=p2v2/t2 t2 = p2*v2*t1/(p1*v1) %state 3 variables v3=v2 %p3v3/t3=p2v2/t2 p3 = p2*t3/t2 constant_c = p3*v3^gamma; v_expansion = piston_kinematics(bore,stroke,con_rod,cr,0,100) p_expansion = constant_c./v_expansion.^gamma %state 4 variables v4=v1 %p3v3^gamma=p4v4^gamma p4 = p3*v3^gamma/v4^gamma %thermal efficiency efficiency = 1-1/cr^(gamma-1) hold on plot(v1,p1,'^','Color','g') plot(v_compression,p_compression,'Color','r') plot(v2,p2,'*','Color','g') plot([v2 v3],[p2 p3],'Color','r') plot(v3,p3,'*','Color','g') plot(v_expansion,p_expansion,'Color','r') plot(v4,p4,'*','Color','g') plot([v4 v1],[p4 p1],'Color','r') plot([v1 v2 v3 v4 v1],[p1 p2 p3 p4 p1],'color','g') xlabel('volume (in m^3)') ylabel('pressure (in Pa)') grid on
and the function used in this script.
MATLAB CODE
function [v] = piston_kinematics(bore,stroke,con_rod,cr,start_crank,end_crank)
%otto cycle piston kinematics
a = stroke/2
r= con_rod/a
v_s = (pi/4)*bore*2*stroke
v_c = v_s/(cr-1)
theta = linspace(0,180,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_c;
end
Description :
Execute the program to create a PV diagram for otto cycle and to determine pressure and volume at the respective steps.
In the 1st step is to assume engine geometric parameters relevance to practical parameters of engine working on an otto cycle.
The engine parameters are as the follows:
1. Bore = 0.1 m
2. Stroke = 0.1 m
3. Connecting rod length = 0.15 m
4. Compression Ratio = 8
5. Pressure at step 1(p1) = 1.01325 Pa
6.Temperature at step 1(t1) = 600 K
7.Temperature at step 3(t3) = 2300 K
Calculating the volume at step 1 (i.e. v1), to calculate the swept volume and clearance volume using the formula,
v_swept = (pi/4)*bore*2*stroke
v_clearance = v_swept/(cr-1)
Then v1 = v_swept+v_clearance
and v2 = v_clearance
with the v1,t1,p1and cr (compression ratio),the volume,pressure and temperature at other steps can be obtained using following equations
PV^gamma = constant
PV = mRT.
the error found running the program displayed on the screen are :
The below PV diagram is generated :
5.CONCLUSION OF THE PROJECT :
1. The Thermal effieciency is calculated to be be 0.5647 or 56.47%.
2.The PV diagram shows the changes in isentropic processes are curve.