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

조회 수: 2 (최근 30일)
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 CenterFile Exchange에서 Troubleshooting에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by