How to run simulink control and simscape model in different timming loops?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Flávio Luiz
le 2 Sep 2024
Réponse apportée : Raghava S N
le 3 Sep 2024
Hello all,
I have a system composer that contains a simulink control and a simscape model. When testing it I found that the simscape model is running faster than the simulink control component and is messing up the simulation.
I am wondering how can I setup different execution loops in order to make them work toghether, since they share the same solver configuration.
PS: the simulink control is already implemented in a real life product and works fine with the current parametrization.
0 commentaires
Réponse acceptée
Raghava S N
le 3 Sep 2024
Hi,
Integrating Simscape models with Simulink requires certain changes to Simulink defaults and consideration of physical simulation trade-offs. The first step would be to choose a suitable Simscape solver for the physical model involved in the simulation. Please refer to this documentation link to determine the optimal solver for physical simulation of Simscape models - https://www.mathworks.com/help/simscape/ug/making-optimal-solver-choices-for-physical-simulation.html.
The next step would be to choose a global, or model-wide solver for Simulink. The solver for the simulation of the physical Simscape model (determined in the first step) however can be configured to behave as a local implicit, fixed-step solver. A physical network using a local solver appears to the global Simulink solver as if it has discrete states. Any continuous global solver can still be used. For more information on configuring global Simulink and local Simscape solvers, please refer to the following link - https://www.mathworks.com/help/simscape/ug/setting-up-solvers-for-physical-models.html#bsmc3yn:~:text=Physical%20Simulation.-,Choosing%20Simulink%20and%20Simscape%20Solvers,-Simulink%20and%20Simscape.
After choosing the solvers for the Simulink and Simscape models, they should be harmonized to work together consistently. Follow the workflow described in this documentation link to ensure that the Simulink and Simscape solvers are configured to work as expected - https://www.mathworks.com/help/simscape/ug/setting-up-solvers-for-physical-models.html#bsmc3yn:~:text=block%20or%20blocks-,Harmonizing%20Simulink%20and%20Simscape%20Solvers,-Your%20Simulink%20and.
The link provides detailed steps to harmonize the two solvers by changing Simscape model configurations, updating Simulink solver settings, dealing with diagnostic messages, using zero-crossing detection in Simscape models, and setting up multirate Simscape simulations.
Hope this helps!
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Troubleshooting 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!