Notation and Syntax

MotionSolve input format is based on the Extensible Markup Language (XML). The input format is called MotionSolve XML. This section describes the notation and syntax for MotionSolve XML. It also describes how MotionSolve XML files may be generated.

A MotionSolve XML file is divided into elements. Each element defines a specific MotionSolve modeling or command element. Elements are delimited in standard XML fashion:

<Element_Name
</Element_Name>
or abbreviated as:
<Element_Name
/>
or abbreviated within a line:
<Element_Name />

An ellipsis (...) indicates the omission of a section of a statement, typically to provide a shorter version of a more complex syntax. In case a modeling or command element has a nested element, the outer element cannot be written in an abbreviated form.

A MotionSolve XML element contains a set of attributes specific to the modeling or command element being defined. Elements, attributes, and their values are always shown in blue in the manual.

MotionSolve XML attributes are not case sensitive. The following are all equivalent to the solver:

SENSOR_EVENT, Sensor_Event, sensor_event
The convention that is typically followed in MotionSolve is:
  • Element names are in upper camel with an underscore separating the different words. For example:
    Sensor_Event, Body_Rigid, Param_Transient, Reference_Marker
  • Attribute names are in lower case. For example:
    stability, mass_unit, integrator_type, inertia_xy

An attribute may have one or more values associated with it. Generic values are typically shown in italics as demonstrated below:

<Sensor_Event
       ID = "integer"
       …  >
</Sensor_Event>
Occasionally, an attribute may have a list of values. The values are separated by one or more blank spaces. For example:
<Contact
       ...
       i_graphics_id = "123 456 789 321 654 987"
       ...

/>
White space between keywords is treated as a delimiter by the XML parser. For the sake of clarity, this manual always lists each keyword in a new line, however the following are equivalent:
  • <Reference_Variable
           id   = "1"
           type = "EXPRESSION"
           expr = "VX(301)"
    />
  • <Reference_Variable id="1" type="EXPRESSION" expr="VX(301)" />
White space between a keyword and its value are ignored by the XML file parser. The following are equivalent:
...          ...          ...
id = 1234    id=1234      id   =   1234
...          ...          ...

Square brackets ("[" and "]") indicate optional attributes. The "[" and "]" are not part of the element; they are there merely to express the fact that the attributes and its value are optional. For example, in the following statement, the attribute label is optional. This is shown syntactically as:

<Sensor_Event
       id  = "integer"
      [label = "This is a label"]
       ...
/>

When one member from a set of choices must be chosen, the alternatives are listed within braces ("{" and "}"), and the values are separated by “|”. In the example shown below, either EXPRESSION or USERSUB must be chosen:

<Sensor_Event
       id   = "integer"
       type = {"EXPRESSION" | "USERSUB"}
       …

/>

Attribute Values

Attributes may have several different kinds of values. The required value type is always indicated in the format specification for the modeling and command element.

  • string implies that the value of the keyword may be any string.
  • integer implies that the value must be an integer. Real valued data, if provided where integers are needed, are cast to integer format before they are stored.
  • real implies that the value should be a real number. Scientific notation may be used to express real valued data. Integer valued data, if provided where real values are needed, are converted to reals before being stored.
  • motionsolve_expression implies the value should be a legal expression that MotionSolve can understand.
  • valid_path_name indicates that the value is the complete path name for a specific file. The conventions for this are different for different operating systems.
  • boolean values are indicated by "TRUE" or "FALSE". These are never italicized.
  • When the value is a specific string or it is shown within "double quotes"; the value itself is not italicized.
A keyword value may not contain white space or be split into separate lines. The following are illegal definitions for keyword values:
...         ...
ID.=.1.234  HALT="T.RUE"
...

MotionSolve Expressions

Numbers
A number can be integer or real.
Integer
A whole number, positive or negative, without decimals.
Real
A number, positive or negative, containing one or more decimals. Numbers can be scientific numbers with an "e" to indicate the power of 10.
A number must not contain any separator, like comma or spaces.
Arithmetic Operators
MotionSolve supports the following arithmetic operators:
+
The addition operator adds two operands.
-
The subtraction operator subtracts the second operator from the first one.
*
The multiplication operator multiplies both operands.
/
The division operator divides the numerator by the denominator.
**
The exponentiation operator raises one operand to the power of the other.
Operator Precedence
Operator precedence determines the grouping in terms of an expression. This affects how an expression is evaluated. Certain operators have higher precedence than others.
The highest precedence goes to exponentiation (**), followed by multiplicative (*, /) and additive (+, -), respectively.
Angle Input
All angle inputs to MotionSolve are in radians. To specify the input value in degrees, use ‘D’ or ‘d’ after the value. Adding 'D' at the end of an integer or real number scales the number with PI/180. For example, 180D represents 180 degrees and is equivalent to PI radians.
Expression
Expression is a finite combination of numbers, operators, constants, functions, and brackets that is well formed to determine the order of execution. The MotionSolve expression evaluates to a scalar value.
Blank spaces and tabs can be added before and after the numbers, operators, constants, functions, and brackets to make it readable.
A valid function example expression that evaluates to one rotation per unit time: 360d*time.
The following expression calculates the centripetal force with a mass of 10.0, a radius of 50.0, and the angular velocity computed from the MotionSolve function WZ, between two markers with the IDs 30102060 and 30101060.
10.0*50.0*WZ(30102060, 30101060,
              30101060)**2
Additional examples include:
-10*(sqrt(VX(11)**2+VY(11)**2))-10*(sqrt(VX(11)**2+VY(11)**2))
IF(50-PROXIMITY(70000,2),0.0,0.0,1000*(50-PROXIMITY(70000,2)))
20*SIGN(DM(24,33),VZ(24,33))
STEP(TIME, 0.1, 1, 0.5, STEP(FXMODE, 4, 0.05, 6, 1))
IF(MODE-4:0,0,-100*DX(1,2))

User Subroutine Parameters

usrsub_param_string = "USER(par_1, ..., par_n)" 

Example

Below is an example of the complete format specification for the SENSOR_EVENT modeling element. Blank lines are added to improve the readability of the document. They are not required.
  <Sensor_Event 
      ​label                 = "string" 
      ​id                    = "integer" 
      ​value                 = "real"{type                  = "EXPRESSION" 
      ​expr                  = "motionsolve_expression"| 
      ​type                  = "USERSUB"  
      usrsub_dll_name       = "valid_path_name" 
      ​usrsub_param_string   = "USER(par_1, ..., par_n)"| 
      ​type                  = "USERSUB"  
      script_name           = "valid_path_name" 
      interpreter           = {"string"} 
      ​usrsub_param_string   = "USER(par_1, ..., par_n)"}[compare               = { "GE" | "LT" | "EQ" } ][evaluate_id           = "integer"][error_tol             = "real"][return                = {"TRUE" | "FALSE"}]/>