在Anylogic中将一个代理移动到另一个代理中 [英] Moving one agent within another agent in Anylogic

查看:127
本文介绍了在Anylogic中将一个代理移动到另一个代理中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Anylogic中建立一个简单的配送中心.我确实做了卡车代理,并且能够将其从一个gis点转移到另一个gis点.

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?

推荐答案

我希望您已经从一年前解决了您的问题.但是,由于没有具体的答案,因此我将其留给任何可能遇到相同问题的人.

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的流程建模库(PML)具有一个名为 Pickup 的元素,而其对置元素是 Dropoff .这正好用于执行您要求的操作:将某些元素加载到运输车(卡车,叉车甚至一个人)中.

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:

队列元素对于保存元素直到发生拾取是必不可少的. Pickup 元素可能会以三种模式选择元素:

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

  • 当给定条件为True时;
  • 确切的金额(如果有);
  • 所有可用的代理商.

我假设所有卡车必须都已完全装满,以达到其最大容量.因此,选择的模式将是第二种模式,确切的数量将是 TruckCapacity ,这是代理商 Truck 的参数. 所选模式将代理(在本例中为Bananas)拣选到所需数量.但是,如果没有可用的东西或当前数量低于期望的数量,则 Pickup 块的本机行为是允许 container 元素简单地通过它并进行选择只有可用的.

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.

为防止此类行为,我创建了一个限制区域,一次只能放置1个 Truck .此外,保持 WaitFullyLoaded (设置为初始阻止)会强制容器代理 Truck 完全加载.每当 Banana 进入队列 waitTruck 时,都会执行验证以检查是否可以填充1个 Truck .如果是这样,则允许该辆卡车通过:

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();
}

要再次阻止 WaitFullyLoaded ,则当卡车通过 restrictedAreaEnd 块时,它会执行WaitFullyLoaded.block();

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.

希望这会有所帮助

路易斯

这篇关于在Anylogic中将一个代理移动到另一个代理中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆