3

Few blocks in the Anylogic Process Modeling Library like "Source" have actions like "On exit" and "On at exit". What is the difference between the two?

I was trying to create a simple flow of:

source -> SelectOutput -> Service -> Sink

The agent being created by source block has a Boolean property "is_vip". When I assigned agent.is_vip to true or false in the "on exit" action of the source, the routing did not work, but when I moved the logic to "on at exit" of the source block, the routing started working.

Ankit Sahay
  • 1,710
  • 8
  • 14

1 Answers1

1

There is no question here, but you are correct and that is the difference between the boxes. OnAtExit is evaluated before an agent exits the block. OnExit is evaluated after it left.

If a downstream block like SelectOutput depends on some upstream changes, they will not be registered if done in upstream OnExit as the agent is already in the SelectOutput block.

Always safer to use OnAtExit

Benjamin
  • 10,603
  • 3
  • 16
  • 28
  • Is it right to say, since SelectOutput is just pass-through, the state change of agent that occurred on-exit in the source block doesnt get "evaluated" in the selectOutput block? But had it been some other block like delay, the state change would have occurred before agent arrived in the delay block? – Ankit Sahay Jan 20 '22 at 06:53
  • 1
    Same for Delay block, try it out. Agents would not have registered the upstream OnExit change when entering OnEnter of a Delay block. But after that, it is registered. It may appear weird but it does make sense (if you know what you are doing :) ) – Benjamin Jan 20 '22 at 07:25