Skip to content

Commit 31e2f58

Browse files
committed
DataSourcingActor: Add frequency support
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 5e10562 commit 31e2f58

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def get_channel_name(self) -> str:
7575
ComponentMetricId.VOLTAGE_PHASE_1: lambda msg: msg.voltage_per_phase[0],
7676
ComponentMetricId.VOLTAGE_PHASE_2: lambda msg: msg.voltage_per_phase[1],
7777
ComponentMetricId.VOLTAGE_PHASE_3: lambda msg: msg.voltage_per_phase[2],
78+
ComponentMetricId.FREQUENCY: lambda msg: msg.frequency,
7879
}
7980

8081
_BatteryDataMethods: Dict[ComponentMetricId, Callable[[BatteryData], float]] = {
@@ -111,6 +112,7 @@ def get_channel_name(self) -> str:
111112
ComponentMetricId.ACTIVE_POWER_INCLUSION_UPPER_BOUND: lambda msg: (
112113
msg.active_power_inclusion_upper_bound
113114
),
115+
ComponentMetricId.FREQUENCY: lambda msg: msg.frequency,
114116
}
115117

116118
_EVChargerDataMethods: Dict[ComponentMetricId, Callable[[EVChargerData], float]] = {
@@ -121,6 +123,7 @@ def get_channel_name(self) -> str:
121123
ComponentMetricId.VOLTAGE_PHASE_1: lambda msg: msg.voltage_per_phase[0],
122124
ComponentMetricId.VOLTAGE_PHASE_2: lambda msg: msg.voltage_per_phase[1],
123125
ComponentMetricId.VOLTAGE_PHASE_3: lambda msg: msg.voltage_per_phase[2],
126+
ComponentMetricId.FREQUENCY: lambda msg: msg.frequency,
124127
}
125128

126129

src/frequenz/sdk/microgrid/component/_component.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ class ComponentMetricId(Enum):
176176
VOLTAGE_PHASE_2 = "voltage_phase_2"
177177
VOLTAGE_PHASE_3 = "voltage_phase_3"
178178

179+
FREQUENCY = "frequency"
180+
179181
SOC = "soc"
180182
SOC_LOWER_BOUND = "soc_lower_bound"
181183
SOC_UPPER_BOUND = "soc_upper_bound"

0 commit comments

Comments
 (0)