Template Expressions

Template expressions allow you to define properties using the syntax for specific solvers.

A template expression is a string that is enclosed between single back-quotes and can contain Templex instructions. When a property is written out to solvers such as MotionSolve and ADAMS, MotionView passes the template expression through Templex and writes the resulting output to a file.

Template expressions enable you to directly enter solver expressions into any property text box. Solver expressions are typically used when a property must be defined as a function of some quantity that varies during the solution, such as time or the distance between two points. Solver expressions are evaluated by the solver during the solution process and must be written in terms of the solver math functions and operators.

In MotionSolve and ADAMS input files, functions refer to entities by integer IDs. MotionView maintains variable names for model entities and properties that can be used in these solver functions to improve readability. When you use a MotionView name in a solver function, enclose the variable name between braces, {}, following standard Templex syntax.

Examples of template expressions using MotionView variable names in MotionSolve functions are shown below:

`-AZ({j_st_wheel.i.id, %d},{j_st_wheel.j.id, %d})*RTOD`

`IF(DZ({frc_bmp.i.l.id,%d},{mrk_disp.l.id,%d},
    {mrk_disp.l.id,%d}):{cr()},0,0,DZ({frc_bmp.i.l.id,%d},
    {mrk_disp.l.id,%d},{mrk_disp.l.id,%d}))`

MotionSolve expressions for joint, bushing, spring, and force properties are often written in terms of MotionSolve functions that measure displacements and velocities between markers. The following functions are used for measuring displacements and velocities:

Translational Displacement Angular Displacement Translational Velocity Angular Velocity
DX(I, J, R) AX(I, R) VX(I, J, R) WX(I, J, R)
DY(I, J, R) AY(I, R) VY(I, J, R) WY(I, J, R)
DZ(I, J, R) AZ(I, R) VZ(I, J, R) WZ(I, J, R)
DM(I, J)   VR(I, J)  
I and J are the two markers whose relative displacements or velocities are being measured.
R is the ID of a reference marker.

These functions enable you to create template expressions such as the following:

`-DX({bsh_lca_frnt.l.i.id},{bsh_lca_frnt.l.j.id},
    {bsh_lca_frnt.l.j.id}`

MotionView provides convenience properties for measuring displacements and velocities on springs, joints, bushings, and forces that can shorten a template expression. When these properties are used in a template expression, they are automatically expanded to the corresponding solver syntax when the solver-input deck ( .xml or .adm) is written. For example, the following two expressions produce exactly the same result.

MotionSolve DX Function `DX({bsh_lca_frnt.l.i.id}, {bsh_lca_frnt.l.j.id}, {bsh_lca_frnt.l.j.id}`
MotionView .DX Property `{bsh_lca_frnt.l.DX}`

The convenience properties are listed below:

  Translational Displacement Property Angular Displacement Property Translational Velocity Property Angular Velocity Property
Forces

Bushings

Compliant Joints

.DX

.DY

.DZ

.AX

.AY

.AZ

.VX

.VY

.VZ

.WX

.WY

.WZ

Coil Springs .DM - .VR -
  - .AZ - .WZ

When MotionView expands convenience properties into the full solver function for bushings, compliant joints, and springs, it automatically uses the J marker of the entity as the reference marker (the RM parameter). Since force entities always have an explicitly defined reference marker in MotionView, this reference marker is used as the "RM" parameter in the full expression.

Note: Convenience properties have no useful meaning outside the context of template expressions.