Paraller states in stateflow.

7 views (last 30 days)
jan
jan on 1 May 2012
Hello, I have a question about paraller states. I have a variable in first state, which is used in second state. At the start of the second state there is condition which using that variable. StateFlow constantly checking second state with its conditions or check it one time at the beginning ?
Thanks!

Accepted Answer

TAB
TAB on 2 May 2012
In stateflow, all the parallel states are executed at every sample time in a sequence decided by their priority number.
In your case, your second state will be executed continuously at each sample time but, codition will be checked constantly or at one time depending on where you have placed that condition.
[EDITED 3 May, 2012]
Flow graph inside your state will execute only once when state is entered. As there is no "during statement" for state, nothing will execute after state entry.
To make your flow graph to be executed continuously inside the state, add inner boundry transition as shown here.
For more details see here.

More Answers (1)

jan
jan on 2 May 2012
Thanks for answer. I have one more problem. I did simple model. As you can see on that image: [IMG]http://i46.tinypic.com/2mot8hw.png[/IMG] There is Matlab Function block. It give to output 0 if time is < 5. If clock > 5 then output from this block is 1. If i did in chart that function: [IMG]http://i48.tinypic.com/6ek9bd.png[/IMG] all is OK. At scope i can see proper plot. If I put function into state like here: [IMG]http://i46.tinypic.com/2h5kw3b.png[/IMG] At scope I can see only one line at 0 level. It doesn't change to 1 after 5sec. Why it doesn't work ?
Thanks for help !

Categories

Find more on Simulink Functions 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!