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

8 visualizzazioni (ultimi 30 giorni)
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 Commento
Lucky
Lucky il 10 Giu 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

Accedi per commentare.

Risposte (1)

Aabha
Aabha il 12 Giu 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.
  1 Commento
Antimo
Antimo il 23 Giu 2025
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?

Accedi per commentare.

Categorie

Scopri di più su Event Functions in Help Center e File Exchange

Prodotti


Release

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by