Joint train limit on multiple sibling train stops

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 883
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Joint train limit on multiple sibling train stops

Post by Impatient »

Scenario:
- an unloading yard
- twin unloading train stops (same name, for higher throughput)
- a stacker, with enough parking space

Requirements:
- just 6 trains should jointly go to the two stops at any time (train limit)
- any train waiting in the stacker should go to any of the two stops that is free
- the stacker should be usable for trains with a different schedule as well - a multipurpose stacker

Question:
- How can this be done?



What I tried and what was the result:

- First idea was to set the train limit on the two stops to 3 each. But when doing this, each train wants to go to one specfic stop of the two. A train is not changing its destination stop, when it waits at a signal and another stop with the same name becomes free. Which in hindsight makes a lot of sense, as stops with the same name might be all over the map and not right next to each other, unloading into the same storage. So this can not be used.

- Next idea was an intermediary stop with train limit set to 4 (2 trains are a the unloading stops and 4 want to go to the intermediary stop. = 6 ). But where do I place this? Between the stacker and the twin stops, I thought. All the waiting slots in the stacker have a chain signal at their exit. So, 4 trains should wait in the stacker until one of the twin stops becomes free, then one goes to the intermediary stop and continues straight to the free stop of the twins. Sounds cool, but the signal system has a special property which may not be well know (I didn't know it), because no one ever puts train stops in intersections: Trains will enter a closed track section, which is guarded by a RED chain signal, if their next stop is in that section. Yes, you read that right. It is in the train signal tutorial ( https://wiki.factorio.com/Tutorial:Trai ... in_signals ). For my case it meant that both twin stops are occupied and a third train will go to the intermediary stop, then chose randomly one stop of the twins it wants to go to, drive up to the exit signal but still wait inside the block with the intermediary stop. Now when the other stop of the twins becomes free first, then that stop can not be approached. Also a train blocking the connecting track between stacker and unloading stops for trains with all kinds of shedules does not meet the requirement of a multipurpose stacker.

So can a joint train limit for mutiple train stops be done? With a multipurpose stacker and each train selecting the free stop to go to?
mmmPI
Smart Inserter
Smart Inserter
Posts: 3687
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Joint train limit on multiple sibling train stops

Post by mmmPI »

I could reproduce sometimes the problem you mentionned in #2 in my experiments. I had already stumbled accross the behavior you describe with train free to cross a chain signal if it is to go to a station, i was really puzzled at the moment because i had already played a lot and it was a surprise, it was from the forum already i think :D

I had seen someone attempting to have a joint train limit of only 1 for a combined 2 train stop that were the same train station, one facing up, the other facing down where if more than 1 train was dispatched it would cause problem, and it didn't end up well.

However i don't think it has to always be a problem, i couldn't nail precisely what caused the problem mentionned, but with further experiment, i think i was able to get rid of it and achieve the requirements.
dual limit.png
dual limit.png (233.82 KiB) Viewed 863 times
dual limit.zip
(1.23 MiB) Downloaded 32 times
In the case described/ the one i attempted, i think you can remove one or the other or even both chain signal marked with belts pointing at them and it still works, at least when i tested it i didn't see anything that would break the requirements. The blue trains are scheduled differently than the red one, using the further station for the loop, initially none of them could be allowed for unloading as they had never priority, so i increased the waiting time of the red trains at station B and remade some newer train to manipulate ID now blue and red are allowed to unload.
Tertius
Filter Inserter
Filter Inserter
Posts: 950
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Joint train limit on multiple sibling train stops

Post by Tertius »

First idea: you didn't observe the game thoroughly enough. Trains will definitely be reassigned on the fly. It doesn't happen immediately, but it happens. In a setup similar to your first idea with a train limit of 4, it happens for me that one empty station has 4/4 reserved but all 4 are somewhere on the track driving. At the same time, trains that are assigned to different (full) stations accumulate in the stacker. Sometimes, the empty station stays empty until one of the assigned trains arrive, but it also happens that some waiting train is reassigned and continue to the empty station.
According to the wiki, this repath happens every 5 seconds. However, it's possible a train in a stacker is again assigned to an already occupied station and not to that empty station and it seems nothing has changed, so a repath to the empty station might take quite some time (multiple of 5 seconds).

The bigger the stacker and the more stations with the same name behind the stacker, the more often a desired reassignment takes place, as far as I see it.
I use this setup in my base. I just posted an example here the other day.

Second idea:
Impatient wrote: Tue Feb 20, 2024 6:39 am For my case it meant that both twin stops are occupied and a third train will go to the intermediary stop, then chose randomly one stop of the twins it wants to go to, drive up to the exit signal but still wait inside the block with the intermediary stop. Now when the other stop of the twins becomes free first, then that stop can not be approached.
That's not correct. If a train wants to leave the intermediary stop, that train doesn't choose a next destination until a next destination actually becomes available. If the twin stops are still occupied, for example they have a train limit of 1 each and a train is currently being loaded/unloaded at both, the train at the intermediary stop will not choose a next destination. Only if one of the two trains leave their station and the train limit goes to 0/1 for that station, the train at the intermediary stop has a eligible destination and actually choose this as destination as result. And since the station is free now, the train at the intermediary station will immediately proceed. If this is not what you observed, you might have improper signaling. Don't use chain signals except for the stacker entry area - this is different to the 1st variant above.

At least this is how it worked for me, when I used this setup previously. It worked very good, never any unexpected train behavior.

However, you need to make sure multiple preconditions are met. 1) every train with the destination station in their schedule (your twin stations) MUST have the intermediary station in their schedule just before the twin station 2) every train with this intermediary station in their schedule MUST have the same destination station in their schedule as next entry. 3) every station located behind the intermediary station MUST have the same name 4) you MUST NOT deactivate the intermediary station or have some mod that might disable the intermediary station. 5) the train limits of the destination stations must be 1, because that's the space in front of the stations: 1 train can halt at each station. If you provide a longer lane in front of the station, so another train can wait directly in front of a station, you can increase it to 2.
It's somewhat tricky to meet all. These are quite some constraints.

There is a third variant. Provide every stacker lane with its own intermediary station instead of using 1 universal intermediary station behind the stacker. Needs slightly more space than a stacker without anything, but this way one train waiting at the intermediary (depot) station cannot block the path for other trains. All these intermediary stations can have the same name, so the stacker still appears as one single construction entity and all trains can have the same schedule, but you can also create ones with different names to support different destination stations.
I didn't use this setup for a long time, so I cannot tell the more subtle benefits/caveats that exist with this variant.
mmmPI
Smart Inserter
Smart Inserter
Posts: 3687
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Joint train limit on multiple sibling train stops

Post by mmmPI »

Impatient wrote: Tue Feb 20, 2024 6:39 am What I tried and what was the result:

- First idea was to set the train limit on the two stops to 3 each. But when doing this, each train wants to go to one specfic stop of the two. A train is not changing its destination stop, when it waits at a signal and another stop with the same name becomes free. Which in hindsight makes a lot of sense, as stops with the same name might be all over the map and not right next to each other, unloading into the same storage. So this can not be used.
So i did some further tests and i think i identified the cause of this problem that may have given you wrong interpretation. In the system i posted, it is actually very easy to reproduce it, one can order any of the train to go to the unload station directly. When togging the automatic mode for the train. If such train is behind the waypoint, it will not reserve it, instead it will reserve one of the 2 slot for unloading directly. But it can happen that then such train is stuck being the train that is waiting in the waypoint train stop. At this point, there is a problem because there is a train willing to go to an unload and occupying the 1 slot, and a train in front of it, that is blocking its path, but not allowed to reserve 1 of the unload station. This leads to a situation where only 1 unload is available only, for potentially a long duration. Which in turns could cause some trains to exceed the stacker capacity, as 1 train isn't counted in the limit of the waypoint/stacker, but instead in the limit of the unload, while it is occupying a slot in the stacker.
Post Reply

Return to “Gameplay Help”