AnyLogic - 为什么我的基于条件的转换不起作用? [英] AnyLogic - Why does my condition based transition not work?

查看:24
本文介绍了AnyLogic - 为什么我的基于条件的转换不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个与状态图中的转换相关的问题(见上图).我有一个名为 palletInUse 的变量,它是一个布尔类型,在 true 和 false 之间变化.对于状态图中的一个转换,我希望它在变量 PalletInUse 的值为 true 时改变.我已经尝试过,例如:

I have a question related to a transition in my statechart (see image above). I have a variable called palletInUse which is a boolean-type and changes between true and false. For one transition in my statechart I want it to change when the variable palletInUse has the value true. I have tried it with for example:

palletInUse == true;

还尝试了不同的代码,例如 equals 和 contentEquals 等,但似乎没有任何效果.对于这个看似简单的问题,您有解决方案吗?

and also tried different code like, equals and contentEquals etc. but nothing seems to work. Do you have a solution for this, seemingly simple problem?

提前致谢

推荐答案

不会持续监控条件,仅当代理中的某些内容发生更改时.当您使用通用的="Java 运算符为变量分配新值时,它不会被 AnyLogic 引擎捕获.之后您需要调用 onChange() 函数.然后,应该执行转换.还有其他方法可以在没有显式 onChange() 调用的情况下触发条件检查.您可能会找到它们 在 AnyLogic 帮助文章中.顺便说一句,您可以仅指定布尔变量作为条件,不需要将其与 truefalse 进行比较:

The condition is not monitored constantly, only when something is changed in the agent. When you assign a new value to variable with common "=" Java operator, it is not caught by the AnyLogic engine. You need to call onChange() function after that. Then, the transition should be executed. There are other ways to trigger the condition check without explicit onChange() call. You may find them in AnyLogic Help article. BTW, you may specify just boolean variable as the condition, it is not required to compare it with true or false:

palletInUse

这篇关于AnyLogic - 为什么我的基于条件的转换不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆