课程章节
培训 · 课程 3. 行为和架构 · 第 3.2 章,共 6 章
3.2 Action 图 2:55
将一个功能分解为若干步骤,包括并行分支、决策以及触发某一步骤的条目。
演示 Holarch 1.27。
您将学到
- 将功能作为 Action 图打开,并将 Action 拖到连线上以添加步骤
- 添加并行分支和决策,各分支概率之和为 100%
- 创建一个 Input/Output,由一个步骤生成、另一个步骤作为触发器接收
- 说明图上的步骤如何成为模型中的 Action
将 Rent a Bike 作为 Action 图打开,并在画布上构建其步骤:串行动作、一个并行分支、一个带分支概率的决策,以及一个由某一步骤产生、另一步骤接收的输入/输出条目。
练习
在 Holarch 中基于 CubeSat EO-1 演示项目亲自完成此操作。
- 打开您的 EO-1 演示项目,或创建它:管理项目 → 项目文件 ▾ → 新建演示项目 → CubeSat(引导式系统工程)。
- 在数据库中选择 F10 Enter Safe Mode,然后选择 打开方式 ▾ → Action 图。
- 将 Action 从 添加 面板拖到连线上,并将其命名为
Detect Undervoltage。然后在其后将一个 Parallel 拖到连线上,一个分支放Shed Payload Loads,另一个分支放Point Arrays to Sun。 - 在 Parallel 之后将一个 Or 拖到连线上,并将其命名为
Battery recovered?。在属性面板中将分支概率设为 80 和 20,并在第一个分支放Resume Nominal Mode,在第二个分支放Keep Charging。 - 将 Input/Output 拖到 Detect Undervoltage 上,并将其命名为
Undervoltage Flag。将 I/O 下方的手柄拖到 Shed Payload Loads 上,然后选择 Input(触发器)。
当 F10 的图显示五个步骤、并行分支、Total 为 100% 的 OR,以及 Undervoltage Flag 从 Detect Undervoltage 传递到 Shed Payload Loads 时,即完成练习。
自测
- 将 Action 放到连线上会向模型添加什么?
- 触发输入与可选输入有什么区别?
- 为什么 OR 的各分支概率之和必须为 100%?
显示答案
将 Action 放到连线上会向模型添加什么?
一个新的 Action,在该图所属功能之下分解,位于其流程中的相应位置。它会出现在数据库以及显示它的每个视图中。
触发输入与可选输入有什么区别?
带有触发输入的步骤要等到该条目到达后才会开始。可选输入会被接收,但不会阻止该步骤开始。
为什么 OR 的各分支概率之和必须为 100%?
仿真器按概率选择分支。如果数值之和不是 100%,属性面板会发出警告。如果概率未知,请选择 None:仿真器会在运行过程中询问,蒙特卡洛则使用相等的概率。
延伸阅读
文字稿
显示文字稿 (旁白和屏幕内容)
Introduction
Welcome back. This chapter takes one function, Rent a Bike, and draws what happens inside it, step by step.
You will build an action diagram on the canvas, from the Add panel.
The canvas
Open the Database, select Rent a Bike, and choose Open in, then Action Diagram. The canvas starts with a start, an end, and the line between them. The Add panel on the left holds the building blocks.
On screen: Database → F.1 → Open in ▾ → Action Diagram.
Steps in order
Drag an Action onto the line, and name it Identify Rider. The rider taps a card or a phone at the kiosk.
On screen: Action → line → Identify Rider.
The next step drops onto the line after it: Check Account. The back office confirms the rider can rent. Each new step is joined to the last for you.
On screen: Action → Check Account.
Parallel branches and a decision
Two things happen at once next: the bay unlocks, and the kiosk shows the rider which bay it is. Drag a Parallel onto the line. It opens two branches that start together and join when both finish.
On screen: Parallel → line.
Drop an action onto each branch: Unlock Bay on the first, Show Bay Number on the second.
On screen: An action on each branch.
Then a decision: does the rider take the bike within thirty seconds? Drag an Or onto the line, and put the question in its name.
On screen: Or → line → name.
Each branch of a decision has a probability, for simulation later. Most riders take the bike: ninety-five percent for yes, five for no. The panel checks that they add up to one hundred.
On screen: Branch probabilities 95 / 5.
On the yes branch the rental starts: Start Rental. On the no branch the bay locks again: Relock Bay.
On screen: An action on each branch.
Inputs and outputs
Steps also pass items to each other. Drag an Input/Output onto Check Account: the step now produces it. Name it Unlock Code, the approval the back office sends.
On screen: I/O → Check Account → Unlock Code.
Unlock Bay receives the code, and receiving it is what starts that step. Drag from the handle on Unlock Code onto Unlock Bay, and choose Input, trigger. An optional input would not start the step.
On screen: Handle on Unlock Code → Unlock Bay → Input (trigger).
The diagram is part of the model. The steps are actions under Rent a Bike, and the item and its links appear in the Database and on every view that shows them.
On screen: The completed action diagram.
Recap
Let's recap. You opened a function as an action diagram, dropped steps onto the line, added parallel branches and a decision with probabilities, and connected an item that triggers a step.
Next, you decide which part of the dock performs each function: allocation.