How to avoid solver resets using a memory block ?

19 ビュー (過去 30 日間)
Romain Dancre
Romain Dancre 2022 年 5 月 6 日
回答済み: Vidip 2023 年 12 月 27 日
I have a mixed Simulink/Simscape model on Matlab R2019b. The model is quite complex and I'd like to speed it up. I used memory block within the model in order to avoid algebraic loop. After investigating with the solver profiler, it seems that those memory blocks are creating zero order signals that drives continuous state. Subsquently I have many solver resets. I use continuous variable time-step solver Ode 23t.
I tried to replace the memory blocks by first order holds (which is as far as I understood the continuous equivalent of the memory block) to avoid zoh signals and have a continuous signal instead. In a sense it works since the solver doesn't reset anymore. However Simscape now struggles to solve state equations (too stiff I guess). The solution completes only if I use Ode 15s and runs slower than the original setup.
I also tried to use a Simscape local solver but since the rest of the model have continuous state it wasn't really convenient.
Do you have any idea how to deal with this memory block inducing solver resets issue ?

回答 (1 件)

Vidip
Vidip 2023 年 12 月 27 日
I understand that the solver resets in a Simulink/Simscape model can indeed be a sign of numerical difficulties, such as when zero-order hold (ZOH) signals drive continuous states. This can lead to inefficient simulation due to frequent solver restarts to reinitialize the solver's states.
This type of solver reset occurs when a block output is not executed during a trial or minor time step and gets updated only during the integration or major time step. As a result, the block output changes discontinuously from one major time step to the other. As a result, the solver resets.
If you have continuous signals that are sampled, consider whether you can use a fixed-in-minor-step sample time to reduce the number of ZOH signals. This approach can help maintain a more continuous signal flow but requires careful handling to ensure that the discretization aligns with the dynamics of your system.
Also, if you have signals transitioning from continuous to discrete rates or vice versa, ensure that you use rate transition blocks to manage these transitions properly. This can help avoid numerical issues caused by rate mismatches.
For further information, refer to the documentation links below:

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by