Significantly improve TEG power generation stability (#37658)

* Significantly improve TEG power generation stability

* Revert "Significantly improve TEG power generation stability"

This reverts commit e88278c0f8dea925a89b240e09e5dbcb84f9d174.

* Reimplement without auto formatting obliterating the entire system

* second round of balancing
This commit is contained in:
ArtisticRoomba
2025-05-26 05:07:49 -07:00
committed by GitHub
parent ba76ceec08
commit 9a910873c8
2 changed files with 11 additions and 1 deletions

View File

@@ -186,8 +186,12 @@ public sealed class TegSystem : EntitySystem
// Turn energy (at atmos tick rate) into wattage.
var power = electricalEnergy / args.dt;
// Add ramp factor. This magics slight power into existence, but allows us to ramp up.
supplier.MaxSupply = power * component.RampFactor;
// Also apply an exponential moving average to smooth out fluttering, as it was causing
// seizures.
supplier.MaxSupply = component.PowerSmoothingFactor * (power * component.RampFactor) +
(1 - component.PowerSmoothingFactor) * supplier.MaxSupply;
var circAComp = Comp<TegCirculatorComponent>(circA);
var circBComp = Comp<TegCirculatorComponent>(circB);