Guarunteed non-stall Oil Factory
Posted: Sun Mar 13, 2016 9:33 pm
Oil factories are one of the more fiddly parts of Factorio. Balancing the three different outputs can be tricky, especially when your usage pattern changes. Early game you only care about petroleum, but light and heavy oil are useful mid and late game products, so you can't just completely ignore them (at least, not without causing serious inefficiency). A while back, I found a topic on this board that discussed a fairly efficient way to handle oil products, and used it in my factories. However, this design was before combinators, and this time through I decided to update it. Below, I present to you an efficient, guaranteed stall-less oil production facility. (with a few messy bits because I made adjustments along the way.)
There is a similar relief valve system at the light oil storage tanks, dumping any excess light oil to be cracked into petroleum. However, due to how the production ratios come out, it has a lot more chemical plants doing the cracking. The situation with petroleum, however, must be slightly different, since you can't simply crack it into heavy oil to complete the loop. Instead, when the petroleum overflows, you have to dump it. The system I have to decide when this is going to happen is shown at the petrol dump site, shown below. At the petrol dump site, I've rigged a small pump to several turbines to dump excess petroleum. However, since this is an inherently wasteful process, I don't want to turn on that small pump unless I absolutely have to in order to avoid stalling. Thus, the combinators next to the pump and the additional lines to connect to the heavy/light storage areas. I only need to dump petrol if the tanks are full and the refineries are stalled, but even then it could be that everything is stalled and I still have plenty of Heavy and Light oil. So I want to check and make sure that I'm actually running out of heavy or light oil before dumping. Thus, the logic I want to implement is: if (Heavy < 250 OR light < 250) AND Petrol > 2400 then turn on pump. I'm not sure if there is a better way to handle this or not, but here's my combinator logic setup:
All combinators input and output connected to the same red circuit.
All combinators output 1 when true.
All combinators are decider combinators.
Combinator 1: If Heavy oil < 250 then yellow output 1
Combinator 2: If Light oil < 250 then yellow output 1
Combinator 3: If Petroleum > 2400 then red output 1
Combinator 4: If yellow output > 0 then red output 1
Small Pump: If red output > 1 then turn on.
If you wanted to improve this (aside from cleaning up some of the clutter), you could try to reclaim some of the dumped petrol for less efficient uses. For example, you may send it first to be turned into solid fuel and only dumping it when that stalls as well. At the moment, I'm only sending light oil to my solid fuel production facilities, since that is the most efficient oil product for it.
Note that all the production facilities are easily expanded horizontally, to make for larger (or smaller) facilities. The storage tanks, however, are tricky to modify, so they should probably be the final size when you first build them. I build them 4x4 in order to avoid any stress while I work on advanced oil processing, since they can handle a heck of a lot of excess heavy/light oil while you can't yet crack them to get rid of excess.
edit: fixed typo on small pump logic.
To the center left is the refinery area, with different outputs stored N, NE and E of the refineries. I tried to separate each different product into pre-storage and post-storage pipelines, and will tend to refer to them as such. I.e., the refineries output into the pre-petrol, pre-light, and pre-heavy pipelines, while different products all tap off the post-petrol, post-light, or post-heavy pipelines. Since I have pumps sucking on them, the pre-pipelines are often not full of product, but the post ones always should be. So... how do I make sure nothing stalls? Lets look at the interesting bits, starting with the heavy oil storage below.
The pre-heavy pipeline enters the storage area from the left, just next to the power pole and column of pumps. I might have a few too many pumps, but their purpose is to both be a one-way gate and to clean out the pre-heavy pipeline and ensure everything makes it to the storage tanks. The post-heavy pipelines can leave from any of the other 3 sides of the storage tanks. Currently, I have one leaving off the bottom side (shown) and one leaving off the top side. If it were just those two input and output sources, I'd start to have problems when the heavy oil usage dropped, because things would back up and stall my refineries. To take care of this case, I have a relief valve attached to the pre-heavy input, The pump facing down attached to the red wire circuit network only turns on if the storage tanks are nearing full (which I define as 2400 out of 2500 heavy oil) and dumps any excess heavy oil into the heavy oil cracking refineries at the bottom of the screenshot. These then crack any excess heavy oil and dump the new light oil into the pre-light pipeline. All I really need to accomplish this is the red wire from the heavy oil tank to the small pump, but the additional red wires take the heavy oil info to use later.There is a similar relief valve system at the light oil storage tanks, dumping any excess light oil to be cracked into petroleum. However, due to how the production ratios come out, it has a lot more chemical plants doing the cracking. The situation with petroleum, however, must be slightly different, since you can't simply crack it into heavy oil to complete the loop. Instead, when the petroleum overflows, you have to dump it. The system I have to decide when this is going to happen is shown at the petrol dump site, shown below. At the petrol dump site, I've rigged a small pump to several turbines to dump excess petroleum. However, since this is an inherently wasteful process, I don't want to turn on that small pump unless I absolutely have to in order to avoid stalling. Thus, the combinators next to the pump and the additional lines to connect to the heavy/light storage areas. I only need to dump petrol if the tanks are full and the refineries are stalled, but even then it could be that everything is stalled and I still have plenty of Heavy and Light oil. So I want to check and make sure that I'm actually running out of heavy or light oil before dumping. Thus, the logic I want to implement is: if (Heavy < 250 OR light < 250) AND Petrol > 2400 then turn on pump. I'm not sure if there is a better way to handle this or not, but here's my combinator logic setup:
All combinators input and output connected to the same red circuit.
All combinators output 1 when true.
All combinators are decider combinators.
Combinator 1: If Heavy oil < 250 then yellow output 1
Combinator 2: If Light oil < 250 then yellow output 1
Combinator 3: If Petroleum > 2400 then red output 1
Combinator 4: If yellow output > 0 then red output 1
Small Pump: If red output > 1 then turn on.
If you wanted to improve this (aside from cleaning up some of the clutter), you could try to reclaim some of the dumped petrol for less efficient uses. For example, you may send it first to be turned into solid fuel and only dumping it when that stalls as well. At the moment, I'm only sending light oil to my solid fuel production facilities, since that is the most efficient oil product for it.
Note that all the production facilities are easily expanded horizontally, to make for larger (or smaller) facilities. The storage tanks, however, are tricky to modify, so they should probably be the final size when you first build them. I build them 4x4 in order to avoid any stress while I work on advanced oil processing, since they can handle a heck of a lot of excess heavy/light oil while you can't yet crack them to get rid of excess.
edit: fixed typo on small pump logic.