Large/complex train setup issues

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
Tertius
Filter Inserter
Filter Inserter
Posts: 668
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Large/complex train setup issues

Post by Tertius »

I have an issue with a complex train setup. For a larger base, I build a train system with 4 stations for every type of train.
Each train type only carries one specific material and has a schedule like this:

1. depot station for empty trains outside the main base
2. loading station
3. depot station near consumers
4. unloading station


Overview is like this:
1train overview.jpg
1train overview.jpg (158.3 KiB) Viewed 1475 times
Example schedule:
2schedule.jpg
2schedule.jpg (61.88 KiB) Viewed 1475 times

Train limit of loading stations is as many as trains can be completely filled by the station buffer chests (usually 0..4)
Train limit of depots is the number of lanes of the depot waiting area.
Train limit of unloading stations is 2 if at least 1 train can be fully unloaded, 1 otherwise. So always at least 1 train is at the station.

Works good in general for 1 big depot per material, however the issue is if I start to create multiple depot stations in different areas of the base.

1. Trains will only drive to the nearest depot station, and only if it is full they will drive to the other depot stations. This vastly increases the amount of trains that are required and much dead material is laying around in the trains.
2. And worse, it sometimes happens that a train drives through one depot, but targets an unloading station behind one other depot at the other end of the base, which twarts the usage of depots near the unloading stations. And these "rogue" trains congest the tracks and the waiting areas of the depot stations, where they still have to drive through (again) to reach their target.

What is the common solution for these two issues? How is my train limit concept or depot concept flawed?

I have ideas how to improve, but I'd like to see other working examples.

One idea is to establish a circuit communication between depot stations that dynamically adjust their train limits, that take the train limits of the unloading stations behind them into account, so trains are distributed more evenly among them. This solves the first, but probably not the second issue.

Or create separate naming spaces and schedules even for the same materials, so there is always only 1 depot station for every naming space. However, this will vastly increase the amount of trains and you lose the synergy of supplying different consumers from the same producers. This solves both issues but vastly increases the required amount of producers (loading stations) and trains.

Or move the waiting areas from the depot station directly to the loading and unloading stations. The depot stations get no waiting area any more and change their role to only uncouple the loading stations from the unloading stations. This solves both issues, however it needs a large amount of space directly in front of busy unloading stations, which is not nice for some tiled smelter array setups, and it vastly increases the amount of trains, since there is no common waiting area any more. Might be a solution for mines/producers, but not for unloading/consumers.

What is it what you do for this?

robot256
Filter Inserter
Filter Inserter
Posts: 596
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: Large/complex train setup issues

Post by robot256 »

Nice description of your system and what is happening. That all sounds like the trains are following the game's rules correctly, so the question is how to use the rules to achieve what you want.

My observation is that the following are two different tasks:

1. Queue enough trains nearby each unloader that production is not halted waiting for the next train; and
2. Not enough space for all idle trains to park at one loader/unloader/depot.

To accomplish #1, you would calibrate the train limit of the unloader and/or that unloader's depot based on its expected consumption rate. If you do not have enough production, or enough trains, then distant unloaders will still be starved, and the only solution is to increase production or give too small a train limit/buffer to the near unloaders. And once you have enough trains, they will be able to fill all the depots and you might as well make them dedicated to each unloading depot.

#2 by itself is easy: you can make depot stops anywhere that return trains to the main network when an unloader needs them. Sometimes they will travel a longer distance, but they won't get stuck.

You can use circuits to dynamically set the depot train limits if you like. But that only masks the problem of having too many depot slots or too few trains/production.

If you want to use mods, you don't have to go straight to LTN. You could use Dispatcher to do exactly what you originally wanted: have trains at each depot able to route to only certain loaders/umloaders, without being dedicated to just that route.

mmmPI
Smart Inserter
Smart Inserter
Posts: 2733
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Large/complex train setup issues

Post by mmmPI »

Tertius wrote:
Fri Dec 16, 2022 11:22 am
What is the common solution for these two issues? How is my train limit concept or depot concept flawed?
Question 1 :

Issue 1 = make sure enough train are queued up near unload station so that supply is not disprupted while not having too much material sitting idle on track

Common solutions = add more trains , reduce/adapt amount of buffer room for trains in front of unload stations.

I know that may sound like dodging the question, but i think on this point it is important to define precisely the objectives one is trying to achieve. The supply disruption means there is not enough production or not enough trains when considering a stable system. The situation where trains are increasingly piling up somewhere while lacking somewhere else i think has to be disregarded as "temporary". And one has to consider the situation in "long time" when all buffer are filled. If your system doesn't reach such state, i think you need to add more production or more trains.

I think that's the common solution, as the uncommon solution would be to set up a priority system to control starvation of material, which is not what people do usually :) they consider as a given/axiom that production>demand leading to part of the issue not being even considered in the first place.

In this case the precise minimum amount of material standing idle on track can in theory be 0, but it's very difficult to achieve such efficiency as the distance between production and demand is bound to increase overtime as ressources deplete so that would require constant adjusting. And as such it's better to have "more" train sitting around than "not enough" and having a margin is not to be seen as inefficency but rather safety.


Issue 2 = it sometimes happens that a train drives through one depot, but targets an unloading station behind one other depot at the other end of the base

This is a true "problem" i think, which comes from the fact that trains that decide to wake up to fill in a "limit slot" that open anywhere on the map are not the closest train to the destination, but rather a train in what look like a random order. ( i can't remember for sure wether it is the train waiting for the longest time, or the train with the smallest ID and there could be particular cases with already moving train vs 0 speed train).

I think it is also one of the anwser to the second question, there seem to be a flawed assumption that this would be the case when you set up your depot.


Question 2:

first I want to express again part of my introduction as " what is too many material sitting idle on track ? "

The trade-off could be expressed as material sitting on track is "available quickly", which gives your factory some reactivity when peak demand, but it takes time to fill in this buffer area which diminish reactivity when reaching edge cases of initialisation or low ressources. Reactivity is necessary when using trains which have different cycling behavior, as if there was always perfect timing for everything, the slightest of change or traffic congestion would create spiraling unbalance, too much buffer is not a fundamental flaw as it would eventually fill up, it feel to me as not really a matter of perfect optimized numbers but has a personnal preference of what you consider too long for those to be filled up.

In such case the "good practice" from my point of view, is to plan according to your particular behavior, not try to find "the perfect system" as an absolute, but rather the most suitable for your particular purpose. Similar to how many slot do you limit the chest that hold the yellow belts in early game. Sometimes 1 slot, sometimes 10 slot, sometimes you don't limit, depending on the plan for the game.

If you add trains 1 by 1 when you notice a lack of them, it will obvisouly be very annoying compared to adding them by batch of 10 or 20. But if you plan to make a megabase with 1000 + trains, you don't start by building all 1000 trains and then 1000 loading and unloading area. If you have an area with "furnaces" that receive shipment of raw ore from all around the map, the distance is going to increase as patch deplete which means more trains will be required to maintain the same throughput of material and as such probably more room for them, it's different if you have a fixed distance between the depot and the unloading area, as this can use special train whose number is going to always be the same, train carrying plastic between refineries and red circuit assembly for example.

Part 2

About that "rogue train " problem i think there are differents solutions depending on the objectives, i'm wondering "what do you use the depot for precisely ?". Considering the previous evaluation of the situation, i see two different angle for what the depot is trying to achieve, 1) maintaining material to be available quickly for the unload station / avoid disruption 2) Optimizing train travel on the map when doing the travel producer=>depot.
The problem faced while trying to achieve this tasks is due to scaling from 1 to 2 depot.

The first task i think doesn't need explanations and would be achieved as a consequence of the second task if the "optimizing train travel" could be defined more precisely. As such i'll focus on this.
Tertius wrote:
Fri Dec 16, 2022 11:22 am
What is it what you do for this?
My personnal thought for your ideas to give name to depot i think is a good idea in general, but it has to be considered relative to how is your base layout. If you consider your base as a core in the middle and ressoures on the periphery, you could have 4 depot North East South West, and their associated station named with the addition of the cardinals somewhere in their name, not so much as "unique" name but rather "group". Yes this would force you as a player to make sure there is enough iron in the North, but also in the East and in the South and in the West. But also if you already have 4 depot, that means 4 furnaces area, and at this point i assumed you have separated system of production, that the 4 iron plate lane do not join in 1 particular place. Going that way allow to name the mines too with the addition of North Eeast South West in their name, and you avoid cross traffic in the denser central area. If you have 1 furnace area, then i'm not sure why 1 larger depot is not used rather than 2 or 3 depot.
In this case as you mentionned there can be no rogue train.

I'm not sure i understand the purpose of the 2 depot per schedule in your second development, "uncouple loading and unloading" is not something i think of as a necessity, sometimes what i do is not uncouple loading and unloading. If you consider you have way enough production, then the trains are supposed to all be waiting full in the depot, or in their way going there, but you will not have many queue to the loading station, there should be 1 available at all time. You can use the limit to make sure a trains goes to load only when there is a full load available. In such case there is only 2 station on schedule, load and unload. The unload station can have a limit of say 5 or 6, 1 train unloading, and the waiting area you can make it further away using chain signal so that all train queue in a "depot/stacker" without name or train stop.

If you don't want to put 5-6, you can have a limit that is dynamic based on how much material is missing at the unload Limit = 1 + ([material when depot full]-[current quantity]/full train capacity. If the limit is preventing trains to move in, they have to wait, filled with material, at the loading area, for when a limit slot opens at the unload area, in doing so they are not preventing any train incoming to the loading area/blocking, because an hypothetical "blocked" train would be one exactly as the one blocking it which would therefore take the open slot liberated by the now "blocked" train.
I only have used occasionally this dynamic limit so i may be forgetting something in that part, i'm more confident with the static limit to 5-6.

I think there are also "technical" workaround for your rogue train problem, one i can think off because i use it often is when using double-head train, you can make it so that a train at the "depot" will only be allowed to reach the closest unload station, otherwise it shows "no path". If you use many "depot" train stop with a limit of 1 in a dead-end. you can make it so that reversing direction from here lead to a train stop for unload. If such reversal is the only way to reach the unload, then a train in a depot could only have its next step be to do such reversal and not reach another unload area somewhere far away solving the rogue train problem.

farcast
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Fri Jul 06, 2018 8:25 am
Contact:

Re: Large/complex train setup issues

Post by farcast »

I don't see the need for a depot for empty trains in your case. If the loading stations can't fill enough trains fast enough then the unloading stations will eventually starve with or without the empty train depot. The difference the empty train depot makes is that it allows unloading stations to use every filled train available before they starve. Without the depot, unloading stations will starve while filled trains are available because the empty trains are stuck waiting for a loading station to open up, but again, they would have starved no matter what, so I consider this to be a purely aesthetic issue.

With only a depot for filled trains, you can make separate schedules for each depot & set of unloading stations while minimizing the number of trains needed, and easily allowing every loading station to supply every unloading station. You can also use the same depot for different resources to make scheduling a little easier.

Train schedule:
-common loading name
-specific depot
-specific unloading group name

Troubleshooting guide:
-Trains waiting at unloading stations?
--Make more loading stations / fix production.

-Consumers are starved, but no trains are waiting?
--Make more trains for that group of consumers.

-Lots of trains in depot, but otherwise nothing is wrong?
--Use fewer trains for that group.
Efficient inefficient design.

Amarula
Filter Inserter
Filter Inserter
Posts: 511
Joined: Fri Apr 27, 2018 1:29 pm
Contact:

Re: Large/complex train setup issues

Post by Amarula »

I love trains, lots of trains, trying different ways of using trains... I have experienced your issue, with trains going from the east edge of my base all the way over to the west, in order to come back again, so I feel your pain. Adding more trains, and more outposts to ensure those trains get filled is great... until they all slow down due to congestion. My own personal experience is that congestion is the ultimate enemy... and dealing with it starts with initial design decisions.

My current favourite approach is to use zones. I have a mall zone with 30 or so city blocks so growing the factory never has to wait on production :) I have zones for each science pack, one for satellites, and one for the rocket silos. Each zone has its own resources, with outpost trains delivering those resources; the resource train lines are separate from the inner zone, so iron ore trains cannot decide to clog circuit production, and LDS trains cannot take a scenic tour through a copper mine. The train network for each zone is similarly isolated from every other zone, so there is no way for a train on the eastern edge to go west young train go west. Finally I have an inter-zone train network that is limited to my personal transport, science trains delivering science packs to the research park (and satellites to the rocket silos), and mall trains delivering train fuel, construction resources, and artillery for defense. This does have entrances, no exits, into the zones, for inserting new trains (which are built by construction bots over in the mall zone).

Now I can't say this has solved my congestion problems, but it certainly limits them so I only have to consider the traffic patterns within a single zone. I also find it much easier to fine tune the allocation of supply trains to meet the needs of a single zone, without juggling competing demands from the entire set of science packs.

Good luck, have fun, Merry Christmas, and may the factory grow!
My own personal Factorio super-power - running out of power.

Tertius
Filter Inserter
Filter Inserter
Posts: 668
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Large/complex train setup issues

Post by Tertius »

Many thanks for all your comments, every single one. Very interesting. I'm glad my view on the thing isn't fundamentally different to yours.
I guess it boils down to this (at least I will now try to approach the issues this way):
  • No empty train depots for mines/producers if possible. Instead, more space for queues and higher train limits for the loader stations themselves.
  • group consumers that can use the same 1 depot and make an own schedule for each group. Share the depot for this group, no need to make every material his own depot.
  • provide more producers (and/or mines). I tried to produce only slightly more than was consumed, so queues filled very slowly.
  • take a view of the whole system after it has stabilized and all queues filled, not during the process of filling.
It's still a project within a lab environment in map editor mode, so I create and destroy whole production lines with one mouse click just to move them by 20 tiles, so I mostly see everything filling up again and not after everything has stabilized (although I thought I waited enough, but I probably didn't).
I will also simulate my mines better. Currently, they are not as far away as you expect for a real map.

Why I do this in map editor mode and not let a real base grow in an organic way:
I get bogged down easily when tackling a complex subject all at once. I tried to start with a real map with the ores, then the smelters, then the green circuits and so on. "Bottom up" concept, if you know what I mean. But I always built too small and lost interest.
Then I did it the other way round. "Top down". In the lab.

I wanted to create a base that continuously launch from 5 fully beaconed rocket silos. This is 5k SPM. This is the goal to reach. 1 seemed a bit lackluster, but 5 seemed ambitious enough.

So I built an array of 5 fully beaconed rocket silos in map editor and supplied the resources from infinity chests.
Then I designed and built as many production lines to provide the resources for the rocket silos and replaced the infinity chests of the rocket silos. And science pack production lines for the other science packs.
Then I built as many production lines to provide the next lower level of material and fed them with infinity chests. And so on.

And now, I'm at ore, smelters and circuits. This was the first time I needed trains. And so I got here. I thought, my sophisticated train and station blueprints (2 lane design) were sufficient, but they weren't sufficient at all. Actually, I didn't even use one of them for the WIP megabase. They were simply not applicable.

mmmPI
Smart Inserter
Smart Inserter
Posts: 2733
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Large/complex train setup issues

Post by mmmPI »

It may be worth mentionning that you don't have to carry ore by trains, depending on how you plan to setup your game, or simulate your mining drills.

On a default settings map, you can decide to offset by a very large distance your large SPM base once you have your starter base ready, this way you get access to very rich ore patch, and as such you can consider setting up furnaces directly adjacent to those ore patches and only carry plates, although the receipe is 1=>1 ratio and gets negative toward the plate if you use productivity module, the stack size of plates vs ore more than makes up for it in reducing the amount of trains required , if considering "rolling stock moving at all time". Smelting steel directly near iron patch cut down on iron trains by A LOT.

Tertius
Filter Inserter
Filter Inserter
Posts: 668
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Large/complex train setup issues

Post by Tertius »

I decided against smelters near the mines, because mines will run out sooner or later, and I want to set up smelters and forget about them - only explore new mines if necessary. Actually, for steel I already planned a completely separate train network with iron ore only.

Somehow, I ended up with this monster for the steel demand of a 5k SPM base, able to create 21 full blue belts with steel, required if you want to research the infinite mining productivity. (ok, it's paradoxial to waste ore to increase ore productivity, but you know: the factory must grow and the only truly good factory is a polluted factory).
Screenshot 2023-01-01 212833.jpg
Screenshot 2023-01-01 212833.jpg (1.02 MiB) Viewed 1104 times
My initial concept was to simplify production and divide it into self contained modules this way:
- trains bring required material
- a production line creates higher refined material from the train-delivered items
- trains carry produced material away

This way every production line has well defined and very little inputs and outputs: trains with the corresponding material, and only trains and nothing else. And it uncouples production and consumption location.


But I realized I am able to "shortcut" much production, for example I don't need to stuff plates required for green circuits into trains, only to unstuff them again only a few tiles away. The belts required to connect the train stations only need a few more belts to directly connect the output of the smelters with the input of the circuit prodution lines. I didn't see this earlier. I thought the space requirements of the different production lines are so different that such shortcutting wasn't feasible. But it's feasible.

I need a few more weeks to let all my thoughts about this become coherent, then I will tackle this again. Meanwhile, I'm in the process of revisiting my nuclear power plant :geek:

Post Reply

Return to “Gameplay Help”