Train Station Scheduling
Posted: Sun Apr 28, 2019 12:40 pm
I'm experimenting setting up a more intelligent trains system, something I've not really done before, and I'm observing some unintended behaviour. I have a setup with a pickup station, drop-off station and depot station. I have it set up so that the pick up and drop off stations only open if there is sufficient supply or demand, and my intention is that the train visits the depot station between pickup and drop off in both directions. I have a "5 seconds inactivity" on the depot to allow for refuelling. I am also sending a signal along wires so that the train will wait at the depot until the pickup or drop-off station is open. My schedule is therefore depot "5 s inactivity" and "pickup open signal" - pickup station inventory full - depot "5 s inactivity" and "drop-off open" - drop-off station inventory empty.
I'm in a situation where the base was idle for a while, so the train collected a full load, but the drop-off is full, so it's waiting at the depot for the "drop-off open" signal. I start production up, the drop-off station empties, station opens and train gets the signal. What I would expect is the train goes to drop off, returns to the depot, then goes to pick up (because the pickup station is full and sending its signal). What I'm observing is when the drop-off station opens, the train gets the signal, sets off, goes straight back to the depot, waits 5 s, then goes to the pickup station, then back to the depot, then goes to the drop-off.
My best guess about what is happening is that I'm seeing something like a race condition. The signal "need more stuff" gets sent to the train and to the station at the same moment, so the train decides what to do at the same time the station does. When the train gets the signal to go, the station is still reporting as closed, so the train skips that step. I want to control open and closed stations so that I can run with a multiple pickup and drop-off system with the same name. Am I interpreting this correctly, or is there something I might have got wrong? Any idea how to make it work as I intend?
I'm in a situation where the base was idle for a while, so the train collected a full load, but the drop-off is full, so it's waiting at the depot for the "drop-off open" signal. I start production up, the drop-off station empties, station opens and train gets the signal. What I would expect is the train goes to drop off, returns to the depot, then goes to pick up (because the pickup station is full and sending its signal). What I'm observing is when the drop-off station opens, the train gets the signal, sets off, goes straight back to the depot, waits 5 s, then goes to the pickup station, then back to the depot, then goes to the drop-off.
My best guess about what is happening is that I'm seeing something like a race condition. The signal "need more stuff" gets sent to the train and to the station at the same moment, so the train decides what to do at the same time the station does. When the train gets the signal to go, the station is still reporting as closed, so the train skips that step. I want to control open and closed stations so that I can run with a multiple pickup and drop-off system with the same name. Am I interpreting this correctly, or is there something I might have got wrong? Any idea how to make it work as I intend?