Skip to content

Commit bc18941

Browse files
committed
Update MockMicrogrid to produce same values from connected components
The MockMicrogrid assigns component_ids based on group and component_type. For example, for the second meter/inverter/battery group, meter_id would be `27`, inverter_id would be `28`, and battery_id would be `29`. The change in this commit ensures that connected meters and inverters will produce similar power values. Signed-off-by: Sahas Subramanian <[email protected]>
1 parent 830b53b commit bc18941

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

tests/timeseries/mock_microgrid.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,9 @@ def battery_msg(value: float) -> ComponentData:
151151
# for inverters with component_id > 100, send only half the messages.
152152
if request.id % 10 == cls.inverter_id_suffix:
153153
if request.id < 100 or value <= 5:
154-
yield next_msg(value=value + request.id)
154+
yield next_msg(value=value + int(request.id / 10))
155155
else:
156-
yield next_msg(value=value + request.id)
157-
156+
yield next_msg(value=value + int(request.id / 10))
158157
time.sleep(0.1)
159158

160159
mocker.patch.object(servicer, "GetComponentData", get_component_data)

0 commit comments

Comments
 (0)