Sinelabore Homepage

Tooling and validation#

A textual model needs no modeling tool — but two things are worth having next to the code generator: an editor that understands SysML v2, and a way to check that a model is not merely accepted by our parser but is valid SysML v2.

Editors#

SysIDE is a Visual Studio Code extension that provides syntax highlighting, navigation and live validation for .sysml files. It catches the class of problem the code generator cannot see, for example accessing a part feature from inside a state def (see States).

Validating against the reference implementation#

The OMG SysML v2 pilot implementation is the reference for what the language actually allows. It is open source and comes with a Jupyter kernel, so a model can be checked and visualized without any commercial tool.

Rough outline:

  1. Clone the pilot implementation.
  2. Build it with ./mvnw install -DskipTests=true. It requires JDK 21; an older JDK stops the build with Unknown OSGi execution environment: 'JavaSE-21'.
  3. Install the Jupyter kernel from org.omg.sysml.jupyter.kernel/installKernel.sh into a Python virtual environment that has JupyterLab.
  4. Open a notebook with the SysML kernel.

The kernel does not read files from disk — paste the model text into cells. Each cell is one compilation unit, but packages stay known across cells in a session, so put a shared package into the first cell and the model that uses it into the second.

A cell that is accepted answers with the package it created:

Package TrafficLight (82c6e2e1-e835-46b4-91fb-63a76ba1e797)

Anything else is a finding worth looking at. This is also the quickest way to settle whether a construct is really valid SysML v2 or just tolerated by one tool.

If the model has errors the package is not registered, and every later command in that session reports the package as unresolvable. Fix the errors first, then visualize.

Diagrams from the textual model#

The pilot implementation renders diagrams with the %viz command. Names must be fully qualified:

%viz --view=tree TrafficLight
%viz --view=interconnection TrafficLight::TrafficLightSystem
%viz --view=state TrafficLight::TrafficLightController::tlcStateMachine
%viz --view=action TrafficLight::TrafficLightController::setRed

Available views are tree (block-definition-like), interconnection (internal-block-like), state, action, sequence and mixed. Styles can be combined, for example --style stdcolor --style lr for a colored, left-to-right layout, or --style showinherited to include features inherited through :>.

A tree view over a whole package quickly becomes unreadable. %viz accepts several names, so it is usually better to name the elements you care about:

%viz --view=tree --style stdcolor TrafficLight::TrafficLightController TrafficLight::BasicTrafficLightController

Other useful commands in the kernel are %show <Name>, which prints the abstract syntax tree and reveals how a construct was really parsed, and %help for the full list.

Graphical tools#

Eclipse SySON is an open source graphical SysML v2 environment that can import textual models and show editable diagrams. It is heavier than the pilot implementation but more comfortable for browsing a model.

Which to use depends on where the truth lives. If the .sysml file is the source — as it is when it feeds the code generator — the pilot implementation fits better, because it renders from the text without taking ownership of the model.

Importers differ in how much of the language they cover. A construct that the pilot implementation accepts may still be rejected elsewhere; new in a constructor expression (send new PortData(…) via p;) is one example. Where an alternative spelling exists, the simpler one usually travels better between tools — see Ports.