User Subroutine Guidelines
- To describe a physical phenomenon that is determined by non-trivial logical conditions.
- When it is impractical to formulate a complicated expression in an explicit form.
- To take full advantage of a programming language like C/C++, Fortran, or a scripting language like Python,
Compose, or MATLAB.Note: Using user subroutines adds a level of complexity to your multibody model. We recommend using the built-in functions to model your system before using subroutines unless it is necessary or more convenient to use subroutines.
To use your own subroutines in MotionSolve, follow these steps:
- Create a Python, Compose, MATLAB, C/C++, or Fortran source file that contains the user-defined modeling entity.
- Obtain a Dynamic-Link Library (DLL) or Shared Object (SO) by compiling and linking your user subroutine(s), only for C/C++ or Fortran source code. No compiling is required for Python, Compose, or MATLAB source code. Python routines are automatically compiled, and you can use compiled Python files with MotionSolve and without the source files. All Altair Simulation products come with a Python interpreter. For Compose and MATLAB, you must install the interpreter separately.
- Modify the corresponding entity in your multibody model to be "user defined" and to point to your DLL/SO or script file.
- Run MotionSolve, verifying that it finds the appropriate DLL/SO or script file during simulation.
See Also