简体   繁体   English

在 AnyLogic 中为同一资源的多个 Seize Blocks 分配优先级

[英]Assign priorities for multiple Seize Blocks for the same resource in AnyLogic

I have a not so typical scenario for which I am not sure how to proceed:我有一个不太典型的场景,我不确定如何进行:

  • There are two stations located at two different locations.有两个车站位于两个不同的位置。
  • Both stations require the same resource.两个站都需要相同的资源。
  • The resource moves from station to station once released.一旦释放,资源就会从一个站移动到另一个站。 So it keeps going from station 1 to station 2 to station 1, etc. until it is seized again.所以它不断地从1号站到2号站再到1号站,以此类推,直到再次被抓住。 This is modeled by adding a link from the resource process port of the release block.这是通过从释放块的资源进程端口添加链接来建模的。 So it is not completely released unless a condition applies.所以除非有条件,否则它不会完全释放。 The condition is that there are agents waiting in the queue of the seize block of that same resource.条件是在同一资源的 seize 块的队列中有代理正在等待。 So it should keep moving until it is needed again.所以它应该继续移动,直到再次需要它。 The tricky part is that there are two seize blocks for that resource, one for each station.棘手的部分是该资源有两个捕获块,每个站一个。 It is possible that agents are ready and waiting in the resource's seize element at both stations.代理可能已准备就绪,并在两个站点的资源占用元素中等待。 I am adding an image of the resource's process at release.我在发布时添加了资源过程的图像。 So at "selectOuput4" it checks whether station 1's seize element has agents waiting, if so, the resource is released and can be seized.所以在“selectOuput4”它检查站1的seize元素是否有代理等待,如果是,则资源被释放并且可以被占用。 Otherwise, it moves to station 2 and checks the same but for station 2.否则,它移动到站 2 并检查相同但站 2。

在此处输入图片说明

My concern is that there might be a situation where both stations have agents waiting in their respective seize blocks.我担心可能会出现两个站点都有代理在各自的占用块中等待的情况。 How can I make sure the resource will be seized by station 1's seize element and not station 2's, and vice versa.我如何确保资源将被站点 1 的占用元素占用而不是站点 2 的元素,反之亦然。 Is there a way to control where the resource is going in a case where two seize elements are waiting for it?在两个 seize 元素正在等待资源的情况下,有没有办法控制资源的去向? Or is it always random?还是总是随机的?

I apologize for the long post, and I hope I managed to deliver my idea properly.我为这篇长文章道歉,我希望我能正确地表达我的想法。

First, I think your design is a bit weird because you keep the resource always seized.首先,我认为你的设计有点奇怪,因为你总是抓住资源。

What I would do is first have a statechart in the resource that controls the resource movement from one place to the next so you have more control over it.我要做的是首先在资源中有一个状态图来控制资源从一个地方到另一个地方的移动,这样你就可以更好地控制它。 The statechart would be used to move your resource ONLY when it's not seized.状态图仅在未被占用时用于移动您的资源。 This will allow a case in which your resource is moving from station 1 to station 2 but something comes to station 1 queue and the resource can immediately react and come back to station 1 before it reaches station 2 (if you think it would be a good idea to do that)这将允许您的资源从站 1 移动到站 2 但有东西进入站 1 队列并且资源可以立即做出反应并在到达站 2 之前返回站 2(如果您认为这是一个好这样做的想法)

The second is that the seize block defines the priority for a task when the agent arrives to the seize block, and your situation requires changing that priority dynamically, which can't be done as far as I know, so the wait block before the seize block is unfortunately a good option.第二个是seize块定义了当agent到达seize块时任务的优先级,你的情况需要动态改变该优先级,据我所知这是无法做到的,所以在seize之前的wait块不幸的是,阻止是一个不错的选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM