Page 1 of 1

Yellow Science - Raw Requirements

Posted: Wed Mar 20, 2024 2:40 am
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

Re: Yellow Science - Raw Requirements

Posted: Wed Mar 20, 2024 8:37 am
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.

Re: Yellow Science - Raw Requirements

Posted: Wed Mar 20, 2024 9:04 am
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.

Re: Yellow Science - Raw Requirements

Posted: Thu Mar 21, 2024 12:36 am
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

Re: Yellow Science - Raw Requirements

Posted: Thu Mar 21, 2024 3:13 am
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.

Re: Yellow Science - Raw Requirements

Posted: Thu Mar 21, 2024 8:17 am
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).

Re: Yellow Science - Raw Requirements

Posted: Fri Mar 22, 2024 11:40 pm
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

Re: Yellow Science - Raw Requirements

Posted: Tue Mar 26, 2024 3:07 am
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...)