Skip to content

Commit daadcee

Browse files
Expose additional fields from ComponentData streams (#75)
This PR exposes the following fields: - `frequency` from `MeterData` objects - `temperature_max` from `BatteryData` objects This PR also temporarily switches to an older version of the channels library.
2 parents 2f34f71 + ef4ef07 commit daadcee

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

RELEASE_NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ time.
2323

2424
<!-- Here goes the main new features and examples or instructions on how to use them -->
2525

26+
* `MeterData` objects now expose the AC `frequency` measured by the meter.
27+
* `BatteryData` objects now expose the temperature of the hottest block in the
28+
battery as `temperature_max`
29+
2630
## Bug Fixes
2731

2832
<!-- Here goes notable bug fixes that are worth a special mention or explanation -->

src/frequenz/sdk/microgrid/component_data.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,13 @@ class MeterData(ComponentData):
7171
-ve current means supply into the grid.
7272
voltage_per_phase: the AC voltage in Volts (V) between the line and the neutral
7373
wire for phase/line 1,2 and 3 respectively.
74+
frequency: the AC power frequency in Hertz (Hz).
7475
"""
7576

7677
active_power: float
7778
current_per_phase: Tuple[float, float, float]
7879
voltage_per_phase: Tuple[float, float, float]
80+
frequency: float
7981

8082
@classmethod
8183
def from_proto(cls, raw: microgrid_pb.ComponentData) -> MeterData:
@@ -101,6 +103,7 @@ def from_proto(cls, raw: microgrid_pb.ComponentData) -> MeterData:
101103
raw.meter.data.ac.phase_2.voltage.value,
102104
raw.meter.data.ac.phase_3.voltage.value,
103105
),
106+
frequency=raw.meter.data.ac.frequency.value,
104107
)
105108
meter_data._set_raw(raw=raw)
106109
return meter_data
@@ -123,6 +126,8 @@ class BatteryData(ComponentData):
123126
power_upper_bound: the maximum charge power, in Watts, represented in the
124127
passive sign convention. This will be a positive number, or zero if no
125128
charging is possible.
129+
temperature_max: the maximum temperature of all the blocks in a battery, in
130+
Celcius (°C).
126131
"""
127132

128133
soc: float
@@ -131,6 +136,7 @@ class BatteryData(ComponentData):
131136
capacity: float
132137
power_lower_bound: float
133138
power_upper_bound: float
139+
temperature_max: float
134140

135141
@classmethod
136142
def from_proto(cls, raw: microgrid_pb.ComponentData) -> BatteryData:
@@ -151,6 +157,7 @@ def from_proto(cls, raw: microgrid_pb.ComponentData) -> BatteryData:
151157
capacity=raw.battery.properties.capacity,
152158
power_lower_bound=raw.battery.data.dc.power.system_bounds.lower,
153159
power_upper_bound=raw.battery.data.dc.power.system_bounds.upper,
160+
temperature_max=raw.battery.data.temperature.max,
154161
)
155162
battery_data._set_raw(raw=raw)
156163
return battery_data

0 commit comments

Comments
 (0)