Skip to content

Commit

Permalink
fixup! Test the support for incremental actors in the PowerManager
Browse files Browse the repository at this point in the history
Signed-off-by: Sahas Subramanian <[email protected]>
  • Loading branch information
shsms committed Jun 4, 2024
1 parent 66f602f commit 62e0552
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions tests/timeseries/_battery_pool/test_battery_pool_control_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ async def test_case_5( # pylint: disable=too-many-statements
"""Test case 5.
- four battery pools with same batteries, but different priorities.
- two battery pools are incremental, two are not.
- two battery pools are in the shifting group, two are not.
- all batteries are working.
"""
set_power = typing.cast(
Expand Down Expand Up @@ -531,8 +531,8 @@ async def test_case_5( # pylint: disable=too-many-statements
await bounds_1_rx.receive(), power=None, lower=-4000.0, upper=4000.0
)

# The target power of non-incremental battery pools should only be visible to
# other non-incremental battery pools, and vice-versa.
# The target power of non-shifting battery pools should only be visible to other
# non-shifting battery pools, and vice-versa.
await battery_pool_2.propose_power(
Power.from_watts(200.0),
bounds=timeseries.Bounds(
Expand All @@ -558,8 +558,8 @@ async def test_case_5( # pylint: disable=too-many-statements
]
set_power.reset_mock()

# Set a power to the second non-incremental battery pool. This should also have
# no effect on the higher-priority incremental battery pools.
# Set a power to the second non-shifting battery pool. This should also have
# no effect on the shifting battery pools.
await battery_pool_1.propose_power(
Power.from_watts(720.0),
)
Expand Down Expand Up @@ -595,9 +595,9 @@ async def test_case_5( # pylint: disable=too-many-statements
]
set_power.reset_mock()

# Setting power to an incremental battery pool should shift the bounds of the
# non-incremental battery pools to adjust for the target power of the incremental
# battery pools.
# Setting power to a shifting battery pool should shift the bounds seen by the
# non-shifting battery pools. It would also shift the final target power sent
# in the batteries.
await battery_pool_3.propose_power(
Power.from_watts(-1000.0),
)
Expand Down Expand Up @@ -634,25 +634,25 @@ async def test_case_5( # pylint: disable=too-many-statements
]
set_power.reset_mock()

# Creating a new non-incremental battery pool that's higher priority than the
# incremental actors should shift the bounds of the incremental actors, because
# the non-incremental battery pools will already have a target power.
# Creating a new non-shifting battery pool that's higher priority than the
# shifting battery pools should still be shifted by the target power of the
# shifting battery pools.
battery_pool_5 = microgrid.battery_pool(priority=5)
bounds_5_rx = battery_pool_5.power_status.new_receiver()

await battery_pool_5.propose_power(None)

self._assert_report(
await bounds_5_rx.receive(), power=720.0, lower=-4000.0, upper=4000.0
await bounds_5_rx.receive(), power=720.0, lower=-3000.0, upper=5000.0
)
self._assert_report(
await bounds_4_rx.receive(), power=-1000.0, lower=-4720.0, upper=3280.0
await bounds_4_rx.receive(), power=-1000.0, lower=-4000.0, upper=4000.0
)
self._assert_report(
await bounds_3_rx.receive(), power=-1000.0, lower=-4720.0, upper=3280.0
await bounds_3_rx.receive(), power=-1000.0, lower=-4000.0, upper=4000.0
)
self._assert_report(
await bounds_2_rx.receive(), power=720.0, lower=-4000.0, upper=4000.0
await bounds_2_rx.receive(), power=720.0, lower=-3000.0, upper=5000.0
)
self._assert_report(
await bounds_1_rx.receive(), power=720.0, lower=-1000.0, upper=1500.0
Expand Down

0 comments on commit 62e0552

Please sign in to comment.