Stateflow, 2012a - Executing substate during actions before superstate during actions

1 view (last 30 days)
Hi,
I have a number of substates within a superstate. The substates process some common data differently, but then call the same functions to make use of these data. So I want to use some lines of code in the substates first to process the data, then do the calls to those same functions in the superstate. However, the default execution order of Stateflow dictates first to execute the during actions of the superstate, then the during actions of the substate. Is there a way to change this behaviour, or any suggestion that can help me avoid repeating the same function calls in each substate after processing the data?
Thanks in advance for replies.
  2 Comments
Wilfred
Wilfred on 19 Feb 2013
Wouldn't it work if you put your superstate function calls in an additional state parallel to the original superstate, with a higher execution order (i.e., the original superstate has execution order1 and the new parallel state ecexution order 2, so that it is always processed after the first one)?
Rey
Rey on 28 Apr 2013
Edited: Rey on 28 Apr 2013
Hi Wilfred, thanks for your input. The web site does not send notifications for comments, so I just saw your comment now while preparing to post another question.
By the way, your suggestion is exactly what I did back then :) Glad to see that this confirms my approach was not weird.
Fyi, Mathworks suggested using atomic charts for code re-use. Depending on the design, that may be a better option.

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!