Re: 4-way intersection testing: Throughput and deadlocks
Posted: Fri May 19, 2017 10:59 pm
It is so big it drops your FPS by 10 xD
www.factorio.com
https://forums.factorio.com/
had to zoom out to 0.1 and my Toaster graphics (HD 3000) didn't care for that.Distelzombie wrote:It is so big it drops your FPS by 10 xD
This issue is known as starvation in computer science, in this case the trains are the processes and the intersection is the shared resource.Miravlix wrote:I noticed an issue with the use of chain signals.
You have trains moving east<->west at the same time, if they perfectly overlap the signals, the north<->south train never gets access to reserving a route.
First the east->west train will reserve the route blocking a north/south train, before it clears, the west->east train arrives reserving the intersection, now a new east->west train arrives just as the west->east train leaves and again blocks north/south from reserving because it needs access past *both* trains to get a reservation.
Looks to me like many of these designs has what you may call a soft deadlock, but it is still a situation where two lanes with high traffic can prevent the two other lanes from accessing the intersection, so to me it's just as bad as a deadlock that can only be solved by player action.
I hate to admit it, but the roundabout design with a complete intersection lockdown, might actually be the best design here. Not that I would ever use something that creates a loop as this result in weird pathing.
It doesn't matter for how long chain signal intersections is blocking, the problem is that they block at all and at any traffic level. A few trains synchronizing their movement and you have train stuck in a traffic jam and then the problem just worsen as everyone else will synch up with the traffic jam. Resulting in you having no clue if your copper train will arrive this week or the next.aaargha wrote:So in short, to my knowledge, the only way to avoid starvation you'd need to make an intersection starvation free is by building some kind of circuit controlled traffic light system that ensures that no lane gets blocked for too long. Single block intersections do not help and may, in may situations, actually be worse. I'd also say that if this is becoming an issue it's most likely a sign that the train system is becoming overloaded and it's time to either upgrade the train system, better intersections/more lanes, to be able to handle more trains or re-plan some train routes to better spread traffic.
It may not affect whether or not it can happen, though long enough output blocks may possibly even remove some cases of it, but it may affect the risk of it happening or reduce the amount of traffic needed for it to become a problem. Also why would all the other trains sync up just because one lane is unable to progress? If anything the other traffic should die down as buffers fill up/empty out and production grinds to a halt, this is obviously not desirable and what we want to avoid, but I currently have a hard time seeing this problem as self-reinforcing.Miravlix wrote:It doesn't matter for how long chain signal intersections is blocking, the problem is that they block at all and at any traffic level. A few trains synchronizing their movement and you have train stuck in a traffic jam and then the problem just worsen as everyone else will synch up with the traffic jam. Resulting in you having no clue if your copper train will arrive this week or the next.
The result of throwing all rail signal 3-way intersections in the throughput tester. I really wish I could say that it at least took a few minutes but no, only two trains managed to get through before we ended up at total deadlock for all paths. (If you think it's incorrectly signalled please provide a blueprint string of how you think it should be signalled so we're on the same page. Current signalling is "2x 3-way" with chains replaced with rail signals.)Miravlix wrote:The roundabout that has no signals inside it, allows all trains the same access to queuing up for crossing, but it's not very well explored in what order they will get to cross and it's entirely possible that it result in an uneven rotation and that a train can end up deadlocked.
That is why I use rail signal only t-sections, as train will nudge their way into the intersection, resulting in a predictable rotational access to pass through it and it's impossible for any two lanes to block access. If you need higher speed, use the circuit traffic light solution, but I'm pretty sure not a lot of us is running that kind of traffic, but most of us will get hurt by the chain signal issue as it doesn't take a lot of traffic and add a unpredictability to the network that you have to be an expert to even know is there..
Perhaps you should at least move every design out of the A category as I don't think many of them actually qualify as safe.
Not currently, I'm planning on releasing it publicly once I've completed the multi-lane throughput tester and, as it turns out I still need more trains to get a good saturation, that is a bit further away.pieppiep wrote:Is the save game with the test setup downloadable somewhere?
As I've not got the multi-lane build but to where I want it I can't give you any real data on this but, from some of the early test runs some of the 4-lane intersections had higher throughput than what I saw for your design. I'll rerun the tests once the build is complete but I'd recommend trying to redesign your intersection so that the left turns don't cross.Rapier31 wrote:I haven't been able to find any decent working designs of 8 lane 4 way intersections, so I spent a stupid amount of time designing my own. It should work fine(haven't tested yet), but I really don't like the look of it. It unfortunately resembles a swastika and I'd love to redo it, but there isn't enough room to make it work properly in the layout. It will have to be bigger or just completely different, and it is really big already, so.... Here are some pics and the BP's. I'm also throwing in the design for a T junction that was inspired from a reddit post that I saw.
I'm not really sure that design will actually prevent starvation, to do that I think you may need to only allow traffic from one entrance at a time, unless the system is more sophisticated.Distelzombie wrote:Here is a simple traffic light system that I put together for you to test stuff with. You can use it with every intersection.
You can change the time it takes to switch using the T value in the constant combinator. It is now set to 300 ticks = 5 seconds.
If you use it in other junctions you have to assign the following signals to these ... signals:
1=North
2=East
3=South
4=West
(I had the N, E, S, W variables set to signals before each entry of the junction to maybe read. But I ditched that idea for now. Still used 1234 though)
I dont understand how the circuit could cause this. Does this happen without circuits? You tested it before: It is "WIDE B" for RHD. Maybe your setup has changed?aaargha wrote:I'm not really sure that design will actually prevent starvation, to do that I think you may need to only allow traffic from one entrance at a time, unless the system is more sophisticated.
It's also not deadlock safe at the moment for heavy traffic, see below, as the entrance signals are rail signals. If it was possible to control chan signals with circuits it would be much easier to make a good system, that is both deadlock and starvation free, while not totally butchering throughput.
It's that the entrance chain signals have been replaced with circuit controlled rail signals so the "wait point" is halfway through the intersection. It may work if you place the circuit controlled rail signals before the chain signals. I'm not really sure if that can guarantee that starvation is not possible though.Distelzombie wrote:I dont understand how the circuit could cause this. Does this happen without circuits? You tested it before: It is "WIDE B" for RHD. Maybe your setup has changed?
Or... is it because there is no wait time between both green signals? I mean to stop trains that otherwise would have blasted through the junction on the last milisecond. Is that it?
One entrance at a time will limit throuphput too much, I think. Any Idea how to improve on this?
It was always rail signals.aaargha wrote:It's that the entrance chain signals have been replaced with circuit controlled rail signals so the "wait point" is halfway through the intersection. It may work if you place the circuit controlled rail signals before the chain signals. I'm not really sure if that can guarantee that starvation is not possible though.Distelzombie wrote:I dont understand how the circuit could cause this. Does this happen without circuits? You tested it before: It is "WIDE B" for RHD. Maybe your setup has changed?
Or... is it because there is no wait time between both green signals? I mean to stop trains that otherwise would have blasted through the junction on the last milisecond. Is that it?
One entrance at a time will limit throuphput too much, I think. Any Idea how to improve on this?
I dunno, it does not match any of the blueprints available in the OP at least. It looks a bit like the LHD variant with the signals just moved to the other side of the rails. I'll probably take a look at it once the tester is up, but we'll see.Distelzombie wrote:It was always rail signals.
Well, I made it for testing. You could change it and do more tests if you want.
That should work, it'd be easier to do with an item that did not require more than what a stack inserter can move per swing to build, but that's easy to fix by changing item to build. I'm not really sure how useful the graph will be but the production stats might be nicer to look at than reading circuit values from a power polepieppiep wrote:Just a random idea I haven't tried yet, you can use the pulse signal from the train counter to control inserters that will build a train in an assembling machine. That way you can use the production screen for graphs.
It is "WIDE B" for RHD with one rail signal on the outside diagonal removed because I dont think thats necessary. It also has a rail signal on the output of the junction. This one should be there always.aaargha wrote:I dunno, it does not match any of the blueprints available in the OP at least. It looks a bit like the LHD variant with the signals just moved to the other side of the rails. I'll probably take a look at it once the tester is up, but we'll see.Distelzombie wrote:It was always rail signals.
Well, I made it for testing. You could change it and do more tests if you want.
If you first build a copy from the blueprint in the OP and the hover your blueprint over that you'll see that some of the rail signals can't be built because they collide with existing chain signals, those are the ones I mean.Distelzombie wrote:It is "WIDE B" for RHD with one rail signal on the outside diagonal removed because I dont think thats necessary. It also has a rail signal on the output of the junction. This one should be there always.
Both changes were not the cause of this deadlock though.
Aynway I am hyped for the test results. xD
Woohoo! Thank you! The proof of my insanity shall forever be immortalizedKoub wrote:[Koub] Stickied the topic : It's invaluable ressource for understanding better the rail part of the game.