Holarch
課程章節

培訓 · 第 3 單元:行為與架構 · 第 3.5 章,共 6 章

3.5 模擬 2:39

為步驟指定持續時間,播放一次執行,再播放一百次,並對照限制檢查結果。

展示 Holarch 1.27。

您將學到

  • 將動作的持續時間設為固定值或分布
  • 執行一次離散事件模擬,並閱讀時間軸
  • 執行蒙地卡羅研究,並閱讀平均值、分散程度與第 95 百分位數
  • 在所需機率下,對照需求的限制檢查總時間

為 Rent a Bike 的步驟指定持續時間(包括常態分布),在時間軸上執行一次離散事件模擬,執行蒙地卡羅,閱讀租借時間的分散情形,並檢查租借在時間限制內完成的可能性。

專案檔案

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

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

練習

在 Holarch 中於 CubeSat EO-1 示範專案上親自操作。

  1. 開啟您的 EO-1 示範專案,或建立它:管理專案 → 專案檔案 ▾ → 新增示範專案 → CubeSat(引導式系統工程)。
  2. 在資料庫中選取 OPS.11 Receive Downlink(9 分鐘),並將其持續時間設為 =triang.dist(8, 15, 9) 分鐘,以反映有時會拉長的過境。
  3. 開啟行為 → 模擬器,選擇 OPS Run Nominal Imaging Pass 作為根 Action,保留離散事件,然後按 ⏩ 執行到結束。閱讀總時間與時間軸。
  4. 切換到蒙地卡羅,然後按 ▶ 執行蒙地卡羅。在分布分頁上,閱讀總時間的平均值與分散程度。
  5. 按一下對照需求檢查…,保留總時間,設定 ≤ 至多 100 分鐘、需求 6.5 Planning Cycle Time,以及所需機率 (%) 95。閱讀 P5 / P50 / P95、P(meet) 與結果。
  6. 若要進行有檢查的逐步練習,請執行教學課程 8 Simulate the Functional Flow(說明 → 教學課程)。

當檢查顯示 P(meet),以及 6.5 Planning Cycle Time 在 95% 下的通過或失敗結果時,即完成。

自我檢查

  1. 為什麼要為步驟指定分布,而不是固定的持續時間?
  2. 單次離散事件執行能告訴您哪些蒙地卡羅無法告訴您的內容?
  3. 為什麼要對照第 95 百分位數,而不是平均值來檢查?
  4. 「記錄結果」會變更模型中的什麼?
顯示答案
  1. 為什麼要為步驟指定分布,而不是固定的持續時間?

    實際的持續時間會有變化。每次執行都會對分布取樣,因此蒙地卡羅顯示的是總時間的分散情形,而不是單一數字。

  2. 單次離散事件執行能告訴您哪些蒙地卡羅無法告訴您的內容?

    它在時間軸上播放單次執行,讓您看到步驟的順序、平行分支,以及決策選擇了哪個分支。蒙地卡羅則重複執行多次以取得統計數據。

  3. 為什麼要對照第 95 百分位數,而不是平均值來檢查?

    一半的執行會比平均值更久。一個必須在 100 次中有 95 次成立的限制,是依那 95 次執行維持在其下的時間來判斷,也就是 P(meet) 與 P95 所回報的數值。

  4. 「記錄結果」會變更模型中的什麼?

    它會將 Measure 的 Projected Value(或 Value)設為平均值,並將驗證該需求的 Test Case 設為「通過」或「未通過」。您會先審查這些變更,然後以一個復原步驟套用。

延伸閱讀

文字稿

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

Introduction

Welcome back. The action diagram of Rent a Bike says what happens. With durations, Holarch can tell you how long it takes.

In this chapter you put numbers on the steps and simulate them.

Durations

Open Rent a Bike as an action diagram again. Select Identify Rider and set its duration. Riders take different times to find their card, so use a distribution: equals norm dot dist, four, one: a normal distribution with a mean of four seconds and a standard deviation of one.

On screen: Database → F.1 → Open in ▾ → Action Diagram; Identify Rider → Duration.

Check Account depends on the network: a normal distribution around two seconds. Unlocking the bay and showing its number take one second each.

On screen: Check Account, Unlock Bay, Show Bay Number.

Starting the rental takes half a second, and relocking the bay, on the rare branch, one and a half.

On screen: Start Rental, Relock Bay.

One run

Open Behavior, then Simulator, and choose Rent a Bike as the root action. Discrete event mode plays one run on a timeline.

On screen: Behavior → Simulator → root F.1 → Discrete Event → Run to End.

Each step appears when it runs, the two parallel branches side by side, and the decision takes one of its branches with the probability you gave it.

On screen: The timeline.

A hundred runs

One run is one sample. Switch to Monte Carlo and run it: a hundred runs, each drawing every duration from its distribution and every decision from its probabilities.

On screen: Monte Carlo → Run.

The statistics give the mean rental time and its spread, and the 95th percentile: the time that ninety-five rentals in a hundred stay under. A commitment to riders needs that number, not the average.

On screen: Statistics and the time chart.

Check against a limit

Is that fast enough? Choose Check Against Requirement. Compare the total time with a limit: at most ten seconds for the whole rental at the kiosk, met in at least ninety-five runs in a hundred.

On screen: Check Against Requirement → ≤ 10 Seconds, 95 %.

The dialog reports the probability of meeting the limit from the hundred runs, and whether it clears the ninety-five percent you asked for. Record Result can save the check on the model.

On screen: The result.

Recap

Let's recap. You gave the steps durations, played one run on a timeline, ran Monte Carlo, read the spread of rental times, and checked the chance of meeting a limit.

Next, the dock's mass: a budget, and a technical performance measure to track it.