Kurskapitel
Schulung · Reihe 9. SysML-v2-Grundlagen · Kapitel 9.8 von 8
9.8 Varianten und Konfigurationen 3:42
Eine Produktlinie mit Variationspunkten und Regeln schreiben, dazu Konfigurationen, die der Editor prüft.
Zeigt Holarch 2.22.
Das lernen Sie
- Eine Variation mit Varianten schreiben und sie als Variationspunkt einer Produktlinie verwenden
- Einer Produktlinie mit einem assert constraint eine Regel hinzufügen
- Konfigurationen erstellen, die pro Punkt eine Variante wählen, und ihre Urteile lesen
- Ein eigenes Metadaten-Schlüsselwort definieren und es mit `#` anwenden
- Das Modell als eine Konfiguration anzeigen
Schreiben Sie eine SysML-v2-Produktlinie in Holarch, nach dem SysML-v2-Tutorial „Variants and Configurations“ an einem kleinen Hybrid-Car-Projekt: das Variabilitäts-Package von Holarch, eine Variation mit Varianten, eine Produktlinie mit einem Variationspunkt und einer Assertion, Konfigurationen, die der Editor prüft, ein eigenes, durch Metadaten definiertes Schlüsselwort und eine General-Ansicht der Produktlinie. SysML ist eine eingetragene Marke der Object Management Group, Inc.
Projektdateien
- Fertiges Projekt (.holarch.json; Projekte verwalten → Projektdateien ▾ → Projekt importieren (.json)…)
Das Video wird von holarch.app abgespielt; siehe Datenschutzerklärung.
Übung
Führen Sie dies selbst in Holarch durch, am Demoprojekt Hybrid Car (SysML v2).
- Öffnen Sie Ihr Demoprojekt Hybrid Car (erstellen Sie es bei Bedarf: Projekte verwalten → Projektdateien ▾ → Neues Demoprojekt → Hybridauto (SysML v2)), öffnen Sie Modell → Editor und das Package
Vehicles. Es importiert bereitsHolarchVariability. - Fügen Sie in
part def CarLinenach der Variationchargervariation part rims : Wheel { variant part steelRims : Wheel; variant part alloyRims : Wheel { attribute :>> mass = 18 [kg]; } }hinzu. Der Editor vermerkt, dass die drei Konfigurationenrimsnoch nicht gewählt haben. - Fügen Sie nach
wallboxNeedsLargePackdie Regelassert constraint alloyNeedsLargePack { rims == rims::alloyRims implies pack == BatteryPack::largePack }hinzu. - Öffnen Sie Modell → Browser und wählen Sie
selfChargingHybridaus. Wählen Sie im Abschnitt Konfiguration des Inspektors steelRims für rims; wählen Sie alloyRims fürplugInHybridundlongRangeHybrid. Probieren Sie dann alloyRims beiselfChargingHybrid, lesen Sie das Urteil und drücken Sie ⌘Z / Ctrl+Z. - Öffnen Sie das Zeilenmenü (⋯) von
CarLineund wählen Sie Neue Konfiguration…. Nennen Sie siecityHybrid, wählen Sie standardPack, noCharger und steelRims, prüfen Sie, dass das Urteil Gültig lautet, und klicken Sie auf Erstellen. - Klicken Sie in der oberen Leiste auf Anzeigen als ▾ und wählen Sie
cityHybrid, öffnen Sie dann die AnsichtcarLineVariantsaus der Liste Diagramme: Die Varianten, die sie nicht wählt, sind ausgeblendet.
Sie sind fertig, wenn der Abschnitt „Produktlinie“ des Inspektors für CarLine vier Konfigurationen auflistet, alle Gültig, sowie die Regel alloyNeedsLargePack.
Selbsttest
- Was ist der Unterschied zwischen
variation part def BatteryPack { … }undvariation part charger : Component { … }? plugInHybridwähltBatteryPack::standardPackundcharger::wallbox. Was geschieht, und warum?- Eine Konfiguration hat noch nicht für jeden Punkt eine Variante gewählt. Wie lautet ihr Urteil?
- Was können Sie mit
metadata def <safetyCritical> SafetyCriticalschreiben, und wie sehen andere SysML-v2-Werkzeuge es?
Antworten anzeigen
Was ist der Unterschied zwischen
variation part def BatteryPack { … }undvariation part charger : Component { … }?Das Erste ist eine Variation-Definition, eine wiederverwendbare Menge von Auswahlmöglichkeiten: Eine damit typisierte Usage, etwa
part pack : BatteryPack;, ist ein Variationspunkt. Das Zweite ist eine Variation-Usage, ein Punkt, der innerhalb eines einzelnen Entwurfs deklariert ist.plugInHybridwähltBatteryPack::standardPackundcharger::wallbox. Was geschieht, und warum?Die Regel
wallboxNeedsLargePackist verletzt: Sie besagt, dass die Wallbox das große Pack voraussetzt. Das Urteil nennt die Regel, und der Editor meldet die fehlgeschlagene Assertion.Eine Konfiguration hat noch nicht für jeden Punkt eine Variante gewählt. Wie lautet ihr Urteil?
Unvollständig, mit Angabe des offenen Punkts. Solange ein Punkt keine Auswahl hat, ist eine Regel darüber weder erfüllt noch verletzt.
Was können Sie mit
metadata def <safetyCritical> SafetyCriticalschreiben, und wie sehen andere SysML-v2-Werkzeuge es?Der Kurzname wird zu einem Schlüsselwort, wie in
#safetyCritical part controller : Controller;. Es ist eine gewöhnliche Metadata-Usage, daher sehen andere SysML-v2-Werkzeuge es als Metadaten am Part.
Weiterlesen
- Tutorial: Variants and Configurations (SysML-v2-Tutorials)
- Dokumentation: SysML-v2-Varianten und -Konfigurationen, Konzepte
- Dokumentation: SysML-v2-Varianten und -Konfigurationen, Eine Konfiguration erstellen
- Dokumentation: SysML-v2-Textnotation, Variationen, Varianten und Konfigurationen
- Dokumentation: Produktlinien, SysML-v2-Projekte
- Hilfe: Varianten und Konfigurationen
Transkript
Transkript anzeigen (Erzählung und Bildschirminhalt)
Introduction
Chapter eight: variants and configurations. A product line offers choices, and a configuration picks one variant for each choice.
In this chapter you write a variation with variants, a product line with a rule, configurations the Editor checks, and a keyword of your own.
Start the tutorial
Start the tutorial Variants and Configurations from Project Files, Start a Tutorial. Its starter project holds the components, the car and the powertrain.
On screen: Project Files ▾ → Start a Tutorial… → SysML v2: Variants and Configurations → Start; Model → Editor.
Variations
Holarch's variability package lets the Editor check configurations. Import it after the other imports.
On screen: After the imports: private import HolarchVariability::*;
A variation lists the choices offered. Before the powertrain, write the battery pack variation: a standard pack and a large pack, each with its own capacity, and the large one with its own mass.
On screen: After Car: variation part def BatteryPack with two variants.
The product line
Below it, the car line. Its pack is typed by the variation, its charger is a variation point with two variants, and an assertion rules out the wallbox with the standard pack.
On screen: Below BatteryPack: part def CarLine :> Car with pack, charger and the assertion.
Configurations
A configuration is a part of the car line, marked Holarch Configuration. Until it chooses a variant for each point, the Editor notes the points still open.
On screen: Below CarLine: part plugInHybrid : CarLine { @HolarchConfiguration; }
Inside the plug-in hybrid, choose the standard pack and the wallbox. The assertion fails: the wallbox needs the large pack.
On screen: In plugInHybrid: pack = BatteryPack::standardPack; charger = charger::wallbox; the assertion error.
Choose the large pack instead, and the configuration checks.
On screen: standardPack → largePack; No problems.
Add a second configuration: a self-charging hybrid, with the standard pack and no charger.
On screen: Below plugInHybrid: part selfChargingHybrid : CarLine.
A keyword of your own
You can also define keywords of your own. At the end of the package, add a metadata definition. Its short name, safety critical, becomes a keyword.
On screen: After Powertrain: metadata def <safetyCritical> SafetyCritical.
In the powertrain, put the keyword before the controller, after a number sign. Other SysML v2 tools see it as ordinary metadata.
On screen: In Powertrain: #safetyCritical part controller : Controller;
The General View
Open Architecture, then General Views, and click New Diagram. Keep General View, choose the Vehicles package under Shows, and click Create.
On screen: Architecture → General Views → + New Diagram; Shows: Vehicles; Create.
The battery pack is marked variation in its heading.
On screen: BatteryPack: «variation part def».
Recap
Every step is ticked off. Click Mark as Done.
On screen: Step panel → Mark as Done.
Let's recap. You imported Holarch's variability package, wrote a variation with variants and a product line with a rule, built configurations that the Editor checks, and defined a keyword of your own.
That completes SysML v2 Fundamentals.