MINI VIDEO: SysMLv1: Cameo Simulation Toolkit: HOWTO Handle a timeout for a Signal send/receive: Strategy: Transition/TimeEvent

MINI VIDEO: SysMLv1: Cameo Simulation Toolkit: HOWTO Handle a timeout for a Signal send/receive: Strategy: Transition/TimeEvent

Darren R C Kelly, Webel IT

A common challenge when dealing with sending and receiving of Signals in Magic Model Analyst® (Cameo Simulation Toolkit®) is synchronising things so that sent Signals don't go lost from the pool because a listening receiver is not ready. One way of preventing this is to use blocking callbacks (awaiting confirmation signals), but that doesn't always represent a real system well. There are many other ways of handling it; this shows just one approach, a TimeEvent on a Transition for a timeout, and a carefully organised outer Transition loop to reset the listener.

In the example the transmitter RandomTX runs in a loop waiting for a random number of seconds between 0 and 10 seconds before sending a RandSig. The receiver TimeoutRX uses a StateMachine, which is critical to the strategy, because the 'doActivity' doListen on the state Listening can be "interrupted" by a Transition with a TimeEvent after (5 s) and Transition to a state TimedOut.

Note that fUML-1.4 does not support InterruptibleActivityRegion! There are nevertheless ways of achieving interrupting a StructuredActivityNode, but in the strategy shown here a TimeEvent on a Transition is used.

A ResetListen send from doListen ensures the context does not simply expire (in which case the timeout Transition to state TimedOut would eventually be taken, although one could instead include a guard on the Transition to state TimedOut).

Note also that doListen does NOT loop, rather the strategy relies on outer control via the StateMachine for TimeoutRX.

Use of a distinct state Resetting state makes it easier to follow in the simulation (one could instead just use a Transition to self for signal ResetListen).

If the StateMachine for TimeoutRX is in state Resetting or state TimeOut when a RandSig is sent, the signal may go lost. Note that there is a wait of 1 second before state TimeOut transitions to state Resetting , and a wait of 1 second before state Resetting transitions back to state Listening.

Some other things to note about the example:

- Using Ports makes it easier to see in the simulation.

- The Operation send is under the explicit outer control of DemoListenTimeout; there is no classifier Behavior for RandomTX.

- The AcceptEventAction for Repeat is just a fallback to catch inadvertent context expiry during testing; if operating correctly it should never be reached.

To learn more visit: webel.com.au/node/3874

Or attend the Webel IT Australia course for SysML/MBSE: webel.com.au/course/sysml/mdsysml

© Copyright 2024 Darren R C Kelly (Webel IT Australia). All rights reserved.

Get started for free

    PricingContact salesWatch demos

24/7 customer support

Our customer support team is available to help 24/7. Enterprise members also receive dedicated account managers and a guaranteed uptime SLA.

© 2026 Vimeo.com, Inc. All rights reserved.

Terms
Privacy
Your Privacy Choices
U.S State Privacy
Copyright
Cookies