Skip to content

Commit ec3b974

Browse files
committed
Remove redundant test from logical meter
The battery power formula has been moved to the battery pool, and is being tested there. And a new test for the new PV Power methods was added in the previous commit. Signed-off-by: Sahas Subramanian <[email protected]>
1 parent b70d414 commit ec3b974

File tree

1 file changed

+0
-71
lines changed

1 file changed

+0
-71
lines changed

tests/timeseries/test_logical_meter.py

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -153,77 +153,6 @@ def mock_resampled_receiver(
153153
assert (await grid_production_recv.receive()).value == 4.0
154154
assert (await grid_consumption_recv.receive()).value == 0.0
155155

156-
async def test_battery_and_pv_power( # pylint: disable=too-many-locals
157-
self,
158-
mocker: MockerFixture,
159-
) -> None:
160-
"""Test the battery power and pv power formulas."""
161-
mockgrid = MockMicrogrid(grid_side_meter=False)
162-
mockgrid.add_batteries(3)
163-
mockgrid.add_solar_inverters(2)
164-
await mockgrid.start(mocker)
165-
battery_pool = microgrid.battery_pool()
166-
logical_meter = microgrid.logical_meter()
167-
168-
battery_power_recv = battery_pool.power.new_receiver()
169-
pv_power_recv = logical_meter.pv_power.new_receiver()
170-
171-
bat_inv_receivers = [
172-
get_resampled_stream(
173-
battery_pool._namespace, # pylint: disable=protected-access
174-
meter_id,
175-
ComponentMetricId.ACTIVE_POWER,
176-
)
177-
for meter_id in mockgrid.battery_inverter_ids
178-
]
179-
180-
pv_inv_receivers = [
181-
get_resampled_stream(
182-
logical_meter._namespace, # pylint: disable=protected-access
183-
meter_id,
184-
ComponentMetricId.ACTIVE_POWER,
185-
)
186-
for meter_id in mockgrid.pv_inverter_ids
187-
]
188-
189-
await synchronize_receivers(
190-
[battery_power_recv, pv_power_recv, *bat_inv_receivers, *pv_inv_receivers]
191-
)
192-
193-
battery_results = []
194-
pv_results = []
195-
battery_inv_sums = []
196-
pv_inv_sums = []
197-
for _ in range(10):
198-
bat_inv_sum = 0.0
199-
pv_inv_sum = 0.0
200-
for recv in bat_inv_receivers:
201-
val = await recv.receive()
202-
assert val is not None and val.value is not None and val.value > 0.0
203-
bat_inv_sum += val.value
204-
battery_inv_sums.append(bat_inv_sum)
205-
206-
for recv in pv_inv_receivers:
207-
val = await recv.receive()
208-
assert val is not None and val.value is not None and val.value > 0.0
209-
pv_inv_sum += val.value
210-
pv_inv_sums.append(pv_inv_sum)
211-
212-
val = await battery_power_recv.receive()
213-
assert val is not None and val.value is not None
214-
battery_results.append(val.value)
215-
216-
val = await pv_power_recv.receive()
217-
assert val is not None and val.value is not None
218-
pv_results.append(val.value)
219-
220-
await mockgrid.cleanup()
221-
222-
assert len(battery_results) == 10
223-
assert equal_float_lists(battery_results, battery_inv_sums)
224-
assert len(pv_results) == 10
225-
assert equal_float_lists(pv_results, pv_inv_sums)
226-
227156
async def test_chp_power(self, mocker: MockerFixture) -> None:
228157
"""Test the chp power formula."""
229158
mockgrid = MockMicrogrid(grid_side_meter=False)

0 commit comments

Comments
 (0)