Skip to content

Commit 8906df8

Browse files
committed
Add a new sample type for holding 3-phase logical meter outputs
Signed-off-by: Sahas Subramanian <[email protected]>
1 parent 1f18880 commit 8906df8

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

src/frequenz/sdk/timeseries/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
[`Sample`][frequenz.sdk.timeseries.Sample]s.
99
"""
1010

11-
from ._base_types import Sample
11+
from ._base_types import Sample, Sample3Phase
1212

13-
__all__ = [
14-
"Sample",
15-
]
13+
__all__ = ["Sample", "Sample3Phase"]

src/frequenz/sdk/timeseries/_base_types.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,25 @@ class Sample:
2626

2727
value: Optional[float] = field(compare=False, default=None)
2828
"""The value of this sample."""
29+
30+
31+
@dataclass(frozen=True)
32+
class Sample3Phase:
33+
"""A 3-phase measurement made at a particular point in time.
34+
35+
Each of the `value` fields could be `None` if a component is malfunctioning
36+
or data is lacking for another reason, but a sample still needs to be sent
37+
to have a coherent view on a group of component metrics for a particular
38+
timestamp.
39+
"""
40+
41+
timestamp: datetime
42+
"""The time when this sample was generated."""
43+
value_p1: Optional[float]
44+
"""The value of the 1st phase in this sample."""
45+
46+
value_p2: Optional[float]
47+
"""The value of the 2nd phase in this sample."""
48+
49+
value_p3: Optional[float]
50+
"""The value of the 3rd phase in this sample."""

0 commit comments

Comments
 (0)