To better understand the usability of the smart packages, please see the following case studies.
Case study #1: Gathering use cases
The case study uses the sample project use case diagram.mdzip, which can be found in <MagicDraw installation folder>\samples\diagrams.
For example, we have a lot of use cases owned by different system boundaries in the project.
We need all these use cases to be in a single package, except for several particular ones. Also, we need all newly created use cases to be automatically included into this package.
In this case, the smart packages feature is very useful. We will create a smart package with dynamic contents to gather all use cases in the model, then demonstrate how it manages further changes in the model. Finally, we will create a snapshot of the smart package to have a static list of use cases as a milestone of the model development.
To accomplish this, do the following:
- Create a smart package named All Use Cases.
- Define the criteria for gathering the contents of the smart package. Specify the search options to find all use case type elements from the root package Data.
- Expand the contents of the smart package All Use Cases.
- Exclude use cases Change password and Change system settings from the contents. See the contents of the smart package shortened.
- Open the Specification window of the smart package and see the excluded use cases in the cell of the Excluded Elements property value.
- Drag use cases Change password and Change system settings to the smart package. See them in the contents of the smart package again.
- Open the Specification window of the smart package again and see these manually included use cases in the cell of the Additional Elements property value. Elements excluded from the contents appear in it after being manually added.
- Create a new use case named Filter by author under the system boundary Item Browser. See the new use case in the smart package All Use Cases.
- Create a snapshot of the smart package All Use Cases to have a static list of use cases as a milestone of the model development.
- Expand the contents of the snapshot and see that it equals the contents of the smart package All Use Cases.
Case study #2: Performing the requirements coverage analysis
The case study uses the sample project hybrid sport utility vehicle.mdzip, which can be found in <MagicDraw installation folder>\samples\SysML, if the SysML plugin is installed.
Here is another case where the smart package feature is very helpful: we need to have all unsatisfied requirements in a separate package. Also, we need requirements to automatically disappear from this package after becoming satisfied.
We will create a smart package with dynamic contents to gather all the unsatisfied requirements in the model and a dependency matrix for performing the requirements coverage analysis. Then we will demonstrate how both the smart package and the dependency matrix reflect the transition of a requirement to satisfy.
Let’s do the following:
- Create a smart package named Unsatisfied Requirements.
To gather the contents of the smart package, add a new script operation (in the Expert mode of the Query dialog) and define the following OCL 2.0 expression as the criteria:
- Expand the contents of the smart package Unsatisfied Requirements.
- Create a dependency matrix and define the following criteria:
- Specify Requirement as the row element type
- Specify Block as the column element type
- Specify the smart package Unsatisfied Requirements as the row scope
- Specify the package HSUV Structure as the column scope
- Specify the Satisfy relationship as dependency criteria
- In the Direction drop-down list, select Column to row.
- On the dependency matrix, create a Satisfy relationship between the block BrakePedal and the requirement Braking.
The requirement becomes satisfied and thus disappears from the contents of the smart package Unsatisfied Requirements and from the dependency matrix as well.
Case Study #3: Configuration management of the complex system - creating dynamic configuration catalogs
The efficient configuration management process is a challenge in the evolution of any industrial scale product family. Smart packages are a real-life out of the box solution supporting the configuration management approach.
Now study the case that illustrates the efficient management of the complex system configurations with the help of smart packages. We have a library (static package) of system components, which we need to see in several different views of the model, that is, catalogs, according to their characteristics. Using the catalogs will not extend the scope of the model, since they do not require duplication of the elements.
We will create two dynamic system configuration catalogs, that is, smart packages with dynamic contents, to gather the servers from the library TI Hardware according to the configuration version defined in a tag value of their specification.
Do the following:
- Create two packages: TI12 Catalog and TI14 Catalog.
- In each package, create a smart package named Servers.
- Define criteria for gathering the contents of the smart package Servers in TI12 Catalog. Specify search options to find in the package TI Hardware, all block type elements with tag value Used In=TI12.
- Define criteria for gathering the contents of the smart package Servers in TI14 Catalog. Specify search options to find in the package TI Hardware, all block type elements with tag value Used In=TI14.
Expand the contents of both smart packages.
The block SUN FIRE T1000 appears in both TI12 Catalog and TI14 Catalog, since it has both tag values Used In=TI12 and Used In=TI14.
Also, you can add a block to a smart package manually. Just drag the block to the smart package.