Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 11 months ago.
I am trying to construct a a simple airport security channel.
I have a 'loadService' where passengers split with a number of bags. (Number of bags is picked randomly off a Custom Distribution).
The bags then go on a conveyor, while the passenger goes through a metal detector.
However, after that is where I have my problem.
I have tried combine, pickup and match but cannot figure out how to get passenger to pick up all their bags that they were split with.
It normally ends up them picking up just 1 random bag from the belt.
Any ideas on how to ensure passengers stay at the revestService until they have collected THEIR bags they own...
Thanks for any help,
-Karl
*Two down votes? I'm happy to clarify more if need be.
This is how I would do it.
- obviously you will have agent types: passenger and bag
- you will create a connection between these 2 agents:
passenger will have a link 1 to many to your bags... let's call it bagsLink
and bag will have a link 1 to 1 with a passenger... let's call it passengerLink
If you have no idea what connections are, check this article:
benjamin-schumann.com/blog/2017/10/21/anylogic-agent-links-a-hidden-gem-for-your-connections
and learn how to use connections
- you will replace queue and queue1 with wait blocks (passengerWait and bagsWait)
- On the passengerWait, on the onEnter action you will check if all the bags connected to the passenger are on the bagWait block... if they are... then you will free (wait.free(agent)) the passenger and the bags
- On the bagsWait, on the onEnter action you will check if the passenger connected to the bag is in the passengerWait block and if all the bags connected to the passenger are on the bagsWait block... if they are... then you will free (wait.free(agent)) the passenger and the bags
- add a small delay after the passenger block that represents the time it takes for the passenger to pick up the bags
- Use a pick up block after the delay on the passenger side (you will need a new queue after bagsWait in the bags side)
- Use the following condition to pick up the bags...
agent.passengerLink.getConnectedAgent().equals(container)
A lot to do, but it should work because I have done this before like this :)