Skip to content

Commit d2e7da7

Browse files
Add steam boiler (#102)
2 parents 6587b75 + 374548b commit d2e7da7

8 files changed

Lines changed: 82 additions & 2 deletions

File tree

RELEASE_NOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
## New Features
1212

13-
<!-- Here goes the main new features and examples or instructions on how to use them -->
13+
Added steam boiler component category.
1414

1515
## Bug Fixes
1616

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ requires-python = ">= 3.11, < 4"
3838
dependencies = [
3939
"typing-extensions >= 4.13.0, < 5",
4040
"frequenz-api-assets >= 0.1.0, < 0.2.0",
41-
"frequenz-api-common >= 0.8.0, < 1",
41+
"frequenz-api-common >= 0.8.2, < 1",
4242
"frequenz-client-base >= 0.11.0, < 0.12.0",
4343
"frequenz-client-common >= 0.3.6, < 0.4.0",
4444
"grpcio >= 1.73.1, < 2",

src/frequenz/client/assets/electrical_component/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
UnspecifiedComponent,
5151
)
5252
from ._static_transfer_switch import StaticTransferSwitch
53+
from ._steam_boiler import SteamBoiler
5354
from ._uninterruptible_power_supply import UninterruptiblePowerSupply
5455
from ._wind_turbine import WindTurbine
5556

@@ -91,6 +92,7 @@
9192
"MismatchedCategoryComponent",
9293
"UnrecognizedComponent",
9394
"UnspecifiedComponent",
95+
"SteamBoiler",
9496
"StaticTransferSwitch",
9597
"UninterruptiblePowerSupply",
9698
"WindTurbine",

src/frequenz/client/assets/electrical_component/_category.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,6 @@ class ElectricalComponentCategory(enum.Enum):
8686

8787
WIND_TURBINE = electrical_components_pb2.ELECTRICAL_COMPONENT_CATEGORY_WIND_TURBINE
8888
"""A wind turbine."""
89+
90+
STEAM_BOILER = electrical_components_pb2.ELECTRICAL_COMPONENT_CATEGORY_STEAM_BOILER
91+
"""A steam boiler."""

src/frequenz/client/assets/electrical_component/_electrical_component_proto.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
from ._precharger import Precharger
5858
from ._problematic import UnrecognizedComponent, UnspecifiedComponent
5959
from ._static_transfer_switch import StaticTransferSwitch
60+
from ._steam_boiler import SteamBoiler
6061
from ._types import ElectricalComponentType
6162
from ._uninterruptible_power_supply import UninterruptiblePowerSupply
6263
from ._wind_turbine import WindTurbine
@@ -219,6 +220,7 @@ def electrical_component_from_proto_with_issues(
219220
| ElectricalComponentCategory.PRECHARGER
220221
| ElectricalComponentCategory.BREAKER
221222
| ElectricalComponentCategory.PLC
223+
| ElectricalComponentCategory.STEAM_BOILER
222224
| ElectricalComponentCategory.STATIC_TRANSFER_SWITCH
223225
| ElectricalComponentCategory.UNINTERRUPTIBLE_POWER_SUPPLY
224226
| ElectricalComponentCategory.CAPACITOR_BANK
@@ -416,6 +418,7 @@ def _trivial_category_to_class(
416418
| Precharger
417419
| Breaker
418420
| Plc
421+
| SteamBoiler
419422
| StaticTransferSwitch
420423
| UninterruptiblePowerSupply
421424
| CapacitorBank
@@ -433,6 +436,7 @@ def _trivial_category_to_class(
433436
ElectricalComponentCategory.PRECHARGER: Precharger,
434437
ElectricalComponentCategory.BREAKER: Breaker,
435438
ElectricalComponentCategory.PLC: Plc,
439+
ElectricalComponentCategory.STEAM_BOILER: SteamBoiler,
436440
ElectricalComponentCategory.STATIC_TRANSFER_SWITCH: StaticTransferSwitch,
437441
ElectricalComponentCategory.UNINTERRUPTIBLE_POWER_SUPPLY: UninterruptiblePowerSupply,
438442
ElectricalComponentCategory.CAPACITOR_BANK: CapacitorBank,
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# License: MIT
2+
# Copyright © 2026 Frequenz Energy-as-a-Service GmbH
3+
4+
"""Steam boiler component."""
5+
6+
import dataclasses
7+
from typing import Literal
8+
9+
from ._category import ElectricalComponentCategory
10+
from ._electrical_component import ElectricalComponent
11+
12+
13+
@dataclasses.dataclass(frozen=True, kw_only=True)
14+
class SteamBoiler(ElectricalComponent):
15+
"""A steam boiler."""
16+
17+
category: Literal[ElectricalComponentCategory.STEAM_BOILER] = (
18+
ElectricalComponentCategory.STEAM_BOILER
19+
)
20+
"""The category of this component."""

src/frequenz/client/assets/electrical_component/_types.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
UnspecifiedComponent,
2727
)
2828
from ._static_transfer_switch import StaticTransferSwitch
29+
from ._steam_boiler import SteamBoiler
2930
from ._uninterruptible_power_supply import UninterruptiblePowerSupply
3031
from ._wind_turbine import WindTurbine
3132

@@ -60,6 +61,7 @@
6061
| Precharger
6162
| Breaker
6263
| Plc
64+
| SteamBoiler
6365
| StaticTransferSwitch
6466
| UninterruptiblePowerSupply
6567
| CapacitorBank
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# License: MIT
2+
# Copyright © 2026 Frequenz Energy-as-a-Service GmbH
3+
4+
"""Test data for successful electrical component listing."""
5+
6+
from typing import Any
7+
8+
from frequenz.api.assets.v1 import assets_pb2
9+
from frequenz.api.common.v1alpha8.microgrid.electrical_components import (
10+
electrical_components_pb2,
11+
)
12+
from frequenz.client.common.microgrid import MicrogridId
13+
from frequenz.client.common.microgrid.electrical_components import ElectricalComponentId
14+
15+
from frequenz.client.assets.electrical_component import SteamBoiler
16+
17+
18+
def assert_stub_method_call(stub_method: Any) -> None:
19+
"""Assert that the gRPC request matches the expected request."""
20+
stub_method.assert_called_once_with(
21+
assets_pb2.ListMicrogridElectricalComponentsRequest(microgrid_id=1234),
22+
timeout=60.0,
23+
)
24+
25+
26+
client_args = (1234,)
27+
grpc_response = assets_pb2.ListMicrogridElectricalComponentsResponse(
28+
components=[
29+
electrical_components_pb2.ElectricalComponent(
30+
id=1,
31+
microgrid_id=1234,
32+
category=electrical_components_pb2.ELECTRICAL_COMPONENT_CATEGORY_STEAM_BOILER,
33+
name="Steam Boiler",
34+
)
35+
]
36+
)
37+
38+
39+
def assert_client_result(result: Any) -> None:
40+
"""Assert that the client result matches the expected component list."""
41+
assert list(result) == [
42+
SteamBoiler(
43+
id=ElectricalComponentId(1),
44+
microgrid_id=MicrogridId(1234),
45+
name="Steam Boiler",
46+
manufacturer=None,
47+
model_name=None,
48+
)
49+
]

0 commit comments

Comments
 (0)