Sparx Systems Forum

Enterprise Architect => Uml Process => Topic started by: MrDX on September 10, 2007, 02:41:53 am

Title: State machine: How to model cyclic action
Post by: MrDX 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?

Title: Re: State machine: How to model cyclic action
Post by: jeshaw2 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.
Title: Re: State machine: How to model cyclic action
Post by: revdev 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
Title: Re: State machine: How to model cyclic action
Post by: MrDX on September 12, 2007, 09:48:53 pm
Thank you, that was very helpfully.