Trains still route to closest station (with limits set)

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
_Shin_
Inserter
Inserter
Posts: 24
Joined: Thu Jan 12, 2017 7:00 am
Contact:

Trains still route to closest station (with limits set)

Post by _Shin_ »

i never used the same station names because of this issue, but figured I'd give it a shot with these limits. It's better than it was, but it still happens. Farthest stations see the least use while closer stations are overused. I was going to go into a lot more detail, but I lost motivation on the topic. At least for outposting this isn't the solution I was hoping for.
Loewchen
Global Moderator
Global Moderator
Posts: 9274
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: Trains still route to closest station (with limits set)

Post by Loewchen »

_Shin_ wrote: Thu Dec 03, 2020 1:07 am Farthest stations see the least use while closer stations are overused.
Of course they do, limiting the trains allowed at a station at the same times does does exactly that and nothing more. If you have multiple stations available the train will always take the one it believes it can reach the fastest, that is why you need to deactivate stations that do not need a train right now.
mmmPI
Smart Inserter
Smart Inserter
Posts: 3648
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Trains still route to closest station (with limits set)

Post by mmmPI »

_Shin_ wrote: Thu Dec 03, 2020 1:07 am At least for outposting this isn't the solution I was hoping for.
You got to put a limit of say 1 train on each oupost, this way, when a train is already going to one outpost ( the closest ) the second train will try to reach another outpost ( the second closest), then third train, if there is a limit of 1 for the 2 outpost, will go to the third outpost and so on.

This way you avoid that all 3 trains try to reach the 1rst outpost. Hence you can avoid train always routing to the closest outpost.
_Shin_
Inserter
Inserter
Posts: 24
Joined: Thu Jan 12, 2017 7:00 am
Contact:

Re: Trains still route to closest station (with limits set)

Post by _Shin_ »

mmmPI wrote: Thu Dec 03, 2020 1:34 am
_Shin_ wrote: Thu Dec 03, 2020 1:07 am At least for outposting this isn't the solution I was hoping for.
This way you avoid that all 3 trains try to reach the 1rst outpost. Hence you can avoid train always routing to the closest outpost.
Right...or I could just give them different names like i've done for like 3 years now.
_Shin_
Inserter
Inserter
Posts: 24
Joined: Thu Jan 12, 2017 7:00 am
Contact:

Re: Trains still route to closest station (with limits set)

Post by _Shin_ »

Loewchen wrote: Thu Dec 03, 2020 1:14 am
_Shin_ wrote: Thu Dec 03, 2020 1:07 am Farthest stations see the least use while closer stations are overused.
that is why you need to deactivate stations that do not need a train right now.
Limiting the # of trains doesn't do a whole lot if the station is deactivated.
mmmPI
Smart Inserter
Smart Inserter
Posts: 3648
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Trains still route to closest station (with limits set)

Post by mmmPI »

_Shin_ wrote: Thu Dec 03, 2020 1:43 am Right...or I could just give them different names like i've done for like 3 years now.
Yes , but if you have 10 trains for 7 outpost, you can't really dispatch the same amount to all outpost if they have unique name.

Or 7 train for 10 outpost :).

The train limit allow you to name all outpost the same without running the risk of all 10 trains arriving and queueing at the closest. ( the "herd" effect ).
If the station gets activated BUT with a limit of 1, you mitigate this.

Limiting the #of train doesn't do a whole lot when it's deactivated, it's when it activate that it shine :)
_Shin_
Inserter
Inserter
Posts: 24
Joined: Thu Jan 12, 2017 7:00 am
Contact:

Re: Trains still route to closest station (with limits set)

Post by _Shin_ »

mmmPI wrote: Thu Dec 03, 2020 1:53 am
_Shin_ wrote: Thu Dec 03, 2020 1:43 am Right...or I could just give them different names like i've done for like 3 years now.
Limiting the #of train doesn't do a whole lot when it's deactivated, it's when it activate that it shine :)
I take your point, I guess it's just a solution to a problem I've not encountered or found other ways to solve.
User avatar
5thHorseman
Smart Inserter
Smart Inserter
Posts: 1193
Joined: Fri Jun 10, 2016 11:21 pm
Contact:

Re: Trains still route to closest station (with limits set)

Post by 5thHorseman »

_Shin_ wrote: Thu Dec 03, 2020 1:43 am
mmmPI wrote: Thu Dec 03, 2020 1:34 am
_Shin_ wrote: Thu Dec 03, 2020 1:07 am At least for outposting this isn't the solution I was hoping for.
This way you avoid that all 3 trains try to reach the 1rst outpost. Hence you can avoid train always routing to the closest outpost.
Right...or I could just give them different names like i've done for like 3 years now.
You can, but by limiting the stations to 1 (or 2 if you want one always waiting in the wings) and having exactly (stations * 2) trains means that all of your trains are active (unloading, loading, or queued) and when you make a new station, all you need to do is copy an existing station and create 2 more trains.

...barring the problem that you frequently have more of one type (loading/unloading) than the other and you'll need to tweak that. But it's still better than having to create "Iron mine 7" and then figuring out to which of your 4 smelting arrays you want to send them.
Kahnugo
Inserter
Inserter
Posts: 48
Joined: Thu Nov 12, 2020 1:10 am
Contact:

Re: Trains still route to closest station (with limits set)

Post by Kahnugo »

You can also dynamically set the train limit on the stops instead of deactivating them. If you set the train limit >0 whenever a stop is in need of a train you can pretty much distribute trains as you like.
foamy
Filter Inserter
Filter Inserter
Posts: 432
Joined: Mon Aug 26, 2019 4:14 am
Contact:

Re: Trains still route to closest station (with limits set)

Post by foamy »

In a save I've got that was started before the transition, what I've wound up doing is, on one hand, naming my mines individually, but using train limiters on their dropoff points. If you have more trains than slots in the dropoffs you'll always have a train wanting to go to a station, but with the train limits you don't have all your trains trying to go to the same station any more. It forces them to spread out amongst your network.

If you want to avoid queueing back at the pickup areas and/or allow trains to re-route, there's some circuit network/dummy stop shenanigans I think can be done, but so far I haven't felt the need.
astroshak
Filter Inserter
Filter Inserter
Posts: 637
Joined: Thu May 10, 2018 9:59 am
Contact:

Re: Trains still route to closest station (with limits set)

Post by astroshak »

Although I suspect there is a simpler way to do it, my plan is to allow the train count dynamically.

Each Cargo Wagon can hold 2000 ore. Each gets fed by 6 Stack Inserters taking from Steel Chests, each of which can hold 2400 ore. With a balancer before the ore reaches the chests, I should have a fairly even distribution of ore for each cargo wagon. So, in theory, summing the ore in all the chests, dividing by the total number of Cargo Wagons, then dividing by 2000 should give me the number of trains the station is ready to accept.

I’d like to do it per Cargo Wagon and then get the lowest result, so if one set of six chests is running low for some strange reason the station does not allow that last train, but I’m not sure how to go about doing that without a ton of combinators.
Guenni7
Fast Inserter
Fast Inserter
Posts: 149
Joined: Thu May 18, 2017 5:53 am
Contact:

Re: Trains still route to closest station (with limits set)

Post by Guenni7 »

_Shin_ wrote: Thu Dec 03, 2020 1:07 am i never used the same station names because of this issue, but figured I'd give it a shot with these limits. It's better than it was, but it still happens. Farthest stations see the least use while closer stations are overused. I was going to go into a lot more detail, but I lost motivation on the topic. At least for outposting this isn't the solution I was hoping for.
When the closer stations get "overused", the train limit on the stations is probably set too high.
It's also important to have enough trains in the network, f.e. if you have 5 stations with train limit=2 you should have at least 10 trains running to satisfy them all.

I just did switch from 1:N to N:N yesterday and it took me a while to find the right amounts for train-limit and trains, but it operates really smooth now, even the farthest outposts are served as intended.
Durr
Inserter
Inserter
Posts: 43
Joined: Fri Mar 22, 2019 8:12 pm
Contact:

Re: Trains still route to closest station (with limits set)

Post by Durr »

I have all my stations set to 1 (unless I have a stacker for that station, then I add the number of trains that will fit in the stacker) and then add the limits of all the stations and subtract one for a particular cargo to determine how many trains. For example, I have 2 copper plate shipping stations and 5 copper plate receiving stations (no stackers for either), so I have 6 copper plate trains running. I do one less train than station limits so that there is always a free station for a train to move to.
Tired of manually backing up your saves? Check this out! -> Factorio Backup
astroshak
Filter Inserter
Filter Inserter
Posts: 637
Joined: Thu May 10, 2018 9:59 am
Contact:

Re: Trains still route to closest station (with limits set)

Post by astroshak »

I used to total the cargo wagon’s chests together to ensure that there was at least 2000 ore before sending a Green signal saying there was enough for a load.

I think, now, that just averaging the total in the chests (to ensure that no chest gets too far ahead of any other) then just dividing the total in the chests by (2000 * number of cargo wagons) and outputting that as a signal T (or L) can then be used for both turning the station on/off (on when T >= 1), and for setting the train limit (limit = T).

You still need to ensure that you have enough mines set up though.
Yoyobuae
Filter Inserter
Filter Inserter
Posts: 509
Joined: Fri Nov 04, 2016 11:04 pm
Contact:

Re: Trains still route to closest station (with limits set)

Post by Yoyobuae »

IMO, the train limit setting is not meant to solve all train problems. You still need those solutions that existed before (train path penalties, train parking areas, etc) to complement train limits.
_Shin_
Inserter
Inserter
Posts: 24
Joined: Thu Jan 12, 2017 7:00 am
Contact:

Re: Trains still route to closest station (with limits set)

Post by _Shin_ »

I was just saying this wasn't the solution I was hoping for. Never said it was useless or not a good new addition, just not what I had hoped for.

Perhaps it would be possible to add an additional option, that being round robin. Instead of the AI always selecting the closest open/available station, it would take all 6, or 10 or whatever, and select them in sequence as first priority. if that one is busy, it goes to the next. It could also go to the longest unused station first. This is similar to how phone banks work to ensure every worker is getting calls.
foamy
Filter Inserter
Filter Inserter
Posts: 432
Joined: Mon Aug 26, 2019 4:14 am
Contact:

Re: Trains still route to closest station (with limits set)

Post by foamy »

In combination with some relatively simple circuits to close a station's entry signal it's not really possible to have an 'overused' station any more. Build as many trains as you have your train limits set and you'll never encounter it again: your trains will distribute themselves among the network, and a station will only allow a train in -- and therefore free up a slot when it departs -- when it requires more material. Alternatively, if you unload direct to machine or belt, I don't think you even need that. The train'll just sit there until it is unloaded, with however many extra you've set the limit to queued in behind it.

I guess if you have a platform with, like, uncontrolled chests, you could have issues, but...?

Like I wouldn't mind more precision in how I can control train routing, but with limits I think the game now gives you the needed tools to do what you want.
Zanthra
Fast Inserter
Fast Inserter
Posts: 232
Joined: Fri Mar 25, 2016 8:18 am
Contact:

Re: Trains still route to closest station (with limits set)

Post by Zanthra »

_Shin_ wrote: Fri Dec 04, 2020 11:49 pm I was just saying this wasn't the solution I was hoping for. Never said it was useless or not a good new addition, just not what I had hoped for.

Perhaps it would be possible to add an additional option, that being round robin. Instead of the AI always selecting the closest open/available station, it would take all 6, or 10 or whatever, and select them in sequence as first priority. if that one is busy, it goes to the next. It could also go to the longest unused station first. This is similar to how phone banks work to ensure every worker is getting calls.
Trains don’t pick a station then find a route to it. Rather they search all the available routes ahead of it in a tree, adding up the path length as it evaluates them, always evaluating the next possible branches from the current shortest path. As soon as the next path branch to be evaluated contains a station that matches the next destination in the schedule, pathfinding can immediately stop, as that is the shortest route to the destination.

If you want trains to better distribute among the various stations, you could use combinator logic. You could for example have an SR latch at each station that sets the trains limit to 0 or 1.

1) A constant combinator at each station sends a signal with a value of 1 into the network on a select signal, such as A to allow a dynamic count of the stations.
2) When the number of trains heading to or at the staton is 1, set a latch indicating the station has been visited this cycle. This sets the trains limit to 0 (but still allows the train currently pathing to the station to arrive), and also send a value of 1 on another signal such as B.
3) When B=A, all stations have been served this cycle. If both B=A and the station can service a train, reset the latch, and set trains limit to 1, and stop sending the B signal on the network.
Guenni7
Fast Inserter
Fast Inserter
Posts: 149
Joined: Thu May 18, 2017 5:53 am
Contact:

Re: Trains still route to closest station (with limits set)

Post by Guenni7 »

I think people are overcomplicating things when it comes to train stations.
I have a lot of stations running without any circuit, took some time to get right amounts of train limits per station and trains, but it's really working like a charme without any circuit logic.
Except for special cases, I guess you're not using the train station limit right if it's not working as you want.
Kyralessa
Filter Inserter
Filter Inserter
Posts: 575
Joined: Thu Sep 29, 2016 5:58 pm
Contact:

Re: Trains still route to closest station (with limits set)

Post by Kyralessa »

_Shin_ wrote: Thu Dec 03, 2020 1:43 am Right...or I could just give them different names like i've done for like 3 years now.
You could. Train limits solve some problems, but can create new ones.

I always send an artillery train around to keep things clean at my outposts.

With train limits, I've named all my iron mines the same, all my copper mines the same, etc. For the artillery train, this causes two problems:
  • I can't send it to individual mines anymore, because it randomly picks from among the same-named stations. It'll go to an iron mine to shoot, but I can't know which one.
  • If I have very low train limits on a set of stations, the artillery train can even get stuck and not go anywhere because no stations are free for it.
Which is not to say I don't like the train limits, but just that I need to do some more thinking about how my artillery train fits into all this.
Post Reply

Return to “Gameplay Help”