In Stateflow, is it possible to reset an Output of a Chart back to an undefined value which it had at the beginning of the simulation?

25 views (last 30 days)
In my State flow model I am using a chart in a triggered subsystem. When the system is triggered the chart calculates an output by using input data from outside of the subsystem. After this the output data is written into a Data Store Memory. As soon as it is written the trigger signal for the subsystem is set to zero and the system goes back to sleep.
Once the system is triggered again to calculate a new output with new input the old output the written into the Data Store Memory for a short time before the new output is written into it. Is there a possibility to delete the old output before the triggered systems is disabled?
Thanks for the help in advance!
  1 Comment
Elizabeth VanDenburgh
Elizabeth VanDenburgh on 29 Jul 2016
I believe that you can register the Data Store Memory as a piece of data that the chart has access to in Model Explorer. Then, on the default transition to the chart, you can set the data to some default value. This will overwrite the old data. Once you have calculated the new value, you can then write it to the Data Store Memory directly from the state block.

Sign in to comment.

Answers (1)

erbao luerbao
erbao luerbao on 12 Sep 2019
In simulink library Ports and subsystems, there is "Resettable subsystem". Put the statemachine in this subsystem, we can use the external rising edge to reset the statemachine.
  1 Comment
Roaa
Roaa on 3 Mar 2024
If the datastore is being updated within the chart, even though the subsystem's property 'States When Enabling' is set to reset, the datastore value itself is not reset.

Sign in to comment.

Categories

Find more on Complex Logic in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!