How to avoid an oil deadlock

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Jupiter
Fast Inserter
Fast Inserter
Posts: 174
Joined: Thu Jun 23, 2016 2:38 pm
Contact:

How to avoid an oil deadlock

Post by Jupiter »

Deadlock.

When I say this, most peoples brains go to a picture of a complicated and badly designed train intersection. But I found another kind of deadlock. An oil deadlock. Or rather, an oil-product deadlock.

The following happened to me today.
I was designing my robot build. When I turned it on it started popping out some robot frames (didn't setup my actual robot building assemblers yet). But then, after a while, it stopped. I traced it back to a lack of lubricant. So why wasn't there any lubricant made? It turns out that I didn't had any lubricant because of a lack of heavy oil, which I was lacking due to my refineries not refining, which was caused by my petroleum gas tanks being full and gas not being consumed, which was caused by plastics and sulfuric acid not being consumed, which was caused by batteries and red circuits not being consumed, which was caused by my assemblers not working on creating robot frames due to a lack of lubricant. And we're back at the beginning.

That is definitely a deadlock situation. Normally you don't encounter such a cycle because petroleum gas gets consumed by a lot of other stuff as well, blue science packs, blue belts and the like, laser turrets etc etc. But it just so happened that all of those processes weren't active. Either due to that same deadlock cycle (in case of the blue belts) or just because I didn't need blue science packs and laser turrets.

So, how do I avoid this situation in general except for making sure that I consume my gas?
Any suggestions?

Koub
Global Moderator
Global Moderator
Posts: 7220
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: How to avoid an oil deadlock

Post by Koub »

You can add a small pump connected to your petroleum, (same for light oil) tanks. when the tanks are more than 95% full, turn it on, and pipe that to anything that consumes petroleum gas (resp. light oil). For example solid fuel. It's not optimal to make solid fuel from petroleum gas, but it will remove any deadlock.
Koub - Please consider English is not my native language.

Kelderek
Filter Inserter
Filter Inserter
Posts: 250
Joined: Tue Nov 11, 2014 6:04 pm
Contact:

Re: How to avoid an oil deadlock

Post by Kelderek »

How does an inability to make engines stop you from making batteries or red circuits? Or are you saying that those items are not being consumed means you have no demand for them? If that's the case then it sounds like you are over-producing gas. If necessary you can stop cracking heavy and light oil or maybe revert from advanced back to normal oil processing in refineries. You can always just build a large set of machines to make solid fuel and maybe rocket fuel from that - you can use up all 3 oil products to do that if necessary - then stockpile it for later use.

As for avoiding this problem in the future, try using some pumps to control the flow of your oil products. For example, I have a single tank for measuring petroleum gas, the output of this tank goes to all my petroleum gas consumers. If the tank has more than 2300 gas then I switch the flow of gas entering that tank off and divert it to make solid fuel from gas. Earlier I have another decision point for light oil cracking. I will only crack light oil to gas if the amount of gas in that tank is less than 2000, otherwise I divert the light oil to make solid fuel. I have another tank for lubricant, all my heavy oil goes to making lube until there is 2400 lube in the tank and then all my heavy oil gets cracked to light oil.

With this setup I have never had a lack of lube, and every consumer gets priority for gas ahead of making solid fuel. I have so many machines capable of making solid fuel that it is currently impossible for me to overproduce oil products - my refineries can run non-stop. If I ever find that I'm not getting enough gas for things like plastic and sulfur, then I know it's time to expand my oil supply and refining.

Jonathan88
Fast Inserter
Fast Inserter
Posts: 180
Joined: Tue Jan 20, 2015 7:49 pm
Contact:

Re: How to avoid an oil deadlock

Post by Jonathan88 »

Koub wrote:For example solid fuel. It's not optimal to make solid fuel from petroleum gas, but it will remove any deadlock.
I've been wondering about that - which is the best oil type to make solid fuel out of? - Which gets you the most solid fuel per crude oil? This is in late game so assume you have advanced oil processing and cracking. Thank you :D
FactoriOh No: when it's accidentally 2am, again

MrFluffums
Manual Inserter
Manual Inserter
Posts: 3
Joined: Tue Jul 12, 2016 4:27 pm
Contact:

Re: How to avoid an oil deadlock

Post by MrFluffums »

Koub wrote:You can add a small pump connected to your petroleum, (same for light oil) tanks. when the tanks are more than 95% full, turn it on, and pipe that to anything that consumes petroleum gas (resp. light oil). For example solid fuel. It's not optimal to make solid fuel from petroleum gas, but it will remove any deadlock.
The best part is that you can make solid fuel out of any of the 3 biproducts to prevent deadlock, and it's the most efficient from Light Oil. While cracking is definitely more efficient, this can help a lot if you're up to 5k light (2 tanks) before you get Advanced Oil Processing, or something like this.

Jupiter
Fast Inserter
Fast Inserter
Posts: 174
Joined: Thu Jun 23, 2016 2:38 pm
Contact:

Re: How to avoid an oil deadlock

Post by Jupiter »

Kelderek wrote:How does an inability to make engines stop you from making batteries or red circuits? Or are you saying that those items are not being consumed means you have no demand for them? If that's the case then it sounds like you are over-producing gas. If necessary you can stop cracking heavy and light oil or maybe revert from advanced back to normal oil processing in refineries. You can always just build a large set of machines to make solid fuel and maybe rocket fuel from that - you can use up all 3 oil products to do that if necessary - then stockpile it for later use.

As for avoiding this problem in the future, try using some pumps to control the flow of your oil products. For example, I have a single tank for measuring petroleum gas, the output of this tank goes to all my petroleum gas consumers. If the tank has more than 2300 gas then I switch the flow of gas entering that tank off and divert it to make solid fuel from gas. Earlier I have another decision point for light oil cracking. I will only crack light oil to gas if the amount of gas in that tank is less than 2000, otherwise I divert the light oil to make solid fuel. I have another tank for lubricant, all my heavy oil goes to making lube until there is 2400 lube in the tank and then all my heavy oil gets cracked to light oil.

With this setup I have never had a lack of lube, and every consumer gets priority for gas ahead of making solid fuel. I have so many machines capable of making solid fuel that it is currently impossible for me to overproduce oil products - my refineries can run non-stop. If I ever find that I'm not getting enough gas for things like plastic and sulfur, then I know it's time to expand my oil supply and refining.
Ah, so you're not storing your fluids at all. Well, only in solid fuel form.

Thanks for the ideas guys. I will definitely be thinking about a solid fuel build now.

Kelderek
Filter Inserter
Filter Inserter
Posts: 250
Joined: Tue Nov 11, 2014 6:04 pm
Contact:

Re: How to avoid an oil deadlock

Post by Kelderek »

Jupiter wrote:Ah, so you're not storing your fluids at all. Well, only in solid fuel form.

Thanks for the ideas guys. I will definitely be thinking about a solid fuel build now.
In my current game I have 1 tank for petroleum gas, as I mentioned before this is mostly just for measuring use. I have 1 tank for lube and one for sulfuric acid. I do not have any tanks for crude, heavy or light oil. I do have a supply of crude in barrels that sits around 3-500 full barrels at any given moment, but I have purposefully limited the number of new empty barrels I add to the system. I have only two outposts pumping oil and I think I made exactly 600 empty barrels total, so you can see a few of them are in transit at any given moment. I convert all solid fuel to rocket fuel - it is more space efficient in storage that way (two stacks of solid fuel become 1 stack of rocket fuel) and if you actually use it for fuel it is much more potent I believe though I haven't used it for anything other than a rocket silo yet.

Jupiter
Fast Inserter
Fast Inserter
Posts: 174
Joined: Thu Jun 23, 2016 2:38 pm
Contact:

Re: How to avoid an oil deadlock

Post by Jupiter »

Kelderek wrote:In my current game I have 1 tank for petroleum gas, as I mentioned before this is mostly just for measuring use. I have 1 tank for lube and one for sulfuric acid. I do not have any tanks for crude, heavy or light oil. I do have a supply of crude in barrels that sits around 3-500 full barrels at any given moment, but I have purposefully limited the number of new empty barrels I add to the system. I have only two outposts pumping oil and I think I made exactly 600 empty barrels total, so you can see a few of them are in transit at any given moment. I convert all solid fuel to rocket fuel - it is more space efficient in storage that way (two stacks of solid fuel become 1 stack of rocket fuel)
Just 600 barrels? I have a total of 1600 barrels for just one outpost (that has 4 wells). 1600 exactly fills up one train for me. I have yet to see how this is going to work out for me though.
Kelderek wrote:and if you actually use it for fuel it is much more potent I believe though I haven't used it for anything other than a rocket silo yet.
Not according to the wiki. Per item yes but the energy in 1 solid fuel = 25 MJ and in 1 rocket fuel = 225 MJ. So it costs 10 solids to make one rocket fuel but you get just 9 times the energy of one solid fuel.
I'll just keep burning coal, and trees after that. Oil is too valuable to burn in my eyes.

Kelderek
Filter Inserter
Filter Inserter
Posts: 250
Joined: Tue Nov 11, 2014 6:04 pm
Contact:

Re: How to avoid an oil deadlock

Post by Kelderek »

Jupiter wrote:Just 600 barrels? I have a total of 1600 barrels for just one outpost (that has 4 wells). 1600 exactly fills up one train for me. I have yet to see how this is going to work out for me though
I haven't actually done the math on it, but I know that my trains only deliver about 30-60 full barrels at a time based on the way I have them scheduled (I have one train for each outpost, but I could probably get away with just one train. They only deliver whatever barrels have been emptied, so that is all that gets filled at the outpost. There are over 400 full barrels waiting to be emptied. I'm guessing I just have too much crude production for the number of refineries I run because I'm sure that my pumpjacks sit idle a lot since there aren't a lot of empty barrels available. I'm sure this is due in part to my heavy use of modules all over. My refineries and cracking machines have prod 3 modules in them so that means I go through fewer crude barrels. I have plenty of resources to meet my current demand though so I don't yet need to expand the refineries and cracking labs.
Jupiter wrote:Not according to the wiki. Per item yes but the energy in 1 solid fuel = 25 MJ and in 1 rocket fuel = 225 MJ. So it costs 10 solids to make one rocket fuel but you get just 9 times the energy of one solid fuel.
I'll just keep burning coal, and trees after that. Oil is too valuable to burn in my eyes.
[/quote]

I agree, coal is plentiful for me so I just use that for my fuel. I guess for my case the inventory efficiency is a bit more useful and I know I will need the rocket fuel for launches later. I am in the process of stockpiling the rocket fuel as I work to set up the other parts for building rockets in silos.

Harkonnen604
Filter Inserter
Filter Inserter
Posts: 285
Joined: Thu Jun 09, 2016 5:56 am
Contact:

Re: How to avoid an oil deadlock

Post by Harkonnen604 »

It's enough to produce lubricant only from heavy oil whenever lubricant is below 2k. Once over 2k, heavy oil is cracked to light oil which is always cracked to petroleum gas. This way you will not have any deadlocks and won't waste oil on solid fuel (produce only as much as you need for rockets).

As for 600 barrels per train - that sounds ridiculous. If your train roundtrip is 60 seconds, then even with 20 derricks you will get 1200 oil (assuming 1 oil/sec on average derrick). That is only 60 barrels. For same reason (20 oil per barrel and 1 second to fill it) I never put any belts or chests for barrels at oil terminals - 4 assemblers directly feed to/from oil wagon (~80 oil/sec for loading/unloading single wagon)

SpeedDaemon
Fast Inserter
Fast Inserter
Posts: 124
Joined: Fri May 22, 2015 3:31 pm
Contact:

Re: How to avoid an oil deadlock

Post by SpeedDaemon »

My oil management logic goes like this:
- One tank for each fraction for measuring purposes only. I usually don't put these in-line, so they don't slow down the flow.
- Decider: If heavy > light -> enable pump to heavy->light cracking
- Decider: If light > PG -> enable pump(s) to light->PG cracking (i use Bob's mods, so I do need light oil for some things)
- Two Deciders: PG>2300 -> A:1, and heavy<100 -> A:1, pump to make solid fuel out of PG with condition A>1.

This prevents getting stuck, and also prevents making solid fuel from PG unless you're actually suffering a heavy oil shortage.

Harkonnen604
Filter Inserter
Filter Inserter
Posts: 285
Joined: Thu Jun 09, 2016 5:56 am
Contact:

Re: How to avoid an oil deadlock

Post by Harkonnen604 »

SpeedDaemon wrote:- One tank for each fraction for measuring purposes only. I usually don't put these in-line, so they don't slow down the flow.
Just put some pumps at the output and you won't have flow problems.
Attachments
oil.jpg
oil.jpg (934.81 KiB) Viewed 26980 times

Neotix
Filter Inserter
Filter Inserter
Posts: 599
Joined: Sat Nov 23, 2013 9:56 pm
Contact:

Re: How to avoid an oil deadlock

Post by Neotix »

In my previous map I built controller for oil process.
Something like that:
https://i.gyazo.com/98eb1daf13d914b01d6 ... cd2e14.png

Of course in game I did some tweaks but principle idea was the same and it worked quite well. It turned really small amount of Light Oil into Solid fuel and only when I used high amount of Lubricant and low amount of petroleum.

Jupiter
Fast Inserter
Fast Inserter
Posts: 174
Joined: Thu Jun 23, 2016 2:38 pm
Contact:

Re: How to avoid an oil deadlock

Post by Jupiter »

Neotix wrote:In my previous map I built controller for oil process.
Something like that:
https://i.gyazo.com/98eb1daf13d914b01d6 ... cd2e14.png

Of course in game I did some tweaks but principle idea was the same and it worked quite well. It turned really small amount of Light Oil into Solid fuel and only when I used high amount of Lubricant and low amount of petroleum.
That diagram doesn't make a lot of sense to me. Like "If PG < 10 then output A = 2". As far as I know this is not possible with just one combinator.
And, "if each = 0 then output each". This literally means "If each = 0 then actively output a 0 on the corresponding signals, else, just output nothing on the signal (which is equivalent to 0)". So this combinator will always output 0 (or nothing) on all signals. But why is that, what seems to be a, SR-latch in there at all? It's not like you are working with pulse signal input right?
And why is the "each * 25 output each" in there? I don't understand that part either.

Frightning
Filter Inserter
Filter Inserter
Posts: 807
Joined: Fri Apr 29, 2016 5:27 pm
Contact:

Re: How to avoid an oil deadlock

Post by Frightning »

Jupiter wrote:Deadlock.

When I say this, most peoples brains go to a picture of a complicated and badly designed train intersection. But I found another kind of deadlock. An oil deadlock. Or rather, an oil-product deadlock.

The following happened to me today.
I was designing my robot build. When I turned it on it started popping out some robot frames (didn't setup my actual robot building assemblers yet). But then, after a while, it stopped. I traced it back to a lack of lubricant. So why wasn't there any lubricant made? It turns out that I didn't had any lubricant because of a lack of heavy oil, which I was lacking due to my refineries not refining, which was caused by my petroleum gas tanks being full and gas not being consumed, which was caused by plastics and sulfuric acid not being consumed, which was caused by batteries and red circuits not being consumed, which was caused by my assemblers not working on creating robot frames due to a lack of lubricant. And we're back at the beginning.

That is definitely a deadlock situation. Normally you don't encounter such a cycle because petroleum gas gets consumed by a lot of other stuff as well, blue science packs, blue belts and the like, laser turrets etc etc. But it just so happened that all of those processes weren't active. Either due to that same deadlock cycle (in case of the blue belts) or just because I didn't need blue science packs and laser turrets.

So, how do I avoid this situation in general except for making sure that I consume my gas?
Any suggestions?
The issue if I am not mistaken is that you aren't using Petroleum (or Light Oil) at all, and you don't have Heavy Oil because you cracked it all into Light Oil? This is the sort of problem that combinators exist to fix (pre 0.13, this was, imo the single most practical use for combinators in the entire game). Put a pump on the input side of your cracking plants, wire it to a group of combinators, also wire one of your storage tanks for each oil product to the combinator group. In 0.12.35 I use 3 combinators: 2 deciders, 1 arithmetic to make an 'and'-gate condition for when to crack. For heavy oil, I will crack to light if my heavy oil storage is at least 20% full, and my light oil storage is less than 80% full. Each signal goes to it's own decider combinator, which outputs a 1 on the same signal type if the condition is satisfied. Those numbers are fed into the arithmetic combinator, which will multiply them, and output the result on what every signal I want to feed to my pumps, the pumps in turn are set to be active if the signal value is greater than 0 (which only happens when both conditions are met and hence both signals coming into the arithmetic combinator are 1's rather than any of them being 0; this is how to get an 'and'-gate, btw). I use an equivalent setup for light oil cracking into petrol.

Neotix
Filter Inserter
Filter Inserter
Posts: 599
Joined: Sat Nov 23, 2013 9:56 pm
Contact:

Re: How to avoid an oil deadlock

Post by Neotix »

Jupiter wrote: That diagram doesn't make a lot of sense to me. Like "If PG < 10 then output A = 2". As far as I know this is not possible with just one combinator.
And, "if each = 0 then output each". This literally means "If each = 0 then actively output a 0 on the corresponding signals, else, just output nothing on the signal (which is equivalent to 0)". So this combinator will always output 0 (or nothing) on all signals. But why is that, what seems to be a, SR-latch in there at all? It's not like you are working with pulse signal input right?
And why is the "each * 25 output each" in there? I don't understand that part either.
It's old diagram and only for personal usage so I used mental shortcuts and there're some errors like output "Each" instead "Each=1" in SR-latch and probably you need one latch per ON/OFF section. So "If PG < 10 then output A = 2" mean that need 2 combinators with output A=1.

This controler is not working witch pulse signals. It ON/OFF sections like production or cracking depend on fluids level in tanks.

"each * 25 output each" calculate "tanks amount * tanks capacity / 100" and it's needed to calculate % value of fluids in tanks. In can be set manually in combinators but i decided to only change tanks amount in constant combinator and leave the rest combinators.

Jupiter
Fast Inserter
Fast Inserter
Posts: 174
Joined: Thu Jun 23, 2016 2:38 pm
Contact:

Re: How to avoid an oil deadlock

Post by Jupiter »

Frightning wrote:The issue if I am not mistaken is that you aren't using Petroleum (or Light Oil) at all, and you don't have Heavy Oil because you cracked it all into Light Oil? This is the sort of problem that combinators exist to fix (pre 0.13, this was, imo the single most practical use for combinators in the entire game). Put a pump on the input side of your cracking plants, wire it to a group of combinators, also wire one of your storage tanks for each oil product to the combinator group. In 0.12.35 I use 3 combinators: 2 deciders, 1 arithmetic to make an 'and'-gate condition for when to crack. For heavy oil, I will crack to light if my heavy oil storage is at least 20% full, and my light oil storage is less than 80% full. Each signal goes to it's own decider combinator, which outputs a 1 on the same signal type if the condition is satisfied. Those numbers are fed into the arithmetic combinator, which will multiply them, and output the result on what every signal I want to feed to my pumps, the pumps in turn are set to be active if the signal value is greater than 0 (which only happens when both conditions are met and hence both signals coming into the arithmetic combinator are 1's rather than any of them being 0; this is how to get an 'and'-gate, btw). I use an equivalent setup for light oil cracking into petrol.
Well, after I noticed the issue I setup something similar to this in an attempt to solve the problem but this doesn't really work if you are in a situation where you need more heavy oil (lub) than gas (which I think is true for the creation of bots, haven't checked the math). Because what happens is that you slowly build up an excess of gas and light oil so the system will stall eventually if you don't have an alternative sink for these 2 liquids (e.g. making rocket fuel).
It is true that I wasn't doing anything else besides creating robots (but that needs both lub and gas for batteries and plastics).

Neotix
Filter Inserter
Filter Inserter
Posts: 599
Joined: Sat Nov 23, 2013 9:56 pm
Contact:

Re: How to avoid an oil deadlock

Post by Neotix »

There is no way to prevent deadlock if Lubricant is used but petroleum gas don't. We can only delay that deadlock by enabling oil process 1 and disabling oil process 2 in refineries.
There have to be system to waste overproduction of petroleum gas, like turning into rocket fuel and fueling trains.

User avatar
MeduSalem
Smart Inserter
Smart Inserter
Posts: 1490
Joined: Sun Jun 08, 2014 8:13 pm
Contact:

Re: How to avoid an oil deadlock

Post by MeduSalem »

My advice is that once your Petroleum Gas tank hits >2400 just turn the Petroleum Gas into Solid Fuel or even Rocket Fuel and burn it in Boilers.

You can easily setup an Emergency Steam Engine array (if you don't use Steam Power anyways)... and turn the Steam Engine setup on to burn the solid fuel/rocket fuel once it stocks up. That way you can get rid of the excess Petroleum gas and even profit from it as energy so it wasn't entirely wasted.


In my map I'm using Steam Engines entirely (I hate Solar Power)... and I only burn Rocket Fuel (yeah not all that efficient, but reduces throughput problems on belts because items move 9 times slower). So basically I'm constantly draining the Light Oil output of my refineries to make Solid Fuel from it. The Light Oil Tanks are usually therefore almost always empty (except some small amount I'm reserving for Flamethrower turrets now). Once Petroleum Gas stocks up to >2400 in the tank I start making Solid Fuel from Petrol Gas as well, getting the Refineries unclogged again to produce more Light Oil.

Basically I NEVER crack Light Oil to Petrol Gas because I burn all the Light Oil (though I have a cracking plant for Light->Petrol in the weird case that Light Oil should pile up >2400 in the tanks, which normally it doesn't). But I do crack Heavy Oil to Light Oil if the Heavy Oil tank is above >2400.

Since I'm constantly draining the refineries of both Light Oil/Petroleum Gas with that setup I never ever experienced any deadlock due to missing Heavy Oil.

Neotix
Filter Inserter
Filter Inserter
Posts: 599
Joined: Sat Nov 23, 2013 9:56 pm
Contact:

Re: How to avoid an oil deadlock

Post by Neotix »

There should be LO->PG cracking setup as emergency when PG level is very low.

Post Reply

Return to “Gameplay Help”