Wolfram Language

Symbolic & Numeric Calculus

Optimize the Shape of a Cam

Design the shape of a convex cam to maximize the area of the valve opening for one rotation of the cam, with constraints on the radii of the cam.

Assume that the shape of the cam is circular over an angle of of its circumference with radius and is shaped symmetrically over the remaining .

The design variables , , , , , represent the radius of the cam at equally spaced angles distributed over an angle of , the top half of the non-circular part of the cam.

In[1]:=
Click for copyable input
n = 100; vars = Array[r, n];

Each radius is constrained to lie in the interval .

In[2]:=
Click for copyable input
rmin = 1; rmax = 2; varbounds = Table[rmin <= r[i] <= rmax, {i, 1, n}];

Enter the angle defined above.

In[3]:=
Click for copyable input
\[Theta] = 2 Pi/(5 (n + 1));

Convexity constraints are expressed by the system of inequalities .

In[4]:=
Click for copyable input
convexconstri = (1/2) r[i - 1] r[i + 1] Sin[2 \[Theta]] <= (1/2) r[i - 1] r[i] Sin[\[Theta]] + (1/2) r[i] r[ i + 1] Sin[\[Theta]];

Using that , the system can be re-expressed as follows. Notice that is the radius of a point on the circular part of the cam and hence equal to .

In[5]:=
Click for copyable input
convexconstr = Table[2 r[i - 1] r[i + 1] Cos[\[Theta]] <= r[i] (r[i - 1] + r[i + 1]), {i, 0, n}] /. {r[-1] -> rmin, r[0] -> rmin, r[n + 1] -> rmax};

A constraint on the rate of change of the radius is expressed in terms of the parameter as .

In[6]:=
Click for copyable input
\[Alpha] = 1.5; rchangeconstr = Table[-\[Alpha] <= (r[i + 1] - r[i])/\[Theta] <= \[Alpha], {i, 0, n}] /. {r[0] -> rmin, r[n + 1] -> rmax};

The objective function (valve opening area), is assumed to have a simple linear relationship with the design variables given as , where is a constant related to the geometry of the valve.

In[7]:=
Click for copyable input
rv = 1; objfun = Pi rv^2 (1/n) Sum[r[i], {i, 1, n}];

Choose initial points for the variables.

In[8]:=
Click for copyable input
initpts = Table[.5 (rmin + rmax), {i, 1, n}];

Solve the maximization problem.

In[9]:=
Click for copyable input
sol = FindMaximum[ Join[{objfun}, varbounds, convexconstr, rchangeconstr], Thread[vars, initpts]];

Note that several of the largest radii are at the maximum .

In[10]:=
Click for copyable input
Table[r[i], {i, 95, 100}] /. sol[[2]]
Out[10]=

Plot the solution.

show complete Wolfram Language input
In[11]:=
Click for copyable input
solpts1 = Table[{r[i] Cos[-2. Pi/5 + \[Theta] i], r[i] Sin[-2. Pi/5. + \[Theta] i]}, {i, -1, n + 2}] /. {r[-1] -> rmin, r[0] -> rmin, r[n + 1] -> rmax, r[n + 2] -> r[n]} /. sol[[2]]; solpts2 = Map[{#[[1]], -#[[2]]} &, Reverse@solpts1]; solpts = Join[solpts1, solpts2]; Show[ListLinePlot[solpts, PlotRange -> {{-2.1, 2.1}, {-2.1, 2.1}}, PlotLabel -> "Cam Shape", AspectRatio -> 1, Axes -> False, Frame -> True], Graphics[{Circle[{0., 0.}, 1.]}], ImageSize -> Medium]
Out[11]=

Related Examples

de es fr ja ko pt-br ru zh