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

조회 수: 6 (최근 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 CenterFile Exchange에서 Event Functions에 대해 자세히 알아보기

태그

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by