Cosimulation
Cosimulation is a method of integrating two or more independent simulation software programs so that they can perform a joint simulation. Data is then transferred between the two programs as needed. Usually one of the programs is in charge of the overall simulation and decides when each program should communicate with the other programs. The points in time when data is exchanged is referred to as communication points or times, and the interval between these times is the communication step. The other programs must then be able to perform the simulation of a (usually small) communication step. The programs performing the simulation may use their own time-stepping algorithms and internal time stepping.
When performing cosimulation of a COMSOL model with Simulink in the described way, the two simulation environments perform the time stepping one after the other. Simulink is in charge of the overall time stepping and controls how and when the simulations of all the blocks in the Simulink diagram are performed.
When Simulink determines that the COMSOL cosimulation block should be simulated during a communication step t to t + dt, the following steps take place:
1
2
Simulink notifies COMSOL that a simulation from t to t + dt has to be performed.
3
4
It is important to note that the simulation of the COMSOL model is performed by the COMSOL solvers defined in the model. Hence the COMSOL solvers determine what type of time stepping is performed internally in COMSOL during the communication step t to t + dt. Often COMSOL will choose to take small time steps within the communication step in order to achieve the desired accuracy.