Anylogic - Combined multiple items back to origina

2020-01-19 10:53发布

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

My Current Setup

*Two down votes? I'm happy to clarify more if need be.

标签: anylogic
1条回答
太酷不给撩
2楼-- · 2020-01-19 11:48

This is how I would do it.

  1. obviously you will have agent types: passenger and bag
  2. 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
  3. you will replace queue and queue1 with wait blocks (passengerWait and bagsWait)
  4. 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
  5. 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
  6. add a small delay after the passenger block that represents the time it takes for the passenger to pick up the bags
  7. Use a pick up block after the delay on the passenger side (you will need a new queue after bagsWait in the bags side)
  8. 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 :)

查看更多
登录 后发表回答