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

查看:301
本文介绍了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天全站免登陆