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 as http://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:
- 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).
- 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)…].
- Rename the model to AirCompressor.
- Right-click AirCompressor (in the Project Browser), and then click Import Model from XMI…
- 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?
- Select Import Diagrams, Write Log file and Import using single transaction, and then click Import.
- 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:
- Looking inside the Project Browser, you can see a <<numberOwner>> Data view has been created beneath the AirCompressor 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.
- Continuing to work in the project browser, right-click AirCompressor and then select Add | Add View…
- 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.
- Work your way down through the <<model>> Air Compressor Model package hierarchy, changing each diagram to the relevant SysML 1.3 type. For example:
- Open the Figure Map, and then click Diagram | Advanced | Change Type…
- The Change Diagram Type window is displayed. Click SysML 1.3, Package, and then OK.
- 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 1.3 tool palettes and:
- Right-click each element in the SysML tool palette, and then select Synchronize Stereotype if available. The Synch Profiled Elements window is displayed. Click OK.
- 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.
- 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:
- Fine-tune the layout and look of the example diagrams.
- 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 Block with a Constraint Property.
In addition, some information does not make it intact through the import process. For example, it is necessary to manually add content into the ID and Text tagged values of the requirement elements. Some of the diagrams do not contain any elements, and this also has to be manually repaired. Problems of this kind are largely related to each tool vendor’s interpretation of the OMG XMI specification itself, and are typically encountered whenever an attempt is made to move XMI between different implementations.