Automated rail depot and outposts (vanilla combinators) 0.14

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.
Post Reply
teenkertoy
Inserter
Inserter
Posts: 37
Joined: Fri Nov 11, 2016 5:03 am
Contact:

Automated rail depot and outposts (vanilla combinators) 0.14

Post by teenkertoy »

I had grand intentions of writing tons of documentation and showing how all this stuff works in great detail, but the rest of my life is just too busy to devote that kind of time to this. However, I know some of you might enjoy this so I'm still happy to share a bit. I'm not sure how long the usefulness of this particular setup will last since the (hopefully) upcoming changes to the logic/combinator rail and train stuff should make much of this outdated. If you have specific questions I'm happy to answer when I have the time. My programming skills are likely not as sophisticated as some of yours so I know some of my work might be hard to reverse engineer or understand. Please ask questions if you want to learn why I did something, I'm happy to share.

This map uses a bunch of mods for 0.14 but you don't need any of them for the trains and logic system to work. All of the components of that are vanilla which was a strong goal I set for myself. You might need to build some power plants if you don't use the solar panel mod since you'll need electricity to get it working. (Factorio Extended Core 0.2.3 and Factorio Extended Power 0.2.3). I would also recommend nixie-tubes 0.3.10 since you can see what the central "computer" and the outposts and depots are doing.

Where to begin...

I wanted to have a storage/unloading depot for each of the resources I am remotely collecting with trains: iron, copper, oil, and it had to be capable of some very specific things to make my life easier. The system I built does the following:

Set a threshold of inventory to keep for each resource (36 steel chests in my case is 86k ore) and also the capacity of the train that can go get more of that resource (6k ore per train, each train has three cars). When the inventory dips below the threshold, and there are no outposts screaming for a resupply of consumables, and there is enough empty space in the storage chests for at least one train worth of materials (less than 80k in this example), and there is also enough material available at any of the connected outposts to completely fill a train (more than 6k in this example), and the train for that particular outpost is waiting and ready to go, and there is no other train currently being loaded with supplies (see below), then send one train to that particular outpost and remember that one train's worth of material is on the way, so that multiple trains are not trying to acquire materials at the same time (don't send all of my trains and have 18k ore incoming to fill the last 6k of capacity in my storage). If I needed two trains worth of materials, then send two trains to the first two outposts that have the right conditions. And so on. The storage/unloading depots should always be nearly full in this regard.

Also, I was relying on bullet turrets instead of laser turrets for defense and didn't want to manually supply every outpost with ammunition all the time, so I need the system to be able to respond to requests from the outposts for materials such as bullets, and then later I discovered it would be cool to also have construction bots and repair hammers and other stuff so the outposts would require less attention from me.

So if an outpost is running low on some consumable material (can be changed to be any material) then the central station "computer" will recognize this and dispatch a train to an intermediate loading area, hold the train while the requested materials are loaded into the train, and send the train to the depot making the request. The supplies will be offloaded to the outpost and used for whatever. Meanwhile, the outpost will know that the supply train is coming and will stop screaming at the central station computer for attention, and the central station can then continue serving all the other outposts in turn.

How it works....

The central station computer has a clock that cycles once every second or so and sends a signal on the red wire to all outposts at the same time. I call this the clock number for lack of a better term, and it is the variable C and the number is the number the clock is currently at. The outpost listens for its own number, and when it sees it (clock=3 for example) then outpost #3 will report if it needs and supplies and also how much ore is available for pickup.

Now the depots are also listening for the clock signal too. I have a copper depot that is fed by trains 1 through 3, that run to outposts 1 through 3. So the copper depot reports if it needs to request a train to restock the storage. Each depot's trigger condition can be unique if you want to keep certain levels of materials stocked up to feed your belts. The rail signals where the trains come to rest and await orders also watch the clock and report if a train is available to be dispatched from the train "yard".

The flexibility ....

I tried to make any user configurable options centralized in constant combinators so they are easy to find and change. The central train "computer" is only needed once. Each storage/unload depot needs a copy of that kind of computer. The depot can be configured to store any material, in any quantity, and request a train of any size. There can be as many trains as you like servicing each depot (if you have a huge map and need ten trains going to ten copper outposts because they are so far away, then that works too). The more trains you have the longer it will take for the central computer to cycle through each of them in turn (I guess you could speed up the clock, but that might make it less stable). Each outpost needs a copy of the logic setup and can also be configured to supply any resource, and request any quantity of up to five individual resources (bullets, bots, repair hammers, spare walls to replace if they get broken, etc).

The problems ....

I've fixed all but one. Sometimes the clock will increment to the next number at exactly the same moment that all the conditions to send a train are correct. For example, the clock is reading 3 on the entire network and the train for that outpost gets requested at the same time that the clock increments to 4. Due to the way the logic spreads through the combinators at one step per tick, the clock will change to 4 right as the train for 3 gets dispatched and since the entire system thinks it is now train 4's turn when actually train 3 is moving around, the central clock gets stuck. I can manually reset this condition easily, and it happens rarely, but I'm not sure how to solve it since it relies on the timing of the logic propagating through the ticks of the game-time, not working like a sequential logic in a programming language like I'm used to.

Anyhow ...

If this is something you enjoy then have fun with it, this is my gift to you. If you look around the map you'll find some other stuff I thought was clever like the rainbow belt concept for distributing science packs and feeding furnaces, and some designs for optimizing the building of stuff like green/red circuits etc. I was in the middle of upgrading all the infrastructure to make a rocket faster (5 minutes I think?) but didn't finish it.
Attachments
_teenkertoys train brain.zip
the save game file
(22.49 MiB) Downloaded 182 times

Post Reply

Return to “Railway Setups”