Tags and keywords
If you've been following this tutorial trail you'll know that one can send a Signal via a nested Port in Magic Model Analyst® (Cameo Simulation Toolkit®) using «InvocationOnNestedPortAction» and 'onNestedPort' together with just basic SysML. However, sometimes it's handy be able to do this programmatically using the vendor-specific Action Language Helper (ALH) API, especially if you wish to parametrise the send logic for families of Signals. It turns out it's quite easy to do with a little trick:
video_sim
Watch a high resolution version of the video on Vimeo.
The ALH API docs give this signature:
void sendSignal(String signalName, Object_ target, String portName)
To send via a nested Port, all you have to do is reference the outer Port as a property of the target, and then the inner Port name. So for the example in the Diagrams shown - and including the Sig
instance creation using the String name "Sig"
- an OpaqueAction uses this Groovy script in combination with ALH to send via a nested Port:
sig = ALH.createSignal("Sig");
ALH.sendSignal(sig, tx.outer, "o");
Note how the outer Port is accessed as
If you have caught a Signal instance upstream (before re-transmitting), you can use that to directly feed an InputPin of the OpaqueAction (instead of the String tx.outer
to specify the effective target
"Sig"
), which approach can be used to nicely parametrise the Signal forwarding logic for a RoutingHub. And it also works well with "families" (inheritance hierarchies) of Signals!
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.
Webel IT Australia is an OMG-Accredited Training Provider for SysML!