Previous section-----Next section

Constraint
2D/3D

Constraint[cnum, equation, {bnum, ... }, {{extravar, guess}, ... } returns a SysCon data object that is used to add a user-defined constraint equation to a Mech model. The equation can be a single equation or a list of equations, each of which must have the head Equal. After creation, the SysCon object is passed to SetConstraints to alter the state of the current Mech model.
• The bnumi are an optional list of the body numbers of those bodies that are constrained by the equation.
{extravar, guess} (or {{extravar, guess}, ... } ) is an optional list of symbols that appear in the model (and their associated initial guesses), that are added to the model's dependent variable list and solved for.

• This function is used to enter constraints directly as equations when the desired relation is not attainable with the standard Mech mechanical constraints.
• The list of body numbers, {bnum, ... } can be omitted if the same bodies are also constrained by other system constraints.
• An {extravar, guess} pair associated with a particular extravar may appear in only one constraint in a model. The same extravar in more than one constraint will generate an error in SetConstraints.
• See also:
Body, GenConstraint, Load.

Further Examples

Load the Modeler2D package and define a simple model.

The help model was defined with OriginLock1 and RotationLock1 constraints for the crank body, which resulted in the following constraint expressions.

Exactly the same state can be achieved by defining the constraint expressions explicitly.

Because the constraint was defined so that body bdcrank would be added to the model, it is possible to use functions like Location or MassMatrix that require a body number.

However, if the constraint was defined without adding a body to the model, instead treating X2, Y2, and CapitalTheta2 as completely independent variables, then all of the features and functions associated with having a body are not available.

See HelpModel2D.