Paraller states in stateflow.

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!

 采纳的回答

TAB
TAB 2012-5-2

0 个投票

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.

更多回答(1 个)

jan
jan 2012-5-2

0 个投票

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 !

类别

帮助中心File Exchange 中查找有关 Simulink Functions 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by