The Synthesis of Function Generating Mechanisms for Periodic Curves Using Large Numbers of Double-Crank Linkages

This paper presents a methodology for synthesizing planar linkages to approximate any prescribed periodic function. The mechanisms selected for this task are the slider-crank and the geared ﬁve-bar with connecting rod and sliding output (GFBS), where any number of double-crank (or drag-link) four-bars are used as drivers. A slider-crank mechanism, when comparing the input crank rotation to the output slider displacement, produces a sinusoid-like function. Instead of directly driving the input crank, a drag-link four-bar may be added to drive the crank from its output via a rigid connection between the two. Driving the input of the added four-bar results in a function that modiﬁes the sinusoid-like curve. This process can be continued through the addition of more drag-link mechanisms to the device, progressively altering the curve toward any periodic function with a single maximum. For periodic functions with multiple maxima, a GFBS is used as the terminal linkage added to the chain of drag-link mechanisms. The synthesis process starts by analyzing one period of the function to design either the terminal slider-crank or terminal GFBS. MATLAB ’s fmincon command is then utilized as the four-bars are added to reduce the structural error between the desired function and the input–output function of the mechanism. Mechanisms have been synthesized in this fashion to include a large number of links that are capable of closely producing functions with a variety of intriguing features. [DOI: 10.1115/1.4035985]


Introduction
Erdman et al. [1] defined the function generation as the correlation of an input motion with an output motion of a mechanism. An input-output function is plotted with the input angle along the horizontal axis and the output motion along the vertical axis. The fundamentals of function generation, particularly its use in designing slider-crank and four-bar linkages, are presented in most machine theory texts [2][3][4]. A slider-crank is not capable of errorfree generation of an arbitrary function as it is able to achieve, at most, five precision points. In practice, precision points are chosen along the desired function to produce a list of N discrete input versus output values. As solutions to the five precision point problem typically divide between circuits or lack a fully rotating input, Almandeel et al. [5] introduced a defect-free approach to achieve four precision points. For more than five arbitrary points, structural error is a certainty [6]. Structural error is defined as the difference between the desired function f(x) and the function g(x) generated by the mechanism [7,8]. Freudenstein developed a classic technique for locating more than five precision points while minimizing structural error in four-bar mechanisms [8].
More than five precision points are achievable with no structural error through the introduction of mechanical adjustments and, hence, additional design parameters in the mechanism. Naik and Amarnath [9] synthesized adjustable four-bar function generators utilizing five-bar loop closure equations. McGovern and Sandor [10] synthesized adjustable linkages for function generation by modifying the fixed pivot locations. Soong and Chang [11] presented a methodology to synthesize four-bar function generation mechanisms to achieve any number of precision points utilizing variable length driving links. Another approach to achieve more than five precision points is to use a mechanism with more links, providing additional design parameters. Subbian and Flugrad [12] used a continuation method to synthesize eightbars to produce six precision points. McLarnan [13] used an iterative solution technique to design Watt and Stephenson six-bar linkages to achieve eight precision points. Dhingra et al. [14] employed continuation with m-homogenization to reduce the number of tracked solutions to design the same. Dhingra and Mani [15] applied symbolic computing to synthesize Watt and Stephenson mechanisms, deriving closed-form solutions and handling as many as 11 finitely separated precision points. Links may also be added to a mechanism via the introduction of a drag-link four-bar. A drag-link is the special case of four-bar mechanisms with the ground link being the shortest and the other links dimensioned such that both the input and output links fully rotate. A variety of uses including altering the outputs of cam-follower, quick-return, and dwell mechanisms is presented by Al-Dwairi and the references therein [16].
A third approach to introduce design parameters is through the use of gears within the mechanism. Geared five-bar mechanisms (GFBMs) were investigated for their use in function generation by Oleksa and Tesar [17] and Erdman and Sandor [18]. Subbian and Flugrad [12] synthesized geared five-bars to produce seven precision points. Sultan and Kalim [19] synthesized geared five-bar slider-crank mechanisms in which the gears are mounted on the moving pivots. For the kinematic properties of GFBMs with arbitrary gear ratios, see Freudenstein and Primrose [20,21].
Mechanisms that follow a desired path have been a longstanding objective of machine design. The theory of mechanisms for the generation of arbitrary plane curves was presented by Artobolevskii [22], where he addressed the generation of mechanisms for tracing algebraic curves and transcendental curves. The synthesis of mechanisms was studied for algebraic curves up to fourth degree. The method applied was called geometro-algebraic because of the combination of geometric construction and the analytical theory of curves. The book also included the history of the development of the theory of mechanisms for the generation of curves. Liu and McCarthy have used Fourier expansion to create mechanisms to trace general curves [23]. Mechanisms including up to 32 elements comprised of links, cams, gears, and cables were synthesized for a Fourier expansion of a heart shape and Batman logo.
Motivated by producing general curves with linkages, the authors set out to decompose closed curves into single-axis components and synthesize function generating linkages that approximate any periodic function. Links have an advantage over cams due to their lower manufacturing cost, higher wear resistance, and better high-speed capability. The nonlinear design challenge associated with function generating mechanisms makes them an ideal application for optimization algorithms. Several methods can already be seen in the citations above. In addition, Southerland and Roth [24] utilized an improved least-squares method, Chen and Chan [25] applied Marquardt's compromise technique, Sarganachari et al. [26] a variable topology approach, Shariati and Norouzi [27] used a gradient-based Sequential Quadratic Programming method, and Akcali and Dittrich used Galerkin's method [28].
This paper presents a technique for reducing the structural error in function generating mechanisms via the addition of large numbers of four-bars. The two terminal mechanisms in the chains under consideration are the slider-crank and the geared five-bar with connecting rod and sliding output (GFBS). A specific application may place practical limits on the number of four-bars that can be used. The technique presented allows for the designer to assess the benefit of each additional four-bar. While achievable for each example presented, techniques for the detailed mechanical design of the links, including interference, are not addressed here. The remainder of the paper is organized as follows. Section 2 details the design of fully rotatable slider-crank mechanisms to provide an initial mechanism that approximates any single maximum periodic function. Section 3 presents the design of the GFBS to match the number of maxima in any desired periodic function. Section 4 reviews drag-link mechanisms. The methodology for adding drag-links to either terminal mechanism or optimizing dimensions is presented in Sec. 5. Section 6 includes a variety of example synthesis problems and Sec. 7 concludes the paper.

The Terminal Slider-Crank Mechanism
Given any prescribed periodic function of crank angle h versus the desired slider position S d ¼ f ðhÞ with a single maximum, a slider-crank can be designed to provide an initial approximation to the desired function. The vector loop of the slider-crank shown in Fig. 1 is where a s and b s are link lengths, and c s is the distance between the fixed crank pivot and the horizontal axis of sliding, which can be positively valued (downward, as shown) or negative (upward). Additionally, S is the slider position (positive to the right) and is measured from an arbitrary location given by S 0 . Note that the value of S 0 can be manipulated to shift the output displacement values of the mechanism vertically on a plot of S as a function of h. The angles h and w s are joint variables, and d s is an offset angle that shifts the plot of the input-output function left or right. Given a set of physical parameters for a slider-crank, x s ¼ fa s ; b s ; c s ; d s ; S 0 g; and h, the loop closure in Eq. (1) produces the generated slider position as where D s ¼ Àa s cosðh À d s Þ and F s ¼ D 2 s þ ½c s þ a s sin ðh À d s Þ 2 À b 2 s . A generated input-output curve may be created by using Eq. (2) and displaying the value of S as a function of h.
Note from Eq. (2) that solutions for S occur as two real values or a complex pair. A complex solution is associated with a linkage that is unable to be positioned at the designated h. The link actuated with a s is fully rotatable [3] if the dimensions conform to With linkage dimensions given by Eq. (3), S in Eq. (2) always produces two real values. This work only examines the larger value of S, as similar results could be expected when optimizing on the smaller value. Accordingly, driving h over the range of 2p produces one period of a repeating curve with a single maximum per period.
The general function generation of a slider-crank is to determine linkage parameters x s that minimize the structural error jf ðhÞ À gðh; x s Þj subject to rotatability constraints h s < 0. However, the approach taken as a first step in this work determines x s to achieve ðh; SÞ at the minimum and maximum of the desired periodic function. Subsequent optimization processes are used to determine the suitable dimensions for driving double-crank linkages that will minimize structural error.
For the initial design, S 0 is assumed to be zero. Therefore, given a desired function with a period of 2p and a single maximum, ( h; S) denotes the location of the period's maximum. Likewise, (h; S) corresponds to the period's minimum. Should the desired function have a horizontal line segment as a maximum or minimum, the midpoint may be used for either of the values. Given a slider-crank with a fully rotating input, S is achieved when h À d s ¼ w s and S when w s ¼ h À d s þ p. Substituting these conditions into Eq. (1) where Given that the value of B 2 s À 4A s C s ! 0 in Eq. (5), d s has two potential values. Both are checked and the one resulting in the mechanism that matches h; S; h, and S is selected. The value B 2 s À 4A s C s can be negative when the difference between h and h is small (relative to the corresponding difference between S and S). If B 2 s À 4A s C s < 0, Eqs. (5) and (7) produce complex values. The minimum allowable difference Dh between h and h that produces real mechanism parameters occurs when B 2 s À 4A s C s ¼ 0 and is After determining Dh; h and h are adjusted equally such that j h À hj ¼ Dh. Equation (8) produces two potential values for Dh.
The value closest to h À h is selected, as the other value will be substantially different. Another consideration is that the values of a s and b s determined by Eq. (7) may be negative. The mechanism is still physically realizable noting that the line segment between the joints is 180 deg different from the joint values in the equation.
The values determined for c s , a s , and b s will always define a fully rotating input link due to the constraints enforced in the development of Eq. (4).

The Terminal Geared Five-Bar With Connecting Rod and Sliding Output
Multiple maxima per period cannot be achieved with a slidercrank. A GFBS is shown in Fig. 2 and can create a single period of a crank angle h versus slider position S plot with any number of maxima due to the gears being able to have any rational number ratio.
The two vector loops needed to analyze the GFBS are and where a g , b g , c g , d g , and f g are positively valued link lengths and t g , the distance between the fixed crank pivot and the horizontal axis of sliding, can be positively valued (upward, as shown) or negative (downward). Additionally, S is the slider position (positive to the right) and is measured from an arbitrary location given by S 0 . Note that the value of S 0 can be manipulated to shift the output displacement values of the mechanism vertically on a plot of S as a function of h g . The angles h, w g , / g , b g , and c g are joint variables, and d g is an offset angle that shifts the plot of the input-output function left or right. The motion of links a g and d g conform to an additional relationship due to the geared relationship where b g0 is an initial angular offset of link d g and k is the gear ratio, which can be any positive or negative rational number. Given a set of physical parameters for a GFBS, and h, the unknown joint variables are the angles w g , / g , b g , c g , and the slider displacement S. The value of angle w g is where and G g ¼ 2b g ða g cos ðh À d g Þ À d g cos b g À f g Þ Only the "þ" term in the numerator of Eq. (13) is used as similar results could be expected when optimizing on the other value. With w g from Eq. (13), Eq. (11) includes the two unknowns c g and the quantity S þ S 0 . Solving for the generated slider position as where D g ¼ a g cos ðh À d g Þ þ b g cos w g À f g and C g ¼ D 2 g þða g sin ðh À d g Þ þ b g sin w g À t g Þ 2 À h 2 g . Likewise, an expression for c g could be generated, but is unused in the analysis.
To ensure full rotation of link a g , a sufficiency condition presented by Ting [29] is used. The link lengths a g , b g , c g , d g , and f g Fig. 2 The vector loop of the geared five-bar mechanism with a connecting rod and a sliding output are arranged in an ascending order. The ordered link lengths are then labeled L 1 , L 2 , L 3 , L 4 , and L 5 . The shortest two links, a g and d g by design in this case, make a complete revolution if If the first condition of Eq. (17) is not true, the chance of a fully rotating link is dependent on k and b g0 and is not considered. The second condition ensures that Eq. (16) produces real values of S. The input-output curve may be obtained from Eq. (16) and displaying the value of S as a function of h g . With an input link that fully rotates, S in Eq. (16) has two real values with the larger one corresponding to the slider being to the right (as shown in Fig. 2) and is used in this work.
The gear ratio k dictates p, the number of maxima generated per period, and the number of rotations needed by gear 1 to create a single period. The gear ratio of the GFBS is k ¼ N 1 =N 2 where N 1 and N 2 are the numbers of teeth on gears 1 and 2, respectively. The ratio can be either negative via a direct meshing of the gears or positive via the use of an idler. The number of maxima is predicted by reducing the fraction N 1 =N 2 by eliminating common factors. For example, 32/14 reduces to 16/7 and this is denoted as N 1 =Ñ 2 . The input gear must be rotated 2pÑ 2 radians to create one period of the output. Typically, the resulting period will have maxfÑ 1 ;Ñ 2 g as the number of maxima. If a single period of the desired curve has p ¼ 4 maxima, the values ofÑ 1 :Ñ 2 considered include 4 : 1; 4 : 3; 3 : 4; 1 : 4 and all of their negatives. Note that 4 : 2 and 2 : 4 are not included because these reduce to 2 : 1 and 1 : 2, respectively. Finally, in the case of 4 : 3 (or À4 : 3), gear 1 needs to be driven 6p radians to produce a single period. Due to the nonlinearities in the GFBS, the predicted number of maxima is not always produced in a single period. One reason is that inflection points can appear, lowering the number of maxima. Additionally, certain combinations of design variables can add either extra inflection points or extra maxima to the counts generated above. Despite these special circumstances, the gear ratio constraints for the synthesis process is posed as The generated number of maxima is verified when postprocessing the optimization results.

The Additional Double-Crank Mechanisms
The addition of a double-crank mechanism (also known as a drag-link) as the input to either the terminal slider-crank or the terminal GFBS will change the shape of the input-output function, but not alter the number of maxima or their values. The shape of the input-output function will continue to be altered as more drag-link mechanisms are added in a series. The vector loop of the ith drag-link mechanism is shown in Fig. 3.
where a i , h i , q i , and b i are positively valued link lengths. Additionally, h, w i , and / i are joint variables, and d i is an offset angle that shifts the actual input-output function left or right. For the draglinks, only the ratio of the link lengths affects the input-output relationship.
To eliminate scaling issues within the optimization, a fixed link length of q i ¼ 1 is set. Given a set of physical parameters for the ith drag-link, y i ¼ fa i ; b i ; h i ; d i g; and the input angle h, the generated output angle is where Either the "þ" or "À" in Eq. (20) must be used over the entire rotation of h i to address a single assembly. As only drag-links are desired, linkage dimensions are constrained to [30] h i ðy i Þ ¼

Synthesis Methodology
The methodology for reducing structural error in function generating mechanisms via the addition of large numbers of four-bar mechanisms is now detailed.
(1) In the case of the desired periodic function having a single maximum per period (p ¼ 1), a slider-crank may be used as the terminal mechanism because of its simplicity, as shown in Fig. 4. If a period includes two or more maxima (p > 1), a GFBS is used, noting that it can also be implemented when p ¼ 1. The function generating mechanism that terminates with a GFBS is shown in Fig. 5.
(a) For the slider-crank, the terminal mechanism is synthesized to achieve the desired minimum and maximum via Eqs. (5)-(7). (b) For the GFBS, the terminal mechanism is synthesized by determining linkage parameters x g that minimize the structural error. In this work, structural error e is defined as the sum of the differences between the desired function f ðhÞ and the generated function gðh; x g Þ. That is, for M point-to-point comparisons of the desired and generated functions The synthesis is performed by minimizing e, subject to the assembly and rotatability constraints h g1 < 0. Since only a small number ofÑ 1 andÑ 2 satisfy h g2 ¼ 0, every possible gear ratio combination is successively selected prior to the optimization. Arbitrarily selecting link Transactions of the ASME lengths is sufficient as they merely serve as initial values for the optimization. Each optimization is performed using MATLAB's fmincon command, as discussed at the end of this section. (2) With a terminal mechanism synthesized, a dyad is added between the ground and input link of the terminal linkage. The dyad is sized such that it operates as a drag-link mechanism. While the output, S remains the same, the input h to the serial mechanism is transferred to the drag-link and / 1 becomes the input to the slider-crank or GFBS terminal mechanism. With i ¼ 1, Eqs. (20) and (21) are used to generate / 1 given the rotation of h. For a slider-crank terminal mechanism, the values of / 1 are then used as the h input in Eq. (2). For the GFBS terminal mechanism, the values of / 1 replace h input in Eq. (16). Arbitrary link lengths that are consistent with Eq. (22) serve as initial values for the optimization. (3) MATLAB's fmincon command is utilized to determine all physical parameters in the drag-link driven mechanism y 1 and make adjustments to the terminal mechanism, x s for the slider-crank or x g for the GFSB. For the slider-crank terminal linkage, the optimization problem is to minimize e ¼ P M j¼0 jf ðh j Þ À gðh j ; x g ; y 1 Þj, subject to h s < 0 and h 11 < 0. Using the GFBS terminal linkage, the optimization problem is to minimize e ¼ P M j¼0 jf ðh j Þ À gðh j ; x g ; y 1 Þj, subject to h g1 < 0 and h 1 < 0, after selecting values ofÑ 1 andÑ 2 consistent with h g2 ¼ 0. In seeking linkage dimensions that produce the lowest structural error, multiple optimizations are conducted, each with different arbitrarily selected sets of initial link lengths. From this multiple starting point optimization, the linkage with the lowest structural error is chosen. (4) If the structural error in the previous step is unsatisfactory, a second drag-link mechanism is added. The serial mechanism input h is transferred to the second drag link, providing an output / 2 , which serves as an input to the first drag link through the offset d 1 . As with the first drag link, the initial link lengths y 2 are arbitrarily selected to be consistent with Eq. (22). MATLAB's fmincon command is used to adjust all physical parameters in the drag-link driven mechanism, including those in the previous step. For example, a slider-crank terminal linkage has the synthesis task of minimizing e ¼ P M j¼0 jf ðh j Þ À gðh j ; x g ; y 1 ; y 2 Þj, subject to h s < 0; h 1 < 0, and h 2 < 0. (5) Drag-links may continue to be added until a threshold on structural error is met or until the structural error ceases to decrease. Fig. 4 The chain of drag-link mechanisms added to a terminal slider-crank mechanism Fig. 5 The chain of drag-link mechanisms added to a GFBS Fig. 6 The desired function, the slider-crank output, and the curve generated using the proposed method resulting in the addition of nine drag-link mechanisms To ideally select the design variables for all of the mechanisms in this work, an optimization is performed using MATLAB's fmincon command. This command minimizes a user-defined multivariable function subject to constraints. The design variables are all of the physical parameters of the mechanism and the objective function is the resulting structural error. In this work, the structural error is assessed at M ¼ 500 equally spaced points in the period. Constraints are implemented as identified in each case above. Bounds are also specified on the relative lengths of the design variables (longest link <10Â shortest link). The output of the optimization command will include all design variables needed to generate either a single maximum or multiple maxima periodic function.

Synthesis Examples
Several examples are now presented. The examples are chosen to display the effectiveness and potential challenges of the synthesis method presented.  Table 1 The link dimensions of the slider-crank and nine draglink mechanisms that best matches the desired function shown in Fig. 6 Slider-Crank mechanism    Table 3 The link dimensions of the seven added drag-link mechanisms producing the best fit shown in Fig. 8 Drag-Link mechanisms and S d ¼ 0:0333h 2 À 9:0000 for 300 deg < h 360 deg. The "slider-crank only" curve shows the match of the initial approximation of the terminal slider-crank using Eqs. (5)- (7). The associated structural error was 102.0421, from Eq. (23) for M ¼ 500 equally spaced points over the range of motion of the input link needed to create one period from the output. The structural error was progressively decreased through the addition of nine draglink mechanisms. The structural error associated with the nine mechanisms was 0.1041. A design model of the full mechanism is shown in Fig. 7. An ad hoc approach to layering the links was used judiciously to avoid interference. Table 1 shows the lengths of all the links in the system, including the dimensions of all nine four-bars and the slider-crank mechanism where S 0 ¼ 0.0020.

A Function
With a Single Maximum per Period-GFBS Terminal Chain. The same desired function as in the previous example was attempted with a GFBS and a chain of draglink four-bars. Due to the single maximum, the two gear ratios considered were 1 : 1 and À1 : 1. The ratio À1 : 1 was selected due to the better initial match found between the GFBS and the desired function. An initial mechanism, in this case the "nonoptimized GFBS" is included in Fig. 8. An initial mechanism is included in many of the examples to indicate the improvement attributed to the methodology. Optimizing the GFBS alone resulted in a structural error of 1.2498 and obtained a shape quite close to the desired function. Note that the methodology continued to adjust the link lengths of the GFBS, producing an additional maxima that improved the structural error.  Recall that the single slider-crank had a structural error of 102.0421 as compared to the optimized GFBS of 1.2498. The structural error of the slider-crank alone should not be compared to the GFBS because it has fewer independent design parameters. The slider-crank has five independent variables (a s , b s , c s , d s , and S 0 ), while the GFBS has 11 independent variables (a g , b g , c g , d g , f g , h g , t g , b g0 , d g , k, and S 0 ). A comparison was done between the GFBS alone and a slider-crank with one drag link attached. The number of the independent variables for the slider-crank with one drag link is nine and produced a structural error of 0.8817, less than the structural error using the GFBS alone. The addition of drag-links continued to improve the error gradually. A chain of seven drag links were added to the terminal GFBS producing a structural error of 0.1125. Note that the structural error using the slider-crank as the terminal chain driven by nine drag links in the previous example was 0.1041, less than the structural error using the GFBS and seven drag links. After many observations, the authors were unable to detect tendencies. When comparing design parameters, neither the slider crank nor the GFBS consistently outperformed the other. Table 2 shows the values of all the physical parameters in the three GFBS mechanisms and Table 3 shows the dimensions of the seven drag links for the mechanism with the lowest structural error.
6.3 Four Maxima Periodic Function. The curve with four maxima shown in Fig. 9 is the desired periodic function for this example. The function defining the curve is S d ¼ sinðh 2 Þ þ sinð2h 2 Þ þ sinð4h 2 Þ for 0 deg h 2 360 deg. The eight choices under consideration for the gear ratio were 61 : 4; 63 : 4; 64 : 1, and 64 : 3. The ratio of À4 : 1 was found to produce the best initial guess. Because of this choice of ratio ð N 1 ¼ 4; N 2 ¼ 1Þ, a single period was produced by 2p N 2 ¼ 1 rotation of the input of the mechanism. Note that the optimized GFBS includes five maxima. As the GFBS parameters are included in the general optimization methodology, one of the maxima is eliminated. The structural error after optimizing the GFBS alone was 92.7699. After the addition of nine drag-links, the structural error was reduced to 7.4919. Since the structural error in this example was not small enough as in the previous examples, where the best structural error was found to be less than one, a À5:1 gear ratio was attempted in order to produce a lower structural error. The structural error obtained was reduced to 3.0724. However, another maxima was added as shown in Fig. 10.

Other Examples.
A variety of additional examples are presented to show the utility of the method. A piecewise-linear function was addressed using the slider-crank and the result can be seen in Fig. 11(a). The same function was also obtained with a GFBS and is shown in Fig. 11(b). The input-output function produced by a GFBS and nine drag-links that combines linear sections with continuous but nondifferentiable curves is depicted in Fig. 11(c). Finally, a function with ten maxima was addressed in Fig. 11(d).

Conclusions
Function generating mechanisms were synthesized with the goal of reducing structural error versus a desired output. This paper addressed the challenge of minimizing the structural error with respect to any desired periodic function. The synthesized mechanisms were allowed to include any number of links. Two basic architectures were considered. The first architecture included any number of drag-link four-bar mechanisms driving each other in succession terminating with a slider-crank mechanism. The second architecture included any number of drag-links driving a GFBS. The slider-crank as a terminal linkage was only used to address functions with a single maximum in the period, whereas the GFBS can be used to create one or more maxima. As expected, an increase in the number of links yielded an improvement in matching the periodic function and reducing structural error. Conditions were implemented throughout to ensure fully rotating inputs, producing double-crank mechanisms. This guaranteed the periodic output of the architectures. Finally, a variety of examples were included to demonstrate the methodology presented, including functions composed of piecewise linear segments.