frequenz-client-microgrid 0.5.1__tar.gz → 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/PKG-INFO +1 -1
- frequenz-client-microgrid-0.6.0/RELEASE_NOTES.md +17 -0
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/pyproject.toml +14 -12
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/src/frequenz/client/microgrid/__init__.py +2 -2
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/src/frequenz/client/microgrid/_client.py +116 -103
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/src/frequenz_client_microgrid.egg-info/PKG-INFO +1 -1
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/src/frequenz_client_microgrid.egg-info/requires.txt +14 -12
- frequenz-client-microgrid-0.5.1/RELEASE_NOTES.md +0 -5
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/LICENSE +0 -0
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/MANIFEST.in +0 -0
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/README.md +0 -0
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/setup.cfg +0 -0
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/src/frequenz/client/microgrid/_component.py +0 -0
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/src/frequenz/client/microgrid/_component_data.py +0 -0
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/src/frequenz/client/microgrid/_component_error.py +0 -0
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/src/frequenz/client/microgrid/_component_states.py +0 -0
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/src/frequenz/client/microgrid/_connection.py +0 -0
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/src/frequenz/client/microgrid/_constants.py +0 -0
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/src/frequenz/client/microgrid/_exception.py +0 -0
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/src/frequenz/client/microgrid/_metadata.py +0 -0
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/src/frequenz/client/microgrid/conftest.py +0 -0
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/src/frequenz/client/microgrid/py.typed +0 -0
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/src/frequenz_client_microgrid.egg-info/SOURCES.txt +0 -0
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/src/frequenz_client_microgrid.egg-info/dependency_links.txt +0 -0
- {frequenz-client-microgrid-0.5.1 → frequenz-client-microgrid-0.6.0}/src/frequenz_client_microgrid.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Frequenz Microgrid API Client Release Notes
|
|
2
|
+
|
|
3
|
+
## Upgrading
|
|
4
|
+
|
|
5
|
+
- `ApiClient`:
|
|
6
|
+
|
|
7
|
+
* The class was renamed to `MicrogridApiClient`.
|
|
8
|
+
* The `api` attribute was renamed to `stub`.
|
|
9
|
+
* The constructor parameter `channel_options` was renamed to `channels_defaults` to match the name used in `BaseApiClient`.
|
|
10
|
+
* The constructor now accepts a `connect` parameter, which is `True` by default. If set to `False`, the client will not connect to the server upon instantiation. You can connect later by calling the `connect()` method.
|
|
11
|
+
|
|
12
|
+
* The `frequenz-client-base` dependency was bumped to v0.8.0.
|
|
13
|
+
|
|
14
|
+
## New Features
|
|
15
|
+
|
|
16
|
+
- The client now inherits from `frequenz.client.base.BaseApiClient`, so it provides a few new features, like `disconnect()`ing or using it as a context manager. Please refer to the [`BaseApiClient` documentation](https://frequenz-floss.github.io/frequenz-client-base-python/latest/reference/frequenz/client/base/client/#frequenz.client.base.client.BaseApiClient) for more information on these features.
|
|
17
|
+
- The client now supports setting reactive power for components through the new `set_reactive_power` method.
|
|
@@ -38,7 +38,7 @@ requires-python = ">= 3.11, < 4"
|
|
|
38
38
|
dependencies = [
|
|
39
39
|
"frequenz-api-microgrid >= 0.15.3, < 0.16.0",
|
|
40
40
|
"frequenz-channels >= 1.0.0-rc1, < 2.0.0",
|
|
41
|
-
"frequenz-client-base >= 0.
|
|
41
|
+
"frequenz-client-base >= 0.8.0, < 0.9",
|
|
42
42
|
"grpcio >= 1.54.2, < 2",
|
|
43
43
|
"protobuf >= 4.21.6, < 6",
|
|
44
44
|
"timezonefinder >= 6.2.0, < 7",
|
|
@@ -55,36 +55,38 @@ dev-flake8 = [
|
|
|
55
55
|
"flake8 == 7.1.1",
|
|
56
56
|
"flake8-docstrings == 1.7.0",
|
|
57
57
|
"flake8-pyproject == 1.2.3", # For reading the flake8 config from pyproject.toml
|
|
58
|
-
"pydoclint == 0.5.
|
|
58
|
+
"pydoclint == 0.5.9",
|
|
59
59
|
"pydocstyle == 6.3.0",
|
|
60
60
|
]
|
|
61
|
-
dev-formatting = ["black == 24.
|
|
61
|
+
dev-formatting = ["black == 24.10.0", "isort == 5.13.2"]
|
|
62
62
|
dev-mkdocs = [
|
|
63
|
-
"black == 24.
|
|
63
|
+
"black == 24.10.0",
|
|
64
64
|
"Markdown==3.7",
|
|
65
65
|
"mike == 2.1.3",
|
|
66
66
|
"mkdocs-gen-files == 0.5.0",
|
|
67
67
|
"mkdocs-literate-nav == 0.6.1",
|
|
68
|
-
"mkdocs-macros-plugin == 1.
|
|
69
|
-
"mkdocs-material == 9.5.
|
|
70
|
-
"mkdocstrings[python] == 0.26.
|
|
71
|
-
"mkdocstrings-python == 1.
|
|
68
|
+
"mkdocs-macros-plugin == 1.3.7",
|
|
69
|
+
"mkdocs-material == 9.5.43",
|
|
70
|
+
"mkdocstrings[python] == 0.26.2",
|
|
71
|
+
"mkdocstrings-python == 1.12.2",
|
|
72
72
|
"frequenz-repo-config[lib] == 0.10.0",
|
|
73
73
|
]
|
|
74
74
|
dev-mypy = [
|
|
75
|
-
"mypy == 1.
|
|
75
|
+
"mypy == 1.13.0",
|
|
76
|
+
"grpc-stubs == 1.53.0.5",
|
|
76
77
|
"types-Markdown == 3.7.0.20240822",
|
|
78
|
+
"types-protobuf == 5.28.3.20241030",
|
|
77
79
|
# For checking the noxfile, docs/ script, and tests
|
|
78
80
|
"frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]",
|
|
79
81
|
]
|
|
80
|
-
dev-noxfile = ["nox == 2024.
|
|
82
|
+
dev-noxfile = ["nox == 2024.10.9", "frequenz-repo-config[lib] == 0.10.0"]
|
|
81
83
|
dev-pylint = [
|
|
82
|
-
"pylint == 3.
|
|
84
|
+
"pylint == 3.3.1",
|
|
83
85
|
# For checking the noxfile, docs/ script, and tests
|
|
84
86
|
"frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]",
|
|
85
87
|
]
|
|
86
88
|
dev-pytest = [
|
|
87
|
-
"pytest == 8.3.
|
|
89
|
+
"pytest == 8.3.3",
|
|
88
90
|
"frequenz-repo-config[extra-lint-examples] == 0.10.0",
|
|
89
91
|
"pytest-mock == 3.14.0",
|
|
90
92
|
"pytest-asyncio == 0.24.0",
|
|
@@ -7,7 +7,7 @@ This package provides a low-level interface for interacting with the microgrid A
|
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
from ._client import
|
|
10
|
+
from ._client import MicrogridApiClient
|
|
11
11
|
from ._component import (
|
|
12
12
|
Component,
|
|
13
13
|
ComponentCategory,
|
|
@@ -65,7 +65,7 @@ from ._exception import (
|
|
|
65
65
|
from ._metadata import Location, Metadata
|
|
66
66
|
|
|
67
67
|
__all__ = [
|
|
68
|
-
"
|
|
68
|
+
"MicrogridApiClient",
|
|
69
69
|
"ApiClientError",
|
|
70
70
|
"BatteryComponentState",
|
|
71
71
|
"BatteryData",
|
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
|
|
4
4
|
"""Client for requests to the Microgrid API."""
|
|
5
5
|
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
6
8
|
import asyncio
|
|
7
9
|
import logging
|
|
8
|
-
from collections.abc import
|
|
10
|
+
from collections.abc import Callable, Iterable, Set
|
|
9
11
|
from dataclasses import replace
|
|
10
|
-
from typing import Any, TypeVar
|
|
12
|
+
from typing import Any, TypeVar
|
|
11
13
|
|
|
12
|
-
import grpc.aio
|
|
13
14
|
from frequenz.api.common import components_pb2, metrics_pb2
|
|
14
15
|
from frequenz.api.microgrid import microgrid_pb2, microgrid_pb2_grpc
|
|
15
16
|
from frequenz.channels import Receiver
|
|
16
|
-
from frequenz.client.base import channel, retry, streaming
|
|
17
|
+
from frequenz.client.base import channel, client, retry, streaming
|
|
17
18
|
from google.protobuf.empty_pb2 import Empty
|
|
18
|
-
from google.protobuf.timestamp_pb2 import Timestamp
|
|
19
19
|
|
|
20
20
|
from ._component import (
|
|
21
21
|
Component,
|
|
@@ -33,7 +33,7 @@ from ._component_data import (
|
|
|
33
33
|
)
|
|
34
34
|
from ._connection import Connection
|
|
35
35
|
from ._constants import RECEIVER_MAX_SIZE
|
|
36
|
-
from ._exception import ApiClientError
|
|
36
|
+
from ._exception import ApiClientError, ClientNotConnected
|
|
37
37
|
from ._metadata import Location, Metadata
|
|
38
38
|
|
|
39
39
|
DEFAULT_GRPC_CALL_TIMEOUT = 60.0
|
|
@@ -55,14 +55,15 @@ microgrid API does not use SSL by default.
|
|
|
55
55
|
"""
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
class
|
|
58
|
+
class MicrogridApiClient(client.BaseApiClient[microgrid_pb2_grpc.MicrogridStub]):
|
|
59
59
|
"""A microgrid API client."""
|
|
60
60
|
|
|
61
61
|
def __init__(
|
|
62
62
|
self,
|
|
63
63
|
server_url: str,
|
|
64
64
|
*,
|
|
65
|
-
|
|
65
|
+
channel_defaults: channel.ChannelOptions = DEFAULT_CHANNEL_OPTIONS,
|
|
66
|
+
connect: bool = True,
|
|
66
67
|
retry_strategy: retry.Strategy | None = None,
|
|
67
68
|
) -> None:
|
|
68
69
|
"""Initialize the class instance.
|
|
@@ -74,29 +75,39 @@ class ApiClient:
|
|
|
74
75
|
where the `port` should be an int between 0 and 65535 (defaulting to
|
|
75
76
|
9090) and `ssl` should be a boolean (defaulting to `false`).
|
|
76
77
|
For example: `grpc://localhost:1090?ssl=true`.
|
|
77
|
-
|
|
78
|
+
channel_defaults: The default options use to create the channel when not
|
|
78
79
|
specified in the URL.
|
|
80
|
+
connect: Whether to connect to the server as soon as a client instance is
|
|
81
|
+
created. If `False`, the client will not connect to the server until
|
|
82
|
+
[connect()][frequenz.client.base.client.BaseApiClient.connect] is
|
|
83
|
+
called.
|
|
79
84
|
retry_strategy: The retry strategy to use to reconnect when the connection
|
|
80
85
|
to the streaming method is lost. By default a linear backoff strategy
|
|
81
86
|
is used.
|
|
82
87
|
"""
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
super().__init__(
|
|
89
|
+
server_url,
|
|
90
|
+
microgrid_pb2_grpc.MicrogridStub,
|
|
91
|
+
connect=connect,
|
|
92
|
+
channel_defaults=channel_defaults,
|
|
88
93
|
)
|
|
89
|
-
"""The gRPC stub for the microgrid API."""
|
|
90
|
-
|
|
91
94
|
self._broadcasters: dict[int, streaming.GrpcStreamBroadcaster[Any, Any]] = {}
|
|
92
95
|
self._retry_strategy = retry_strategy
|
|
93
96
|
|
|
94
97
|
@property
|
|
95
|
-
def
|
|
96
|
-
"""The
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
def stub(self) -> microgrid_pb2_grpc.MicrogridAsyncStub:
|
|
99
|
+
"""The gRPC stub for the API."""
|
|
100
|
+
if self.channel is None or self._stub is None:
|
|
101
|
+
raise ClientNotConnected(server_url=self.server_url, operation="stub")
|
|
102
|
+
# This type: ignore is needed because we need to cast the sync stub to
|
|
103
|
+
# the async stub, but we can't use cast because the async stub doesn't
|
|
104
|
+
# actually exists to the eyes of the interpreter, it only exists for the
|
|
105
|
+
# type-checker, so it can only be used for type hints.
|
|
106
|
+
return self._stub # type: ignore
|
|
107
|
+
|
|
108
|
+
async def components( # noqa: DOC502 (raises ApiClientError indirectly)
|
|
109
|
+
self,
|
|
110
|
+
) -> Iterable[Component]:
|
|
100
111
|
"""Fetch all the components present in the microgrid.
|
|
101
112
|
|
|
102
113
|
Returns:
|
|
@@ -107,22 +118,14 @@ class ApiClient:
|
|
|
107
118
|
most likely a subclass of
|
|
108
119
|
[GrpcError][frequenz.client.microgrid.GrpcError].
|
|
109
120
|
"""
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
),
|
|
119
|
-
)
|
|
120
|
-
except grpc.aio.AioRpcError as grpc_error:
|
|
121
|
-
raise ApiClientError.from_grpc_error(
|
|
122
|
-
server_url=self._server_url,
|
|
123
|
-
operation="ListComponents",
|
|
124
|
-
grpc_error=grpc_error,
|
|
125
|
-
) from grpc_error
|
|
121
|
+
component_list = await client.call_stub_method(
|
|
122
|
+
self,
|
|
123
|
+
lambda: self.stub.ListComponents(
|
|
124
|
+
microgrid_pb2.ComponentFilter(),
|
|
125
|
+
timeout=int(DEFAULT_GRPC_CALL_TIMEOUT),
|
|
126
|
+
),
|
|
127
|
+
method_name="ListComponents",
|
|
128
|
+
)
|
|
126
129
|
|
|
127
130
|
components_only = filter(
|
|
128
131
|
lambda c: c.category
|
|
@@ -152,14 +155,15 @@ class ApiClient:
|
|
|
152
155
|
"""
|
|
153
156
|
microgrid_metadata: microgrid_pb2.MicrogridMetadata | None = None
|
|
154
157
|
try:
|
|
155
|
-
microgrid_metadata = await
|
|
156
|
-
|
|
157
|
-
self.
|
|
158
|
+
microgrid_metadata = await client.call_stub_method(
|
|
159
|
+
self,
|
|
160
|
+
lambda: self.stub.GetMicrogridMetadata(
|
|
158
161
|
Empty(),
|
|
159
162
|
timeout=int(DEFAULT_GRPC_CALL_TIMEOUT),
|
|
160
163
|
),
|
|
164
|
+
method_name="GetMicrogridMetadata",
|
|
161
165
|
)
|
|
162
|
-
except
|
|
166
|
+
except ApiClientError:
|
|
163
167
|
_logger.exception("The microgrid metadata is not available.")
|
|
164
168
|
|
|
165
169
|
if not microgrid_metadata:
|
|
@@ -174,7 +178,7 @@ class ApiClient:
|
|
|
174
178
|
|
|
175
179
|
return Metadata(microgrid_id=microgrid_metadata.microgrid_id, location=location)
|
|
176
180
|
|
|
177
|
-
async def connections(
|
|
181
|
+
async def connections( # noqa: DOC502 (raises ApiClientError indirectly)
|
|
178
182
|
self,
|
|
179
183
|
starts: Set[int] = frozenset(),
|
|
180
184
|
ends: Set[int] = frozenset(),
|
|
@@ -196,25 +200,18 @@ class ApiClient:
|
|
|
196
200
|
[GrpcError][frequenz.client.microgrid.GrpcError].
|
|
197
201
|
"""
|
|
198
202
|
connection_filter = microgrid_pb2.ConnectionFilter(starts=starts, ends=ends)
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
self.api.ListConnections(
|
|
207
|
-
connection_filter,
|
|
208
|
-
timeout=int(DEFAULT_GRPC_CALL_TIMEOUT),
|
|
209
|
-
),
|
|
203
|
+
valid_components, all_connections = await asyncio.gather(
|
|
204
|
+
self.components(),
|
|
205
|
+
client.call_stub_method(
|
|
206
|
+
self,
|
|
207
|
+
lambda: self.stub.ListConnections(
|
|
208
|
+
connection_filter,
|
|
209
|
+
timeout=int(DEFAULT_GRPC_CALL_TIMEOUT),
|
|
210
210
|
),
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
operation="ListConnections",
|
|
216
|
-
grpc_error=grpc_error,
|
|
217
|
-
) from grpc_error
|
|
211
|
+
method_name="ListConnections",
|
|
212
|
+
),
|
|
213
|
+
)
|
|
214
|
+
|
|
218
215
|
# Filter out the components filtered in `components` method.
|
|
219
216
|
# id=0 is an exception indicating grid component.
|
|
220
217
|
valid_ids = {c.component_id for c in valid_components}
|
|
@@ -263,18 +260,16 @@ class ApiClient:
|
|
|
263
260
|
if broadcaster is None:
|
|
264
261
|
broadcaster = streaming.GrpcStreamBroadcaster(
|
|
265
262
|
f"raw-component-data-{component_id}",
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
# AsyncIterator, but it is a grpc.aio.UnaryStreamCall[...,
|
|
269
|
-
# microgrid_pb2.ComponentData], which it is.
|
|
270
|
-
lambda: cast(
|
|
271
|
-
AsyncIterator[microgrid_pb2.ComponentData],
|
|
272
|
-
self.api.StreamComponentData(
|
|
263
|
+
lambda: aiter(
|
|
264
|
+
self.stub.StreamComponentData(
|
|
273
265
|
microgrid_pb2.ComponentIdParam(id=component_id)
|
|
274
|
-
)
|
|
266
|
+
)
|
|
275
267
|
),
|
|
276
268
|
transform,
|
|
277
269
|
retry_strategy=self._retry_strategy,
|
|
270
|
+
# We don't expect any data stream to end, so if it is exhausted for any
|
|
271
|
+
# reason we want to keep retrying
|
|
272
|
+
retry_on_exhausted_stream=True,
|
|
278
273
|
)
|
|
279
274
|
self._broadcasters[component_id] = broadcaster
|
|
280
275
|
return broadcaster.new_receiver(maxsize=maxsize)
|
|
@@ -407,7 +402,9 @@ class ApiClient:
|
|
|
407
402
|
maxsize=maxsize,
|
|
408
403
|
)
|
|
409
404
|
|
|
410
|
-
async def set_power(
|
|
405
|
+
async def set_power( # noqa: DOC502 (raises ApiClientError indirectly)
|
|
406
|
+
self, component_id: int, power_w: float
|
|
407
|
+
) -> None:
|
|
411
408
|
"""Send request to the Microgrid to set power for component.
|
|
412
409
|
|
|
413
410
|
If power > 0, then component will be charged with this power.
|
|
@@ -424,24 +421,46 @@ class ApiClient:
|
|
|
424
421
|
most likely a subclass of
|
|
425
422
|
[GrpcError][frequenz.client.microgrid.GrpcError].
|
|
426
423
|
"""
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
component_id=component_id, power=power_w
|
|
433
|
-
),
|
|
434
|
-
timeout=int(DEFAULT_GRPC_CALL_TIMEOUT),
|
|
424
|
+
await client.call_stub_method(
|
|
425
|
+
self,
|
|
426
|
+
lambda: self.stub.SetPowerActive(
|
|
427
|
+
microgrid_pb2.SetPowerActiveParam(
|
|
428
|
+
component_id=component_id, power=power_w
|
|
435
429
|
),
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
430
|
+
timeout=int(DEFAULT_GRPC_CALL_TIMEOUT),
|
|
431
|
+
),
|
|
432
|
+
method_name="SetPowerActive",
|
|
433
|
+
)
|
|
434
|
+
|
|
435
|
+
async def set_reactive_power( # noqa: DOC502 (raises ApiClientError indirectly)
|
|
436
|
+
self, component_id: int, reactive_power_var: float
|
|
437
|
+
) -> None:
|
|
438
|
+
"""Send request to the Microgrid to set reactive power for component.
|
|
439
|
+
|
|
440
|
+
Negative values are for inductive (lagging) power , and positive values are for
|
|
441
|
+
capacitive (leading) power.
|
|
442
|
+
|
|
443
|
+
Args:
|
|
444
|
+
component_id: id of the component to set power.
|
|
445
|
+
reactive_power_var: reactive power to set for the component.
|
|
446
|
+
|
|
447
|
+
Raises:
|
|
448
|
+
ApiClientError: If the are any errors communicating with the Microgrid API,
|
|
449
|
+
most likely a subclass of
|
|
450
|
+
[GrpcError][frequenz.client.microgrid.GrpcError].
|
|
451
|
+
"""
|
|
452
|
+
await client.call_stub_method(
|
|
453
|
+
self,
|
|
454
|
+
lambda: self.stub.SetPowerReactive(
|
|
455
|
+
microgrid_pb2.SetPowerReactiveParam(
|
|
456
|
+
component_id=component_id, power=reactive_power_var
|
|
457
|
+
),
|
|
458
|
+
timeout=int(DEFAULT_GRPC_CALL_TIMEOUT),
|
|
459
|
+
),
|
|
460
|
+
method_name="SetPowerReactive",
|
|
461
|
+
)
|
|
462
|
+
|
|
463
|
+
async def set_bounds( # noqa: DOC503 (raises ApiClientError indirectly)
|
|
445
464
|
self,
|
|
446
465
|
component_id: int,
|
|
447
466
|
lower: float,
|
|
@@ -469,21 +488,15 @@ class ApiClient:
|
|
|
469
488
|
target_metric = (
|
|
470
489
|
microgrid_pb2.SetBoundsParam.TargetMetric.TARGET_METRIC_POWER_ACTIVE
|
|
471
490
|
)
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
bounds=metrics_pb2.Bounds(lower=lower, upper=upper),
|
|
480
|
-
),
|
|
481
|
-
timeout=int(DEFAULT_GRPC_CALL_TIMEOUT),
|
|
491
|
+
await client.call_stub_method(
|
|
492
|
+
self,
|
|
493
|
+
lambda: self.stub.AddInclusionBounds(
|
|
494
|
+
microgrid_pb2.SetBoundsParam(
|
|
495
|
+
component_id=component_id,
|
|
496
|
+
target_metric=target_metric,
|
|
497
|
+
bounds=metrics_pb2.Bounds(lower=lower, upper=upper),
|
|
482
498
|
),
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
operation="AddInclusionBounds",
|
|
488
|
-
grpc_error=grpc_error,
|
|
489
|
-
) from grpc_error
|
|
499
|
+
timeout=int(DEFAULT_GRPC_CALL_TIMEOUT),
|
|
500
|
+
),
|
|
501
|
+
method_name="AddInclusionBounds",
|
|
502
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
frequenz-api-microgrid<0.16.0,>=0.15.3
|
|
2
2
|
frequenz-channels<2.0.0,>=1.0.0-rc1
|
|
3
|
-
frequenz-client-base<0.
|
|
3
|
+
frequenz-client-base<0.9,>=0.8.0
|
|
4
4
|
grpcio<2,>=1.54.2
|
|
5
5
|
protobuf<6,>=4.21.6
|
|
6
6
|
timezonefinder<7,>=6.2.0
|
|
@@ -13,40 +13,42 @@ frequenz-client-microgrid[dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxf
|
|
|
13
13
|
flake8==7.1.1
|
|
14
14
|
flake8-docstrings==1.7.0
|
|
15
15
|
flake8-pyproject==1.2.3
|
|
16
|
-
pydoclint==0.5.
|
|
16
|
+
pydoclint==0.5.9
|
|
17
17
|
pydocstyle==6.3.0
|
|
18
18
|
|
|
19
19
|
[dev-formatting]
|
|
20
|
-
black==24.
|
|
20
|
+
black==24.10.0
|
|
21
21
|
isort==5.13.2
|
|
22
22
|
|
|
23
23
|
[dev-mkdocs]
|
|
24
|
-
black==24.
|
|
24
|
+
black==24.10.0
|
|
25
25
|
Markdown==3.7
|
|
26
26
|
mike==2.1.3
|
|
27
27
|
mkdocs-gen-files==0.5.0
|
|
28
28
|
mkdocs-literate-nav==0.6.1
|
|
29
|
-
mkdocs-macros-plugin==1.
|
|
30
|
-
mkdocs-material==9.5.
|
|
31
|
-
mkdocstrings[python]==0.26.
|
|
32
|
-
mkdocstrings-python==1.
|
|
29
|
+
mkdocs-macros-plugin==1.3.7
|
|
30
|
+
mkdocs-material==9.5.43
|
|
31
|
+
mkdocstrings[python]==0.26.2
|
|
32
|
+
mkdocstrings-python==1.12.2
|
|
33
33
|
frequenz-repo-config[lib]==0.10.0
|
|
34
34
|
|
|
35
35
|
[dev-mypy]
|
|
36
|
-
mypy==1.
|
|
36
|
+
mypy==1.13.0
|
|
37
|
+
grpc-stubs==1.53.0.5
|
|
37
38
|
types-Markdown==3.7.0.20240822
|
|
39
|
+
types-protobuf==5.28.3.20241030
|
|
38
40
|
frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]
|
|
39
41
|
|
|
40
42
|
[dev-noxfile]
|
|
41
|
-
nox==2024.
|
|
43
|
+
nox==2024.10.9
|
|
42
44
|
frequenz-repo-config[lib]==0.10.0
|
|
43
45
|
|
|
44
46
|
[dev-pylint]
|
|
45
|
-
pylint==3.
|
|
47
|
+
pylint==3.3.1
|
|
46
48
|
frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]
|
|
47
49
|
|
|
48
50
|
[dev-pytest]
|
|
49
|
-
pytest==8.3.
|
|
51
|
+
pytest==8.3.3
|
|
50
52
|
frequenz-repo-config[extra-lint-examples]==0.10.0
|
|
51
53
|
pytest-mock==3.14.0
|
|
52
54
|
pytest-asyncio==0.24.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|