systemcomposer.interaction.Message
说明
Message
对象表示交互中两条生命线之间的通信。在表示交互的序列图上,消息以箭头的形式显示。消息有标签,可以正式或非正式地描述通信的发生。消息相当于架构模型中连接两个组件端口的连接器。
一个消息标签有一个触发条件 (trigger)、一个可选的保护条件 (guard) 和一个可选的约束条件 (constraint),其形式为 trigger[guard]{constraint}
。trigger
表示此消息的标识事件。guard
表示确定消息是否发生的附加条件。constraint
是当此消息发生时预期为 true 的表达式。
在信号事件中,触发器遵循以下格式:
direction(signal [+|-] value)
,它指定了带有方向和表达式的触发边沿。方向可以是:上升 - 边沿表达式从严格低于零上升到等于或大于零的值。
下降 - 边沿表达式从严格高于零开始下降。
交叉 - 上升或下降过零的边沿表达式。
在消息事件中,触发器的格式为
port
,指定输入消息端口的名称,代表消息的到达。消息标签上方括号内的保护条件是一个 MATLAB® 布尔表达式,是确定消息是否发生的附加条件。只有在软件检测到有效触发条件时,才会计算保护条件。在执行过程中,序列图会等待进入下一条消息,直到保护表达式计算结果为 true。
消息标签上大括号中的约束条件是一个 MATLAB 布尔表达式,指定了输入目标生命线的预期值。在执行过程中,对约束条件的计算决定了序列图对该消息显示通过还是失败。
创建对象
通过相应 systemcomposer.interaction.Interaction
对象的 RootFragment
属性访问 Message
对象。遍历根片段,检查片段中的 systemcomposer.interaction.MessageEvent
对象。访问消息事件的 Message
属性可查看相应的 Message
对象。
属性
示例
详细信息
版本历史记录
在 R2024a 中推出
另请参阅
工具
函数
openViews
|sim
|addInteraction
|getInteraction
|getInteractions
|open
|addLifeline
|addFragment
|addOperand
|addMessage
|addDurationConstraint
|addAnnotation
|findLifeline
|findElement
|move
|move
|move
|destroy
|next
|current
|reset
对象
systemcomposer.arch.Model
|systemcomposer.interaction.Interaction
|systemcomposer.interaction.Iterator
|systemcomposer.interaction.Lifeline
|systemcomposer.interaction.MessageEvent
|systemcomposer.interaction.FormalGate
|systemcomposer.interaction.Fragment
|systemcomposer.interaction.Operand
|systemcomposer.interaction.DurationConstraint
|systemcomposer.interaction.Annotation