Skip to content

Commit 1da3fe4

Browse files
committed
Update mock api to support inverter types
Signed-off-by: Sahas Subramanian <[email protected]>
1 parent 8dfd2ed commit 1da3fe4

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

tests/microgrid/mock_api.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from frequenz.api.microgrid.common_pb2 import AC, Metric, MetricAggregation
2121
from frequenz.api.microgrid.ev_charger_pb2 import EVCharger
2222
from frequenz.api.microgrid.inverter_pb2 import Inverter
23+
from frequenz.api.microgrid.inverter_pb2 import Type as InverterType
2324
from frequenz.api.microgrid.meter_pb2 import Data as MeterData
2425
from frequenz.api.microgrid.meter_pb2 import Meter
2526
from frequenz.api.microgrid.microgrid_pb2 import (
@@ -77,10 +78,22 @@ def __init__(
7778
self._latest_discharge: Optional[PowerLevelParam] = None
7879

7980
def add_component(
80-
self, component_id: int, component_category: ComponentCategory.V
81+
self,
82+
component_id: int,
83+
component_category: ComponentCategory.V,
84+
inverter_type: InverterType.V = InverterType.TYPE_UNSPECIFIED,
8185
) -> None:
8286
"""Add a component to the mock service."""
83-
self._components.append(Component(id=component_id, category=component_category))
87+
if component_category == ComponentCategory.COMPONENT_CATEGORY_INVERTER:
88+
self._components.append(
89+
Component(
90+
id=component_id, category=component_category, inverter=inverter_type
91+
)
92+
)
93+
else:
94+
self._components.append(
95+
Component(id=component_id, category=component_category)
96+
)
8497

8598
def add_connection(self, start: int, end: int) -> None:
8699
"""Add a connection to the mock service."""

0 commit comments

Comments
 (0)