I have built a very simple model, shown below:
model image
When the second train (left) touches the switch, an exception occur:
Cannot invoke “com.anylogic.engine.markup.RailwayTrack.getRailYard()” because “” is null.
I have no idea what’s causing this. The complete error message is:
complete erro message
I am using the Personal Learning Edition.
By the extreme simplicity, my expectation is the model to run properly. I just want to test the limits of the .reserveFor() method.
Both trainMoveTo have the code “track.reserveFor(train);” on the field “on enter track” and “track.cancelReservation();” on the field “on exit track”. Nothing more.
Matheus Martins is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.