|
2 | 2 | # Copyright © 2022 Frequenz Energy-as-a-Service GmbH |
3 | 3 | """Definition of the user request.""" |
4 | 4 |
|
5 | | -from dataclasses import dataclass |
6 | | -from typing import Set |
| 5 | +from __future__ import annotations |
7 | 6 |
|
| 7 | +import dataclasses |
8 | 8 |
|
9 | | -@dataclass |
| 9 | + |
| 10 | +@dataclasses.dataclass |
10 | 11 | class Request: |
11 | | - """Request from the user.""" |
| 12 | + """Request to set power to the `PowerDistributingActor`.""" |
12 | 13 |
|
13 | | - # How much power to set |
14 | 14 | power: int |
15 | | - # In which batteries the power should be set |
16 | | - batteries: Set[int] |
17 | | - # Timeout for the server to respond on the requests. |
| 15 | + """The amount of power to be set.""" |
| 16 | + |
| 17 | + batteries: set[int] |
| 18 | + """The set of batteries to use when requesting the power to be set.""" |
| 19 | + |
18 | 20 | request_timeout_sec: float = 5.0 |
19 | | - # If True and requested power value is above upper bound, then the power will be |
20 | | - # decreased to match the bounds. Only the decreased power will be set. |
21 | | - # If False and the requested power is above upper bound, then request won't |
22 | | - # be processed. result.OutOfBound message will be send back to the user. |
| 21 | + """The maximum amount of time to wait for the request to be fulfilled.""" |
| 22 | + |
23 | 23 | adjust_power: bool = True |
| 24 | + """Whether to adjust the power to match the bounds. |
| 25 | +
|
| 26 | + If `True`, the power will be adjusted (lowered) to match the bounds, so |
| 27 | + only the decreased power will be set. |
| 28 | +
|
| 29 | + If `False` and the power is outside the batteries' bounds, the request will |
| 30 | + fail and replied to with an `OutOfBound` result. |
| 31 | + """ |
0 commit comments