Java中的IllegalStateException是在AnyLogic中从传送带上移除物品时出现的异常。

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

Java IllegalStateException when removing items on conveyor in AnyLogic

问题

以下是翻译好的部分:

我正在使用以下代码在AnyLogic中的某些时刻删除传送带上的物品。但有时在执行时会出现错误。

for (ConveyorPath conveyor : zweiterTeilConveyor) {
    List list = conveyor.getAgents();
    for (Object a : list) {
        Kerze k = (Kerze) a;
        conveyor.removeAgent(k);
        kToRemove.add(k);
    }
}

错误消息:

离散事件执行期间发生异常:
内部错误:在 blocked Hold root.convey_FTM.conveyorEnter.?<MHLSettings>.conveyorSystems_xjal[4].asyncStationControllers_xjal[1].enterBlocker 中未注册实体 147645。
java.lang.IllegalStateException: 内部错误:在 blocked Hold root.convey_FTM.conveyorEnter.?<MHLSettings>.conveyorSystems_xjal[4].asyncStationControllers_xjal[1].enterBlocker 中未注册实体 147645。

遗憾的是,这个消息本身并没有提供太多信息,我不知道如何修复它。我猜想在这个时刻代理正在等待传送带的进入口被释放。您有关于这个错误是什么以及如何避免它的任何想法吗?

英文:

I am using the following codes to remove the items on conveyors at some moments in AnyLogic. But sometimes it throws an error when executed.

for (ConveyorPath conveyor : zweiterTeilConveyor) {
    List list = conveyor.getAgents();
    for (Object a : list) {
	    Kerze k = (Kerze) a;
	    conveyor.removeAgent(k);
	    kToRemove.add(k);
    }
}

The error message:

Exception during discrete event execution:
Internal error: Entity 147645 at blocked Hold root.convey_FTM.conveyorEnter.?<MHLSettings>.conveyorSystems_xjal[4].asyncStationControllers_xjal[1].enterBlocker hasn't registered in it.
java.lang.IllegalStateException: Internal error: Entity 147645 at blocked Hold root.convey_FTM.conveyorEnter.?<MHLSettings>.conveyorSystems_xjal[4].asyncStationControllers_xjal[1].enterBlocker hasn't registered in it.

Sadly the message itself doesn't provide too much information for me and I have no clue how to fix it. I guess at the moment the agent is waiting at for the conveyor's enter port to be free. Do you have any ideas what the error is about and how to avoid it?

答案1

得分: 1

不应通过代码从传送带上移除元素。因此出现了错误。

相反,请使用底部的 outRedirect 端口:

Java中的IllegalStateException是在AnyLogic中从传送带上移除物品时出现的异常。

根据帮助文档,这是使代理提前离开传送带的方法。

英文:

You are not supposed to remove elements from conveyors via code. Hence the error.

Instead, use the outRedirect port at the bottom:

Java中的IllegalStateException是在AnyLogic中从传送带上移除物品时出现的异常。

As per the help, this is how you can make agents leave conveyors prematurely

huangapple
  • 本文由 发表于 2023年5月24日 23:58:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/76325413.html
匿名

发表评论

匿名网友

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

确定