英文:
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
端口:
根据帮助文档,这是使代理提前离开传送带的方法。
英文:
You are not supposed to remove elements from conveyors via code. Hence the error.
Instead, use the outRedirect
port at the bottom:
As per the help, this is how you can make agents leave conveyors prematurely
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论