Previous section-----Next section

12.5 Locking Variables

The LockMech function is a special function provided by MechanicalSystems that allows the values of constant dependent variables in a model to be retained to accelerate the evaluation of large models.

A special function for locking dependent variables.

LockMech replaces the dependent variables in the constraint equations with constant values so that they cannot be changed until the constraints are rebuilt. This function is useful when the model must be solved many times with different applied loads or different inertia properties, all at the same physical configuration. After LockMech has been run, the dependent variables (X2, Y2, ...) in a model are replaced by numeric values so that they no longer need to be replaced at runtime, essentially eliminating the time required to replace them.
To demonstrate the use of LockMech, the 3D slider-crank model that was used in Section 12.1 is redefined with applied forces.

Here is an entire slider-crank model built in one step.

And here are the locations of each body at T = 0.1.

We can now add an applied force to the model and solve for the static reaction forces at several values of a parameter that affects the direction of the applied force. A valid location solution pos is passed into SolveMech with the CheckRules -> False option so that regeneration of the location solution does not occur.

This applies force to the origin of the slider with constant magnitude and variable direction.

Now the model is solved for the static reaction forces at 11 different values of k.

LockMech is run to embed the location coordinates of the model into all of the equations of motion, including the load vector.

The model is solved again for the static reaction forces at 11 different values of k. It is not necessary to use the CheckRules option now because the constraint equations are constant.


Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information