MotionView contains an implicit variable called SolverMode. In MDL, SolverMode can be used in an "if" context to define topology (include Templex templates). MotionView retains the "if" result for both cases so that when you toggle the solver type, the associated text becomes active within the user interface.
The example below shows how a gravity template is constructed through the model library.
*if( SolverMode == "SIMPACK" )
*Template(tpl_gravity_unit_spk, "Gravity & units",SOLVER_INPUT,
tpldef_misc_model_spk, ds_gravity)
*elseif( SolverMode == "ADAMS" )
*Template(tpl_gravity_unit_adm, "Gravity",SOLVER_INPUT,
tpldef_misc_model_adm, ds_gravity)
*endif( )
When an MDL model containing the previous text is loaded into MotionView (or also through std_inc), the following template is displayed when the solver mode is selected as ADAMS in MotionView:
{ if grav.op_gravity.value == "On" }
!Gravity
ACCGRAV/IGRAV={ grav.igrav.value }
,JGRAV={ grav.jgrav.value }
,KGRAV={ grav.kgrav.value }
{ endif }
If the solver mode is selected as SIMPACK in MotionView, the following template is displayed:
! *************************************************
! *** Volume-Forces ***
! *************************************************
{ if grav.op_gravity.value == "On" }
gravity ( 1 ) = { grav.igrav.value }
gravity ( 2 ) = { grav.jgrav.value }
gravity ( 3 ) = { grav.kgrav.value }
{ endif }
SolverMode can be used to put "if" logic around any MDL topology.