This is a follow-up to my previous post “Using sketch-based laws in CATIA Kinematics.”
Just to refresh your memory what this is all about…
CATIA Law features can be used to link all commands in the mechanism to a single parameter – time. This enables the mechanism’s motion to be simulated by manipulating the time parameter alone, so multiple commands are varied simultaneously and, in a user-defined way. Also, this enables calculation of time-dependent quantities in the mechanism, such as velocities and accelerations.
There are two types of Laws in CATIA – sketched-based and equation-based. The sketch-based laws (explained in my above-mentioned post) require definition of the motion profile as a sketch, which works well in many cases. But – sketch-based laws have their limitations.
Consider this task: How do I simulate motion of a pendulum? From physics, we know that motion of the pendulum follows the sine-wave law, but – there’s no tool in the Sketcher workbench to draw a sine-wave!
In this post, I’ll explain how to use equation-based laws to work around such limitations.
The sample model is shown below. The model consists of the axis part and the pendulum part. The axis part is fixed, and the pendulum is linked with the axis with a Revolute joint, Angle-commanded. The goal is to simulate motion of the pendulum according to the sine-wave law, with 30-degree swing amplitude.
First, we need to write down the motion equation. The swing angle during the pendulum’s motion is described by the following equation:
Where A is the swing amplitude, t is time, ω is cyclical frequency in radians per second, f is frequency in cycles per second (Hertz), and φ is phase in radians.
For instance, if pendulum completes one full swing forth and back in 1 second, then frequency f =1Hz. Assuming the maximum swing 30deg and the start of the motion at the leftmost swing position, the motion equation becomes:
Now we need to create the Law feature. Click the (Law) icon in the Knowledge toolbar to display the Law Editor dialog box. The right-hand side allows you to create formal parameters to be used in the law (“formal” in the sense that these are not actual parameters in a CATIA model, rather, they serve as the “input” and the “output” parameters in the law definition), the left-hand side is the law edition box.
Now we need to figure out the types of the formal parameters we need. In the Dictionary section, scroll down to the Law chapter and examine the function Evaluate – this is the function we will later use to link the angle command in the mechanism with the Law.
Note that the function requires input parameter of type Real and produces output value of type Real too. Therefore, using the New parameter of type button, create two parameters of type Real, and rename them as y and t.
Now, in the law edition section, type the following equation (the function sin can be found in chapter Math and the constant PI in chapter Constant in the Dictionary section):
y = 30*sin(2*PI*t*1rad – PI/2*1rad)
Note the use of units in the law code – this is quite important! If no units are specified, CATIA will interpret the values in international SI system of units. Click OK to complete the law definition.
Next, we need to link the command in the mechanism to the law. Double-click Command.1 in the tree, right-click in the Command value field, and select Edit formula in the contextual menu.
In the Formula Editor, type the following formula:
Close the Formula Editor. Note that the Command value is now controlled by the formula, and its start value is -30deg, which is the leftmost swing position of the pendulum. Click OK to close the Command Edition box.
We’re done! Now select the (Simulation with Laws) tool, select Maximum time bound and Number of steps, and run the simulation.
The use of laws in Kinematics is covered in the Rand 3D DMU Kinematics Class. www.Rand3D.com
About the Author
Follow on Linkedin Visit Website More Content by Iouri Apanovitch