You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

AnyLogic中电梯接货前触发故障调用repair()抛出NoSuchElementException问题

AnyLogic Lift组件故障修复报错问题

模型背景

我创建了一个简易模型用于研究Lift(电梯)故障时的行为逻辑:智能体抵达地面层输送机后,通过电梯转运至两个高层输送机中的任意一个。我通过点击按钮调用fail()和repair()函数,按钮动作代码为if (lift.isFailed()) lift.repair(); else lift.fail();,使用的软件版本为8.7.4 PLE(8.7.6版本同样存在该问题)。

报错场景

除在电梯即将执行接货操作前触发故障的场景外,其余场景运行均正常:当我触发该类故障后再次点击按钮修复电梯时,会抛出如下报错:

Exception during discrete event execution:
java.util.NoSuchElementException
java.util.NoSuchElementException
    at java.base/java.util.LinkedList.getFirst(LinkedList.java:248)
    at com.anylogic.libraries.material_handling.LiftController_xjal$f.b(Unknown Source)
    at com.anylogic.libraries.material_handling.LiftController_xjal$f.d(Unknown Source)
    at com.anylogic.libraries.material_handling.LiftController_xjal.d(Unknown Source)
    at com.anylogic.libraries.material_handling.LiftController_xjal.d(Unknown Source)
    at com.anylogic.libraries.material_handling.LiftController_xjal$12.onTargetReach(Unknown Source)
    at com.anylogic.libraries.material_handling.MoveTo_xjal.c(Unknown Source)
    at com.anylogic.libraries.material_handling.MoveTo_xjal.a(Unknown Source)
    at com.anylogic.libraries.material_handling.MoveTo_xjal$d.a(Unknown Source)
    at com.anylogic.libraries.material_handling.EventExecutor$b.execute(Unknown Source)
    at com.anylogic.engine.Engine.i(Unknown Source)
    at com.anylogic.engine.Engine.if(Unknown Source)
    at com.anylogic.engine.Engine.e(Unknown Source)
    at com.anylogic.engine.Engine$n.run(Unknown Source)

已尝试的解决方案

  • 将接货时长设为0:该方案仅可规避电梯在卸货过程中发生故障时抛出的RuntimeException问题,本次报错发生在接货前而非接货过程中,因此该方案无效。我已在电梯的On pickup、On failed、On repaired动作中添加了控制台打印逻辑,可确认事件触发顺序符合上述判断。
  • 尝试判断电梯当前运行状态,若处于特定状态则延迟调用fail(),但API参考文档中未提供可查询电梯当前具体运行状态的相关方法,无法实现该逻辑。

需求

后续我计划通过Event等组件自动调用fail(),需要可规避该报错的可行解决方案。


内容的提问来源于stack exchange,提问作者mczandrea

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.10 01:27:03