age-series / ElectricalAge

Electrical Age (ELN) is a Minecraft Mod offering the ability to perform large-scale in-game electrical simulations.
Other
65 stars 30 forks source link

What's with Rotary Motor and its Efficiency? #306

Closed msparkles closed 6 months ago

msparkles commented 6 months ago

Looking at the source code, it seems to be a constant unless the shaft speed is >700, which seems impossible? Any attempt at making it spin faster seems to just reach the ~250 max speed and break the machine.

jrddunbr commented 6 months ago

The rotary motor is designed for starting bases and is intentionally nerfed so that you don't try to use it for full-time base load.

Here's the code you mentioned:

            val computedEfficiency = if (shaft.rads > 700) {
                 Math.max(Math.pow(Math.cos(((shaft.rads - desc.optimalRads) / (desc.optimalRads * desc.efficiencyCurve)) * (Math.PI / 2)), 3.0), 0.0) * RotaryMotorDescriptor.GAS_GUZZLER_CONSTANT
            } else {
                0.25
            }

I forgot to update the piecewise function to account for the actual maximum shaft speed being changed from 1,000 to 250 rad/s in 1.21.x. It should have been specified in relation to 250 for the maximum speed, so 0.7 * max speed. The corrected value should be around 175 rad/s.

Thanks for noticing the bug, I can put out a PR to fix it sometime this weekend.

Screenshot from 2023-12-15 17-25-04

Graph: X is rad/s, Y is eff from 0-1.

jrddunbr commented 6 months ago

What I find to be really curious is that WAILA doesn't show this properly; it always says 25% eff. I'm guessing there's a mistake in the code there for that too. Edit: I'm a derp. The piecewise function in the graph is backwards; it's always 25% but should drop off above 700 rad/s. Instead, it drops off before that.

I think my intent was that a mechanical piston engine has a power band near the optimal speed. Above that we just break the engine but below that we wanted to be less effective given fuel. So I probably just need to shift the 700 number like I said above.

msparkles commented 6 months ago

The rotary motor is designed for starting bases and is intentionally nerfed so that you don't try to use it for full-time base load.

Can you elaborate on this also? The Rotary Motor also claims to have 84.7kW max, which is significantly more than the gas turbine..

msparkles commented 6 months ago

It'd be quite silly considering that with RotaryCraft ethanol being basically free, that fuel would be the consideration here...

jrddunbr commented 6 months ago

Can you elaborate on this also? The Rotary Motor also claims to have 84.7kW max, which is significantly more than the gas turbine..

The fuel consumption is vastly more inefficient on the rotary engine, which is designed to balance it against the gas turbines which are much more efficient at converting fuel energy into actual rotational energy (although the smaller power output is there - we're working on an update to address that).

The rotary engine at full throttle consumes 64mB/s for that 84.7kW, while the gas turbine draws around 4mB/s for 10-16kW depending on the fuel. That 84.7kW max is determined from the most efficient fuel, and may not be the eff. numbers for RotaryCraft fuel. A calculation using the fluid code would be needed to determine that and we don't document it as it's up to the player to discover that for themselves.

It'd be quite silly considering that with RotaryCraft ethanol being basically free, that fuel would be the consideration here...

RotaryCraft frankly was ignored in the balancing of the mod. We may accept their fuel but it was from a physics standpoint of what fuel would be worth realistically - check the fluid code for answers on how we do that.

I'm open to feedback and/or interop with RC but we currently have no plans as such. If we did add interop with RotaryCraft, Reika said that we can only export RC energy into our systems, and not the other way around. I have proposed that we would do that via some sort of CVT-looking multiblock. Plans to implement that are currently not on the table, but pull requests are welcome (although you should expect that you will receive balance scrutiny from both sides before a merge).

In general, Eln is going to be somewhat underpowered compared to RC and other Reika mods. We don't aim to balance against that, but rather keep within the realm of what our circuit simulation can handle. If you want to output more RF/t or something on the energy exporter, just use the relevant config options to adjust the balance of your modpack to your liking.

Side note, we do plan to increase the kW per block placed in the future. That sort of balance change is on our radar but not done yet.

jrddunbr commented 6 months ago

Here's the relevant file where fuels are registered, for reference: https://github.com/age-series/ElectricalAge/blob/1.21.x/src/main/kotlin/mods/eln/fluid/FuelRegistry.kt

jrddunbr commented 6 months ago

Here's the RF config line. Other lines above it handle it for EU and OpenComputers conversion: https://github.com/age-series/ElectricalAge/blob/1.21.x/src/main/java/mods/eln/Eln.java#L562

Sorry, I realize the codebase is a mess. We've been migrating from Java to Kotlin slowly as we have time, but primarily focus on the features that make development fun.

msparkles commented 6 months ago

No worries, we've seen where the config is.

We actually wrote a few mods in Kotlin before, although never Forge :100:

msparkles commented 6 months ago

That 84.7kW max is determined from the most efficient fuel, and may not be the eff. numbers for RotaryCraft fuel.

So does this mean that RC ethanol may not reach the full power?

jrddunbr commented 6 months ago

np. FWIW, it's probably easier to go back and forth on the Eln discord: https://discord.gg/YjK2JAD

jrddunbr commented 6 months ago

So does this mean that RC ethanol may not reach the full power?

Correct.

jrddunbr commented 6 months ago

The highest output power is based on the largest number there, so probably with the exception of some CraftTweaker script hooks in there, "lightoil" to 35358000.0 // Magneticraft, density = 0.83 kg/l, heating value = 42.6 MJ/kg has the highest energy density per mB.

jrddunbr commented 6 months ago

Fixed (probably) in ca0f372