General Constraints

Use the General Constraints tool to create a generic expression-based constraint.

MotionView provides several standard constraints such as Joints and Motions, however they may not be suitable to represent all possible modeling scenarios. A GeneralConstraint may be defined using solver expressions in such scenarios. During solution, the solver would impose constraint such that the given expression is equated to zero.

Create General Constraints using the General Constraints Tool

The following are the standard initial steps to create a General Constraint.

  1. From the Model Browser, select the system to which the general constraint entity is to be added.
  2. From the Model ribbon, click on the Entities group down arrow to expand a drop-down menu that contains more entities.
  3. Click on the General Constraints option to invoke the Add General Constraint dialog.
  4. Specify a label and variable name.
    By default, variables names of entities in MotionView follow a certain convention. For example, all general constraint entities have a variable name starting with “gcon_”. This is the recommended convention to follow when building models in MotionView since it has many advantages in model editing and model manipulation.
  5. Click OK to close the window or Apply to continue creating entities.
    Once a general constraint is created, it is displayed in the Entity Editor.

Edit General Constraints

General Constraint references can be edited using Entity Editor.

  1. Select the General Constraint to be edited. Its properties will appear in the Entity Editor.
  2. In the Properties tab, enter a solver expression in the Expression field.
    The expression may involve position, velocity, or any other general measure of the system.
  3. Alternatively, activate the User-defined check box to provide the constraint through a sub-routine.
    1. Provide an expression with the USER solver function in User expr with parameters being passed to the user subroutine.
    2. Alternatively, activate the Use local file and function name check box to specify a local file where the subroutine code can be accessed by the solver.
      If this option is not specified, MotionSolve will search for a subroutine following its user subroutine loading rules.
    3. Select the Local file for the subroutine.
    4. Select a Function Type from the drop-down menu.
      The type of file to be specified will depend on the selected function type. For example, if DLL is selected, you can specify a file with a .dll extension (for Windows) or an .so extension (for Linux).
    5. Specify the Function name in the subroutine that defines the entity.
General Constraint Properties:
Property Description
Label Descriptive label for the entity.
Varname Variable name of the entity.
ID Integer identifier.
Active Active state of the entity. True or False. Entity is deactivated if False.
Use Virtual Make this a virtual constraint. See the comment* below.
Expression Solver expression that sets the constraint.
User Defined
User expr USER() expression used to call the subroutine.
Use local file and function name Option to use a local subroutine file along with the function.
Local file Name of the subroutine file depending on the Function Type.
Function Type Type of subroutine function. Available choices are DLL/SO, PYTHON, MATLAB, COMPOSE.
Function name Name of function to be called within the subroutine.
Use Reaction marker Use a marker to impose reaction force (ADAMS only).
Reaction marker Marker where the reaction is imposed.
Note & Tags
Note Optional descriptive note.
Attachment Candidates Add tags for the entity to use as possible attachments to Systems/Assemblies/Analyses.

*Defines whether the constraint is virtual or regular. If Use Virtual is selected, the constraint is implemented as a virtual constraint. Otherwise, the constraint is implemented as a regular algebraic constraint. See Comment 17 in Constraint: Joint for more information about virtual joints.