Skip to content

Commit 1418d7d

Browse files
Add no_meter params to add_chps in MockMicrogrid
Signed-off-by: Matthias Wende <[email protected]>
1 parent 3532396 commit 1418d7d

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

tests/timeseries/mock_microgrid.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def add_consumer_meters(self, count: int = 1) -> None:
249249
self._connections.add(Connection(self._connect_to, meter_id))
250250
self._start_meter_streaming(meter_id)
251251

252-
def add_chps(self, count: int) -> None:
252+
def add_chps(self, count: int, no_meters: bool = False) -> None:
253253
"""Add CHPs with connected meters to the mock microgrid.
254254
255255
Args:
@@ -263,12 +263,13 @@ def add_chps(self, count: int) -> None:
263263
self.meter_ids.append(meter_id)
264264
self.chp_ids.append(chp_id)
265265

266-
self._components.add(
267-
Component(
268-
meter_id,
269-
ComponentCategory.METER,
266+
if not no_meters:
267+
self._components.add(
268+
Component(
269+
meter_id,
270+
ComponentCategory.METER,
271+
)
270272
)
271-
)
272273
self._components.add(
273274
Component(
274275
chp_id,
@@ -277,8 +278,11 @@ def add_chps(self, count: int) -> None:
277278
)
278279

279280
self._start_meter_streaming(meter_id)
280-
self._connections.add(Connection(self._connect_to, meter_id))
281-
self._connections.add(Connection(meter_id, chp_id))
281+
if no_meters:
282+
self._connections.add(Connection(self._connect_to, chp_id))
283+
else:
284+
self._connections.add(Connection(self._connect_to, meter_id))
285+
self._connections.add(Connection(meter_id, chp_id))
282286

283287
def add_batteries(self, count: int, no_meter: bool = False) -> None:
284288
"""Add batteries with connected inverters and meters to the microgrid.

0 commit comments

Comments
 (0)