simulinkstateflow

Simulink Stateflow: Wait for Parallel States


I would like to create a state machine in Stateflow that enters into multiple parallel states (A&B&C) and then exits to an end state (D) only when a condition from each parallel state has been achieved. The picture demonstrated below exits when any of the exit conditions for any state in {A,B,C} is satisfied. (In Enterprise Architect's state chart, I believe this would be a Synchronized state).

Is this possible to do in Stateflow? If so, how?

Wait for Multiple States


Solution

  • Would something like this work? enter image description here

    You'll probably need to use atomic subchart mappings (see https://www.mathworks.com/help/stateflow/ug/mapping-variables-for-atomic-subcharts.html) to map variables in1, in2, in3 to some data in the corresponding atomic subcharts, and assign them in there.