This page describes my car on belts factory. The factory has now some hours of play time and it is not the first try. I've learned a lot of tricks with previous factories and I'll explain some of the reasons why the factory looks like it does.
The factory is build in Factorio free play mode with default settings and no mods except the waterfill mod which I used to clean up some incorrectly placed landfill. It has over 100 hours of playing time and produces around 350 space science per minute overall.
For people who are interested in the blueprints click here for the blueprint book
The whole factory consists of a long belt moving stuff around.
Connected to the belt are three complete factories with a capacity of around 150 to 200 SSPM.
Mines, oil and defence depots are also connected as well as a mall for personal usage and defence products.
Next to the belt is a paved road that I use to zip around in my personal car.
In a distance to the belt are the defence walls consisting of artillery turrets and normal gun turrets firing uranium bullets. I have two big nuclear stations for power supply. The second larger one is build into a big lake for better water supply.
For my loading and unloading stations I didn't want to have to identify empty cars, which is a little tedious. Instead I have one belt with loaded cars and one belt with unloaded cars. In my factory these belts go from right to left and at the end meet again and loop right back to the beginning. This allows me to easily fill up empty cars from the empty car belt and move them to the full car belt. Unloading works exactly the other way round. The cars just do from the middle belt (the one with only full cars) to the lower belt (the one with the empty cars).
The cars are aligned in a specific way on the three lines of the bus. They are always put on the bus with a t-intersection which means that they are hanging to the outer side of the line. This is easier than centering the cars since completly centering needs at least a left and a right turn.
The bus also incorporates power with the large power poles and a circuit network signalizing the current open requests. More about that later.
As a last feature I have a straight brick road next to the bus which allows me to zip around with my car between the different parts of the factory.
Loaders are slightly easier than unloaders so I cover them first. The loaders side-load with eight stack inserters. The cars are stopped as long as the inserters are working and the belts are not empty. The circuit logic is a counter that is reset as soon as any of the inserters are picking up an item. The unloader holds three empty cars and new cars will slide by if those slots are occupied.
The logic is actually a little bit more than "stop the cars as long as the inserters are working".
The cars are also stopped if the green bus line does not show any requests for the specific item being loaded.
This prevents the scenario that all cars are filled up with only one type of item.
The cars are not released until we see at least an item on one of the input belts. This should ensure that we don't release mostly empty cars on the bus.
Usually there are some miners and smelters connected to the loader. I started with high-tech smelters with level three modules inside but eventually I stopped doing this. The resource consumption and production time for all those modules was just too high for me.
The unloaders are a lot more complex than the loaders. In short, the unloaders buffer up to three cars and signalize if there is space for a car open. The cars are stopped as long as the inserters are full and active.
Once a car comes along the bus the small t-intersection will align it correctly on the bus.
The filtered inserter is able to pick an item out of the car if it contains the right stuff.
This will in turn reset one of the counters.
If already enough cars are waiting then the filter inserter does not have a place to put the item down. This will of course block the inserter from picking up a new item and thus from opening the gate again. A strategically placed power pole will block the inserter from putting any item on the ground. The car does this strange s-curve after the gate in order to get into place for the inserter.
The fine-tuning of the unloaders is quite tricky.
To get it to work fail save you need to test at least that cars next to each other work correctly.
This means an acceptable car (e.g. iron) followed by one that should not be accepted work correctly.
The false car should not get into the unloading station.
Also the other way round should work of course.
This is of course why there are a couple of yellow belts at the top. Without these belts the cars are just too fast and an empty car followed by a full one would slip through.
After running a lot of the unloaders for a time I noticed a glitch and upon investigating it I found an other error condition. If a slot in the buffer get's free while an acceptable car is already next to the gate the inserter would pick an item out of it but the car might already be too far to slip into the gate thus blocking the whole thing for the future.
You can still break the mechanism. If the cars are backed up they might block each other half way into the gates. And then of course if you don't have enough power the inserers will be too slow messing up the whole timing.
The following image shows a combined unloader/loader station used for filling empty oil barrels with crude oil. The station on the right takes in cars with empty barrels and spits them out on the empty car lane. The station on the left takes in empty cars and fills them with full barrels, spitting them onto the full car lane.
The loading and unloading stations cannot be rotated. The cars have to be oriented vertically or it won't work.
Balancing the bus
Since my unloader stations signal whenever their input queue has less than three cars it seems like the bus is balanced.
However the loading stations are not coordinated, so as soon as the request for e.g. copper goes out, all the copper mines will start spitting out copper cars.
In the worst case, and if this goes on for a while then all the cars on the bus will be full of copper an no empty cars are left over.
A possible solution for this is to keep track of the exact number of cars being put out and requested. I've done this before but it's quite fragile (a car lost due to a biter attack will not be detected) and also the requested car might currently be at the opposite side of the bus.
A counted buffer station with cars waiting for a request is also a solution but this means again that the car might take a long time to reach the destination and it also means even more resources are standing around somewhere.
So what I did is counting cars for a whole circuit. I detect the circuit by a special car containing an item that is not seen otherwise on the bus (a mine in my case). The counted number is then substracted from the number of requests.
As an example: The counter detected 10 copper cars during the last circuit. Currently 5 unloading stations require copper. I add another value for the requests, e.g. I always might want to have at least 10 copper cars circling, so I add 10 to the requests. The result is 5 - 10 + 10 = 5. A positive number means that we need more copper, so the copper loading stations will be active and produce copper.
In this way the whole thing is self-balancing. Too many cars of one type of resource will stop the loading stations from adding more stuff. So there should still be enough empty cars around to fill up.
To optimize the settings I put the counting station after the last factory, so I am counting full cars that were not consumed by any factory.
What to put on the bus
Now we have loaders, unloaders and a long bus where the cars are looping.
But what do we actually put on the bus?
My first idea was to produce almost everything in separate factories and put things like green circuits, red, blue, maybe even science packs on the car bus and have unloading stations at a central science hub.
I tried this at the beginning but noticed fairly quickly that the number of unloading stations just get's too much. E.g. a central science hub, as cool as it would be, would need seven unloading stations and for most of the time I would have 240k of science packs of every color just waiting to be unloaded.
So in the end I decided to only put iron plates, copper plates, coal, stone, steel and crude oil on the bus. In addition there are cars with empty barrels and cars for supplying the defences.
After running my factory a while I noticed that I was resource constrained, meaning my factories were not running 100% because I didn't get enough resources in.
So I added more mines to the left (in this game I only expanded to the left) but that makes the bus longer and thus full cars need much more time for a full circle.
So I invented this kind of end-caps.
There is a left and a right and they will send cars back to the factories.
These intersections will leave the following cars through:
- Bullets, walls and such (because this is a car containing wall supplies and they are also needed in the far left and right)
- Empty barrels (because I need them for filling up crude oil)
- Lamp (because I used a lamp as a marker for cars that should move to the complete left. This allows me to automatically send supplies to ones side)
- And of course empty cars
The powerplant is nothing special. I went for nuclear and build my second, larger power plant in a lake. That takes a surprising amount of landfill.
The defence is constructed out of wall segments. Each wall segment has it's own power supply via solar panels, two robo ports, a radar and an artillery turret and a couple of gun turrets supplied with uranium bullets via filter inserters directly out of the cars.
The walls are self sufficient, meaning they have disconnected robo ports and solar pannel power supply.