I created a simple model to study how lifts behave when they are failed: agents arrive on a ground level conveyor and continue to either one of the two higher conveyors, using a lift. Fail() and repair() functions are called when I click a button (Action: if (lift.isFailed()) lift.repair(); else lift.fail();
) I'm using version 8.7.4 PLE. (Edit: the problem persists with 8.7.6 too)
Everything works fine except if I manage to fail the lift just before pickup, then I get the following error message when I click the button again to repair it:
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)
Here's how the model looks when I get the error
What I've tried so far:
- Setting pickup time to 0. Maybe this would be worth another question but if the lift is failed during dropoff, the simulation throws a RuntimeException. Altough not very sophisticated, setting dropoff time to zero seems to get rid of the problem as I can't call fail() during dropoff. The error in question doesn't happen during pickup, but before it so this doesn't work. (I say this because I print to console at the lift actions "On pickup", "On failed" and "On repaired" to know in which order the events happened)
- Finding a way to delay calling fail() if the lift is in a specific state. Unfortunately I didn't find any method in the API reference which could tell me specifically what the lift is doing at the moment.
Obviously later on I plan to call fail() automatically from an Event or something similar, so I'd be interested in a solution which helps me avoid this error.