Moving one agent within another agent in Anylogic

左心房为你撑大大i 提交于 2019-12-25 03:41:03

问题


I am making simple distribution center in Anylogic.I did make truck agent and i am able to move it from one gis point to another gis point.

But I want to load some other agents(Let's say banana agent) into my truck agent and then trucks start their journey(if truck is full of banana).How can i do this?


回答1:


I hope you have already solved your problem from almost a year ago. However, since there is no specific answer, I'll leave it here for anyone who might get stuck with the same problem.

Anylogic's Process Modelling Library (PML) has an element called Pickup and its opposite, Dropoff. This is used to do exactly what you asked: to load some element into a transporter (either a truck, a forklift, or even a person).

To use the block as you asked you would need a topology like in the picture:

The Queue elements are necessary to hold elements until the pickup occurs. The Pickup element might pick elements in three modes:

  • While a given condition is True;
  • An exact amount (if available);
  • All available agents.

I'm assuming all trucks must be completely filled up to its maximum capacity. Hence, the chosen mode will be the second one where the exact amount will be TruckCapacity, a parameter of agent Truck. The selected mode picks up agents (in this case Bananas) up to the desired amount. However, if nothing is available or the present amount is inferior to the desired, the native behavior of the Pickup block is to allow the container element to simply go through it and pick only what's available.

To prevent such behavior, I've created a restricted area where only 1 Truck can be at a time. Additionally, the Hold block WaitFullyLoaded (set to initially blocked) forces the container agent Truck to be fully loaded. Whenever a Banana enters the Queue waitTruck, a verification is performed to check if 1 Truck can be filled. If so, allows passage for that one truck:

if(self.size()/TruckCapacity>=1){
    WaitFullyLoaded.unblock();
}

To block WaitFullyLoaded again, when the truck passes through the restrictedAreaEnd block, it performs WaitFullyLoaded.block();

The main idea is this. However, many features can be added and changed.

Hope this helps,

Luís



来源:https://stackoverflow.com/questions/33734667/moving-one-agent-within-another-agent-in-anylogic

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!