How to select a single configuration from a variant model?
In a previous post I’ve described an approach how to model variants with SysML (Variant Modeling with SysML). Modeling variants leads to a model that represents a multidimensional configuration space. It is a description of each variant, the common elements and the relationships between them in a single model.
A single configuration is a valid selection of variants that together with the common elements represents a complete system (in a specific configuration). Today unfortunately there is no explicit tool support in standard SysML modeling tools for variant modeling. You can download the SYSMOD profile that includes stereotypes for variant modeling. But there are no special functions in the tools that helps to select a valid configuration. Probably that’ll change with SysML 1.4. It is planned to incorporate variant modeling elements in the new version of SysML and we currently work on a concept.
There are two orthogonal concepts how to get the single configuration from the complete model: the view versus copy strategy and the filter versus transformation strategy.
Filter versus transformation strategy
The filter strategy simply removes all unused elements from the complete configuration space model to get the single system model. The resulting model still contains information about the variant modeling, e.g. the package structure or generalization relationships that are used between the variant and the core elements.
The transformation strategy refactors the model so that there is no more overhead from the variant modeling in the system model. For example it merges the elements of a generalization relationship between the core and variant elements.
View versus copy strategy
This strategies describe how to provide the single system model. The view strategy creates a view on the complete configuration space model that shows only the elements from the selected configuration.
The copy strategy creates a copy of the original model that only contains the elements from the selected configuration. Any changes will not have an effect on the original model.
Filter and view strategy with MagicDraw
Although the modeling tool MagicDraw from NoMagic doesn’t provide special function for variant modeling, you can use the common function to apply the filter and view strategy. Let’s take a simple model example. The figure below shows the high level package structure. The Core package contains all elements that are valid for all system configurations. The variations package includes all the specific variant elements. It is essential to separate the core from the variant elements. Note that the core package and each variant package is a module.
The package System configurations is used to select a single configuration. Create a package for each configuration and export it again as a module.
The next figure shows how to select a configuration in a package diagram. Model a trace relationship from the configuration package to the core package and to each variant package that should be part of the configuration.
It would be necessary to develop additional checks as a tool extension to consider the variant constraints like xor or requires between the selected variants. There is no way to do this with the standard functions of the tool.
Now select the system configuration package, open the context menu and click on “Open Module As Project”.
It opens the module with all dependent packages, i.e. the core package and the selected variant packages. All unused variants are filtered out (filter strategy). The packages are still associated with the original module files. All changes will apply the original model (view strategy). To use the copy strategy just create a copy of each module file.
From the language perspective it is possible to model variants and configurations (see Variant Modeling with SysML). SysML in combination with a profile like the SYSMOD profile is a comprehensive set of model elements for variants and more. What’s missing is the tool support for special variant modeling functions. With SysML 1.4 and explicit standardized model elements the tools will hopefully also provide variant modeling support. However you can use the standard functions of the tools to variant modeling already today as shown above.