检查扣押块中的代理

问题描述

我想知道如何通过检查队列(位于Seize Block的Main中)是否包含具有特定特征(p_contaminated,布尔参数)的患者来触发条件状态图转换(位于代理,患者中)。 true,以便触发转换)。即,如果队列中包含一名p_contaminated = true的患者,则该语句应产生true才能触发转换。

Picture showing the Main chart and the Patient chart. Emphasizing (with red) the mentioned Seize Block and the conditional transition that is wanted to be triggered

解决方法

永远不要使用条件转换。他们有一些怪癖(不是bug,但是如果您没有裂缝,很容易以意想不到的方式工作),并且会大大降低模型的性能。

您始终可以将其替换为基于消息的过渡。

在您的情况下,请进行以下设置: enter image description here

每x秒,使Treatment保持超时过渡。在AnyPatientFound中检查您的患者队列,如果为true,则移至GoToHallway,否则返回Treatment

AnyPatientFound应该调用一个布尔函数anyPatientContaimated,该函数遍历队列中的所有患者,如果有污染则返回true,否则返回false。