Co-Simulation Execution
Simulink® supports cosimulation between components with local solvers or involves external simulation tools. For example, cosimulation can involve an S-function implemented as a cosimulation gateway between Simulink and third-party tools or custom code. A cosimulation component can be a Functional Mockup Unit (FMU) in cosimulation mode imported to Simulink.
Execution Timing
In Simulink simulation, the solver step size must be an integer divisor of each periodic, discrete block sample time. In other words, if a cosimulation component defines its own sample time, Simulink must communicate with the component at those time steps. Cosimulation can involve components whose time steps are determined internally and are not known to Simulink. The only information available to Simulink is the block sample time, either through the communication step size parameter of an FMU block, or the sample time definition in an S-function implementation. The block sample time determines the time steps Simulink must communicate with the cosimulation component. If the solver step size is not automatic, the communication step size must be an integer multiple of the solver step size.
If the cosimulation component internally uses a local solver, then this local solver should also be taken into account when determining the communication step size of the block. The step size of the local solver is not exposed to Simulink, and knowledge of the implementation is necessary to set the communication step size correctly. The behavior of cosimulation in case of a potential incompatibility also depends on this internal solver implementation.
References
[1] Runge, Carl. "Uber empirische Funktionen und die Interpolation zwischen aquidistanten Ordinaten", Zeitschrift für Mathematik und Physik. Vol. 46, 1901, pp. 224–243.
See Also
FMU | S-Function | ssGetInputPortIsContinuousQuantity
| ssGetOutputPortIsContinuousQuantity
| ssSetInputPortIsContinuousQuantity
| ssSetOutputPortIsContinuousQuantity