Project

SOLVING PISTON KINEMATICS FOR OTTO CYCLE USING MATLAB

AIM:

To write a program using matlab for otto cycle to find the piston kinematics

FORUMULA USED:

`v_s = (pi/4)*d^2*l`

`v_c= v_s/(cr-1)`

`v_1 = v_s + v_c`

`v_2 = v_c`

`p_2 = p_1*(v_1/v_2)^gamma`

`t_2 = (p_2*v_2*t_1)/(p_1*v_1)`

`p_3=(p_2*t_3)/t_2`

`v_1/v_2=cr`

`V/V_c = 1 + 1/2(cr-1)[R+ 1-costheta-(R^2-SIN^2theta)^(1/2)]`

To determine the volume inside the combustion chamber which changes is found using this formulae.

Project objective:

# The main objective of the project is to plot the otto cycle for the piston kinematics using the given input values.

# The workflow is started is from plotting a simple pv diagram for a otto cycle. Then it follows by the four stages occurs in otto cycle. The inputs for the diagram and the values to be find are figured and listed out. Geometric parameters are taken for the engine. Plotting coordinates points are listed for programming.

Body of the content

# The programming language used here html in matlab

clear all
close all
clc
 
%inputs
gamma = 1.4
t3 = 2300
 
% state variables
p1 = 101235
t1 = 500
 
% Engine geometric 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 = p1v1^gammma
p2 = p1*(v1/v2)^gamma;
 
% p1v1/t1 = p2v2/t2 
t2 = p2*v2*t1/(p1*v1);
 
constant_c = p1*v1^gamma;
V_compression = piston_kinematics(bore,stroke,con_rod,cr,0,180);
p_compression = constant_c./V_compression.^gamma;
 
% state variables at point 3
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,180);
p_expansion = constant_c./V_expansion.^gamma;
 
% state variables at point 4
v4 = v1
 
% p3v3^gamma = p4v4^gamma
p4 = p3*(v3/v4)^gamma
 
figure(1)
hold on
plot(v1,p1,'*','color','r')
plot(v2,p2,'*','color','r')
plot(V_compression,p_compression)
plot(v3,p3,'*','color','r')
plot(V_expansion,p_expansion)
plot(v4,p4,'*','color','r')
plot([v2 v3],[p2 p3])
plot([v1 v4],[p1 p4])

function is created by writing this script

function [V] = piston_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 = 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 

Program Description:

# By using v1 and t1 the presure at point 1 is calculated.

# Compression ratio is provided so we can calculate v2 and p2.

# t3 or p3 is provided in the problem. If t3 is known we can find v3 because v3 and v2 are due to constant heat addition stage process.

# To calculate v1 and v2 we need the swept volume and clearance volume where from the volume trades which is to be solved and the kinematics equation of a piston is considered from engine geometric parameters, they are bore, stroke, connecting rod, compression ratio.

# The variables are stated in the script which is p1 taken in atmosperic pressure bar and t1 is mention kelvin.

# The engine geometric parameters values are feeded.

# Calulating each stage process with formulas and plotting is done, where the plots for each stage is marked but the plotting lines are in appropriate. So another script is written .

# Where to determine the volume inside the combustion chamber which changes is found using this formula which is purely derived from geometric relations. The forumula is dived into 3 terms for easy understanding and working.

# To plot the otto cycle a function is to called which is written in another script and for a function we need to use end keyword. function is a good way to use codes.

# (R = con_rod/a) is which the ratio of connecting rod length to crankpin radius

# a = stroke/2 which is called crankpin radius.

# When theta= 0, then the volume should correspond to the clearance volume which is basically top dead center volume

# semi colon (;) is used when no output from the function.

# Finally the plotting is done by mapping the stages point by its process in x and y axis.

Graph plot

Conclusion:

# The graph for piston kinematics in otto cycle is plotted and each stages seperate points and the graph does not plot a straight line it plots on its points

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.