Oct 222018

SysML allow both structural and behavioral modeling of the system. SysML models can be formally interpreted and executed. Ones executed analysis can be performed at system level. Ones we are good with simulation results we can prototype. Using programmable Lego Mindstors NXT for prototyping is an out of the box way to test and demonstrate future system behavior. We can use same system model to control and calibrate prototype.

In the second video [1st reference – 1st part] from the series of three we will demonstrates the SysML transmission model connected to LEGO Mindstorms NXT linear gearbox. We will demonstrate how using API between Cameo Systems Modeler and LEGO executable SysML model controls switching between gears in LEGO model. We will show how model is built to use API.

See video demonstrating working integration and model setup:

Java API of LEGO Mindstorms NXT is accessed by Cameo Systems Modeler plugin [2nd reference], which enables below functions in the model to control motors and read sensors data.


x – Motor number starting from 0

Y – Power (with “–“ in front if direction is opposite)

Z – Degrees of rotation

Sample: NXTManager.startRunMotor(1,-100,4000);


Sample: color = NXTManager.getColorBySensor();


Sample: distance = NXTManager.getDistanceFromSensor();


X – number of motor

Sample: NXTManager.stopRunMotor(2);

Functions are used in custom created opaque behaviors library associated with state machine states to execute when entering the states, leaving the states, and in transition. Fig. 1 demonstrate setup and use of the opaque behaviors library.

Fig 1. Setup and use of open behavior library with functions to control LEGO


In the third video we will demonstrate how LEGO gearbox (hardware in the loop) is calibrated to get right gears transfer rate and speed eliminating instability of motor speed depending on load introduced by gearbox.


  1. Building Executable SysML Model – Automatic Transmission System (Part 1) https://blog.nomagic.com/building-executable-sysml-model-automatic-transmission-system-part-1/
  2. Interface between Cameo Systems Modeler and LEGO Mindstorms https://blog.nomagic.com/collaboration-between-simulated-model-and-external-system-controlling-lego-mindstorms-with-cameo-simulation-toolkit/

About Cameo Simulation Toolkit

The Cameo Simulation Toolkit provides the first in the industry extendable model execution framework and infrastructure based on number of standards:

  • Model debugging and animation environment
  • Pluggable engines, languages and evaluators
  • User Interface prototyping support
  • Model driven configurations and test cases

The standard based model execution of:

  • Activities (OMG fUML standard)
  • Composite structures (OMG PSCS)
  • State Machines (W3C SCXML standard)
  • Actions/scripts (JSR223 standard)
  • Parametrics (OMG SysML standard) including build in and external math solvers: Math solvers: Built-in solver, Matlab, Maple, Mathematica, OpenModelica.
  • Sequence diagrams (OMG UML Testing Profile)
5.00 avg. rating (98% score) - 1 vote

  2 Responses to “Linear LEGO Gearbox Controlled by SysML Model (Part 2)”

  1. In reference 2, the Mindstorms plugin supports an older version of Magicdraw. Is there an updated version of this plugin that supports v18.5?

  2. Was the third video every posted?

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>



Time limit is exhausted. Please reload CAPTCHA.