简体   繁体   English

检查占用块中的代理

[英]Checking agents in a Seize Block

I wonder how I can trigger a conditional state chart transition (located in an agent, Patient) by checking if a queue (located in Main in a Seize Block) contains patients with a certain characteristic (p_contaminated, boolean parameter here should be true in order for the transition to trigger).我想知道如何通过检查队列(位于 Seize Block 中的 Main 中)是否包含具有特定特征的患者(p_contaminated,boolean 参数此处应为 true用于触发的过渡)。 Ie, if the queue contains one Patient with p_contaminated = true, the statement should yield true in order to trigger the transition.即,如果队列包含一个 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强调(用红色)提到的 Seize Block 和想要触发的条件转换

Do not use conditional transitions, ever.永远不要使用条件转换。 They have some quirks (not bugs but easy to work in unexpected ways if you are no crack) and can deteriorate your model performance massively.他们有一些怪癖(不是错误,但如果你没有破解,很容易以意想不到的方式工作)并且可能会大大降低你的 model 性能。

You can always replace them with message-based transitions.您始终可以将它们替换为基于消息的转换。

In your case, have setup as below:在您的情况下,设置如下: 在此处输入图像描述

every x seconds, leave Treatment with a timeout transition.每 x 秒,使用超时转换离开Treatment Check your patient queue in AnyPatientFound and if true, move to GoToHallway , else return to Treatment检查AnyPatientFound中的患者队列,如果为真,则移至GoToHallway ,否则返回Treatment

AnyPatientFound should call a boolean function anyPatientContaimated that loops through all patients in your queue and returns true if any is contaminated, else false. AnyPatientFound应该调用 boolean function anyPatientContaimated循环遍历队列中的所有患者,如果有任何患者被污染则返回 true,否则返回 false。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM