
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.
NXTManager.startRunMotor(x,y,z);
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);
NXTManager.getColorBySensor();
Sample: color = NXTManager.getColorBySensor();
NXTManager.getDistanceFromSensor();
Sample: distance = NXTManager.getDistanceFromSensor();
NXTManager.stopRunMotor(x);
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.
Next
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.
References
- Building Executable SysML Model – Automatic Transmission System (Part 1) https://blog.nomagic.com/building-executable-sysml-model-automatic-transmission-system-part-1/
- 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)
In reference 2, the Mindstorms plugin supports an older version of Magicdraw. Is there an updated version of this plugin that supports v18.5?
Was the third video every posted?