Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- Here goes a general summary of what this release is about -->

## Upgrading

* Microgrid_config is updated from AC_ACTIVE_POWER to AC_POWER_ACTIVE in accordance with the update in client-reporting - v0.20.0
Comment thread
Mohammad-Tayyab-Frequenz marked this conversation as resolved.
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->

## New Features
Expand Down
4 changes: 2 additions & 2 deletions src/frequenz/gridpool/_microgrid_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class ComponentTypeConfig:
def __post_init__(self) -> None:
"""Set the default formula if none is provided."""
self.formula = self.formula or {}
if "AC_ACTIVE_POWER" not in self.formula:
self.formula["AC_ACTIVE_POWER"] = "+".join(
if "AC_POWER_ACTIVE" not in self.formula:
self.formula["AC_POWER_ACTIVE"] = "+".join(
[f"#{cid}" for cid in self._default_cids()]
)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"1": {
"meta": {"name": "Test Grid", "gid": 1, "microgrid_id": 1},
"ctype": {
"pv": {"meter": [101, 102], "formula": {"AC_ACTIVE_POWER": "#12+#23"}},
"pv": {"meter": [101, 102], "formula": {"AC_POWER_ACTIVE": "#12+#23"}},
"battery": {
"inverter": [201, 202, 203],
"component": [301, 302, 303, 304, 305, 306],
Expand Down Expand Up @@ -104,7 +104,7 @@ def test_microgrid_config_component_type_ids(

def test_microgrid_config_formula(valid_microgrid_config: MicrogridConfig) -> None:
"""Test retrieval of formula for a given component type and metric."""
assert valid_microgrid_config.formula("pv", "AC_ACTIVE_POWER") == "#12+#23"
assert valid_microgrid_config.formula("pv", "AC_POWER_ACTIVE") == "#12+#23"

with pytest.raises(ValueError):
valid_microgrid_config.formula("pv", "INVALID_METRIC")
Expand Down