The Power Usage report adds to the Added count when a generator generates power, but it only adds to the Removed count when power is removed directly from the generator (by a consumer). This means that any power that's removed from batteries isn't counted; so you can have batteries draining with non-negative Net Power Usage.
I've attached a save showing batteries draining with zero Power Usage: Added, Power Usage: Removed, and Power Usage: Net.
I believe this could be fixed by adding to the report in CircuitManager.PowerFromBatteries:
private float PowerFromBatteries(float joules_needed, IList<Battery> batteries) { int num; float batteryJoulesAvailable = this.GetBatteryJoulesAvailable(batteries, out num); float a = batteryJoulesAvailable * (float)num; float num2 = Mathf.Min(a, joules_needed); // begin added code ReportManager.Instance.ReportValue(ReportManager.ReportType.EnergyCreated, -num2, null); // end added code joules_needed -= num2; float joules = num2 / (float)num; for (int i = batteries.Count - num; i < batteries.Count; i++) { Battery battery = batteries[i]; battery.ConsumeEnergy(joules); } return joules_needed; }
Steps to Reproduce
Fill some batteries with a generator Disconnect the generator and connect a consumer Watch the Power Usage report no power removed as batteries drain
Fill some batteries with a generator Disconnect the generator and connect a consumer Watch the Power Usage report no power removed as batteries drain
-
1
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now