Importing a model from “A Practical Guide to SysML (2nd edition)” for use in Sparx EA

Morgan Kauffmann has published the second edition of “A Practical Guide to SysML” by Sanford Friedenthal, Alan Moore and Rick Steiner (ISBN 978-0-12-385206-9). The authors have made a very complete selection of supporting materials available for download from http://www.elsevierdirect.com/v2/companion.jsp?ISBN=9780123852069.

These companion resources include the “Air Compressor”, “Automobile”, “Distiller”, and “Security System” example models, as described in the book. Unfortunately, the model files are only available in MagicDraw tool format (although the authors have also provided HTML reports for use by anyone who do not have access to MagicDraw). I decided to try importing the files into Sparx Enterprise Architect version 10, to support my work at Dunstan Thomas.

After you use a tool like 7-zip (http://www.7-zip.org) to extract the archive, you will see that the files have a “.mdxml” extension. Opening one of them in your favourite text editor will confirm that they are in XML format, based on the XMI 2.1 specification (http://schema.omg.org/spec/XMI/2.1), and also including some proprietary extensions to support the SysML profile (such ashttp://www.magicdraw.com/schemas/SysML_Profile_Extensions.xmi).

Here is a step-by-step breakdown of how I imported the “Air Compressor” example model into Sparx Enterprise Architect version 10:

  1. Despite the proprietary extensions, the model files are basically XMI, and so I simply changed/renamed the file extension from “.mdxml” to “.xml” (changing to “.xmi” also works).
  2. Either open a new project in Sparx Enterprise Architect, or at least add a new model into your working repository [right-click in the Project Browser and then select Add Model (root node)…].
  3. Rename the model to AirCompressor.
  4. Right-click AirCompressor (in the Project Browser), and then clickImport Model from XMI…
  5. The Import Package from XMI window is displayed. Click the ellipsis button alongside the Filename field and browse to the “Air Compressor-OMG Style_ReadOnly (from Alan).xml” model file. Did you remember to change/rename the “.mdxml” to “.xml” file extension first?
  6. Select Import DiagramsWrite Log file and Import using single transaction, and then click Import.
  7. Once the import has been completed, you can close the Import Package from XMI window.

You now have the model imported into Sparx Enterprise Architect, but you need to reorganize the model, and convert the diagrams and model elements to the SysML 1.3 profile. The outline steps for how to do this are:

  1. Looking inside the Project Browser, you can see a<<numberOwner>> Data view has been created beneath theAirCompressor model. This view contains two packages,<<model>> Air Compressor Model and MBSE Method, that are useful. There are also several spurious Package or <<profile>> Package elements that can be deleted.
  2. Continuing to work in the project browser, right-click AirCompressorand then select Add | Add View…
  3. Create each of Behaviour (Dynamic View), Parametrics (Class View), Requirements (Simple View) and Structure (Class View) in turn. Also create a “MBSE Method” (Dynamic View), if wanted.
  4. Work your way down through the <<model>> Air Compressor Model package hierarchy, changing each diagram to the relevant SysML 1.3 type. For example:
    1. Open the Figure Map, and then click Diagram | Advanced | Change Type…
    2. The Change Diagram Type window is displayed. Click SysML 1.3,Package, and then OK.
    3. Even after converting all of the diagrams to SysML 1.3 types, it is still necessary to synchronize the model elements. To do this work your way through the various SysML tool palettes and:
      1. Right-click each element in the SysML tool palette, and selectSynchronize Stereotype if available. The Synch Profiled Elements window is displayed. Click OK.
      2. The Actions list will display a list of the elements that have had new tags or constraints added as a result of applying synchronizing the stereotype.
      3. Finally, move the converted elements underneath appropriate Behaviour, Parametrics, Requirements or Structure view. You can then delete any remaining superfluous packages that were created during the import.

Although this importing method is faster than manually recreating the example models from scratch, some manual editing is still necessary to:

  1. Fine-tune the layout and look of the example diagrams.
  2. Further change some of the SysML 1.3 diagram types to better represent the example models. For example, you can replace an instance of a Constraint Blocks with a Constraint Property.
Previous Next
0 comments