what's the difference in stateflow update method?
14 views (last 30 days)
Show older comments
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.
The model can be download from: http://www.mathworks.cn/matlabcentral/fileexchange/37762-stateflow-update-method
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:
Can somebody tell me why they are different? Thanks!!!!
0 Comments
Accepted Answer
TAB
on 9 Aug 2012
Edited: TAB
on 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.
To explore what Descrete & Continuous state means, see Simulink states, a good explanation in this thread, this blog and this blog.
3 Comments
TAB
on 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.
More Answers (0)
See Also
Categories
Find more on Decision 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!