Author Topic: State machine: How to model cyclic action  (Read 4184 times)

MrDX

  • EA User
  • **
  • Posts: 49
  • Karma: +0/-0
    • View Profile
State machine: How to model cyclic action
« on: September 10, 2007, 02:41:53 am »
Hi,
I am trying to model a cyclic action in a state machine, for example for this scenario:
Machine is in state 'A', so send all 2 seconds a message until the state is changed.

How can I model it?


jeshaw2

  • EA User
  • **
  • Posts: 701
  • Karma: +0/-0
  • I'm a Singleton, what pattern are you?
    • View Profile
Re: State machine: How to model cyclic action
« Reply #1 on: September 10, 2007, 07:53:16 pm »
Quote
Hi,
I am trying to model a cyclic action in a state machine, for example for this scenario:
Machine is in state 'A', so send all 2 seconds a message until the state is changed.

How can I model it?


Which cycle are you trying to model, the "cycle from and to state 'A' ", or the repetitive "send all 2 seconds" ?

It would not appear that the "send all 2 seconds" causes any state change so the repetitve action would apear in an Activity diagram.  If you are modeling in and out of state 'A', there would be triggers that initiate those state changes.

Another approach would involve the use of a Timer event.
« Last Edit: September 10, 2007, 08:33:34 pm by jeshaw2 »
Verbal Use Cases aren't worth the paper they are written upon.

revdev

  • EA User
  • **
  • Posts: 27
  • Karma: +0/-0
  • Love this stuff.
    • View Profile
Re: State machine: How to model cyclic action
« Reply #2 on: September 11, 2007, 11:27:42 am »
Your question isn't entirely clear, but it sounds like every 2 seconds you want to do something until there is a state change.

The "Do Action" is used for such repetitive tasks.  You can have a reflexive transition (a transition that starts and ends at the current state).  Label the transition with a "2 second" note and the modeling is complete.

revdev
re-Vision Development

MrDX

  • EA User
  • **
  • Posts: 49
  • Karma: +0/-0
    • View Profile
Re: State machine: How to model cyclic action
« Reply #3 on: September 12, 2007, 09:48:53 pm »
Thank you, that was very helpfully.