Skip to content

Commit 40c6432

Browse files
Add active power metrics to data sourcing
Signed-off-by: Daniel Zullo <[email protected]>
1 parent ea0f330 commit 40c6432

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/frequenz/sdk/actor/_data_sourcing/microgrid_api_source.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828

2929
_MeterDataMethods: dict[ComponentMetricId, Callable[[MeterData], float]] = {
3030
ComponentMetricId.ACTIVE_POWER: lambda msg: msg.active_power,
31+
ComponentMetricId.ACTIVE_POWER_PHASE_1: lambda msg: msg.active_power_per_phase[0],
32+
ComponentMetricId.ACTIVE_POWER_PHASE_2: lambda msg: msg.active_power_per_phase[1],
33+
ComponentMetricId.ACTIVE_POWER_PHASE_3: lambda msg: msg.active_power_per_phase[2],
3134
ComponentMetricId.CURRENT_PHASE_1: lambda msg: msg.current_per_phase[0],
3235
ComponentMetricId.CURRENT_PHASE_2: lambda msg: msg.current_per_phase[1],
3336
ComponentMetricId.CURRENT_PHASE_3: lambda msg: msg.current_per_phase[2],
@@ -59,6 +62,9 @@
5962

6063
_InverterDataMethods: dict[ComponentMetricId, Callable[[InverterData], float]] = {
6164
ComponentMetricId.ACTIVE_POWER: lambda msg: msg.active_power,
65+
ComponentMetricId.ACTIVE_POWER_PHASE_1: lambda msg: msg.active_power_per_phase[0],
66+
ComponentMetricId.ACTIVE_POWER_PHASE_2: lambda msg: msg.active_power_per_phase[1],
67+
ComponentMetricId.ACTIVE_POWER_PHASE_3: lambda msg: msg.active_power_per_phase[2],
6268
ComponentMetricId.ACTIVE_POWER_INCLUSION_LOWER_BOUND: lambda msg: (
6369
msg.active_power_inclusion_lower_bound
6470
),
@@ -82,6 +88,9 @@
8288

8389
_EVChargerDataMethods: dict[ComponentMetricId, Callable[[EVChargerData], float]] = {
8490
ComponentMetricId.ACTIVE_POWER: lambda msg: msg.active_power,
91+
ComponentMetricId.ACTIVE_POWER_PHASE_1: lambda msg: msg.active_power_per_phase[0],
92+
ComponentMetricId.ACTIVE_POWER_PHASE_2: lambda msg: msg.active_power_per_phase[1],
93+
ComponentMetricId.ACTIVE_POWER_PHASE_3: lambda msg: msg.active_power_per_phase[2],
8594
ComponentMetricId.CURRENT_PHASE_1: lambda msg: msg.current_per_phase[0],
8695
ComponentMetricId.CURRENT_PHASE_2: lambda msg: msg.current_per_phase[1],
8796
ComponentMetricId.CURRENT_PHASE_3: lambda msg: msg.current_per_phase[2],

0 commit comments

Comments
 (0)