コースのチャプター
トレーニング · トラック 9. SysML v2 の基礎 · チャプター 9.8(全 8 チャプター)
9.8 バリアントと構成 3:42
バリエーションポイントとルールを持つプロダクトラインと、エディターがチェックする構成を記述します。
Holarch 2.22 の画面です。
学習内容
- バリアントを持つバリエーションを記述し、プロダクトラインのバリエーションポイントとして使う
- assert constraint でプロダクトラインにルールを追加する
- ポイントごとに 1 つのバリアントを選ぶ構成を作成し、その判定を読む
- 独自のメタデータキーワードを定義し、`#` で適用する
- モデルを 1 つの構成として表示する
小さな Hybrid Car プロジェクトで SysML v2 チュートリアル「Variants and Configurations」に沿って、Holarch で SysML v2 のプロダクトラインを記述します。Holarch の可変性パッケージ、バリアントを持つバリエーション、バリエーションポイントとアサーションを持つプロダクトライン、エディターがチェックする構成、メタデータで定義する独自のキーワード、そしてプロダクトラインの General View を扱います。SysML は Object Management Group, Inc. の登録商標です。
プロジェクトファイル
- 完成したプロジェクト (.holarch.json。プロジェクトを管理 → プロジェクトファイル ▾ → プロジェクトをインポート (.json)…)
動画は holarch.app から再生されます。プライバシーポリシーをご覧ください。
演習
Hybrid Car デモプロジェクト(SysML v2)を使って、Holarch で実際に操作します。
- Hybrid Car デモプロジェクトを開き(必要に応じて作成します:プロジェクトを管理 → プロジェクトファイル ▾ → 新しいデモプロジェクト → Hybrid Car (SysML v2))、モデル → エディターとパッケージ
Vehiclesを開きます。このパッケージはすでにHolarchVariabilityをインポートしています。 part def CarLineで、chargerのバリエーションの後にvariation part rims : Wheel { variant part steelRims : Wheel; variant part alloyRims : Wheel { attribute :>> mass = 18 [kg]; } }を追加します。エディターは、3 つの構成がまだrimsを選んでいないことを示します。wallboxNeedsLargePackの後に、ルールassert constraint alloyNeedsLargePack { rims == rims::alloyRims implies pack == BatteryPack::largePack }を追加します。- モデル → ブラウザーを開き、
selfChargingHybridを選択します。インスペクターの構成セクションで、rims に steelRims を選び、plugInHybridとlongRangeHybridには alloyRims を選びます。次にselfChargingHybridで alloyRims を試し、判定を読んでから ⌘Z / Ctrl+Z を押します。 CarLineの行メニュー(⋯)を開き、新しい構成…を選びます。名前をcityHybridにして、standardPack、noCharger、steelRims を選び、判定が Valid であることを確認して作成をクリックします。- トップバーの表示形式 ▾をクリックして
cityHybridを選び、ダイアグラムの一覧からビューcarLineVariantsを開きます。選ばれていないバリアントは非表示になります。
インスペクターの CarLine のプロダクトラインセクションに 4 つの構成(すべて Valid)とルール alloyNeedsLargePack が表示されれば完了です。
確認問題
variation part def BatteryPack { … }とvariation part charger : Component { … }の違いは何ですか?plugInHybridはBatteryPack::standardPackとcharger::wallboxを選んでいます。どうなりますか?それはなぜですか?- ある構成が、まだすべてのポイントでバリアントを選んでいません。その判定は何ですか?
metadata def <safetyCritical> SafetyCriticalによって何を記述できるようになり、他の SysML v2 ツールはそれをどう扱いますか?
解答を表示
variation part def BatteryPack { … }とvariation part charger : Component { … }の違いは何ですか?前者はバリエーション定義で、再利用できる選択肢の集合です。
part pack : BatteryPack;のようにそれで型付けされた使用が、バリエーションポイントになります。後者はバリエーション使用で、1 つの設計の中で宣言されたポイントです。plugInHybridはBatteryPack::standardPackとcharger::wallboxを選んでいます。どうなりますか?それはなぜですか?ルール
wallboxNeedsLargePackが破られます。このルールは、wallbox なら大容量パックであることを要求しています。判定はそのルールを示し、エディターは失敗したアサーションを報告します。ある構成が、まだすべてのポイントでバリアントを選んでいません。その判定は何ですか?
Incomplete で、未選択のポイントが示されます。ポイントに選択がない間、それに関するルールは満たされも破られもしません。
metadata def <safetyCritical> SafetyCriticalによって何を記述できるようになり、他の SysML v2 ツールはそれをどう扱いますか?#safetyCritical part controller : Controller;のように、短縮名がキーワードになります。通常のメタデータ使用なので、他の SysML v2 ツールはそれをパート上のメタデータとして扱います。
関連資料
トランスクリプト
トランスクリプトを表示 (ナレーションと画面の内容)
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.