From 8f49f21bffd016fb5b5b05ff2b25bf6433f08b2e Mon Sep 17 00:00:00 2001 From: Tar Viturawong Date: Thu, 27 Mar 2025 11:09:04 -0400 Subject: [PATCH 1/5] Add protobuf definition for communication components Signed-off-by: Tar Viturawong --- .../communication_components.proto | 71 +++++++++++++++++++ pytests/test_common.py | 8 +++ 2 files changed, 79 insertions(+) create mode 100644 proto/frequenz/api/common/v1/microgrid/communication_components/communication_components.proto diff --git a/proto/frequenz/api/common/v1/microgrid/communication_components/communication_components.proto b/proto/frequenz/api/common/v1/microgrid/communication_components/communication_components.proto new file mode 100644 index 00000000..67956ddc --- /dev/null +++ b/proto/frequenz/api/common/v1/microgrid/communication_components/communication_components.proto @@ -0,0 +1,71 @@ +// Frequenz microgrid communication components definitions. +// +// Copyright: +// Copyright 2023 Frequenz Energy-as-a-Service GmbH +// +// License: +// MIT + +syntax = "proto3"; + +package frequenz.api.common.v1.microgrid.communication_components; + + +// CommunicationComponent represents a communication component within a +// microgrid. +// +// Communication components are networked devices responsible for enabling +// communication between electrical components, sensors, controllers, and other +// networked equipment. +message CommunicationComponent { + // Unique identifier of the communication component. + uint64 id = 1; + + // Unique identifier of the parent microgrid. + uint64 microgrid_id = 2; + + // Human-readable name of the communication component. + string name = 3; + + // Category identifying the type of the communication component. + CommunicationComponentCategory category = 4; + + // List of IP addresses assigned to this communication component. + repeated string ip_addresses = 5; +} + +// CommunicationComponentCategory enumerates possible types of communication +// components within the microgrid. +// +// Categories help distinguish communication devices according to their roles, +// capabilities, and protocols they handle within the microgrid infrastructure. +enum CommunicationComponentCategory { + // Unspecified communication component category. + // + // !!! caution + // This default value should never be used explicitly and indicates that + // the category has not been properly defined. + COMMUNICATION_COMPONENT_CATEGORY_UNSPECIFIED = 0; + + // Modbus Gateway used for protocol translation and managing Modbus + // communication. + COMMUNICATION_COMPONENT_CATEGORY_MODBUS_GATEWAY = 1; + + // LTE Router providing cellular connectivity (LTE, 4G, 5G) for the microgrid. + COMMUNICATION_COMPONENT_CATEGORY_ROUTER = 2; + + // Ethernet Switch enabling wired network connections within the microgrid. + COMMUNICATION_COMPONENT_CATEGORY_ETHERNET_SWITCH = 3; + + // Digital Input/Output (DIO) Gateway enabling communication and control + // of digital signals between microgrid devices. + COMMUNICATION_COMPONENT_CATEGORY_DIO_GATEWAY = 4; + + // Programmable Logic Controller (PLC) used for automation tasks, + // process control, and operational logic in the microgrid. + COMMUNICATION_COMPONENT_CATEGORY_PLC = 5; + + // Serial Gateway (RS-232, RS-485, etc.) facilitating serial communication + // between legacy equipment and modern network infrastructures. + COMMUNICATION_COMPONENT_CATEGORY_SERIAL_GATEWAY = 6; +} diff --git a/pytests/test_common.py b/pytests/test_common.py index 5e6d0258..6f2d84b8 100644 --- a/pytests/test_common.py +++ b/pytests/test_common.py @@ -181,6 +181,14 @@ def test_module_import_microgrid_components() -> None: assert transformer_pb2_grpc is not None +def test_module_import_microgrid_communication_components() -> None: + """Test that the modules can be imported.""" + # pylint: disable=import-outside-toplevel + from frequenz.api.common.v1.microgrid import communication_components + + assert communication_components is not None + + def test_module_import_location() -> None: """Test that the modules can be imported.""" # pylint: disable=import-outside-toplevel From 5829065c49c825734146cb572547d94da09d8b8d Mon Sep 17 00:00:00 2001 From: Tar Viturawong Date: Mon, 31 Mar 2025 08:38:09 -0400 Subject: [PATCH 2/5] Update RELEASE_NOTES.md Signed-off-by: Tar Viturawong --- RELEASE_NOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 56ab6759..23ab7ac1 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -11,6 +11,7 @@ ## New Features - Added message linking microgrid and sensor IDs. +- Added new message definitions for communication components. ## Bug Fixes From a1c65cc8502fb98b8f7fb0ed1e87b330b603516d Mon Sep 17 00:00:00 2001 From: Tar Viturawong Date: Mon, 31 Mar 2025 10:20:05 -0400 Subject: [PATCH 3/5] Update documentation on review Signed-off-by: Tar Viturawong --- .../communication_components.proto | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/proto/frequenz/api/common/v1/microgrid/communication_components/communication_components.proto b/proto/frequenz/api/common/v1/microgrid/communication_components/communication_components.proto index 67956ddc..b1e6aea1 100644 --- a/proto/frequenz/api/common/v1/microgrid/communication_components/communication_components.proto +++ b/proto/frequenz/api/common/v1/microgrid/communication_components/communication_components.proto @@ -1,7 +1,7 @@ // Frequenz microgrid communication components definitions. // // Copyright: -// Copyright 2023 Frequenz Energy-as-a-Service GmbH +// Copyright 2025 Frequenz Energy-as-a-Service GmbH // // License: // MIT @@ -11,12 +11,12 @@ syntax = "proto3"; package frequenz.api.common.v1.microgrid.communication_components; -// CommunicationComponent represents a communication component within a +// `CommunicationComponent` represents a communication component within a // microgrid. // // Communication components are networked devices responsible for enabling // communication between electrical components, sensors, controllers, and other -// networked equipment. +// network devices. message CommunicationComponent { // Unique identifier of the communication component. uint64 id = 1; @@ -34,7 +34,7 @@ message CommunicationComponent { repeated string ip_addresses = 5; } -// CommunicationComponentCategory enumerates possible types of communication +// `CommunicationComponentCategory` enumerates possible types of communication // components within the microgrid. // // Categories help distinguish communication devices according to their roles, From 9ee3a11bb3c0551fcb8f9c7f16b1a142a2c7d909 Mon Sep 17 00:00:00 2001 From: Tar Viturawong Date: Tue, 1 Apr 2025 07:54:12 -0400 Subject: [PATCH 4/5] Add communication_components py module Signed-off-by: Tar Viturawong --- .../api/common/v1/microgrid/communication_components/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 py/frequenz/api/common/v1/microgrid/communication_components/__init__.py diff --git a/py/frequenz/api/common/v1/microgrid/communication_components/__init__.py b/py/frequenz/api/common/v1/microgrid/communication_components/__init__.py new file mode 100644 index 00000000..e69de29b From 167052f4c90cf3a8e381e8b23e796f4bae2064c9 Mon Sep 17 00:00:00 2001 From: Tar Viturawong Date: Tue, 1 Apr 2025 08:13:38 -0400 Subject: [PATCH 5/5] add import tests for communication_components_pb2/grpc Signed-off-by: Tar Viturawong --- pytests/test_common.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pytests/test_common.py b/pytests/test_common.py index 6f2d84b8..18b09123 100644 --- a/pytests/test_common.py +++ b/pytests/test_common.py @@ -188,6 +188,18 @@ def test_module_import_microgrid_communication_components() -> None: assert communication_components is not None + from frequenz.api.common.v1.microgrid.communication_components import ( + communication_components_pb2, + ) + + assert communication_components_pb2 is not None + + from frequenz.api.common.v1.microgrid.communication_components import ( + communication_components_pb2_grpc, + ) + + assert communication_components_pb2_grpc is not None + def test_module_import_location() -> None: """Test that the modules can be imported."""