Initialize, Reinitialize, Reset, and Terminate Functions without stateflow.

8 ビュー (過去 30 日間)
Antimo
Antimo 2025 年 6 月 10 日
コメント済み: Antimo 2025 年 6 月 23 日
I am trying to reset multiple states inside a model using one of the simulink block mentioned in the title.
The issue, is that I do not understand how to trigger the event (i.e., the reset). The only examples from mathworks I am able to find are using stateflow to trigger the event, which is not part of my tool suite.
  1 件のコメント
Lucky
Lucky 2025 年 6 月 10 日
It sounds like you're trying to reset multiple states in a Simulink model using one of the "Resettable Subsystem" or "Triggered Subsystem" blocks, but without using Stateflow

サインインしてコメントする。

回答 (1 件)

Aabha
Aabha 2025 年 6 月 12 日
You can implement initialize, reinitialize, reset, and terminate functions in Simulink without using Stateflow by using a combination of Initialize’, Reset, and Terminate Function blocks, available in Simulink Function-Call Subsystems.
During simulation, you can reset the state of a block using a 'State Writer' block. To control when reset occurs, use a Reset Function block. To configure the reset conditions, open the Reset Function block, and model reset conditions using a ‘State Writer’ block inside. Once that is done, make sure to connect the state writer with the state owner.
Please refer to the following link that demonstrates an example of Using Initialize, Reinitialize, Reset, and Terminate Functions, without Stateflow: https://www.mathworks.com/help/releases/r2025a/simulink/ug/initialize-blocks-with-state.html
Additionally, to reset multiple internal states, an alternative approach is to use a 'Resettable Subsystem'. This subsystem resets all blocks inside it when a signal triggers the 'Reset Port'. You can trigger the reset of a resettable subsystem using any boolean signal such as a comparison logic, manual switch, a function-call subsystem output, etc. A rising/falling edge on this signal will reset all the internal states.
Please refer to the following documentation link to understand more about how resettable subsystems can be implemented: https://www.mathworks.com/help/releases/r2025a/simulink/ug/reset-block-states-in-a-subsystem.html
I hope this helps.
  1 件のコメント
Antimo
Antimo 2025 年 6 月 23 日
The issue with this approach is that some of my inputs are "time-dependent." Therefore, after the subsystem reset, although the initial conditions are the same as at time=0, the inputs are evaluated based on the time instant when the simulation is resumed.
Is there any way to also "reset" the input?

サインインしてコメントする。

カテゴリ

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

タグ

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by