Anylogic,动画队列 [英] Anylogic, animating a queue

查看:129
本文介绍了Anylogic,动画队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这总是让我烦恼,所以我通常只是忽略它,但这一次它促使我提出这个问题......

This always annoys me so I usually just ignore it but this time it has prompted me to ask the question...

我正在动画代理使用表示队列的路径为资源排队.我有一个 moveTo 块来将我的代理移动到一个位于队列前面的节点.当队列为空并且有代理到达需要服务时,当代理移动到队列路径的末尾并沿着路径平滑地前进到节点所在的队列前部时,看起来很棒.
但是,如果队列中有多个代理,则新代理将移动到队列路径并一直移动到队列的前面(节点所在的位置),然后跳回到它们在队列路径上的正确位置.

I am animating agents queuing for a resource using a path to represent the queue. I have a moveTo block to move my agents to a node which is placed at the front of the queue. When the queue is empty and an agent arrives to be serviced, it looks great as the agent moves to the end of the queue path and smoothly progresses along the path to the front of the queue where the node is located.
However, if there are multiple agents in the queue then new agents will move to the queue path and move all the way to the front of the queue (where the node is located) and then jump back to their correct position on the queue path.

如果我将节点放在队列的后端,那么当代理到达时动画看起来很棒,因为他们加入队列,因为他们在其他已经在那里的代理后面加入了队列,但是当队列前面的代理抓住了他们正在等待的资源时它跳到队列的后面,然后沿着队列前进到资源节点.

If I put the node at the back end of the queue then the animation looks great when the agents arrive as they join the queue behind others already there but when the agent at the front of the queue seizes the resource they are waiting for it jumps to the back of the queue and then proceeds along the queue to the resource node.

关于如何正确设置动画的任何想法?

Any ideas on how to get this to animate correctly?

推荐答案

您可以简单地使用 Conveyor 块来表示shuffling around"队列(具有某些特定配置),但值得考虑更广泛的情况(其中还有助于理解为什么尝试将 MoveTo 块添加到服务,其队列沿路径无法实现您想要的).

You can achieve this simply using a Conveyor block to represent the 'shuffling along' queue (with some specific configuration), but it's worth considering the wider picture (which also helps understand why trying to add a MoveTo block to a Service with its queue along a path cannot achieve what you want).

过程模型可以包括与模型相关的空间,其中移动时间很重要.(与 MoveTo 块一样,RackPick/Store 和 Service 块等带有发送占用的资源"隐式检查的块包含移动.)但是,通常您不这样做:队列沿路径的 Service 块正在使用路径只是提供队列的一些视觉表示.在底层模型中,代理从上游块立即到达队列,并在资源空闲时立即进入延迟——这就是模型的过程抽象.因此,尝试使用先前的 MoveTo 块或类似块来修复动画"将不起作用,因为 Service 块不应该表示其队列的这种概念(因此代理将弹回"到您观察到的潜在行为的现实).此外,适当的动画队列"会掩盖模型的底层基础(使该运动看起来好像是明确建模的,但实际上并非如此).

A process model can include model-relevant spatiality where movement times are important. (As well as the MoveTo block, blocks such as RackPick/Store and Service blocks with "Send seized resources" checked implicitly include movement.) However, typically you don't: a Service block with the queue being along a path is using the path just to provide some visual representation of the queue. In the underlying model agents arrive instantly into the queue from the upstream block and instantly enter the delay when a resource is free — that is the process abstraction of the model. Hence trying to 'fix the animation' with a previous MoveTo block or similar will not work because the Service block is not supposed to be representing such a conception of its queue (so agents will 'spring back' to the reality of the underlying behaviour as you observed). Additionally, a 'properly animated queue' would be obscuring the underlying basis of the model (making it seem as if that movement is being explicitly modelled when it isn't).

Conveyor 确实在概念上捕获了必须保持一定距离的代理,并且(对于累积的传送带)在有可用空间时明确模拟移动的代理.因此,尽管这似乎违反直觉,但这实际上是对移动中的人员队列(当然也与实际传送带相匹配)的正确"详细概念化.

A Conveyor does conceptually capture agents which have to stay a certain distance apart and (for an accumulating conveyor) explicitly models agents moving along when there is free space. So, although it may seem counterintuitive, this is actually a 'correct' detailed conceptualisation of a moving human queue (which also of course matches an actual conveyor).

为了让它按您的意愿工作,您需要调整代理的大小(仅从传送器的角度来看),以便您的队列中只有所需数量的人(现在是传送器),如下所示仅具有容量为 1 的队列的服务块(因此仅代表队列的前端人员")——服务块不能具有容量为 0 的队列.您可以使用一个点节点作为这个单入口队列的位置,该队列刚好超出传送带路径的末端(这样它就可以有效地代表队列中的第一个位置)——见下文.

To make it work as you want it, you need to make the size of the agents (just from the conveyor's perspective) such that you only have the required number of people in your queue (now a conveyor), with the following Service block just having a capacity 1 queue (which thus represents the 'front of the queue person' only) — Service blocks can't have a capacity 0 queue. You can use a Point Node as the location for this single-entry queue which is just beyond the end of the conveyor path (so that this effectively represents the first position in the queue) — see below.

然后您希望传送带上的代理长度代表您的队列槽长度",这需要指定队列容量(在我的示例中是一个变量),例如

You then want the agent length on the conveyor to represent your 'queue slot length' which requires specifying the queue capacity (a variable in my example), so something like

path.length(METER)/(queueCapacity - 1)

其中 path 是您的传送带路径.(传送带代表除第一个之外的所有队列插槽",因此我们在上面减去 1.)

where path is your conveyor path. (The conveyor represents all queue 'slots' except the first, hence why we subtract 1 above.)

您还可以将所有这些封装为自定义 ServiceWithMovingQueue 块或类似块.

You could also encapsulate all of this as a custom ServiceWithMovingQueue block or similar.

请注意,如果传送带没有空间容纳到达的代理(即概念队列"已满),则需要传送带之前的队列.如果您想变得特别现实,则必须决定现实生活中会发生什么,并明确建模(例如,溢出队列、代理离开等).

Note that the Queue before the Conveyor is needed in case the conveyor has no room for an arriving agent (i.e., the 'conceptual queue' is full). If you wanted to be particularly realistic you'd have to decide what happens in real-life and explicitly model that (e.g., overflow queue, agent leaves, etc.).

附言另一种替代方法是使用 Pedestrian 库,其中 Service with Lines 空间标记旨在对此进行建模:下面的部分示例流程.但是,这意味着将您的代理切换为行人(参与用于运动的行人建模基础物理模型)并再次返回,这是性能密集型的(并且在某些情况下由于物理原因可能会导致一些奇怪的运动).另外,由于行人图书馆没有明确的行人服务资源概念,因此您必须做一些事情,例如让资源池容量变化影响哪些服务点是否开放.(带有 Lines 标记的 Service 中的服务点具有诸如 setSuspended 之类的功能,因此您可以将它们动态设置为打开"或关闭",在这种情况下,与资源是否正在轮班以管理它们有关.)

P.S. Another alternative is to use the Pedestrian library, where Service with Lines space markup is designed to model this: partial example flow below. However, that means switching your agents to be pedestrians (participating in the pedestrian modelling underlying physics model for movement) and back again which is performance-intensive (and can cause some bizarre movement in some cases due to the physics). Plus, because the pedestrian library has no explicit concept of resources for pedestrian services, you'd have to do something like have resource pool capacity changes influence which service points were open or not. (The service points within a Service with Lines markup have functions like setSuspended so you can dynamically set them as 'open' or 'closed', in this case linked to whether resources are on-shift to man them.)

P.P.S.请注意,从建模准确性的角度来看,捕捉人员队列中的真实"运动通常是无关紧要的,因为

P.P.S. Note that, from a modelling accuracy perspective, capturing the 'real' movement in a human queue is typically irrelevant because

  • 如果队列为空,与服务时间相比,从尾部移动到前端的时间通常可以忽略不计(并且,即使不可忽略,通常存在队列的服务也意味着这种额外的移动仅与一小部分到达者相关 - 见下文).

  • If the queue's empty, the time to move from the end to the front is typically negligible compared to the service time (and, even if it's not negligible, a service which generally has a queue present means this extra movement is only relevant for a tiny proportion of arrivals — see below).

如果队列不是空的,人们会在其他人正在接受服务时向上移动,因此服务方面没有延迟(在与某人完成后总是可以立即"接受下一个人,因为他们已经在队列的前面).

If the queue's not empty, people move up whilst others are being served so there is no delay in terms of the service (which can always accept the next person 'immediately' after finishing with someone because they are already at the front of the queue).

这篇关于Anylogic,动画队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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