1

I was hoping someone could help me design this state machine correctly. I'm using Spring state machine with Papyrus for this project. I have a lot of simple, orthogonal states and one sort of "master" state that depends on all the others being "on." So, let's say...

M.off -> M.on
A.off -> A.on
B.off -> B.on
C.off -> C.on

There are events that trigger a transition from A.off to A.on, B.off to B.on, etc. I have each of these (A, B, C) in its own region. Only when A B and C are all in the "on" position do I want to transition to the M.on state.

I'm unsure of the best way to structure this in a state machine. Any help would be appreciated.

1
  • What happens if M is in "on" and any of A, B, C get an "off" event? Does M go to off again? Or is it a one-way process where once M is on M stays on?
    – DrP3pp3r
    Mar 14, 2018 at 6:10

1 Answer 1

2

I don't know the details of Spring Statemachine. But for a UML state machine a solution would be to join when all regions are in their "on" state.

It's not clear from the question what happens when A, B, or C go to off when M is "on". Assumption: M goes to "off".

To make/keep this simple I add an history pseudo-state to each region in order to remember which regions were "on" whenever one goes to "off".

Diagram of state machine

The transitions to the join will trigger when all of the source states of the incoming transitions are active (so only if A && B && C are "on").

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.