Cam Design

Description

Cams are used in many kinds of mechanical devices. Their basic purpose is to convert rotary motion into linear motion that has a particular displacement as a function of time.  An important application is to car engines: cams are used to control the opening and closing of valves in engine cylinders.

Displacement Diagrams

Parabolic Motion

One of the simplest kinds of cam has a displacement function that consists of two parabolic sections.

Here is the equation for the first half of the motion. theta is the cam rotation angle. y is the displacement. This defines y as a function of theta.

y[theta_] = a theta^2 + b theta + c

Here are the conditions that the first parts of the cam motion must satisfy.

eqns1 = {y[0]==0, y'[0]==0, y[beta/2]==L/2}

We can solve these equations for the parameters a, b,and c.

ans1 = Solve[eqns1, {a, b, c}]

The second part of the cam motion must match the slope of the first part of the motion at 
theta = beta/2.

eqns2 = {First[y'[beta/2] /. ans1] == y'[beta/2],
				y[beta]==L, y'[beta]==0}

ans2 = Solve[eqns2, {a, b, c}]

Now we can plot the cam displacement, choosing beta = 2Pi, L = 1.

y1[theta_] = First[y[theta]/.ans1] /. {beta->2Pi, L->1} ;

y2[theta_] = First[y[theta]/.ans2] /. {beta->2Pi, L->1} ;

Plot[If[theta < Pi, y1[theta], y2[theta]], {theta, 0, 2Pi}]

Higher Derivatives

As the cam rotates, the angle theta is given by some function of t. Taking derivatives shows how the displacement varies with time.

Clear[y]

Velocity:

D[y[theta[t]], t]

Acceleration:

D[y[theta[t]], {t, 2}]

Jerk:

D[y[theta[t]], {t, 3}]

Polynomial Cams

Clear[y]

y[theta_] = Sum[c[i] (theta/beta)^i, {i, 0, 5}]

eqns = {y[0]==0, y'[0]==0, y''[0]==0, y[beta]==L, y'[beta]==0,
				y''[beta]==0}

Solve[eqns, Array[c, 6, 0]]

First[y[theta] /. %]

Harmonic Cams

Here are the equations for the displacement of a modified harmonic cam.

beta=Pi;

ydisp = 1/2 (       (1 - Cos[  Pi theta/beta]) - 
				1/4 (1 - Cos[ 2Pi theta/beta]))

Here is a picture of the cam.

CamPlot[2, ydisp, theta]

The next cell group contains a movie of the cam rotating.To see the movie, first select
the cell and click it to start the animation.

SpinCam[2, ydisp, theta, 15];

Here are the first four derivatives of the displacement function.

der = Table[D[ydisp, {theta, i}], {i, 0, 3}]

Plot[Release[der], {theta, 0, 2Pi}, PlotStyle->
	{RGBColor[1,0,0], RGBColor[0,1,0], RGBColor[0,0,1],
	RGBColor[0,.7,.2], RGBColor[0,.2,.7]}]

Implementation

BeginPackage["Cam`"]

SubCamPlot[r0_, y_, theta_, phi_] :=
	Block[{u, v, yp, cosphi = Cos[phi], sinphi = Sin[phi]},
		yp = D[y, theta] ;
		u = (r0 + y) Sin[theta] + yp Cos[theta] ;
		v = (r0 + y) Cos[theta] + yp Sin[theta] ;
		ParametricPlot[{u cosphi + v sinphi,
						v cosphi - u sinphi},
					   {theta, 0, 2Pi},
					   PlotStyle->Thickness[.02],
					   AspectRatio->Automatic,
					   PlotRange -> { {-4,4}, {-4,4} }
					  ]
		 ]

CamPlot[r0_, y_, theta_] := SubCamPlot[r0,y,theta,0]

SpinCam[r0_, y_, theta_, Nsteps_] :=
	Do[ SubCamPlot[r0,y,theta,2Pi i/Nsteps], {i,Nsteps}]

EndPackage[ ]