ShotgunNinja / Kerbalism

Hundreds of Kerbals were killed in the making of this mod.
The Unlicense
43 stars 19 forks source link

Process rates of LiquidFuel, Oxidizer and Monoprop are wrong. #135

Open ShotgunNinja opened 7 years ago

ShotgunNinja commented 7 years ago

We used the wrong values in the spreadsheet. Anthraquinone process, for example, is producing 5 times more LiquidFuel Oxidizer than it should.

PiezPiedPy commented 7 years ago

Maybe because the Anthraquinone process produces Hydrogen Peroxide - H2.O2, Liquid Fuel in KSP is something different and might account for the error.

For the Anthraquinone process I used a 5Litre volume for each KSP resource unit and densities of Hydrogen H2 Gas = 8.99e-8 Oxygen O2 Gas = 1.41e-6 Output Hydrogen Peroxide H2.O2 Liquid = 1.45e-3 KSP Oxidizer ?? = 1e-3

to calculate the mass of each KSP unit. 1 unit of H2 Gas is 0.4495 grams 1 unit of O2 Gas is 7.05 grams 1 unit of H2.O2 Liquid is 7250 grams (7.25Kg) 1 unit of KSP Oxidizer Liquid is 5000 grams (5Kg)

Using molar mass per atom of Hydrogen at 1.00794 and a big fat Oxygen weighing in at a whopping 15.9994, along with Avogadro's constant in the calculations. I get molar mass per molecule of H2 = 3.3475e-24 and O2 = 5.3136e-23 which gives out H2.O2 at 5.6483e-23

With the molar mass and weight of a KSP unit I calculated the number of molecules in each KSP unit 1 unit of H2 Gas has 1.3428e23 molecules 1 unit of O2 Gas has 1.3268e23 molecules 1 unit of H2.O2 Liquid has 1.2836e26 molecules

using those figures and normalizing to 1 unit of H2 Gas I get 1 unit of H2 Gas needs 1.0120677706 units of O2 Gas to Output 0.0010461487 units of H2.O2 Liquid.

To convert the Hydrogen Peroxide to KSP Oxidizer I just calculated a conversion value by dividing the masses of Oxidizer and H2.O2 5000/7250 = 0.689655172 so 0.0010461487 units of H2.O2 Liquid becomes 0.0015169156 of KSP Oxidizer.

the process definition in default.cfg looks good to me

Process { name = anthraquinone process modifier = _Anthraquinone input = Hydrogen@1.0 input = Oxygen@1.0120677706 output = Oxidizer@0.001516915615 // (HydrogenPeroxide@0.0010461487) }

maybe there is a bug in the dll code or elsewhere in the .cfg scripts ??

lordcirth commented 7 years ago

I know that Kerbalism assumes monopropellant to be hydrazine, what does it assume LF to be? Kerosene?

ShotgunNinja commented 7 years ago

@lordcirth Methane

@PiezPiedPy The rate of HydrogenPeroxide is correct. The issue is that I then converted the rate of HydrogenPeroxide to Oxidizer using a mass of 1Kg/unit for oxidizer. Instead, just now I realized, each unit of Oxidizer weight 5Kg in game. That lead to producing 5 times more Oxidizer in anthraquinone. Similar errors were made in all the other processes that include LiquidFuel and Monoprop.

Let's check the current anthraquinone:

inputs:
  1.00 hydrogen x 0.0000899 Kg/unit
+ 1.0120677706 oxygen x 0.0014100 Kg/unit
  total: 0.001516915556546 Kg of inputs

outputs:
  0.0010461487hydrogen peroxide x 1.4500000 Kg/unit
  total: 0.001516915615 Kg of outputs

output (stockified, wrong):
  0.001516915615 oxidizer x 5 Kg/unit
  total: 0.007584578075 Kg of outputs

output (stockified, corrected):
  0.000303383123 oxidizer x 5 Kg/unit
  total: 0.001516915615 Kg of outputs
PiezPiedPy commented 7 years ago

@ShotgunNinja Well spotted ;)