train bus factory

Smart setups of railway stations, intelligent routing, solutions to complex train-routing problems.
Please provide - only if it makes sense of course - a blueprint of your creation.
User avatar
MeduSalem
Smart Inserter
Smart Inserter
Posts: 1686
Joined: Sun Jun 08, 2014 8:13 pm
Contact:

Re: train bus factory

Post by MeduSalem »

vanatteveldt wrote:I supe assumed so :-S.

Let's science this!

[...]

So: yes, it works :)
Awesome. :o
vanatteveldt wrote:Now that just sounds crazy :). I think the point to optimizing train traffic in factorio (especially given the lack of overpasses/tunnels) is to separate flow as much as possible, i.e. separate lines for ores, plates, etc.

If you have a central storage but with unconnected rail systems, you essentially have a bunch of good-specific depots just placed close together, right?I.e. you could also pull them apart and it would function exactly the same.

But my question would be: what is the point of such as 'depot'? I always have only one place producing a certain good, so that place is essentially the 'depot' of that good. If you add a depot without adding more places that produce it, you just add an extra train trip without obvious benefit, especially since the number of loading bays for a good at the production facility and at the depot need to be identical or the production->depot line will be the bottleneck... or am I missing something?
Yeah, without overpasses/tunnels the traffic becomes ridiculous in some spots, but I think one can overcome all the intersection problems by just... having none. Now how would one have no intersections? I'll point towards having... rings.

The point of such a central depot for all goods would probably be to increase throughput by overcoming the train bottleneck that happens due to the immense amount of intersections, even branching off for a station basically counts as an intersection.

But also because gathering all necessary resources from one central spot causes less potential traffic jams than to have multiple trains pick up each resource individually from several locations.

That said yeah, it might cause an extra train trip, but if one uses the same train which gathers resources from the central depot also to bring back the finished good to the depot then... you didn't do an extra trip because you needed to go there anyways to pick up the resources.

[edit]

Here's the sketch of my thought process:
Base Layout
Basically the individual departments use the same train(s) to pick up the recipe specific resources from the depot, then unload at the department, then load the finished products back on the same train and drive back to the depot to unload the products there, then load new resources, rinse & repeat.

This allows each department to be connected as a "circle" to the Depot. The train tracks from each department don't interact... they are all parallel.

The central depot is where everything gets multiplexed by the bots. It should be big enough to handle extensions of additional departments etc.

Hypothetically one could even have multiple central depots and interconnect them with trains that try to "balance the items" between them. Or extend the central depot horizontally, having all the departments vertically north and south from the central depot. Like so:
Base Layout Variant
I guess one can see I'm too much into processor design/development. :D

The Central Depot = L3 Cache
Individual Departments = Cores
mrvn
Smart Inserter
Smart Inserter
Posts: 5925
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: train bus factory

Post by mrvn »

Switch your load and unloads around so the output of one item is on the same side as the input of the same item for the next stage. E.g. unload the electronic circuits on the side where you load them for the advanced circuits. Or unload iron plates where you load for steel. Makes the belts have far fewer crossings (pre logistic robots, for bots it just reduces the distances).

Also I wouldn't put copper inside the iron/steel loop.


Overall though with this design why use trains at all? Just replace every rail with belts. I think the advantage of rails is that you can move many different goods over the same train line, unlike with a belt where a mixed belt quickly leads to one item deadlocking the belt.
vanatteveldt
Filter Inserter
Filter Inserter
Posts: 947
Joined: Wed Nov 25, 2015 11:44 am
Contact:

Re: train bus factory

Post by vanatteveldt »

Cool idea :)

- Why concentric loops and not just one loop per product? That should make it a lot easier to expand processors, and you can still locate stations so e.g. green unloading and green loading share chests or at least are close together?

- It will be a challenge to write good train timetables. If you want to combine dropping off and picking up, you want to have mixed trains (i.e. resources for blue circuits are green circuits, red circuits, and sulphur), and ideally you would load and unload them simultaneously. This requires good thinking to make sure that trains don't needlessly drive around (i.e. if output cannot be unloaded because buffers are full, train should not go) but at the same time preventing e.g. an overflow of sulfur from blocking the rest of the ride.

- Given how logibots work, it might be worth having multiple depots, e.g. a ore/plate depot, a plate/circuits depot, and a advanced goods depot. I think the ore-plate-circuits could also work fine without logibots, but it would certainly make things a lot easier and more compact.
mrvn
Smart Inserter
Smart Inserter
Posts: 5925
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: train bus factory

Post by mrvn »

I see two ways to solve this:

1) have cars per good in the ratio needed for the recipe, e.g. 2 iron plate cars and 3 copper plate cars for electric circuits
2) have mixed cars with stacks reserved for all goods in the right ratio. Wastefull since some stacks will be empty going one way and the others empty going back.

Also have the number of loading and unloading buffer chests in the right ratio so that a full set of unloading chests will fill all the loading chests.
vanatteveldt
Filter Inserter
Filter Inserter
Posts: 947
Joined: Wed Nov 25, 2015 11:44 am
Contact:

Re: train bus factory

Post by vanatteveldt »

Ratios become a lot less neat with productivity modules added in :-S

E.g. according to helmod, green circuits is copper:iron 1.07:1, blue circuits from ores is sulfur:plastic:iron:copper approx. 1:7:39:46. Of course, if all chains are trivial (i.e. consist of one recipe) this doesn't hold, but not sure I would want to be transporting copper cable etc separately.

Mixed cars with stacks is lot of hassle and lower throughput, but for e.g. blue circuits you could have e.g. 3 copper, 2 iron, and 1 mixed car for input, and output only into the copper car (since input:output for blue is about 30:1, you really don't need a lot of space for output :). Green circuits is less extreme but still 3:2, so you probably have a 'spare' car)
User avatar
MeduSalem
Smart Inserter
Smart Inserter
Posts: 1686
Joined: Sun Jun 08, 2014 8:13 pm
Contact:

Re: train bus factory

Post by MeduSalem »

mrvn wrote:Switch your load and unloads around so the output of one item is on the same side as the input of the same item for the next stage. E.g. unload the electronic circuits on the side where you load them for the advanced circuits. Or unload iron plates where you load for steel. Makes the belts have far fewer crossings (pre logistic robots, for bots it just reduces the distances).

Also I wouldn't put copper inside the iron/steel loop.
Yeah, basically it was a rough mock-up so to get the basic idea across. The exact "grouping" of departments for profiting "neighbouring" departments for the next stage are something that obviously need to be tweaked. :D
mrvn wrote:Overall though with this design why use trains at all? Just replace every rail with belts. I think the advantage of rails is that you can move many different goods over the same train line, unlike with a belt where a mixed belt quickly leads to one item deadlocking the belt.
I'd say because each Express belt is limited to a maximum of 2400 Units/Min. So you will have multiple parallel Express Belts for each resource type going from the Depot to the Department and for the finished Product to be moved back to the depot.

A rail track only uses 2 tiles width... a train can load much more and can do the trip several times a minute. So eventually the bulk throughput of the train should hypothetically outperform the belts. Also like you wrote yourself... because you can load the various source items into the same train.

That said I get what you are trying to point out and it might actually not be a bad idea to do a direct comparison between using belts or using trains as "interconnect". Would at least be interesting to see what turns out to be easier or more efficient.
vanatteveldt wrote:- Why concentric loops and not just one loop per product? That should make it a lot easier to expand processors, and you can still locate stations so e.g. green unloading and green loading share chests or at least are close together?
Hypothetically you could only do one loop per product with several loops next to one another... but then you will have to stretch the Depot which acts as crossbar so that every department can connect to the depot. The further you stretch the depot... the longer it takes for bots to travel from one point to another... which requires a lot more bots to keep up with the increasing throughput since a lot of them are just busy traveling around.

It might not be that much of a problem though, except if you are short of energy.
vanatteveldt wrote:- It will be a challenge to write good train timetables. If you want to combine dropping off and picking up, you want to have mixed trains (i.e. resources for blue circuits are green circuits, red circuits, and sulphur), and ideally you would load and unload them simultaneously. This requires good thinking to make sure that trains don't needlessly drive around (i.e. if output cannot be unloaded because buffers are full, train should not go) but at the same time preventing e.g. an overflow of sulfur from blocking the rest of the ride.
Yeah the timetables are an issue, I looked a little bit into it myself yesterday evening but then I was too tired and said "screw it" and went to bed. So it still is an open issue.

I got it to work that trains unload and load simultaneously, but I ran into some obvious problems on how to prevent to overstock a department with a certain resource.

Maybe some kind of circuit network intervention might not be avoidable... but somehow I'd hate that... because wiring up the entire base sucks somehow.
vanatteveldt wrote:- Given how logibots work, it might be worth having multiple depots, e.g. a ore/plate depot, a plate/circuits depot, and a advanced goods depot. I think the ore-plate-circuits could also work fine without logibots, but it would certainly make things a lot easier and more compact.
Well I don't think that splitting the depot really works too favorably, because of how some recipes like concrete even require Iron Ore as resource. So you would have to make a connection between the Ore Depot and this and that and whatnot... and yeah that's why I came to the idea that is one might be better off to dump everything into one large depot and draw from that central spot... then you are guaranteed that you will have what it takes without additional weird side-routing or other bypassing.

Also while drawing from the central depot it is easier to have "priorities" between different departments... since you have a central stock and can make it work so that departments only get resources if a certain threshold of resources are in the central depot, temporarily suspending several low priority departments if other things are more important. That said a local cache in each department wouldn't be a too bad idea... means it can run longer even if the central depot is out of stock in peak demand times.
mrvn wrote:I see two ways to solve this:

1) have cars per good in the ratio needed for the recipe, e.g. 2 iron plate cars and 3 copper plate cars for electric circuits
2) have mixed cars with stacks reserved for all goods in the right ratio. Wastefull since some stacks will be empty going one way and the others empty going back.

Also have the number of loading and unloading buffer chests in the right ratio so that a full set of unloading chests will fill all the loading chests.
1) is nasty with Productivity Modules... the ratios are thrown off.

2) mixed cars is what I went for in the first try.

First I didn't set any filter and rather let the train wait at the depot to load a certain amount of resource items onto the train with "Resource Item > xxx" condition while at the same time waiting for the train to unload the finished good completely with "Product Item = 0" condition.
And in the department I did the same but vice versa... waiting until "Resource Item = 0" and "Product Item > xxx".

Obviously I ran into overstocking problems... and eventually the train couldn't unload/load anymore. Literally my approach went down like this from the Development explained in Gifs Thread when you think that the easy shortcut will do... :D
...
As second try I looked into setting a filter for each slot in the train cars... but that's where I lost it and went to bed then. And I agree that might turn out quite wasteful since you also need to reserve slots for the finished product which needs to be delivered back to the depot which are empty while delivering resources to the department and vice versa... decreasing overall throughput.

Trying to control it over the chests is in my opinion a little bit too fiddly.
vanatteveldt wrote:Ratios become a lot less neat with productivity modules added in :-S

E.g. according to helmod, green circuits is copper:iron 1.07:1, blue circuits from ores is sulfur:plastic:iron:copper approx. 1:7:39:46. Of course, if all chains are trivial (i.e. consist of one recipe) this doesn't hold, but not sure I would want to be transporting copper cable etc separately.

Mixed cars with stacks is lot of hassle and lower throughput, but for e.g. blue circuits you could have e.g. 3 copper, 2 iron, and 1 mixed car for input, and output only into the copper car (since input:output for blue is about 30:1, you really don't need a lot of space for output :). Green circuits is less extreme but still 3:2, so you probably have a 'spare' car)
Yeah... trying to work with ratios is basically out of question. The mechanic to prevent overstocking etc has to work without considering any ratios (or at least considering ratios should only be for fine tuning the efficiency, but not to make it depend on it).

But yeah, the Input:Output ratio is better for later recipes... but for easy recipes where Input:Output is 2:1 or 3:2 or something it's quite ugly.

1:1.2 (considering PM3s) is quite easy on the other hand because if you input Iron ore you get almost as much Iron Plates back onto the train.



Overall said... I might think that this is a case where reading the rough Train Contents of the train by connecting the Train Station to the Circuit Network would really help... because if you already have a certain amount of Items in the train then you can prevent inserters from inserting more until they get unloaded the next time. So the train might drive around with a mix of Resources/Products and only loads to fill what has been consumed. Also the Circuit Network numbers can be easier tweaked to match Productivity Module stats much better than it would be trying to do that over a vague slot ratio.



Updated Diagramm adopting the "one loop per product" idea:
Central Depot B.png
Central Depot B.png (57.58 KiB) Viewed 6728 times
mrvn
Smart Inserter
Smart Inserter
Posts: 5925
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: train bus factory

Post by mrvn »

I tried mixed train and designed the following:

- Central depo with many waiting bays and one unload/load pair with buffer chests per good.

I used 3 automobiles as buffer chests here. Cars are 2 tiles wide, another tile for inserters for unloading and a fourth tile for inserters for loading. This means I can place the unloading and loading railroads 4 tiles apart and don't have any belts in there. Straight train to chest to train. All unloading is done with filter (stack) inserters to prevent any wrong items from being unloaded by accident. For stations where mixed cars stop this is a must but I used them everywhere just to be sure.

- Iron/Copper ore

I pick up ores until the car is full and drop them in the depo until the car is empty. The way back to the mines the car is empty. I use one train per mine so that setup is really simply. I could use multiple trains with a waiting bay or trains set to stop loading ore when the next train arrives but usually ore production is slower than a single train can haul away. I don't have mines far enough away yet that travel times matter.

- Iron/Copper smelting

I have separate train for coal and a separate train stop to deliver it. Pick up coal from the depo until full, drop of at the smelter until empty. Alternatively just bring the coal with a belt.

For the rest I pick up ore at the depo until the car is full and drop them at the smelter until the car is full of plates or 5 seconds of inactivity. The buffer chests ensure that multiple cars full of ore can be unloaded so that should never stall as long as plates are removed and no back pressure happens. And if ore is unloaded plates can be loaded until the car is full. The train should never leave with any ore left in the car.

The second condition is a bit more tricky. I wired a arithmetic combinator to the train signal before the train stop with "RED * -50 ==> PLATES". The output is wired to all the buffer chests and the inserters loading them. The inserters are set to stop if "PLATES < 0". That means if the buffer chests are nearly empty and a train is in the station then they are not refilled. The buffer chests are drained by the train and the train will depart 5 seconds after unloading ore has completed. Otherwise it would keep loading plates in ones or twos unto the train till it is full because a new plate always arrives in less than 5 seconds.

The effect of this is that at the start the train will deliver ore and drive away empty or half empty. Over time plates will collect in the buffer chests so that the train car can be filled completely without running the buffer chests dry.

- Electronic circuits (or other complex recipes)

I have a mixed train in roughly the right ratios. With speed modules the ratios have fractions but I don't much care. Get the ratios about right for optimal throughput. If you are off nothing bad happens.

The train makes multiple depo stops collecting resources at every stop. Each time it waits for the Item count to fill all the stacks for the relevant item. It then delivers them to the electronic circuit assembly stop with the following conditions:

Item count: Iron Plate = 0
OR Item count: Copper Plate = 0
OR Inactivity 5s

I assume the ratios of stacks are wrong. So I allow the train to drive away with ingreediences left in the car as long as one of the ingreediences is completely unloaded. Otherwise the train might get stuck because the assembler have run out of copper plates and a backlog of iron plates prevents unloading. I don't wait for electronic circuits to get loaded. Normaly loading the resulting good is faster than unloading and is done before unloading the next batch of ingreediences. If loading is too slow it will build a backlog until unloading is halted and only then wait for loading to complete before driving away. Otherwise the train will drive away half full and get more ingreediences inseatd of waiting for all the output. The "Inactivity 5s" condition ensures this won't deadlock.

Design the number of loading inserters and unloading inserters to (even more roughly) match the ratios in the recipe. If you have too many of one kind then the train will drive around with items of the other kinds left to unload until the buffer chests for the first item are full and create a back pressure to unload the other items. So nothing bad will happen if you are off in the ratios of inserters or stack on the car but the train will make more round trips that necessary.
User avatar
MeduSalem
Smart Inserter
Smart Inserter
Posts: 1686
Joined: Sun Jun 08, 2014 8:13 pm
Contact:

Re: train bus factory

Post by MeduSalem »

Well... I will probably wait until 0.15 before I start thinking about how to implement the above idea... because it might bring some features that make things easier.
User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: train bus factory

Post by Deadly-Bagel »

I'm not running on much sleep today and just couldn't read through most of the topic so sorry if I've misinterpreted something xP Just a note I found on my modular base game is that I found it far more efficient for each module or outpost to have a single "requester" train, rather than a "providing" train. By this I mean there is a single train that supplies that outpost with resources, rather than one train that takes resources from that outpost to all the other outposts.

Firstly it's better for balance. If you've got a train full of iron that goes around a circuit, what's to say there will be anything left in it when it reaches its destination? You would need to ensure that each oupost only takes a portion of the train's cargo and ideally not have the total exceed 100%.

Secondly with a supply network you pretty much always have every train running. You can limit it by sending circuit signals over the rail lines but if one outpost needs a shipment they're all going to get one. This is more a problem for stations as if you've got several trains visiting a station you can potentially have many of them queueing at any time which then means those trains can't service other outposts. And it's not like you can easily filter on inactivity to reduce that as if one item is being used per second it will take it out of the train while it's there and keep it at the station.

With a demand network you can link up the unloading chests to a Constant Combinator, put in negative values of everything you unload from the train and connect both to the Train Stop. Have a Wait Condition on the train ([Anything] < 0) - you'll also need an "AND 30 seconds passed" to give it time to unload - and the train will only run when any of the required resources drops below that threshold. It will still go to every stop to pick up but if you use 5 seconds of inactivity it will pass through whatever it doesn't need fairly quickly. This means less load on both your rails and your stations.

Of course ores are an exception.

I'm running the above in a Bob's Mods game and have several outposts: Power, Smelting, Electronics, Circuits, Modules, Oil, Science, Logistics, and several ore mines, and this seems to be the most efficient approach. I originally had say a Circuit train that carried circuits everywhere but ran into a few problems when things started getting more complex so swapped to doing this instead.
Money might be the root of all evil, but ignorance is the heart.
ribsngibs
Long Handed Inserter
Long Handed Inserter
Posts: 77
Joined: Mon Mar 28, 2016 5:42 am
Contact:

Re: train bus factory

Post by ribsngibs »

Just remembered that this thread existed.

I finished my train-bus factory awhile ago and it sustains 1 rocket per minute, so I suppose it is a train bus megafactory.

The imgur album with some explanations is HERE.

The zoomable/pannable googlemaps view is HERE

My rail line is 4 wide (2 in each direction), and I ended up laying out a giant, regular grid of these 2x2 rail lines with 4 way junctions everywhere, and on the inside of each grid square are two mini assembly lines, each with a single unloading station and a load station.

Trains are almost all mixed cargo trains with filters set appropriately. Each unloading station has multiple trains just to maintain throughput (so that the next one arrives before all the raw materials from the last one get used up), and they all have multiple pickups and single delivery stops (e.g. the red circuit supply trains go around and pick up green circuits, copper plates, and plastic bars, then drops everything off at the unloading station). Unloading stations have logic that says "IF any of the items are empty AND the train's been here longer than the minimum amount of time it would take to fully unload the slowest-unloading-item, then release the train." That way if the train still has some of all items, it will delay at the unloader (which is good because the supply stations will be kept clear), but the train won't leave as soon as one item empties. e.g. Once the only stack of oil barrels gets pulled off the wagon, you don't want the train to depart immediately until it's had a chance to unload the 19 stacks of electronic circuits (or whatever).

Anyway, I am happy to answer any questions people have about how this works.

A few interesting parts:

A simple assembly line, for green circuits. Incoming train brings iron and copper, outgoing train picks up green circuits.

Slightly more complicated, for red circuits. Incoming train brings copper, green circuits, plastic, outgoing train picks up red circuits.

Here's I think my most involved unloader, for solar panels, accumulators, and radars, which unloads petrol barrels (using a universal barreling mod), iron, steel, copper, and electronic circuits. The barreling stuff doesn't need to be done with robots - it should just be a small closed circuit thing where empty barrels get put right back on the train. Must have brain farted when I built it.

Fastest one-sided unloading station I could come up with where each wagon's unloaders fit into a 7-tile wide strip (6 for the wagon + 1 tile in between wagons), so that it is tileable. This design dumps 124 iron ore per second per wagon onto belts, so this 4-wagon station alone outputs 496 iron per second, or enough for about 120 steel per second, which is enough steel to feed 1 rocker per second worth of low density structures.
vanatteveldt
Filter Inserter
Filter Inserter
Posts: 947
Joined: Wed Nov 25, 2015 11:44 am
Contact:

Re: train bus factory

Post by vanatteveldt »

Very cool, well done!

How did you make the 'google maps' view?
ribsngibs
Long Handed Inserter
Long Handed Inserter
Posts: 77
Joined: Mon Mar 28, 2016 5:42 am
Contact:

Re: train bus factory

Post by ribsngibs »

vanatteveldt wrote:How did you make the 'google maps' view?
It's a mod called "Factorio Maps"
mrvn
Smart Inserter
Smart Inserter
Posts: 5925
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: train bus factory

Post by mrvn »

Deadly-Bagel wrote:I'm not running on much sleep today and just couldn't read through most of the topic so sorry if I've misinterpreted something xP Just a note I found on my modular base game is that I found it far more efficient for each module or outpost to have a single "requester" train, rather than a "providing" train. By this I mean there is a single train that supplies that outpost with resources, rather than one train that takes resources from that outpost to all the other outposts.

Firstly it's better for balance. If you've got a train full of iron that goes around a circuit, what's to say there will be anything left in it when it reaches its destination? You would need to ensure that each oupost only takes a portion of the train's cargo and ideally not have the total exceed 100%.
You are assuming you have one source and multiple destinations. That is not always true, actually it's often wrong. When you have multiple source and one destination you want "providing" trains. Otherwise your train will drive to 5 ore fields but is already full after the second. But that situation is just as unlikely as the other way around.

I think the most common situation is that you have multiple sources and multiple destinations. That's where people start building a depo and have both "requester" trains and "providing" trains with a single depo where the two exchange goods. So instead of having multiple sources delivering to multiple destinations you insert the depo to make a X-to-1-to-Y setup. "Providing" trains for the first half and "requester" trains for the second.
User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: train bus factory

Post by Deadly-Bagel »

I did point out ores are an exception. I have a managed ore outpost that unloads 11 ores I think and filters them down, a signal is sent across the rails to request more ores from outposts where the trains are held. See viewtopic.php?f=194&t=39636 for more info.

For a standard central factory you'll have multiple sources with one destination, when splitting your base up with trains you'll usually have one source but multiple destinations. There may be some exceptions but these can easily be overcome with a simple unload/load area for those materials, though the throughput of trains is immense so generally you should only need to do this if space is restricted.
Money might be the root of all evil, but ignorance is the heart.
mrvn
Smart Inserter
Smart Inserter
Posts: 5925
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: train bus factory

Post by mrvn »

I have multiple sources for more than just ore. Mostly smelting. You never have enough smelting and then you add a second smelter setup and a third. But yeah, that's basically a problem of not enough space or it's companion of not planning big enough.

On the other hand there is only so much smelting (or other production) you can do from a train before exceeding the load/unload speed. Then you can add more cars to the train or more smelting setups (and trains). For me adding more smelters is easier than redesigning everything for longer trains. Just put down the blueprint for a smelter stop and watch the robots fly. :)
Post Reply

Return to “Railway Setups”