Skip to content

PowerDistributor is going away from zero when zero power is requested, when there are exclusion bounds #794

@shsms

Description

@shsms

What happened?

When 0 power is requested when there are exclusion bounds, the power distributor is returning non-zero power values that are outside the exclusion bounds. This can be reproduced by adding the below snippet under test_scenario_1

diff --git a/tests/actor/power_distributing/test_battery_distribution_algorithm.py b/tests/actor/power_distributing/test_battery_distribution_algorithm.py
index 3501cc2c..3841deef 100644
--- a/tests/actor/power_distributing/test_battery_distribution_algorithm.py
+++ b/tests/actor/power_distributing/test_battery_distribution_algorithm.py
@@ -1039,6 +1039,10 @@ class TestDistWithExclBounds:
 
         algorithm = BatteryDistributionAlgorithm()
 
+        self.assert_result(
+            algorithm.distribute_power(0, components),
+            DistributionResult({1: 0, 3: 0, 5: 0}, remaining_power=0.0),
+        )
         self.assert_result(
             algorithm.distribute_power(-300, components),
             DistributionResult({1: -100, 3: -100, 5: -100}, remaining_power=0.0),

What did you expect instead?

It should produce 0 values, because the api service accepts 0 values, even when there are exclusion bounds.

Affected version(s)

No response

Affected part(s)

I don't know (part:❓)

Extra information

We renamed the power distribution label to power management, but the Affected part(s) dropdown when reporting a bug still says power distribution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    part:power-managementAffects the management of battery power and distributionpart:❓We need to figure out which part is affectedpriority:❓We need to figure out how soon this should be addressedtype:bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions