The Webel SysML4Mathematica recipe for modelling Wolfram Language code in Systems Modeling Language (SysML) for Model-Based Systems Engineering

Icon class
icon_class_computed
fas fa-book
Institution

Webel IT Australia is developing a recipe for modelling Wolfram Language code for Mathematica graphically in Systems Modeling Language v1 (SysML®), so far primarily for SysMLv1.6 and SysMLv1.7, but a version of the recipe for SysMLv2 is foreseen. The recipe is intended for use with the MagicDraw SysML Plugin and Magic Model Analyst® (Cameo Simulation Toolkit®) tools.

The SysML4Mathematica diagrams created are primarily for analysis, code organisation, logic tracking, refactoring, and documentation, but some diagrams (depending on the application) are executable in Magic Model Analyst® (Cameo Simulation Toolkit®) , including performing calculations using SysML Parametrics, although that is not the main purpose.

It is not intended that the functionality of the modelled Mathematica code be fully replicated in SysML!

The main aims are:

  • Represent data structures such as Mathematica Associations <||> and Lists {} as SysML Blocks with inter-relationships, and value-adding Stereotypes for metadata.
  • Represent MTools classes (using the 3rd party contributed MTools paclet) as SysML Blocks.
  • Represent the logic and flow of collaborating Mathematica functions using SysML Activity Diagrams, and use these for refactoring of Mathematica code.
  • Represent the dependencies between arguments and results of Mathematica functions graphically using SysML Parametric Diagrams.
  • Represent Mathematica Paclets and their inter-dependencies using SysML Package Diagrams.

Together, these form a compelling way also to document complex Mathematica applications, and have proven very useful in developing and maintaining Mathematica applications, including already a complex application for modelling air conditioning systems and performing heat exchanger calculations.

The main conventions and modelling rules of the recipe are being recorded progressively on this Webel site as Policy Note pages cross-referenced in many cases to examples.

The much longer term goal is to create a complete bridge between Mathematica and SysMLv1.7 and SysMLv2 (which has a built-in Web API for sharing and querying SysMLv2 models across teams).

SysML4 Mathematica public examples

Due to commercial IP restrictions examples of applications to client projects can't be shared on this site.

There are, however, already some public examples of the recipe in use as part of the following annotated slide trail, which presents many SysML Activity Diagrams and SysML Parametric Diagrams that represent Mathematica code:

The part of that trail with SysML4Mathematica examples starts here (the earlier slides just show Mathematica applied to some Psychrometrics scenarios):

Concerning handling units-aware Mathematica Quantities

The Mathematica applications developed by Webel IT Australia make heavy use of the units-aware Quantity algebra system of Mathematica. Recording complex networks of functions and equations that use the Mathematica Quantity as "analysis" diagrams using SysML Activity Diagrams and SysML Parametric Diagrams, and high level views of ConstraintBlocks for Mathematica functions as Block Definition Diagrams (BDDs) has proven very useful especially for traceability, refactoring, representation of networks of equations, and documentation.

However, while a SysMLv1.x ValueType can carry information about units, SysMLv1.x and supporting tools do not directly support units-aware calculations, which has made achieving executability in the SysMLv1.x diagrams problematic (it can be done, but not elegantly, and not without introducing many additional elements not present in the modelled Mathematica code).

Policy Note pages for the Webel SysML4Mathematica modelling recipe

Each Note page has further explanation and is cross-linked to examples on this site:

Notes
Relevant snippets (from other sources)
Visit also
Visit also (backlinks)
Flags