Book a Demo

Author Topic: Linking Statemachines  (Read 4008 times)

aidancourts

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Linking Statemachines
« on: October 09, 2015, 01:34:58 am »
Hi,

I am attempting to make to state machines interact with each other. How do I go about setting up variables to represent each state.

For example, if I have two state machines engine and key.
Key has two states key present and no key present.
Engine has two states on and off.

How can I make the state machine for engine go to on only when the key state machine is at key present.

Many thanks in advance.

Aidan

HarryPlotter

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: Linking Statemachines
« Reply #1 on: October 09, 2015, 11:17:56 am »
Hello.

The phrase 'setting up variables' suggest you're looking at an implementation. Variable declaration will depend on your chosen technology.

So looking just at the model part of the question... states are important, but so are transitions.

Transitions can have guards (a condition that must be met in order to traverse the transition). In the 'engine' example, you could consider using '[key present]' to guard the transition of the engine turned from state 'Engine off' to 'Engine on'.

aidancourts

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Linking Statemachines
« Reply #2 on: October 09, 2015, 06:58:54 pm »
Thanks,

I have a slight concern about traceability with guards, as I can see know way of knowing that the words 'key present' in the guard would be in any way linked to 'key present' in the other state machine. (You can name more than one state 'key present' and so how would we know which state the guard is referring too?)

Also is there any way of typing Boolean equations into guards to give 'and' and 'or' conditions?

Thanks
Aidan