Saving and Restoring Simulation States in an External Application from a Code-Generated Simulink Model with Custom S-Functions
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a fixed-step Simulink model that includes a referenced model with a custom S-function. This S-function is built with the legacy code tool using a DLL that was compiled from Ada and C code. I plan to autocode this entire Simulink model into a library, which I intend to use in an external non-Matlab real time environment with optional man-in-the-loop inputs. In this external environment, we want to be able to save the simulation's state at a certain point and then load it back later to continue the simulation repeatably.
We're in a planning phase and I need to determine whether this is feasible. I've looked through some of the documentation and other questions but this use case seems a little out of the ordinary, and it's not clear to me that the RestoreOperatingPoint etc will work in this case. Will RestoreOperatingPoint work in this scenario, or is there another approach?
0 commentaires
Réponses (1)
Sachin Lodhi
le 15 Juil 2024
Hi Robert,
You can use "Simulink.op.ModelOperatingPoint" object which contains a complete representation of a model operating point that you can use to specify the initial state for a simulation. For example, when you run a set of simulations for a model of a system that has a startup phase or initialization behavior, you can simulate the model through the end of the startup or initialization phase once, save the model operating point, then run a set of simulations that use the operating point as the initial state. You can then use the "Simulink.op.ModelOperatingPoint" object to run the same model again but this time starting from the time-step and simulation state that was saved during previous simulation.
To get started on "Simulink.op.ModelOperatingPoint", please refer to the following documentation link:
I hope this helps!
0 commentaires
Voir également
Catégories
En savoir plus sur Simulink Coder 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!