TIP: SysMLv1/UML: Cameo Simulation Toolkit: HOWTO convert an fUML ReadLine CLI String to a Boolean for cleaner DecisionNode tests against a LiteralBoolean [true] guard.

Icon class
icon_class
far fa-sticky-note
icon_class_computed
far fa-sticky-note
Note kind
Policy level
Specification keywords
UML keywords
Keywords
Click on the image to view it full size

If you find all that magic detection of variables in Magic Model Analyst® (Cameo Simulation Toolkit®) from "names" within guards on ControlFlow edges outgoing from a DecisionNode a bit mysterious and want to use some basic Boolean logic this might be for you.

A convenient way to explore this in Magic Model Analyst® (Cameo Simulation Toolkit®) is to 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. You can then input 'test' values via a CLI in the simulation console.

Rather than using Cameo's "magical" implied variable detection based on a "freestyle" guard, an OpaqueBehavior with this Groovy script is used here to convert from some candidate inputs to a hard Boolean true or false:

List match = ["True", "true", "Yes", "yes", "y", "Y"];
o = (i != null && i != "" && match.any { it.contains(i) })

IMPORTANT: the guard [true] uses a LiteralBoolean true.

For a mini video of it simulated visit:

Compare with using a "magical" implied variable [name] in the guard as shown here:

Related:

Visit also the many Mini SysML/UML simulations videos.


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.
Relates to
Related notes
Related notes (backlinks)
Related snippets (extracts)
Visit also
Visit also (backlinks)