Chapitres du cours
Formation · Parcours 9. Les fondamentaux de SysML v2 · Chapitre 9.8 sur 8
9.8 Variantes et configurations 3:42
Écrire une ligne de produits avec des points de variation et des règles, et des configurations que l'Éditeur contrôle.
Montre Holarch 2.22.
Ce que vous allez apprendre
- Écrire une variation avec des variantes et l'utiliser comme point de variation d'une ligne de produits
- Ajouter une règle à une ligne de produits avec un assert constraint
- Créer des configurations qui choisissent une variante par point, et lire leurs verdicts
- Définir votre propre mot-clé de métadonnée et l'appliquer avec `#`
- Afficher le modèle selon une seule configuration
Écrivez une ligne de produits SysML v2 dans Holarch, en suivant le tutoriel SysML v2 Variants and Configurations sur un petit projet Hybrid Car : le package de variabilité de Holarch, une variation avec des variantes, une ligne de produits avec un point de variation et une assertion, des configurations que l'Éditeur contrôle, un mot-clé personnel défini par une métadonnée, et une Vue générale de la ligne de produits. SysML est une marque déposée d'Object Management Group, Inc.
Fichiers de projet
- Projet terminé (.holarch.json ; Gérer les projets → Fichiers de projet ▾ → Importer un projet (.json)…)
La vidéo est diffusée depuis holarch.app ; voir la Politique de confidentialité.
Pratique
Faites-le vous-même dans Holarch, sur le projet de démonstration Hybrid Car (SysML v2).
- Ouvrez votre projet de démonstration Hybrid Car (créez-le si besoin : Gérer les projets → Fichiers de projet ▾ → Nouveau projet de démonstration → Hybrid Car (SysML v2)), ouvrez Modèle → Éditeur et le package
Vehicles. Il importe déjàHolarchVariability. - Dans
part def CarLine, après la variationcharger, ajoutezvariation part rims : Wheel { variant part steelRims : Wheel; variant part alloyRims : Wheel { attribute :>> mass = 18 [kg]; } }. L'Éditeur signale que les trois configurations n'ont pas encore choisirims. - Après
wallboxNeedsLargePack, ajoutez la règleassert constraint alloyNeedsLargePack { rims == rims::alloyRims implies pack == BatteryPack::largePack }. - Ouvrez Modèle → Navigateur et sélectionnez
selfChargingHybrid. Dans la section Configuration de l'inspecteur, choisissez steelRims pour rims ; choisissez alloyRims pourplugInHybridetlongRangeHybrid. Essayez ensuite alloyRims surselfChargingHybrid, lisez le verdict et appuyez sur ⌘Z / Ctrl+Z. - Ouvrez le menu de ligne (⋯) de
CarLineet choisissez Nouvelle configuration…. Nommez-lacityHybrid, choisissez standardPack, noCharger et steelRims, vérifiez que le verdict est Valide et cliquez sur Créer. - Cliquez sur View as ▾ dans la barre supérieure et choisissez
cityHybrid, puis ouvrez la vuecarLineVariantsdepuis la liste Diagrammes : les variantes qu'elle ne choisit pas sont masquées.
C'est terminé quand la section Ligne de produits de l'inspecteur pour CarLine liste quatre configurations, toutes Valides, et la règle alloyNeedsLargePack.
Vérifiez vos connaissances
- Quelle est la différence entre
variation part def BatteryPack { … }etvariation part charger : Component { … }? plugInHybridchoisitBatteryPack::standardPacketcharger::wallbox. Que se passe-t-il, et pourquoi ?- Une configuration n'a pas encore choisi de variante pour chaque point. Quel est son verdict ?
- Qu'est-ce que
metadata def <safetyCritical> SafetyCriticalvous permet d'écrire, et comment les autres outils SysML v2 le voient-ils ?
Afficher les réponses
Quelle est la différence entre
variation part def BatteryPack { … }etvariation part charger : Component { … }?La première est une définition de variation, un ensemble réutilisable de choix : un usage typé par elle, comme
part pack : BatteryPack;, est un point de variation. La seconde est un usage de variation, un point déclaré à l'intérieur d'une seule conception.plugInHybridchoisitBatteryPack::standardPacketcharger::wallbox. Que se passe-t-il, et pourquoi ?La règle
wallboxNeedsLargePackest enfreinte : elle dit que la wallbox implique la grande batterie. Le verdict nomme la règle, et l'Éditeur signale l'assertion en échec.Une configuration n'a pas encore choisi de variante pour chaque point. Quel est son verdict ?
Incomplete, en nommant le point ouvert. Tant qu'un point n'a pas de choix, une règle qui le concerne n'est ni respectée ni enfreinte.
Qu'est-ce que
metadata def <safetyCritical> SafetyCriticalvous permet d'écrire, et comment les autres outils SysML v2 le voient-ils ?Le nom court devient un mot-clé, comme dans
#safetyCritical part controller : Controller;. C'est un usage de métadonnée ordinaire : les autres outils SysML v2 le voient comme une métadonnée sur la part.
Pour aller plus loin
- Tutoriel : Variants and Configurations (tutoriels SysML v2)
- Docs : Variantes et configurations SysML v2, concepts
- Docs : Variantes et configurations SysML v2, créer une configuration
- Docs : Notation textuelle SysML v2, variations, variantes et configurations
- Docs : Lignes de produits, projets SysML v2
- Aide : Variantes et configurations
Transcription
Afficher la transcription (narration et contenu de l'écran)
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.