Gcon

Model ElementThe GCON element is used to specify a user defined general constraint. Your constraint equations may involve position as well as velocity measures of the system. Although MotionSolve provides a large set of constraints to choose from (see JOINT), there are situations that require non-standard constraints.

Class Name

Gcon

Description

For example, the constraint that a wheel rolls without slipping is a non-holonomic constraint that can be modeled using the GCON element.

Attribute Summary

Name Property Modifiable by command? Designable?
id Int ()   NO
label Str () Yes
function Function ("GCOSUB") Yes
routine Routine ()  
active Bool () Yes

Usage

Gcon (function=userString, optional_attributes)

Attributes

function
String
An expression (that will be set to zero) defining the general constraint.
OR
The list of parameters that are passed from the data file to the user-defined subroutine, GCOSUB.
The function attribute is mandatory
i
Reference to an existing Marker object.
Specifies the marker that extracts the reaction force from the general constraint.
The i attribute is optional. When it is not specified, you cannot obtain any reaction forces from the GCON.
id
Integer
Specifies the element identification number. This number must be unique among all the GCON objects in the model.
This attribute is optional. MotionSolve will automatically create an ID when one is not specified.
Range of values: id > 0
label
String
Specifies the name of the GCON object.
This attribute is optional. When not specified, MotionSolve will create a label for you.
routine
String or a pointer to a Python function.
Specifies an alternative name for the user subroutine.
The attribute routine is optional.
When function is specified, but routine is not, routine defaults to GCOSUB.
active
Bool
Select one from True or False.
  • True indicates that the element is active in the model and it affects the behavior of the system
  • False indicates that the element is inactive in the model and it does not affect the behavior of the system. It is almost as if the entity was removed from the model, of course with the exception that can be turned "ON" when desirable.
The attribute active is optional. When not specified, active defaults to True.

Example

Three GCONs that together are equivalent to a spherical joint.
# Get the ids of the I and J markers
iid  = imrkr.id
jid  = jmrkr.id

# Create the expression strings
strx = "dx({i},{j})".format(i=iid, j=jid)
stry = "dy({i},{j})".format(i=iid, j=jid)
strz = "dz({i},{j})".format(i=iid, j=jid)

# Define the 3 GCONS: DX(I,J)=0, DY(I,J)=0, DZ(I,J)=0
gx   = Gcon (function=strx, i=imrkr, label="X-Constraint")
gy   = Gcon (function stry, i-imrkr, label="Y-Constraint")
gz   = Gcon (function=strz, i=imrkr, label="Z-Constraint")

Comments

  1. See Properties for an explanation about what properties are, why they are used, and how you can extend these.
  2. For a more detailed explanation about Gcon, see Constraint: General.