Holarch
コースのチャプター

トレーニング · トラック 9. SysML v2 の基礎 · チャプター 9.7(全 8 チャプター)

9.7 制約と計算 4:26

制約と計算を記述し、単位付きでセダンの値をチェックし、未確定の値をマークします。

Holarch 2.22 の画面です。

学習内容

  • パラメーターを持つ制約定義と計算定義を記述する
  • 制約使用のパラメーターをモデル内の値にバインドする
  • パラメトリックビューで制約の合格と不合格を確認し、「すべて解く」ですべての制約をチェックする
  • TBD と TBR のメタデータで未確定の値をマークし、TBD/TBR 登録簿で見つける
  • 予算と TPM でパートの質量を積み上げる

小さな Hybrid Car プロジェクトで SysML v2 チュートリアル「Constraints and Calculations」に沿って、Holarch で SysML v2 の制約と計算を記述します。制約定義と計算、セダンの値にバインドした制約使用、チェックが不合格になり合格するパラメトリックビュー、すべて解く、分析ケース、TBD と TBR の値とその登録簿、そして予算での質量の積み上げを扱います。SysML は Object Management Group, Inc. の登録商標です。

プロジェクトファイル

  • 完成したプロジェクト (.holarch.json。プロジェクトを管理 → プロジェクトファイル ▾ → プロジェクトをインポート (.json)…)

動画は holarch.app から再生されます。プライバシーポリシーをご覧ください。

演習

Hybrid Car デモプロジェクト(SysML v2)を使って、Holarch で実際に操作します。

  1. Hybrid Car デモプロジェクトを開き(必要に応じて作成します:プロジェクトを管理 → プロジェクトファイル ▾ → 新しいデモプロジェクト → Hybrid Car (SysML v2))、モデル → エディターとパッケージ VehicleRequirements を開きます。
  2. constraint def SpeedLimit の後に、constraint sedanBatteryCheck : MassLimit { in mass = fleet.sedan.powertrain.battery.mass; in limit = 50 [kg]; } を追加します。
  3. ダイアグラムページで+ 新しいダイアグラムをクリックし、パラメトリックビューと、表示内容で VehicleRequirements を選んで作成をクリックします。新しいチェックは合格します。48 kg は 50 kg 以内です。
  4. パッケージ Vehicles で、セダンのバッテリーの質量を 52 [kg] に変更します。ビューにはチェックの不合格が表示されます。⌘Z / Ctrl+Z を押してから、すべて解くをクリックしてすべての制約をもう一度チェックします。
  5. requirement def <'VR-2'> Acceleration で、attribute zeroToHundred : TimeValue; を attribute zeroToHundred : TimeValue { @TBD { owner = "Test lead"; rationale = "The test track is not booked yet."; } } に置き換えます。ニーズと要求 → TBD/TBR を開き、オーナー付きの要求を見つけます。
  6. アーキテクチャ → 予算と TPM を開き、ルートパートを選択…をクリックして sedan を選びます。数量で Mass を選び、バッテリーの 48 kg を見つけます。

パラメトリックビューで sedanBatteryCheck が合格と表示され、TBD/TBR 登録簿にオーナー Test lead の Acceleration 要求が表示されれば完了です。

確認問題

  1. constraint def と calc def の違いは何ですか?
  2. パラメトリックビューの制約に「入力が必要」と表示されています。何が不足していますか?
  3. 値として TBD と書く代わりに、#TBD や @TBD { … } で未確定の値をマークするのはなぜですか?
  4. 分析ケースは計算に何を加えますか?
解答を表示
  1. constraint def と calc def の違いは何ですか?

    制約定義は、mass <= limit のように、パラメーターに対して成り立つか成り立たないかの条件を述べます。計算定義は、return ratio = power / mass; のように値を計算して返します。

  2. パラメトリックビューの制約に「入力が必要」と表示されています。何が不足していますか?

    パラメーターにまだ値がありません。たとえば in mass = fleet.sedan.curbMass; のように、すべてのパラメーターを値にバインドします。

  3. 値として TBD と書く代わりに、#TBD や @TBD { … } で未確定の値をマークするのはなぜですか?

    値の代わりの TBD は有効な SysML ではありません。Holarch の HolarchMetadata パッケージのメタデータを使えばテキストは有効なままです。TBD と TBR は標準の StatusInfo メタデータを特化したものなので、他の SysML v2 ツールはそれらをステータスの注釈として読み取ります。

  4. 分析ケースは計算に何を加えますか?

    セダンなどの対象に計算を適用して結果を返し、Holarch が他の制約と同様に評価する require 制約を含む目的を持ちます。

関連資料

トランスクリプト

トランスクリプトを表示 (ナレーションと画面の内容)

Introduction

Chapter seven: constraints and calculations. They turn the model's values into checks and results that Holarch evaluates with units.

In this chapter you write a constraint and a calculation, bind a check to the sedan's values, see it fail and pass in a Parametric View, run an analysis case, and mark open values.

Start the tutorial

Start the tutorial Constraints and Calculations from Project Files, Start a Tutorial. Its starter project holds the sedan with its engine and battery values, and two targets: the maximum curb mass and the minimum power to weight.

On screen: Project Files ▾ → Start a Tutorial… → SysML v2: Constraints and Calculations → Start; Model → Editor.

Constraints and calculations

A constraint definition states a condition over its parameters. After the constraints comment, write the mass limit: the mass is at most the limit.

On screen: After // ---- Constraints and calculations ----: constraint def MassLimit.

Below it, a calculation: power to weight divides the power by the mass, and returns the ratio.

On screen: Below it: calc def PowerToWeight.

A constraint usage binds each parameter to a value: here, the sedan's curb mass and the maximum curb mass.

On screen: Below it: constraint sedanMassCheck : MassLimit with bound inputs.

The Parametric View

Open the Diagrams page, click New Diagram, and choose Parametric View. Choose the vehicle analysis package under Shows, and click Create.

On screen: Diagrams → + New Diagram → Parametric View; Shows: VehicleAnalysis; Create.

The check shows its expression, with its parameters bound to the values. Fifteen hundred eighty kilograms is within sixteen hundred fifty, so it passes.

On screen: The mass check: pass.

In the Editor, change the sedan's curb mass to seventeen hundred kilograms. Back in the Parametric View, the mass check now fails.

On screen: Model → Editor: curbMass 1580 → 1700; Diagrams → the Parametric View: fail.

Change it back to fifteen hundred eighty in the Editor. In the view, Solve All checks every constraint again, with units.

On screen: Model → Editor: 1700 → 1580; the view → Solve All → Pass; Close.

An analysis case

An analysis case computes a result for a subject. At the end of the package, add the power to weight analysis, and apply it to the sedan. Its objective requires at least the minimum, and the checker evaluates it like any constraint.

On screen: Model → Editor; after sedanMassCheck: analysis def PowerToWeightAnalysis; analysis sedanPowerToWeight.

TBD and TBR

Values that are still open get a mark. First import Holarch's metadata package after the other imports.

On screen: After the imports: private import HolarchMetadata::*;

Then add a charge time requirement. TBR marks the time limit to be reviewed, and TBD marks the charger power to be determined, with an owner, a due date and a rationale. Both come from Holarch's metadata library and specialize the standard status metadata, so other SysML v2 tools see them as status annotations.

On screen: At the end: requirement def <'VR-5'> ChargeTime with #TBR and @TBD.

Open Needs and Requirements, then TBD/TBR. The charge time is listed with the owner and the due date from its metadata. The register only lists them: to change them, edit the metadata in the Editor.

On screen: Needs & Requirements → TBD/TBR; the ChargeTime row with owner and due date.

Budgets

Last, open Architecture, then Budgets, and select the sedan as the root part. The quantity Mass reads each part's mass attribute with its unit: the battery shows the sedan's own forty eight kilograms.

On screen: Architecture → Budgets & TPMs → Select Root Part… → sedan; the battery 48 kg.

Recap

Every step is ticked off. Click Mark as Done.

On screen: Step panel → Mark as Done.

Let's recap. You wrote a constraint and a calculation, bound a check to the sedan's values, saw it fail and pass in a Parametric View, ran an analysis case, marked open values for the register, and rolled up the mass.

Next, variants and configurations describe a product line.