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):
- 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).
- 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.