Mekanism

Mekanism

111M Downloads

Math errors result in wrong conversion for Joules/FE in the case of the gas burning generator

utoc opened this issue · 3 comments

commented

Issue description:

Gas burning generator creates an excessive amount of energy due to a conversion error in maths

Steps to reproduce:

  1. Create ethylene gas cylinder piped into a Mek Gas Burning generator. Power outputted from generator into an induction cube (to measure power input)
  2. Profit (72krf/t)

Version (make sure you are on the latest version before reporting):

Forge: forge-1.15.2-31.1.63
Mekanism: Mekanism-1.15.2-9.10.1.414
Other relevant version: No other mods running for this test

Based on the code and configs:

MekanismConfig.general.FROM_H2.get().add(MekanismGeneratorsConfig.generators.bioGeneration.get().multiply(2L * MekanismConfig.general.ETHENE_BURN_TIME.get())));

bioGeneration = "350"
EthyleneBurnTime = 40

So the math is going to be something like ``350 * (2 * 40)) which comes out to 28000J/t which should convert down to 11200rf/t. However, my induction cell is receiveing 72krf/t which is what you'd get if you multiplied J2.5 rather than J0.4.

Here are some screenshots which may help:

The setup:
javaw_VOUh4B9mMM

Power produced in Joules
javaw_9JicTamewD

Power produced in FE
javaw_24ta5VvoFv

Power received into the induction cube:
javaw_PHMT2lR4jf

If a (crash)log is relevant for this issue, link it here: (It's almost always relevant)

[No crashlog with this issue]

As an aside, I think maybe the config items for J to FE and FE to J may be misnamed and I don't know if this has anything to do with the issue or not:

FROM_FORGE = CachedFloatingLongValue.define(this, builder, "Conversion multiplier from Forge Energy to Joules (FE * JoulesToForge = Joules)",
              "JoulesToForge", FloatingLong.createConst(2.5), CachedFloatingLongValue.POSITIVE);

"FROM_FORGE" and "JoulesToForge" are not the same thing but I may not fully understand how that is intended.

Cheers.

commented

Thanks for pointing this out. The issue actually doesn’t have to do with energy conversion, but the fact that the client fails to take into account the ‘fuel ticks’ (40) of Ethylene when calculating the energy production rate. You’re right that the conversion config naming is ambiguous, I’ll look into that too.

commented

Regardless, rest assured that no energy duplication is taking place. At a burn rate of 6.4 mB/t, the gas generator is actually capable of producing 72k RF/t.

commented

I've renamed the config values from 'JoulesToX' to 'JoulePerX', which I think better describes their function. For example, 'JoulePerEU' defines how many joules translates to 1 EU (of which 10 is the default). The opposing variable, 'EUPerJoule', is set to 0.1.

I've also fixed the original offending issue re: the Gas Generator.