How to use external ode solver in Simulink
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello all, is there a way to use an external ode solver (written in C++) within Simulink?
I would like Simulink to run a C MEX S-function where system states are internally integrated. Unfortunatelly I have no idea how to disable the ode solver of Simulink.
From what I've learnt so far it is possible to import a FMU model into Simulink which can use its own solvers for simulation. Hence, it must be possible to tell Simulink to basically do nothing but trigger the computation. Right?
Any help is highly appreciated!
0 commentaires
Réponses (1)
Yash
le 16 Fév 2025
Simulink supports cosimulation between components with local solvers or involves external simulation tools. For example, co-simulation can involve an S-function implemented as a cosimulation gateway between Simulink and third-party tools or custom code.
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.
Refer to this MATLAB Answer post on using an external program with its own solver: https://www.mathworks.com/matlabcentral/answers/693230
0 commentaires
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!