基于交付日期选择 RackPick 代理。

huangapple go评论48阅读模式
英文:

RackPick agents based on parameter Delivery Date

问题

我有一个模型,在模型时间匹配代理参数的交货日期时,我需要使用PalletRack中的RackPick来挑选代理。

我有一个日期类型的参数,我正在使用以下代码生成随机的交货日期(在30天内)addToDate(date(), DAY, random()*30);

我有一个名为DeliveryDate的参数,在该日期上我想从货架上挑选代理。

我应该如何做呢?

英文:

I have model, where I need to pickup agents using RackPick from PalletRack when the model time matches the agent parameter delivery date.

I have a parameter of type date, and I am generating random delivery dates (withing 30 days) using the following code addToDate(date(), DAY, random()*30);

I have a parameter called DeliveryDate, and on that date I want to RackPick agents from the pallete rack.

How can I do this?

Here are the images,

基于交付日期选择 RackPick 代理。
基于交付日期选择 RackPick 代理。
基于交付日期选择 RackPick 代理。

答案1

得分: 2

我将只翻译你提供的文本,不包括代码部分:

注意:在AnyLogic中,参数应以小写字母开头,以避免与类和代理类型混淆。我在我的代码片段中使用了小写版本的您的参数。

我将假设您的托盘架上有通用代理类型的代理,并且在订单的deliveryDate日期上,您想要挑选与orderQuantity参数描述的数量相同的代理。

现在,您正在挑选代理,就在它们被放入托盘架中。为了避免这种情况,请在RackStoreRackPick之间添加一个等待块。然后创建一个动态事件 - 我称之为PickAgent。它将负责在交付日期释放等待块上的代理。PickAgent的操作是 wait.free(wait.get(0))

在您的订单种群中删除deliveryDate的默认值,然后转到您的订单代理并在'On startup:'操作中编写以下内容:

double deliveryDays = random()*30;
deliveryDate = addToDate(date(), DAY, deliveryDays);
for (int i = 0; i < orderQuantity; i++){
	main.create_PickAgent(deliveryDays, DAY);
}

这将设置您的订单的deliveryDate参数,并创建与orderQuantity相等数量的PickAgent事件,这些事件将在deliveryDate上采取行动。这将导致从托盘架中挑选出orderQuantity数量的代理。

注意2:如果您的等待块为空,这将引发错误。您需要定义在存储中没有足够的代理来完成订单时应该发生什么。

英文:

Note: in AnyLogic parameters should start with a lowercase letter to avoid confusion with classes and agent types. I used the lowercase version of your parameters in my code snippets.

I am going to assume you have generic Agent type agents in your pallet rack and on the date deliveryDate of an order you want to pick as many as the orderQuantity parameter describes.

Right now you are picking agents as soon as they were put into the pallet rack. To avoid this, put a Wait block between RackStore RackPick. Then create a Dynamic Event - I called it PickAgent. It will be responsible for freeing an agent from the wait block on delivery dates. PickAgent's action is wait.free(wait.get(0)).

基于交付日期选择 RackPick 代理。

In your orders population delete the default value of deliveryDate and go to your Order agent and write the following in the 'On startup:' action:

double deliveryDays = random()*30;
deliveryDate = addToDate(date(), DAY, deliveryDays);
for (int i = 0; i&lt;orderQuantity; i++){
	main.create_PickAgent(deliveryDays, DAY);
}

This will set the deliveryDate parameter of your Order and also create a number of PickAgent events equal to orderQuantity that will take action on deliveryDate. This will lead to orderQuantity number of agents to be picked from the pallet rack.

Note 2: If your Wait block is empty, this will throw an error. You need to define what should happen when there are not enough agents in storage to fulfill an order.

huangapple
  • 本文由 发表于 2023年7月17日 13:52:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/76701790.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定