Yellow Science - Raw Requirements

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
TheAtomJet
Manual Inserter
Manual Inserter
Posts: 3
Joined: Wed Mar 20, 2024 2:14 am
Contact:

Yellow Science - Raw Requirements

Post by TheAtomJet »

Hi,

New to the game and the wiki. This may not belong here.

I was doing some work on the requirements for yellow science. I built the equations to calculate the required Petro, heavy oil and sulfur from the plastic, lubricant and sulfuric acid in the bill of materials. To craft 1 yellow science, I found it to take:
Plastic: 7 2/3
Heavy oil: 5
Sulfur: 1 2/3

Broken down that's:
Petroleum: 101 2/3
Heavy oil: 5

Using AOP, the ratio of Petro: crude is .975. But if you pull heavy oil off that process to make lube, you're making less petro. So I wanted to find how much more crude oil you need to produce the same amount of Petro as when you weren't making lube. Here's the equation I came up with:

PE = (.85 + .125(1-X/25)) CO

Where PE is Petro out, X is heavy oil out and CO is crude oil in.

To make the Petro and heavy oil I need to make 1 yellow science, I calculated needing 107.02 but the science packs page says I need 106.84. I did end up finding how that number is found but I think it's incorrect because it relies on the crude oil being 100 input when doing the initial calculation then doesn't account for the different ratio of the rates are different.

Can someone check my math or give me an explanation as to why it's 106.84 and not 107.02? I know it's close and .18 isn't a big number but I'd like to make sure I've done everything correctly.

Cheers

SoShootMe
Filter Inserter
Filter Inserter
Posts: 477
Joined: Mon Aug 03, 2020 4:16 pm
Contact:

Re: Yellow Science - Raw Requirements

Post by SoShootMe »

TheAtomJet wrote:
Wed Mar 20, 2024 2:40 am
Petroleum: 101 2/3
Heavy oil: 5
This is correct.
PE = (.85 + .125(1-X/25)) CO
This is also correct, but tells you how much petroleum gas you can get per crude oil when you use X heavy oil per AOP craft, which isn't what you want to calculate.

Not a general approach but in this case, you can calculate the amount of crude oil needed for 5 heavy oil and 101+2/3 petroleum gas as follows (starting from recipe data):
  • For 5 heavy oil, you need 5/25 = 1/5 AOP crafts, using 100/5 = 20 crude oil. This will also produce 55/5 = 11 petroleum gas and 45/5 = 9 light oil. Cracking the light oil to petroleum gives an additional 9*20/30 = 6 petroleum gas. That is, 20 crude oil used for 5 heavy oil and 17 petroleum gas.
  • This is a shortfall of 101+2/3 - 17 = 84+2/3 petroleum gas. AOP with full cracking uses 100 crude oil for (25*30/40 + 45) * 20/30 + 55 = 97.5 petroleum gas, or 100/97.5 crude oil per petroleum gas. So you need an extra (84+2/3)*100/97.5 = 86.84 crude oil (to 2dp).
  • In total, that's 20 + 86.84 = 106.84 crude oil used for 5 heavy oil and 17 + 84+2/3 = 101+2/3 petroleum gas.

Bilka
Factorio Staff
Factorio Staff
Posts: 3139
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Yellow Science - Raw Requirements

Post by Bilka »

For the wiki I usually doublecheck the numbers with an online calculator like https://kirkmcdonald.github.io. For yellow science for example see https://kirkmcdonald.github.io/calc.htm ... e-pack:r:1 and scroll down to oil - it shows that for the one utility science per hour, 106.838 crude oil (per hour) is needed.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

TheAtomJet
Manual Inserter
Manual Inserter
Posts: 3
Joined: Wed Mar 20, 2024 2:14 am
Contact:

Re: Yellow Science - Raw Requirements

Post by TheAtomJet »

Thanks for your replies.
For the wiki I usually doublecheck the numbers with an online calculator
I'm questioning the math that results in this answer so I'd question this calculator too.

SoShootMe, after some math, I found the equation for your process to be:

CO(total) = 4(Heavy oil required)(1 - .85/.975) + (Petro required)/.975

Roughly:

CO = HO(.5128) + PE/.975

I understand the process you describe but I'm not sure why you would first calculate the crude oil requirements from the heavy oil, then calculate the Petro from that crude oil and then find the crude oil for the remaining balance at the .975 ratio. If the answer is that's how the game is coded use heavy oil, that's how it is.

Also, the term, (1-X/25), would need to be adjusted to fit in a general equation for crude oil usage. Would that equation work as a general solution given there's a large number of oil refineries and the production could be considered constant?

Cheers

User avatar
Khagan
Fast Inserter
Fast Inserter
Posts: 233
Joined: Mon Mar 25, 2019 9:40 pm
Contact:

Re: Yellow Science - Raw Requirements

Post by Khagan »

TheAtomJet wrote:
Thu Mar 21, 2024 12:36 am
I'm not sure why you would first calculate the crude oil requirements from the heavy oil, then calculate the Petro from that crude oil and then find the crude oil for the remaining balance at the .975 ratio.
Because the quantity of crude required depends on the limiting component. Usually (almost always, over the factory as a whole) that's gas, in which case you can just convert requirements for heavy or light oil into gas equivalents (1 light oil = 2/3 gas, 1 heavy oil = 1/2 gas), and then apply the 0.975 ratio to the total gas equivalent requirement. But if you are interested in a particular process that needs lots of oil and not so much gas, it might be the oil that acts as the lower bound on the quantity of crude required.

SoShootMe
Filter Inserter
Filter Inserter
Posts: 477
Joined: Mon Aug 03, 2020 4:16 pm
Contact:

Re: Yellow Science - Raw Requirements

Post by SoShootMe »

TheAtomJet wrote:
Thu Mar 21, 2024 12:36 am
I understand the process you describe but I'm not sure why you would first calculate the crude oil requirements from the heavy oil, then calculate the Petro from that crude oil and then find the crude oil for the remaining balance at the .975 ratio.
As Khagan wrote, it's usually the case that petroleum gas is the limiting factor, however the effect of that is to simplify the calculation. The actual reason comes from the recipes involved: advanced oil processing, heavy oil cracking and light oil cracking. These yield an order crude oil, heavy oil, light oil, petroleum gas, where each can be made from all of the preceding fluids and none of the succeeding ones. Related is that AOP can be seen as producing heavy oil from crude oil with light oil and petroleum gas as byproducts, AOP+HOC can be seen as producing light oil from crude oil with petroleum gas as a byproduct, and AOP+HOC+LOC can be seen as producing petroleum gas from crude oil.

The more general case of crude oil required for H heavy oil, L light oil and P petroleum gas may make this clearer (hopefully without mistakes):
  • Crude oil required for heavy oil, Ch = 100*H/25 = 4H, and this also produces Lh = 45H/25 light oil and Ph = 55H/25 petroleum gas.
  • If Lh < L, more crude oil is needed to make up the light oil shortfall. Combining advanced oil processing and heavy oil cracking yields a recipe of 100 crude oil -> 25*30/40+45=63.75 light oil and 55 petroleum gas, so crude oil required for light oil, Cl = 100(L-Lh)/63.75, and this also produces Pl = 55(L-Lh)/63.75 petroleum gas. Otherwise, Cl = 0 and Pl = 0. Equivalently: Cl = max(100(L-Lh)/63.75, 0) and Pl = max(55(L-Lh)/63.75, 0).
  • If Ph+Pl < P, more crude oil is needed to make up the petroleum gas shortfall. Combining advanced oil processing and both heavy and light oil cracking yields a recipe of 100 crude oil -> 97.5 petroleum gas, so crude oil required for petroleum gas, Cp = 100(P-Ph-Pl)/97.5. Otherwise, Cp = 0. Equivalently: Cp = max(100(P-Ph-Pl)/97.5, 0).
  • Total crude oil required is Ch+Cl+Cp.
Substituting in to get the total in terms of H, L and P (an expression containing the max() function), and calculating the excess heavy and light oil (if any) are left as an exercise for the reader ;).

The fully general case, such as used by factory calculators, is (surprise!) more complex. You may find https://alt-f4.blog/ALTF4-47/ an interesting read on the subject (I don't think I could add more to what is there).

TheAtomJet
Manual Inserter
Manual Inserter
Posts: 3
Joined: Wed Mar 20, 2024 2:14 am
Contact:

Re: Yellow Science - Raw Requirements

Post by TheAtomJet »

Thanks again for your replies.

The math described in the article is super helpful and sheds light on how the game calculates resource usage. It's the answer I'm looking for.

Cheers

FritzHugo3
Fast Inserter
Fast Inserter
Posts: 103
Joined: Tue Jan 09, 2018 4:30 pm
Contact:

Re: Yellow Science - Raw Requirements

Post by FritzHugo3 »

There are multiples calculators at websites and as mods ingame.

If people like to calculate all in head or excel - no problem have fun with this.
But maybe people dont know that ther are really great tools for planing and calculating the hole base.
Or only shows the right ratios with Production time 0.5, 0.75,1 (worser-better fabrication, furnace, modules...)

Post Reply

Return to “Gameplay Help”