如何将 AnyLogic 代理从一个 space 移动到另一个?

How do I move AnyLogic agents from one space to another?

在我的 AnyLogic 模型中,Container 代理在 Main 代理中移动到不同的位置。

Main 在特定位置包含多个 Block 代理实例。 区块 包含一台多桥桥式起重机,它应该拿起 集装箱 并将其移动到本地存储。

Container 被放置在 Block 起重机范围内的 Attractor 处时,Block 被调用。 此过程包含 Entry、MoveByCrane 和 Exit 块。 在 MoveByCrane 块中,在捕获步骤中,AnyLogic 给我以下错误:

Exception during discrete event execution
root.blocks[0].moveContainerIn.seize:
The agent root.containers[0] and the crane com.anylogic.engine.markup.OverheadCrane@50b7349f have different spaces
    at com.anylogic.engine.Engine.error(Unknown Source)
    at com.anylogic.engine.Agent.error(Unknown Source)
    at com.anylogic.engine.Utilities.error(Unknown Source)
    at com.anylogic.libraries.material_handling.MHLBlock_xjal.error(Unknown Source)
    at com.anylogic.libraries.material_handling.SeizeCrane.j(Unknown Source)
    at com.anylogic.libraries.material_handling.SeizeCrane.k(Unknown Source)
    at com.anylogic.libraries.material_handling.SeizeCrane.getHookDestinationPoint(Unknown Source)
    at com.anylogic.libraries.material_handling.SeizeCrane.a(Unknown Source)
    at com.anylogic.libraries.material_handling.SeizeCrane.a(Unknown Source)
    at com.anylogic.libraries.material_handling.SeizeCrane.onEnter(Unknown Source)
    at com.anylogic.libraries.processmodeling.Delay.b(Unknown Source)
    at com.anylogic.libraries.processmodeling.Delay.b(Unknown Source)
    at com.anylogic.libraries.processmodeling.Delay.onEnter(Unknown Source)
    at com.anylogic.libraries.processmodeling.InputBlock.b(Unknown Source)
    at com.anylogic.libraries.processmodeling.InPort.a(Unknown Source)
    at com.anylogic.libraries.processmodeling.InPort.receiveImmediately(Unknown Source)
    at com.anylogic.libraries.processmodeling.InputBlock.a(Unknown Source)
    at com.anylogic.libraries.processmodeling.OutPort.a(Unknown Source)
    at com.anylogic.libraries.processmodeling.OutPort.b(Unknown Source)
    at com.anylogic.libraries.processmodeling.OutputBlock.forwardReadyEntityNotification(Unknown Source)
    at com.anylogic.libraries.processmodeling.InputBlock.a(Unknown Source)
    at com.anylogic.libraries.processmodeling.OutPort.a(Unknown Source)
    at com.anylogic.libraries.processmodeling.OutPort.b(Unknown Source)
    at com.anylogic.libraries.processmodeling.OutPort.a(Unknown Source)
    at com.anylogic.libraries.processmodeling.OutputBlock.a(Unknown Source)
    at com.anylogic.libraries.processmodeling.OutputBlock.a(Unknown Source)
    at com.anylogic.libraries.processmodeling.OutputBlock.a(Unknown Source)
    at com.anylogic.libraries.processmodeling.OutputBlock.action(Unknown Source)
    at com.anylogic.libraries.processmodeling.AsynchronousExecutor_xjal$a.execute(Unknown Source)
    at com.anylogic.engine.LibraryEventHandler$b.execute(Unknown Source)
    at com.anylogic.engine.Engine.c(Unknown Source)
    at com.anylogic.engine.Engine.hi(Unknown Source)
    at com.anylogic.engine.Engine.f(Unknown Source)
    at com.anylogic.engine.Engine$b.run(Unknown Source)

所有 Block 代理都位于 main 中的不同坐标。他们每个人都有自己的坐标reference/origin。 (块中的位置 (0,0) 与 main 中的 (0,0) 不同。)这是错误消息中术语“spaces”的含义吗?

有没有办法将代理从一个 space 移动到另一个?

我应该从一个 space 中删除(下沉)代理并在另一个中创建一个新代理吗?

是的。

最简单的方法是在 Main 和您的代理类型中使用 EnterExit 块,并以这种方式将代理发送到不同的 space。在 Enter 属性中,在代理类型中指定一个位置,这将使您到达的代理“切换”到新的 space.

如果您不使用流程建模块,则需要调用 setEnvironment(),然后使用 setLocation(...)

在其新环境中定义代理位置