Holarch
課程章節

培訓 · 第 9 單元:SysML v2 基礎 · 第 9.6 章,共 8 章

9.6 驗證與可追溯性 3:32

撰寫驗證案例、閱讀 RVTM、在矩陣中追溯一個步驟,並衍生一個需求。

展示 Holarch 2.22。

您將學到

  • 撰寫具有目標與判定的驗證定義,並將它套用到主體
  • 在驗證案例頁面上記錄步驟與結果
  • 在 RVTM 中閱讀需求的驗證案例與狀態
  • 在可追溯性矩陣中將需求追溯到動作
  • 以 Derivation 連接從一個需求衍生出另一個需求

在 Holarch 中驗證並追溯 SysML v2 需求,依循 SysML v2 教學課程 Verification and Traceability,以一個小型 Hybrid Car 專案進行:目標驗證某個需求的驗證定義、套用到轎車的驗證用法、驗證案例頁面與 RVTM、在可追溯性矩陣中建立的 satisfy、需求之間的衍生關係,以及模型檢查。SysML 是 Object Management Group, Inc. 的註冊商標。

專案檔案

  • 完成的專案 (.holarch.json;管理專案 → 專案檔案 ▾ → 匯入專案 (.json)…)

影片從 holarch.app 播放;請參閱隱私權政策。

練習

在 Holarch 中於 Hybrid Car 示範專案(SysML v2)上親自操作。

  1. 開啟您的 Hybrid Car 示範專案(如有需要請建立:管理專案 → 專案檔案 ▾ → 新增示範專案 → Hybrid Car (SysML v2)),開啟模型 → 編輯器以及套件 VehicleRequirements。
  2. 在 verification <'VC-1.1'> sedanWeighing 之後新增 verification def <'VC-2'> BatteryWeighing { subject battery : Battery; objective { verify batteryMassLimit; } return verdict : Boolean = battery.mass <= 50 [kg]; } 與 verification <'VC-2.1'> sedanBatteryWeighing : BatteryWeighing { subject battery = fleet.sedan.powertrain.battery; }。
  3. 開啟驗證 → 驗證案例。在新案例的列中按一下 + 步驟,接著按 + 新增步驟,在動作下輸入 Weigh the battery on a bench scale,按一下套用,然後在其狀態按鈕中按一下通過。
  4. 開啟驗證 → RVTM,找到 VR-6 batteryMassLimit 以及新案例與其狀態。
  5. 開啟驗證 → 可追溯性矩陣,以需求作為列、類別 動作 作為欄,按一下 sedanAcceleration 與 accelerate 交會的儲存格,然後選擇 satisfied by。
  6. 在套件末尾新增 requirement <'VR-9'> tankVolume { doc /* The fuel tank shall hold at least 40 L. */ subject tank : FuelTank; } 與 connection tankDerivation : Derivation connect carSpec.sedanRange to tankVolume;。然後開啟驗證 → 模型檢查。

當 RVTM 將新案例列在 VR-6 下且為通過、編輯器包含新的 satisfy 與 tankDerivation,且狀態回報沒有問題時,即完成。

自我檢查

  1. 在 objective massObjective { verify carSpec.sedanMass; } 中,verify 表達了什麼?您在哪裡看到它?
  2. 驗證案例的 verdict 與驗證案例頁面上的狀態有什麼不同?
  3. 什麼時候使用 satisfy,什麼時候使用 Derivation?
  4. 在可追溯性矩陣的儲存格中選擇 satisfied by 時,會發生什麼事?
顯示答案
  1. 在 objective massObjective { verify carSpec.sedanMass; } 中,verify 表達了什麼?您在哪裡看到它?

    表示這個驗證案例驗證需求 sedanMass。RVTM 會將該案例列在該需求下。

  2. 驗證案例的 verdict 與驗證案例頁面上的狀態有什麼不同?

    verdict 是模型的一部分:一個運算式,此處為整備質量是否在限制內。步驟、結果以及測試執行的狀態則是保存在模型旁的 Holarch 資料。

  3. 什麼時候使用 satisfy,什麼時候使用 Derivation?

    satisfy 表示某個設計元素(例如零件或動作)滿足一個需求。Derivation 將原始需求連接到由它衍生的需求;它需要 private import RequirementDerivation::*;。

  4. 在可追溯性矩陣的儲存格中選擇 satisfied by 時,會發生什麼事?

    Holarch 會將 satisfy 寫入 SysML 文字,因此追溯成為模型的一部分,並顯示在編輯器中。

延伸閱讀

文字稿

顯示文字稿 (旁白與畫面內容)

Introduction

Chapter six: verification and traceability. A verification case says how a requirement is checked, and traceability shows what connects to what.

In this chapter you write a verification case and apply it to the sedan, check the RVTM, trace a step to a requirement in the matrix, and derive a requirement.

Start the tutorial

Start the tutorial Verification and Traceability from Project Files, Start a Tutorial. Its starter project holds the curb mass requirement and the car specification, a short drive cycle, and two more requirements: a battery mass limit and stopping from cruise.

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

Verification cases

After the verification comment, write the verification definition. Its objective names the requirement it verifies, and its verdict passes when the curb mass is within the limit.

On screen: After // ---- Verification ----: verification def <'VC-1'> CurbMassTest.

Below it, apply it to the sedan: a verification usage that weighs the sedan of the fleet.

On screen: Below it: verification <'VC-1.1'> sedanWeighing : CurbMassTest.

Open Verification, then Verification Cases. The model's verification cases are the test cases here. Steps, results and status are Holarch data next to the model, kept on this page.

On screen: Verification → Verification Cases; the Sedan Weighing row.

In the Sedan Weighing row, click Steps, then Add Step. Type weigh the car as the action, and click Apply.

On screen: + Steps → + Add Step; Action: Weigh the car; Apply.

Then set the result: click Passed in its status buttons.

On screen: Status buttons → Passed.

Open the RVTM. Each requirement is listed with its verification method, the cases that verify it, and their status.

On screen: Verification → RVTM.

Traceability

Now trace a step to a requirement. Open the Traceability Matrix. Its rows are the requirements; open Columns, and choose the class Action.

On screen: Verification → Traceability Matrix; rows: Requirement; Columns: class Action; Done.

Click the cell where stop from cruise meets the brake step, and choose satisfied by. Holarch writes a satisfy into the text.

On screen: Cell stopFromCruise × brake → satisfied by.

In the Editor, the satisfy is there. To derive a requirement, first import the requirement derivation package after the other imports.

On screen: Model → Editor: the new satisfy; import RequirementDerivation.

Then, at the end of the package, connect the sedan's mass requirement to the battery mass limit with a derivation: the battery limit is derived from the curb mass requirement.

On screen: After sedanWeighing: connection batteryMassDerivation : Derivation connect carSpec.sedanMass to batteryMassLimit;

Last, open Verification, then Model Checks. Rules run over the whole model, for example requirements without a satisfy or a verify, and each finding links to its element.

On screen: Verification → Model Checks.

Recap

Every step is ticked off. Click Mark as Done.

On screen: Step panel → Mark as Done.

Let's recap. You wrote a verification case with an objective and a verdict, applied it to the sedan, opened the Verification Cases and the RVTM, traced a step to a requirement in the matrix, and derived one requirement from another.

Next, constraints and calculations evaluate the sedan's values.