what's the difference in stateflow update method?

13 Ansichten (letzte 30 Tage)
Rong Zhou
Rong Zhou am 9 Aug. 2012
Hello all, I am using stateflow blocks to determine the state the system is in.
There are 1 repeating sequence source, 3 stateflow blocks and 1 scope.
The soure is designed to output sequence of 0 and 1, updating every second.
Below are the parameters of the source: Time values: [0 1 2 3 4 5] Output values: [0 1 1 1 0 0]
Start time is 0.0, stop time is 6.0, and the sample time is set to 1.0 second.
When it inputs value 0, it is supposed to output 0; and when it inputs value 1, it is supposed to output 1.
I chose different update method for the stateflow blocks, inherited, discrete and continous. And I get different results:
please see the image here.
Can somebody tell me why they are different? Thanks!!!!

Akzeptierte Antwort

TAB
TAB am 9 Aug. 2012
Bearbeitet: TAB am 9 Aug. 2012
Stateflow chart runs under simulink environment. Simulink invokes or triggers the blocks (in your case a stateflow chart) at particular sample times. Update method property of chart specifies how simulink invokes or trigger the stateflow chart and calculate its output.
See Stateflow Block Update Method for details description.
See Types of Sample Time to know more about discrete & continuous sample times.
To explore what Descrete & Continuous state means, see Simulink states, a good explanation in this thread, this blog and this blog.
  3 Kommentare
TAB
TAB am 13 Aug. 2012
The term "continous sample time" is related with the continuous state in the block or stateflow chart. If a block/chart has continuous state it communicate with the simulink solver proving derivative of its state to the solver. Solver then integrates the derivative to find the next time step in the form of Major time step & Minor time steps.
And a "discrete" sample time" means block/chart invokes at the rate provided in the sample time dialog. The "sample time" parameter is associated with discrete (non-continuous) blocks only.
And finaly "Inherited sample time" means your chart will be awakened by some external input events to the chart. This events can be explicit (a trigger or a function call) and if explicit events are not provided, chart awakens according to the sample rate of fastest changing input. This input sample rate can be discrete or continuous.
Hope this will help to sort out your confusion.
Rong Zhou
Rong Zhou am 16 Aug. 2012
Thank you!!!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Decision Logic finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by