Skip to content

Commit 02be569

Browse files
committed
Add Metric enum
Signed-off-by: Leandro Lucarella <[email protected]>
1 parent e416a80 commit 02be569

File tree

2 files changed

+266
-0
lines changed

2 files changed

+266
-0
lines changed

src/frequenz/client/microgrid/metrics/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33

44
"""Metrics definitions."""
55

6+
from ._metric import Metric
67
from ._sample import AggregatedMetricValue, AggregationMethod
78

89
__all__ = [
910
"AggregatedMetricValue",
1011
"AggregationMethod",
12+
"Metric",
1113
]
Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
# License: MIT
2+
# Copyright © 2024 Frequenz Energy-as-a-Service GmbH
3+
4+
"""Supported metrics for microgrid components."""
5+
6+
7+
import enum
8+
9+
from frequenz.api.common.v1.metrics import metric_sample_pb2
10+
11+
12+
@enum.unique
13+
class Metric(enum.Enum):
14+
"""List of supported metrics.
15+
16+
Note: AC energy metrics information
17+
- This energy metric is reported directly from the component, and not a
18+
result of aggregations in our systems. If a component does not have this
19+
metric, this field cannot be populated.
20+
21+
- Components that provide energy metrics reset this metric from time to
22+
time. This behaviour is specific to each component model. E.g., some
23+
components reset it on UTC 00:00:00.
24+
25+
- This energy metric does not specify the start time of the accumulation
26+
period,and therefore can be inconsistent.
27+
"""
28+
29+
UNSPECIFIED = metric_sample_pb2.METRIC_UNSPECIFIED
30+
"""The metric is unspecified (this should not be used)."""
31+
32+
DC_VOLTAGE = metric_sample_pb2.METRIC_DC_VOLTAGE
33+
"""The direct current voltage."""
34+
35+
DC_CURRENT = metric_sample_pb2.METRIC_DC_CURRENT
36+
"""The direct current current."""
37+
38+
DC_POWER = metric_sample_pb2.METRIC_DC_POWER
39+
"""The direct current power."""
40+
41+
AC_FREQUENCY = metric_sample_pb2.METRIC_AC_FREQUENCY
42+
"""The alternating current frequency."""
43+
44+
AC_VOLTAGE = metric_sample_pb2.METRIC_AC_VOLTAGE
45+
"""The alternating current electric potential difference."""
46+
47+
AC_VOLTAGE_PHASE_1_N = metric_sample_pb2.METRIC_AC_VOLTAGE_PHASE_1_N
48+
"""The alternating current electric potential difference between phase 1 and neutral."""
49+
50+
AC_VOLTAGE_PHASE_2_N = metric_sample_pb2.METRIC_AC_VOLTAGE_PHASE_2_N
51+
"""The alternating current electric potential difference between phase 2 and neutral."""
52+
53+
AC_VOLTAGE_PHASE_3_N = metric_sample_pb2.METRIC_AC_VOLTAGE_PHASE_3_N
54+
"""The alternating current electric potential difference between phase 3 and neutral."""
55+
56+
AC_VOLTAGE_PHASE_1_PHASE_2 = metric_sample_pb2.METRIC_AC_VOLTAGE_PHASE_1_PHASE_2
57+
"""The alternating current electric potential difference between phase 1 and phase 2."""
58+
59+
AC_VOLTAGE_PHASE_2_PHASE_3 = metric_sample_pb2.METRIC_AC_VOLTAGE_PHASE_2_PHASE_3
60+
"""The alternating current electric potential difference between phase 2 and phase 3."""
61+
62+
AC_VOLTAGE_PHASE_3_PHASE_1 = metric_sample_pb2.METRIC_AC_VOLTAGE_PHASE_3_PHASE_1
63+
"""The alternating current electric potential difference between phase 3 and phase 1."""
64+
65+
AC_CURRENT = metric_sample_pb2.METRIC_AC_CURRENT
66+
"""The alternating current current."""
67+
68+
AC_CURRENT_PHASE_1 = metric_sample_pb2.METRIC_AC_CURRENT_PHASE_1
69+
"""The alternating current current in phase 1."""
70+
71+
AC_CURRENT_PHASE_2 = metric_sample_pb2.METRIC_AC_CURRENT_PHASE_2
72+
"""The alternating current current in phase 2."""
73+
74+
AC_CURRENT_PHASE_3 = metric_sample_pb2.METRIC_AC_CURRENT_PHASE_3
75+
"""The alternating current current in phase 3."""
76+
77+
AC_APPARENT_POWER = metric_sample_pb2.METRIC_AC_APPARENT_POWER
78+
"""The alternating current apparent power."""
79+
80+
AC_APPARENT_POWER_PHASE_1 = metric_sample_pb2.METRIC_AC_APPARENT_POWER_PHASE_1
81+
"""The alternating current apparent power in phase 1."""
82+
83+
AC_APPARENT_POWER_PHASE_2 = metric_sample_pb2.METRIC_AC_APPARENT_POWER_PHASE_2
84+
"""The alternating current apparent power in phase 2."""
85+
86+
AC_APPARENT_POWER_PHASE_3 = metric_sample_pb2.METRIC_AC_APPARENT_POWER_PHASE_3
87+
"""The alternating current apparent power in phase 3."""
88+
89+
AC_ACTIVE_POWER = metric_sample_pb2.METRIC_AC_ACTIVE_POWER
90+
"""The alternating current active power."""
91+
92+
AC_ACTIVE_POWER_PHASE_1 = metric_sample_pb2.METRIC_AC_ACTIVE_POWER_PHASE_1
93+
"""The alternating current active power in phase 1."""
94+
95+
AC_ACTIVE_POWER_PHASE_2 = metric_sample_pb2.METRIC_AC_ACTIVE_POWER_PHASE_2
96+
"""The alternating current active power in phase 2."""
97+
98+
AC_ACTIVE_POWER_PHASE_3 = metric_sample_pb2.METRIC_AC_ACTIVE_POWER_PHASE_3
99+
"""The alternating current active power in phase 3."""
100+
101+
AC_REACTIVE_POWER = metric_sample_pb2.METRIC_AC_REACTIVE_POWER
102+
"""The alternating current reactive power."""
103+
104+
AC_REACTIVE_POWER_PHASE_1 = metric_sample_pb2.METRIC_AC_REACTIVE_POWER_PHASE_1
105+
"""The alternating current reactive power in phase 1."""
106+
107+
AC_REACTIVE_POWER_PHASE_2 = metric_sample_pb2.METRIC_AC_REACTIVE_POWER_PHASE_2
108+
"""The alternating current reactive power in phase 2."""
109+
110+
AC_REACTIVE_POWER_PHASE_3 = metric_sample_pb2.METRIC_AC_REACTIVE_POWER_PHASE_3
111+
"""The alternating current reactive power in phase 3."""
112+
113+
AC_POWER_FACTOR = metric_sample_pb2.METRIC_AC_POWER_FACTOR
114+
"""The alternating current power factor."""
115+
116+
AC_POWER_FACTOR_PHASE_1 = metric_sample_pb2.METRIC_AC_POWER_FACTOR_PHASE_1
117+
"""The alternating current power factor in phase 1."""
118+
119+
AC_POWER_FACTOR_PHASE_2 = metric_sample_pb2.METRIC_AC_POWER_FACTOR_PHASE_2
120+
"""The alternating current power factor in phase 2."""
121+
122+
AC_POWER_FACTOR_PHASE_3 = metric_sample_pb2.METRIC_AC_POWER_FACTOR_PHASE_3
123+
"""The alternating current power factor in phase 3."""
124+
125+
AC_APPARENT_ENERGY = metric_sample_pb2.METRIC_AC_APPARENT_ENERGY
126+
"""The alternating current apparent energy."""
127+
128+
AC_APPARENT_ENERGY_PHASE_1 = metric_sample_pb2.METRIC_AC_APPARENT_ENERGY_PHASE_1
129+
"""The alternating current apparent energy in phase 1."""
130+
131+
AC_APPARENT_ENERGY_PHASE_2 = metric_sample_pb2.METRIC_AC_APPARENT_ENERGY_PHASE_2
132+
"""The alternating current apparent energy in phase 2."""
133+
134+
AC_APPARENT_ENERGY_PHASE_3 = metric_sample_pb2.METRIC_AC_APPARENT_ENERGY_PHASE_3
135+
"""The alternating current apparent energy in phase 3."""
136+
137+
AC_ACTIVE_ENERGY = metric_sample_pb2.METRIC_AC_ACTIVE_ENERGY
138+
"""The alternating current active energy."""
139+
140+
AC_ACTIVE_ENERGY_PHASE_1 = metric_sample_pb2.METRIC_AC_ACTIVE_ENERGY_PHASE_1
141+
"""The alternating current active energy in phase 1."""
142+
143+
AC_ACTIVE_ENERGY_PHASE_2 = metric_sample_pb2.METRIC_AC_ACTIVE_ENERGY_PHASE_2
144+
"""The alternating current active energy in phase 2."""
145+
146+
AC_ACTIVE_ENERGY_PHASE_3 = metric_sample_pb2.METRIC_AC_ACTIVE_ENERGY_PHASE_3
147+
"""The alternating current active energy in phase 3."""
148+
149+
AC_ACTIVE_ENERGY_CONSUMED = metric_sample_pb2.METRIC_AC_ACTIVE_ENERGY_CONSUMED
150+
"""The alternating current active energy consumed."""
151+
152+
AC_ACTIVE_ENERGY_CONSUMED_PHASE_1 = (
153+
metric_sample_pb2.METRIC_AC_ACTIVE_ENERGY_CONSUMED_PHASE_1
154+
)
155+
"""The alternating current active energy consumed in phase 1."""
156+
157+
AC_ACTIVE_ENERGY_CONSUMED_PHASE_2 = (
158+
metric_sample_pb2.METRIC_AC_ACTIVE_ENERGY_CONSUMED_PHASE_2
159+
)
160+
"""The alternating current active energy consumed in phase 2."""
161+
162+
AC_ACTIVE_ENERGY_CONSUMED_PHASE_3 = (
163+
metric_sample_pb2.METRIC_AC_ACTIVE_ENERGY_CONSUMED_PHASE_3
164+
)
165+
"""The alternating current active energy consumed in phase 3."""
166+
167+
AC_ACTIVE_ENERGY_DELIVERED = metric_sample_pb2.METRIC_AC_ACTIVE_ENERGY_DELIVERED
168+
"""The alternating current active energy delivered."""
169+
170+
AC_ACTIVE_ENERGY_DELIVERED_PHASE_1 = (
171+
metric_sample_pb2.METRIC_AC_ACTIVE_ENERGY_DELIVERED_PHASE_1
172+
)
173+
"""The alternating current active energy delivered in phase 1."""
174+
175+
AC_ACTIVE_ENERGY_DELIVERED_PHASE_2 = (
176+
metric_sample_pb2.METRIC_AC_ACTIVE_ENERGY_DELIVERED_PHASE_2
177+
)
178+
"""The alternating current active energy delivered in phase 2."""
179+
180+
AC_ACTIVE_ENERGY_DELIVERED_PHASE_3 = (
181+
metric_sample_pb2.METRIC_AC_ACTIVE_ENERGY_DELIVERED_PHASE_3
182+
)
183+
"""The alternating current active energy delivered in phase 3."""
184+
185+
AC_REACTIVE_ENERGY = metric_sample_pb2.METRIC_AC_REACTIVE_ENERGY
186+
"""The alternating current reactive energy."""
187+
188+
AC_REACTIVE_ENERGY_PHASE_1 = metric_sample_pb2.METRIC_AC_REACTIVE_ENERGY_PHASE_1
189+
"""The alternating current reactive energy in phase 1."""
190+
191+
AC_REACTIVE_ENERGY_PHASE_2 = metric_sample_pb2.METRIC_AC_REACTIVE_ENERGY_PHASE_2
192+
"""The alternating current reactive energy in phase 2."""
193+
194+
AC_REACTIVE_ENERGY_PHASE_3 = metric_sample_pb2.METRIC_AC_REACTIVE_ENERGY_PHASE_3
195+
"""The alternating current reactive energy in phase 3."""
196+
197+
AC_TOTAL_HARMONIC_DISTORTION_CURRENT = (
198+
metric_sample_pb2.METRIC_AC_TOTAL_HARMONIC_DISTORTION_CURRENT
199+
)
200+
"""The alternating current total harmonic distortion current."""
201+
202+
AC_TOTAL_HARMONIC_DISTORTION_CURRENT_PHASE_1 = (
203+
metric_sample_pb2.METRIC_AC_TOTAL_HARMONIC_DISTORTION_CURRENT_PHASE_1
204+
)
205+
"""The alternating current total harmonic distortion current in phase 1."""
206+
207+
AC_TOTAL_HARMONIC_DISTORTION_CURRENT_PHASE_2 = (
208+
metric_sample_pb2.METRIC_AC_TOTAL_HARMONIC_DISTORTION_CURRENT_PHASE_2
209+
)
210+
"""The alternating current total harmonic distortion current in phase 2."""
211+
212+
AC_TOTAL_HARMONIC_DISTORTION_CURRENT_PHASE_3 = (
213+
metric_sample_pb2.METRIC_AC_TOTAL_HARMONIC_DISTORTION_CURRENT_PHASE_3
214+
)
215+
"""The alternating current total harmonic distortion current in phase 3."""
216+
217+
BATTERY_CAPACITY = metric_sample_pb2.METRIC_BATTERY_CAPACITY
218+
"""The capacity of the battery."""
219+
220+
BATTERY_SOC_PCT = metric_sample_pb2.METRIC_BATTERY_SOC_PCT
221+
"""The state of charge of the battery as a percentage."""
222+
223+
BATTERY_TEMPERATURE = metric_sample_pb2.METRIC_BATTERY_TEMPERATURE
224+
"""The temperature of the battery."""
225+
226+
INVERTER_TEMPERATURE = metric_sample_pb2.METRIC_INVERTER_TEMPERATURE
227+
"""The temperature of the inverter."""
228+
229+
INVERTER_TEMPERATURE_CABINET = metric_sample_pb2.METRIC_INVERTER_TEMPERATURE_CABINET
230+
"""The temperature of the inverter cabinet."""
231+
232+
INVERTER_TEMPERATURE_HEATSINK = (
233+
metric_sample_pb2.METRIC_INVERTER_TEMPERATURE_HEATSINK
234+
)
235+
"""The temperature of the inverter heatsink."""
236+
237+
INVERTER_TEMPERATURE_TRANSFORMER = (
238+
metric_sample_pb2.METRIC_INVERTER_TEMPERATURE_TRANSFORMER
239+
)
240+
"""The temperature of the inverter transformer."""
241+
242+
EV_CHARGER_TEMPERATURE = metric_sample_pb2.METRIC_EV_CHARGER_TEMPERATURE
243+
"""The temperature of the EV charger."""
244+
245+
SENSOR_WIND_SPEED = metric_sample_pb2.METRIC_SENSOR_WIND_SPEED
246+
"""The speed of the wind measured."""
247+
248+
SENSOR_WIND_DIRECTION = metric_sample_pb2.METRIC_SENSOR_WIND_DIRECTION
249+
"""The direction of the wind measured."""
250+
251+
SENSOR_TEMPERATURE = metric_sample_pb2.METRIC_SENSOR_TEMPERATURE
252+
"""The temperature measured."""
253+
254+
SENSOR_RELATIVE_HUMIDITY = metric_sample_pb2.METRIC_SENSOR_RELATIVE_HUMIDITY
255+
"""The relative humidity measured."""
256+
257+
SENSOR_DEW_POINT = metric_sample_pb2.METRIC_SENSOR_DEW_POINT
258+
"""The dew point measured."""
259+
260+
SENSOR_AIR_PRESSURE = metric_sample_pb2.METRIC_SENSOR_AIR_PRESSURE
261+
"""The air pressure measured."""
262+
263+
SENSOR_IRRADIANCE = metric_sample_pb2.METRIC_SENSOR_IRRADIANCE
264+
"""The irradiance measured."""

0 commit comments

Comments
 (0)