Describe System Behavior Using Sequence Diagrams
一个序列图是一个行为图,代表架构的结构元素之间的相互作用作为消息交换的顺序。
使用序列图来描述静态系统的部分相互作用。
序列图与System Composer™中的体系结构模型集成在一起。
交通灯的作者序列图示例:交互创建和编辑序列图并学习术语。
实现序列图片段:了解如何实施片段以及有关片段语义的更多信息。
与架构模型一起使用序列图: Create and use sequence diagrams with architecture models.
同步序列图和架构模型:了解如何将序列图与体系结构模型同步。
笔记
此示例使用状态流®块。如果您没有状态流许可证,则可以打开并模拟模型,但只能进行基本更改,例如修改块参数。
Traffic Light Example for Sequence Diagrams
该交通灯示例包含序列图,以描述跨越十字路口的行人。该模型描述了以下步骤:
这traffic signal cycles from red to yellow to green.
什么时候the pedestrian crossing button is pressed, if the traffic signal is green, the traffic signal transitions from yellow to red for a limited time.
行人信号在活动时交叉。
打开包含序列图的系统作曲家模型。
模型= systemcomposer.openModel ('tlex amplem');
打开架构视图画廊以查看序列图。
OpenViews(模型)
此示例中的序列图表示架构模型中的操作场景。
1。pressDetection
序列图:行人按下行人交叉按钮和信号SW
上升到1
。这poller
生命线被激活,一个switchevent
消息发生在SWitch
更改交通信号的生命线以使行人越过。
2。信号序列
序列图:行人按下行人交叉按钮和信号SW
上升到1
。经过一些中介事件,灯具
生命线传输a扳机
signal to theped lamp
改变行人灯交通颜色的生命线红色的
(停下来绿色
(去),允许行人越过。
3。PedestrianCross
序列图:首先traffic
value is3
, which indicates that the traffic light color is green. The traffic light loops from yellow (2
) to red (1
) to green (3
) 然后再次。按下行人交叉按钮时控制器
生命线认识到有效的pedrequest
消息,交通灯从黄色变化(2
) to red (1
),这使行人可以越过。然后,主循环继续进行。
4。抑制
序列图:抑制
flag determines whether a pedestrian crossing button is set up for pedestrians to press to control the traffic lamp signal on an intersection and cross. When抑制
是set to0
,存在交叉按钮。什么时候抑制
是set to1
,不存在交叉按钮。这switchevent
value is1
,这表明行人想越过。一旦switchevent
值设置为1
,如果抑制
是0
, 这控制器
生命线认识到pedrequest
消息以启动行人灯颜色的更改。另外,切换
value is1
,因此交通灯将从黄色变为红色。否则,如果抑制
是1
, 这切换
value is2
,因此,交通灯将继续正常运行,而不会更改为红色,以专门允许行人越过。
Simulate Architecture Model
You can execute the model after setting these variables.
createworkspacevar(“ switchinputs”,[0 11 18],[-1 1 -1]); createWorkSpaceVar(“抑制剂”,1,0);