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

Refactor energy exporter to have less internal buffer #292

Open OfficerPotato911 opened 11 months ago

OfficerPotato911 commented 11 months ago

Using the ELN to other exporter is difficult, and it has some pretty big bugs.

I personally have a vision to make everything in my world be powered by one source - that source being ELN energy.

When using the exporter, under no load, the thing appears to have an internal buffer of around 750,000RF (almost two Leadstone Energy Cells for comparison). No matter if there is a load or not the device will draw the max amount of current from the line i have it connected to, and in my testing, the device draws around 2500 KJ from the energy source it was connected to [3200V, set to 273 Ohms]

Please refine the energy exporter to remove that buffer. If a buffer is a requirement [Which i could see how it would be], then maybe have different tiers of exporter with different buffers that have more expensive crafting recipies. You could decide what to do with these recipies depending upon installed mods or something.

There's also no real transparent information on the conversion rates or anything either, and it's a very mysterious block to have such an impactful purpose.

jrddunbr commented 11 months ago

Which version of Eln are you using? There are two different behaviors. Based on the fact that you're mentioning using the newer version, yeah, the energy exporter is quite ... interesting.

Accepting PR's for fixing it. There's no documentation but the source code will give you everything you need to know.

For what it's worth though, due to the way RF works, a buffer is required. There isn't really a great way around that. The buffer is as large as it is because we wanted to allow large quantities of RF to be drawn per tick if you connected it via direct pole to a T2 transmission line at 51.2kV nominal. With the current cable update, that means you can probably get circa 5.12MW out of a single converter... about 384kRF/s or 6.4kRF/t. It could probably be improved.

No matter if there is a load or not the device will draw the max amount of current from the line i have it connected to, and in my testing, the device draws around 2500 KJ from the energy source it was connected to [3200V, set to 273 Ohms]

https://github.com/age-series/ElectricalAge/blob/c59c012dcdf269c55fb8b118639f051a9f90c456/src/main/java/mods/eln/Eln.java#L344

https://github.com/age-series/ElectricalAge/blob/c59c012dcdf269c55fb8b118639f051a9f90c456/src/main/kotlin/mods/eln/simplenode/energyconverter/EnergyConverterElnToOtherDescriptor.kt#L11

I think it should be about 240kJ. That is not a small number by any means for sure. Once that buffer is full though, the power draw will drop to zero as the simulator puts the device into maximum impedance.

then maybe have different tiers of exporter with different buffers that have more expensive crafting recipies.

This has been proposed before. Open to implementation suggestions (ie, how we explain it works). Is it a device that goes on a shaft network, or is it some sort of magic box with a pair of motors in it that convert one type of energy to another? To some extent, that's why the ohms dial exists - the problem then becomes what to do if the user changes the setting while it has energy in it. And perhaps it could be a craftable item you put in it to get a range of outputs. idk.

There's also no real transparent information on the conversion rates or anything either, and it's a very mysterious block to have such an impactful purpose.

Believe it or not, this is better than the previous implementation, which occasionally sourced/sinked energy into/out of thin air. Now it at least has the correct quantity of energy going in and out - just a large buffer. Not saying that it's necessarily better from a player standpoint. Both of them are annoying to use at best.

OfficerPotato911 commented 11 months ago

I kinda figured the way RF worked would be the reason why there is a buffer in place. Although currently the size of that buffer makes it pretty much uncontrollable [not to mention kinda cheat-y to have such a big power storage capacity for not that much crafting expense]. In an application where one might want to turn off equipment on the other side of the converter [such as Immersive Engineering's flood lights, the first thing that comes to mind you'd want to switch], that's almost impossible.

Perhaps a new upgrade could be made to increase the buffer and the output capacity of the machine. Ideally, i'd say the operator would be able to set the desired buffer amount and output rate to their desired need, but would need to insert an upgrade [or a few] to be able to increase these options past a certain amount.

This not only fixes the annoying problem of not being able to control your equipment very well, but also gives more balance to the game since it's cheaper to make an exporter than it is to make an energy cell. [and for lunatics like me who like to occasionally just turn off everything and feel the wrath of my own authority, i don't have to wait for the buffer to go away before everything goes dark! :D (I have problems.) ]

As for the version I'm using, I just updated to 1.20.4

jrddunbr commented 11 months ago

Continued conversation in Discord; but the meat and potatoes of the issue is here; if wants to implement this, feel free. Otherwise, it's not super high on the priority list compared to the new simulator rewrite that we're doing (along with all the bugfixing in 1.21.x)