Initialize, Reinitialize, Reset, and Terminate Functions without stateflow.
10 views (last 30 days)
Show older comments
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 Comment
Lucky
on 10 Jun 2025
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
Answers (1)
Aabha
on 12 Jun 2025
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.
See Also
Categories
Find more on Event Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!