TIP: SysMLv1: Cameo Simulation Toolkit®: HOWTO handle receiving multiple Signal events in parallel within a repeated loop [with mini video]

Gallery
Tutorial
A common challenge with Magic Model Analyst® (Cameo Simulation Toolkit®) is handling multiple Signal events in parallel with correct control synchronisation. This shows two different approaches: one using a StateMachine with Transitions to self and effect Behaviors for each Signal type; and one using an Activity with AcceptEventActions.
Click on the image to view it full size
Watch simulation
video_sim
Watch a high resolution version of the video on Vimeo.

StateMachine approach (left)

This approach is in some ways easier and cleaner, and requires less synchronisation. The only tricky part is that there MUST be an intermediary MergeNode for the looping control flow (shown in green), which is also entered here from the InitialNode.

Activity approach (right)

This approach requires some careful synchronisation. In addition to having an intermediary MergeNode for the looping control flow (shown in green), the control within the structured activity node has to fork then join (shown in blue).

Applicable to both

They both use the ReadLine Activity from the fUML_Library.mdzip, which you can load via Use Project > Use Local Project then select under <install.root>/modelLibraries. A 'choice' String value entered via a CLI in the simulation console is tested for '1', which triggers Signal Event1, otherwise Signal Event2 is triggered. Groovy println is used via OpaqueBehaviors to echo the received events to the console. These could be replaced with Activities to handle the events (such as for Signals with attributes).

The use of a structured activity node (shown in magenta) in each is optional, but it helps make the control flow clearer and also aids the modelling and helps keep the diagrams tidy. It can be upgraded to a dedicated Activity for a CallBehaviorAction to make it more explicit.


Learn SysML for MBSE with the Webel IT Australia Live Online web seminar or On-Site course!

Please email or phone Webel IT Australia on +61 405 029 008 to arrange On-Site, Off-Site, or Live Online remote web training seminars and workshops.
Up next
Notes
Snippets (quotes/extracts)
Visit also
Visit also (backlinks)
Related slides (includes other tutorials)
Related slides (backlinks, includes other tutorials)
External links