Stateflow Statemachine not giving out the right output, Please Help
2 views (last 30 days)
Show older comments
I have a 16 state state machine that I build using Stateflow toolboxes statetable block. I have been testing this state machine for a couple weeks now and found out that although the resultant action of receiving an input from simulink x=23, while in State 11, is to change the State to State 7 and put out an output of y=33, the state machine puts out y=38. I have triple checked my code where it clearly says [x==23] {y=33} state 7. There are 3 other states that exhibit the same behavior and the rest of the machine works well. I have tried to test it, by coming to State 11 from many other states and conditions and every single time when it exits that state to state 7 because of an input of x=23, it sets y=38. The state machine itself is too big to be fit in one picture, so here are some zoomed in pictures on how the condition is set. The first picture shows the condition entry, second picture shows expected and received values. If you look at line 16 of that excel file, 23 was supposed to give 33 but it gave a 38. There are no conditions listed in state 11 that is supposed to give a 38. I also followed the state machine by running it step by step and saw with my own eyes to jump to State 11, get the 23 input and put out the 38 output where there is no such condition. Picture 1
2 Comments
Ryan G
on 27 Jun 2013
Where (if it exists) do you define y=38? Can you take a screenshot?
Is the Stateflow and Simulink stepper active? Can you visually see the transitions? Using the debugger/visualization, can you take a screenshot of the 3 steps (before/during/after) this problem?
Have you tried simplifying this? Removing states, see if it still does it and finding the minimum model that shows the issue.
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Complex Logic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!