This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Animation and Model of Automotive Piston

This example shows how to model the motion of an automotive piston by using MATLAB® and Symbolic Math Toolbox™.

Define the motion of an automotive piston and create an animation to model the piston motion.

Step 1: Describe Piston Model

The following figure shows the model of an automotive piston. The moving parts of the piston consist of a connecting rod (red line), a piston crank (green line), and a piston cylinder head (gray rectangle).

Describe the properties of the piston by defining the parameters:

  • the cylinder stroke length S

  • the piston bore diameter B

  • the length of the connecting rod L

  • the crank radius a

  • the crank angle θ

Define the origin O of the coordinate system at the crankshaft location. Label the nearest distance between the piston head and the crankshaft location as bottom dead center (BDC). The height of BDC is L-a. Label the farthest distance between the piston head and the crankshaft location as top dead center (TDC). The height of TDC is L+a.

Step 2: Calculate and Plot Piston Height

The following figure is a schematic of the crank and connecting rod.

The height of the piston relative to the origin is H=acosθ+L2-a2sin(θ)2. Define the piston height as a symbolic function by using the syms function.

syms pistHeight(L,a,theta)
pistHeight(L,a,theta) = a*cos(theta) + sqrt(L^2-a^2*sin(theta)^2);

Assume that the connecting rod length is L=150mm and the crank radius is a=50mm. Plot the piston height as a function of the crank angle for one revolution within the interval [0 2*pi].

fplot(pistHeight(150,50,theta),[0 2*pi])
xlabel('Crank angle (rad)')
ylabel('Height (mm)')

The piston head is highest when the piston is at TDC and the crank angle is 0 or 2*pi. The piston head is lowest when the piston is at BDC and the crank angle is pi.

You can also plot the piston height for various values of a and θ. Create a surface plot of the piston height by using the fsurf function. Show the piston height within the interval 30mm<a<60mm and 0<θ<2π.

fsurf(pistHeight(150,a,theta),[30 60 0 2*pi])
xlabel('Crank radius (mm)')
ylabel('Crank angle (rad)')
zlabel('Height (mm)')

Step 3: Calculate and Plot Volume of Piston Cylinder

The length of the combustion chamber is equal to the difference between the TDC location and the piston height. The volume of the piston cylinder can be expressed as V=π(B2)2(L+a-H).

Define the piston volume as a symbolic function and substitute the expression for H with pistHeight.

syms pistVol(L,a,theta,B)
pistVol(L,a,theta,B) = pi*(B/2)^2*(L+a-pistHeight)
pistVol(L, a, theta, B) = 

πB2L+a-acos(θ)-L2-a2sin(θ)24

Next, define the values for the following parameters:

  • the length of the connecting rod L=150mm

  • the crank radius a=50mm

  • the bore diameter B=86mm

Plot the piston volume as a function of the crank angle for one revolution within the interval [0 2*pi].

fplot(pistVol(150,50,theta,86),[0 2*pi])
xlabel('Crank angle (rad)')
ylabel('Volume (mm^3)')

The piston volume is smallest when the piston is at TDC and the crank angle is 0 or 2*pi. The piston volume is largest when the piston is at TDC and the crank angle is pi.

Step 4: Evaluate Piston Motion for Changing Angular Speed

Assume the crank rotates at 30 rpm for the first 3 seconds, then steadily increases from 30 to 80 rpm for the next 4 seconds, and then remains at 80 rpm.

Define the angular speed as a function of time by using the piecewise function. Multiply the angular speed by 2π/60 to convert the rotational speed from rpm to rad/sec.

syms t0 t
rpmConv = 2*pi/60;
angVel(t0) = piecewise(t0<=3, 30, t0>3 & t0<=7, 30 + 50/4*(t0-3), t0>7, 80)*rpmConv
angVel(t0) = 

{π if  t03π25t02-15230 if  t0(3,7]8π3 if  7<t0

Calculate the crank angle by integrating the angular speed using the int function. Assume an initial crank angle of θ=0. Compute the integral of the angular speed from 0 to t.

angPos(t) = int(angVel,t0,0,t);

Find the piston height as a function of time by substituting the expression angPos for the crank angle.

H(t) = pistHeight(150,50,angPos)
H(t) = 

{200 if  t=0100 if  t=320625+25 if  t=750cos(σ1)+22500-2500sin(σ1)2 if  7<t50cos(πt)+22500-2500sin(πt)2 if  t3t022500-2500sin(σ2)2-50cos(σ2) if  t(3,7]where  σ1=31π3+8πt-73  σ2=π5t+9t-324

Plot the piston height as a function of time. Notice that the oscillation of the piston height becomes faster between 3 and 7 seconds.

fplot(H(t),[0 10])
xlabel('Time (sec)')
ylabel('Height (mm)')

Step 5: Create Animation of Moving Piston

Create an animation of the moving piston given a changing angular speed.

First, create a new figure. Plot the cylinder walls that have fixed locations. Set the x-axis and y-axis to be equal length.

figure;
plot([-43 -43],[50 210],'k','LineWidth',3)
hold on;
plot([43 43],[50 210],'k','LineWidth',3)
plot([-43 43],[210 210],'k','LineWidth',3)
axis equal;

Next, create a stop-motion animation object of the piston head by using the fanimator function. By default, fanimator creates an animation object by generating 10 frames per unit time within the range of t from 0 to 10. Model the piston head as a rectangle with a thickness of 10 mm and variable height H(t). Plot the piston head by using the rectangle function.

fanimator(@rectangle,'Position',[-43 H(t) 86 10],'FaceColor',[0.8 0.8 0.8])

Add the animation objects of the connecting rod and the piston crank. Add a piece of text to count the elapsed time.

fanimator(@(t) plot([0 50*sin(angPos(t))],[H(t) 50*cos(angPos(t))],'r-','LineWidth',3))
fanimator(@(t) plot([0 50*sin(angPos(t))],[0 50*cos(angPos(t))],'g-','LineWidth',3))
fanimator(@(t) text(-25,225,"Timer: "+num2str(t,2)));
hold off;

Use the command playAnimation to play the animation of the moving piston.