Round Robin Scheduler Troubleshooting

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
Lilje
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sat Sep 19, 2020 12:38 pm
Contact:

Round Robin Scheduler Troubleshooting

Post by Lilje »

Because plastic production saturates belts so fast, and I didn't want to make a very wide robot array, I made a plastic factory that feeds directly into trains. To prevent trains from picking the closest free station, instead pick the longest waiting station, I made a round robin scheduler using a train counter with a modulo operator, and switching on and off the rail signal in front of the stations based on it.
This works great 99.9% of the time, the throughput is amazing (can't have belt saturation when there are no belts!), except sometimes this happens, and it can happen on any of the stations.
Image
If you don't see it; the rail signal in front of the train is red, it should be yellow, and the station to the right is open.

The counter activates when a rail signal in front of any station turns yellow and opens up the next station.
The current station loses its condition to be open but since
If a train cannot stop in time (signal is yellow),...,the signal will not stop the train.
it will remain yellow for the current train to pass.
Except sometimes it does turn red, what's up with this? should I file a bug report?

The factory blueprint:
https://pastebin.com/1q61VYn9

User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 880
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: Round Robin Scheduler Troubleshooting

Post by Impatient »

if you think the game's behavior is buggy, I recommend to create a test setup which shows this behavior and strip away everything, that is not crucial to showing this behavior (eg the plastic production, etc. ...).

There have been several issues in the past connected to circuit controlled train signals and the reservation of track blocks. I think there even is one in the bugs list right now, where trains do not path to a track they are expected to. but I don't think that it is related.

viewtopic.php?f=7&t=89587

User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 694
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: Round Robin Scheduler Troubleshooting

Post by disentius »

Possible workaround: use the round robin to enable the station , not the signal.

Yoyobuae
Filter Inserter
Filter Inserter
Posts: 499
Joined: Fri Nov 04, 2016 11:04 pm
Contact:

Re: Round Robin Scheduler Troubleshooting

Post by Yoyobuae »

Trains may repath at any time.

Some event, somewhere in the rail network, probably caused by yourself, triggered this train to repath at just the wrong moment. When a train repaths it clears all the block reservations it had and tries them again. Which means you cannot rely on this:
If a train cannot stop in time (signal is yellow),...,the signal will not stop the train.
Because if you close a signal that's already yellow via circuit network, the train that reserved that block may lose that reservation at any time due to repathing, causing the train to stop at the signal anyway (video):


In the video I manually added a rail signal to trigger the repath event. But the list of things that could potentially cause a train to repath is very long: https://wiki.factorio.com/Railway/Train ... ath_events

I don't expect any player to be able to account for everything on that list. So from the point of view of the player, train repathing is random and will eventually happen at the worst time possible. The only thing you can do as a player is make your designs immune to such repathing.

Lilje
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sat Sep 19, 2020 12:38 pm
Contact:

Re: Round Robin Scheduler Troubleshooting

Post by Lilje »

Image
Random repaths be random I guess, not repathing during a yellow signal path would be nice but I remade the factory turning off the stations when a train arrives and turning on again on the train counter round robin. Works great and doesn't lock up.
https://pastebin.com/CPKMLCN2
Thanks for the help everyone!

macdjord
Inserter
Inserter
Posts: 34
Joined: Fri Feb 22, 2013 4:26 am
Contact:

Re: Round Robin Scheduler Troubleshooting

Post by macdjord »

@Lilje: Instead of round-robin, you might consider just having each station be activated when its chests contain enough plastic to fill a train, and deactivated when it falls too low. After all, it isn't really necessary to make sure the stations are access equally; you just want to make sure you don't get a train pulling in to a stations that's almost empty when another, full station is available, right? This would also let the original, signal-based control system work, because the amount of plastic available can only ever go down when a train is stopped at the station.

Post Reply

Return to “Gameplay Help”