Model/Control

Usage

control (function, routine=None, script=None):

Attributes

function
String defining a valid MotionSolve user expression
The string contains the list of parameters that are passed to the user-defined subroutine.
This argument is mandatory.
routine
String
The user subroutine is defined in a DLL or shared library
Specifies an alternative name for the user subroutine. The name consists of two pieces of information, separated by "∷". The first is the pathname to the shared library containing the Consub. The second is the name of the Consub function in the shared library.
An example is: routine="/staff/Altair/engine.dllmyConsub"
  • "/staff/Altair/ engine.dll is the dll
  • "myConsub" is the function within this DLL that performs the calculations
The user subroutine is defined in a Python function
Pointer to a callable function in Python
An example is: routine=myConsub
  • myConsub is a Python function or method that can be called from wherever the model resides.
The attribute routine is optional. When not specified, routine defaults to "CONSUB".
Script
String
The string points to a file that contains the consub function defined in routine.

Example

# Create a model
m = CreateStewartPlatform (output="Stewart-Platform")

# Invoke a CONSUB, mySimulationDriver to run the simulation
m.control (function="USER(1,2,3)", routine=mySimulationDriver)