How to run simulink control and simscape model in different timming loops?

2 ビュー (過去 30 日間)
Flávio Luiz
Flávio Luiz 2024 年 9 月 2 日
回答済み: Raghava S N 2024 年 9 月 3 日
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.

採用された回答

Raghava S N
Raghava S N 2024 年 9 月 3 日
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 件)

カテゴリ

Help Center および File ExchangeTroubleshooting についてさらに検索

製品


リリース

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by