Page 1 of 1

How to optimize railsetup

Posted: Fri Mar 20, 2020 5:49 pm
by planetmaker
Consider the setup as in the screenshot:

one train is waiting at the entrance to the station complex while there are accessible free stations. Is there a way to make it favour the non-occopied but open stations instead of waiting for an occupied one? The difference is the open, but un-occupied are behind a circuit-controlled closed station. I consider this a bit strange behaviour on behalf of the path finder... alas.

More combinators and closing station as soon as one train is loading might be an option but is not my preferred solution as it costs space which I don't have.
Bildschirmfoto von 2020-03-20 18-45-04.png
Bildschirmfoto von 2020-03-20 18-45-04.png (227.49 KiB) Viewed 2965 times

Re: How to optimize railsetup

Posted: Fri Mar 20, 2020 8:18 pm
by astroshak
IIRC trains choose their routes based on “percieved distances”, and it measures that percieved distance based on the number of signals (rail and chain) it must pass, picking the shortest distance.

Things like trains occupying a station add a certain amount of weight, or “percieved distance” to the calculation. So do circuit-closed stations. In fact, I believe that circuit-closed stations add the most to that distance calculation.

I understand what you are trying to do, to load the train directly from the miners, and to account for the fact that different wagon spaces will have different depletion times for the overall mine. I just don’t know what you should do about it. I tried it once, and at a very low Mining Productivity level did not care for it. I have personally scrapped the idea, but if you can get it to work well, more power to you.

Re: How to optimize railsetup

Posted: Fri Mar 20, 2020 8:38 pm
by 5thHorseman
This is just a thought. I've never used this particular setup but I have had multiple stations with the same name at the same outpost.

Try putting a station right where your train is waiting. Name it "Enter [iron ore]" or something. Have all trains path to it with no conditions, then "[iron ore] pickup". They should pick an unused station at that time, no?

If that doesn't work, maybe disable stations based on if a train is at them.

If that doesn't work, try both together :)

Re: How to optimize railsetup

Posted: Fri Mar 20, 2020 9:07 pm
by Ghoulish
Optera wrote:
Fri Jan 24, 2020 6:15 pm
Too bad you didn't also "fix" that trains waiting at signals can accumulate infinite penalties.
A simple cap on the waiting penalty would make trains path into stackers a lot more reliable.
Think this is the same issue? Quote from Friday Facts #331 - 0.18.0 release & Train pathfinder changes

Re: How to optimize railsetup

Posted: Fri Mar 20, 2020 9:29 pm
by Zavian
Quoting https://wiki.factorio.com/Railway/Train_path_finding
When the path includes a train stop that is not the destination -> Add a penalty of 2000.
My guess is that penalty will result in a train preferring to wait for an open but occupied train station to be available rather than pass a train stop that is closed. (I'm not certain that a closed station applies that penalty, but I think it probably does).

Maybe try closing the other stations as soon as a train arrives. (I've never used such a setup, but from memory of other forum threads closing a station as soon as a train arrives shouldn't result in the just arrived train having to leave). With only one open station, the train will hopefully use that despite the penalty.

Re: How to optimize railsetup

Posted: Sat Mar 21, 2020 6:10 am
by Optera
Ghoulish wrote:
Fri Mar 20, 2020 9:07 pm
Optera wrote:
Fri Jan 24, 2020 6:15 pm
Too bad you didn't also "fix" that trains waiting at signals can accumulate infinite penalties.
A simple cap on the waiting penalty would make trains path into stackers a lot more reliable.
Think this is the same issue? Quote from Friday Facts #331 - 0.18.0 release & Train pathfinder changes
No my post in FF331 was a reference to an issue with stackers here: viewtopic.php?p=382712#p382712

What's happening in the op is the train waiting would have to pass through closed stops getting to open stops so it prefers the occupied stop.
For this setup to work 4 closed stops must have less penalty than one occupied open stop.

Re: How to optimize railsetup

Posted: Sat Mar 21, 2020 12:26 pm
by Pi-C
Zavian wrote:
Fri Mar 20, 2020 9:29 pm
My guess is that penalty will result in a train preferring to wait for an open but occupied train station to be available rather than pass a train stop that is closed. (I'm not certain that a closed station applies that penalty, but I think it probably does).

Maybe try closing the other stations as soon as a train arrives.
How about enabling a waypoint stations shortly after a switch instead, so the path behind it gets a bonus (i.e. decreased penalty)? I'm using that method in my game to enforce certain routes. The station needs to be enabled only until the train has crossed the switch:
main_depot.png
main_depot.png (49.42 KiB) Viewed 2861 times
Trains come in from the left and stop at the station with the yellow box. The station on the bottom right is open by default (overflow). I use combinator logic to determine which exit should be opened. The signal behind that switch is set to green, the signals behind all other exits are set to red. The "Node" stations immediately behind those signals are enabled when the signal in front of them is green. The waypoint will always be the closest station of that name the train can reach, so it actually chooses that path. Once the head of the train has passed the signal, it will turn red, so the waypoint station will be disabled again and the train moves on to the next station behind it, without coming to a halt.

Re: How to optimize railsetup

Posted: Wed May 13, 2020 12:56 am
by ZlovreD
Just try to use both signals before each junction. Chain+regular like this:
Image
I've made some tests trying to solve another problem, but conclusions may be helpful and in your case.

Re: How to optimize railsetup

Posted: Wed May 13, 2020 1:32 am
by Impatient
Zavian wrote:
Fri Mar 20, 2020 9:29 pm
... Maybe try closing the other stations as soon as a train arrives. (I've never used such a setup, but from memory of other forum threads closing a station as soon as a train arrives shouldn't result in the just arrived train having to leave). ...
Deactivating a station immediately makes a train leave (if it has more stations on its schedule).

Re: How to optimize railsetup

Posted: Wed May 13, 2020 1:54 am
by Impatient
Pi-C wrote:
Sat Mar 21, 2020 12:26 pm
How about enabling a waypoint stations shortly after a switch instead, ... The "Node" stations immediately behind those signals are enabled when the signal in front of them is green. ... Once the head of the train has passed the signal, it will turn red, so the waypoint station will be disabled again and the train moves on to the next station behind it
Very smart idea

I also had the idea for nodes stations on each track that are active if one station after them is active. But linking those node stations directly to the entrance signal of that track is just too smart.
Pi-C wrote:
Sat Mar 21, 2020 12:26 pm
... without coming to a halt.
"Not coming to a halt" also happens if there are no conditions set for that station in the trains schedule.
planetmaker wrote:
Fri Mar 20, 2020 5:49 pm
Consider the setup as in the screenshot ...
One thing that comes to my mind is the following: If there is more than one "PICKUP" station activated on one track, the trains will always go for the right most one of those stations, I think. Emptying the ore patch from right to left.

Re: How to optimize railsetup

Posted: Wed May 13, 2020 6:52 am
by Pi-C
Impatient wrote:
Wed May 13, 2020 1:54 am
Pi-C wrote:
Sat Mar 21, 2020 12:26 pm
... without coming to a halt.
"Not coming to a halt" also happens if there are no conditions set for that station in the trains schedule.
That wouldn't work in my game: All my stations have the same name, and all trains have the same schedule (goto station, wait for X seconds inactivity + circuit signal "green"). Routing is completely done via circuit network. To be frank, I don't know how it will behave with lots of trains, I've just concentrated on the logic part, neglecting most of my factory during that time. Couldn't continue playing even if I had the time because the one mod crucial to my setup still crashes reliably whenever I touch a locomotive. :-D