MotionSolve and Simulink Co-simulation Overview

This topic describes the main points in creating and performing a co-simulation with Simulink.

Simulink Model Form (Simulink-driven vs. Simulink Coder Library):

For a Simulink model (the Simulink model is exposed and you start co-simulation from within the Simulink interface):
S-Function represents the MotionSolve model
Simulink model is connected to the MotionSolve model by creating an S-Function (System Function). An S-Function allows you to model any general system of equations with inputs, outputs, states, and so on, and is somewhat analogous to a Control_StateEqn in MotionSolve. The S-Function has the inputs and outputs connected from the rest of the Simulink model.
S-Function calls MotionSolve
Simulink calls MotionSolve via the same S-Function block, which uses a library provided in the MotionSolve installation. (Note that environment variables must be set to run MotionSolve from Simulink).
For a Simulink Coder (formerly Real-Time Workshop) generated model/library, co-sim driven by MotionSolve:
  • Simulink components Inports and Outports represent the interface to the MotionSolve model.

Inputs/Outputs

The interface between two solvers is defined as the inputs and outputs from the systems to each other. Special modeling statements (Control_PlantInput and Control_PlantOutput) are added to the model to specify the inputs/outputs to the model. These statements reference variables that are either used as inputs to the model (for example, forces or torques) or measure outputs (for example, displacements or velocities).

Communication Types

MotionSolve and Simulink models communicate data via an Inter-Process-Communication interface, such as TCP/IP.

Solver Coordination

Solvers are held within one integration time step of each other to maintain accuracy.

Execution of Solvers

MotionSolve and Simulink run in parallel, each on their process.

Input/output Data Interpolation/Extrapolation

MotionSolve interpolates data in time as needed. You may choose zero-order, first-order, or second-order hold for data interpolation and extrapolation.

Output

Both solvers generate results for their respective models that can be post-processed within their own software.