SolarModule : EC output is wrongly multiplied by TimeWarp.fixedDeltaTime instead of divided
gotmachine opened this issue ยท 3 comments
I believe this is correct. The configs specify EC in EC/s. The part consumes it in EC/physics tick. FIxedDeltaTime is the portion of a second happening in a physics tick, as a scalar.
Thus, to convert from one seconds worth of EC to one physics-tick worth, you multiply:
One Second EC Value * Portion of a Second =EC value for portion of a second.
Unless I've forgotten something fundamental about math?
You are converting from EC/s to EC/tick a few lines before :
But obviously at line 226 you intend to do the reverse conversion, EC/tick to EC/s, that would require doing totalOutput / TimeWarp.fixedDeltaTime, not totalOutput * TimeWarp.fixedDeltaTime
And also : TimeWarp.fixedDeltaTime isn't a scalar, it's the amount of ingame seconds per physic tick. Can, and will be > 1.0 at high timewarp speeds.
You are converting from EC/s to EC/tick a few lines before :
I got ya. Indeed, there does appear to be a double multiplication in there.
I'll have to take a look at that code and figure out what it was supposed to be doing, as obviously its a bit incorrect.
TimeWarp.fixedDeltaTime isn't a scalar, it's the amount of ingame seconds per physic tick. Can, and will be > 1.0 at high timewarp speeds.
Yes, its a scalar, that represents the number of seconds per physics tick. If it is > 1, that just means that there is more than one second per physics tick (scalars can be >1). Not meaning to argue, I think we are both meaning the same thing.
Thankfully this error:
doesn't directly impact the EC output, only the cached/exposed value. Yes, it is a problem, but hopefully the panels will continue to function until it can be fixed.