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

11 次查看(过去 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,4:55
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