Anylogic Event not triggering - Stack Overflow

I have a event that triggers by the condition linesSorted == totalLines. Which are 2 int variables. tot

I have a event that triggers by the condition linesSorted == totalLines. Which are 2 int variables. totalLines increases to about 200 when the model is just starting (within the first second), while linesSorted increases slowly as the simulation progresses.

However, even when the 2 variables are equal, the event is not triggered. The event, 2 variables, and the process blocks are in the same agent, a single agent created inside main.

Why is the event not triggering?

I tried moving the event and variables into main and it does trigger. Why does it only trigger if they are in main?

I have a event that triggers by the condition linesSorted == totalLines. Which are 2 int variables. totalLines increases to about 200 when the model is just starting (within the first second), while linesSorted increases slowly as the simulation progresses.

However, even when the 2 variables are equal, the event is not triggered. The event, 2 variables, and the process blocks are in the same agent, a single agent created inside main.

Why is the event not triggering?

I tried moving the event and variables into main and it does trigger. Why does it only trigger if they are in main?

Share Improve this question asked Mar 13 at 10:57 XanderWXanderW 131 silver badge5 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Just because you define a condition does NOT mean that it is evaluated upon any change in the model.

This would make your models very slow as any condition would constantly check if it triggers.

Instead, it is your responsibility to "tell" the event about it.

In general, you should avoid condition-based events, transitions, etc. They lure you into a false sense of security.

You can replace ANY condition with a safer setup. In your case, whenever you change the 2 int variables, you would check if the condition is now met. If so, you trigger the code of the event (delete the event and put the code into a function)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744705826a4589049.html

相关推荐

  • Anylogic Event not triggering - Stack Overflow

    I have a event that triggers by the condition linesSorted == totalLines. Which are 2 int variables. tot

    1天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信