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 分钟),将其 Duration 设为 =triang.dist(8, 15, 9) Minutes,以反映有时会延长的过境。
  3. 打开 行为 → 仿真器,选择 OPS Run Nominal Imaging Pass 作为 根 Action,保留 离散事件,然后按 ⏩ 运行到结束。查看 总时间 和时间线。
  4. 切换到 蒙特卡洛,然后按 ▶ 运行蒙特卡洛。在 分布 标签页上查看总时间的均值和离散程度。
  5. 单击 对照需求检查…,保留 总时间,设置 ≤ 最多 100 分钟、需求 6.5 Planning Cycle Time,以及 所需概率 (%) 95。查看 P5 / P50 / P95、P(meet) 和 结果。
  6. 如需带检查的分步演练,请运行教程 8“仿真功能流程”(帮助 → 教程)。

当检查显示 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 设为 Passed 或 Failed。您先审查这些更改,它们作为一个撤销步骤应用。

延伸阅读

文字稿

显示文字稿 (旁白和屏幕内容)

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.