Skip to content

Commit c9a075d

Browse files
Add enum ElectricalComponentControlMode (#307)
This enum is used to explicitly define whether an electrical component is intended to be active (enabled) or inactive (disabled). This intention directly determines the component's availability to downstream services and applications. Note that this enum differs from the `ElectricalComponentStatus` enum, which is used to report the actual operational state of the component. Thanks to @thomas-nicolai-frequenz for providing the original version.
2 parents 997959c + 49ac745 commit c9a075d

File tree

2 files changed

+52
-21
lines changed

2 files changed

+52
-21
lines changed

RELEASE_NOTES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## Upgrading
88

9-
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
9+
- The `ElectricalComponentStatus` enum has ben removed in favour of the `ElectricalComponentControlMode` enum.
1010

1111
## New Features
1212

@@ -24,6 +24,7 @@
2424
- Added new message definitions for streaming events (Deleted, Created, Updated)
2525
- Remove unnecessary gap in numbering in the `ElectricalComponentCategory` enum.
2626
- Renumber variants in the `Metric` enum to remove unnecessary gaps.
27+
- Added a new enum `ElectricalComponentControlMode` to define control modes for electrical components.
2728

2829
## Bug Fixes
2930

proto/frequenz/api/common/v1/microgrid/electrical_components/electrical_components.proto

Lines changed: 50 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,6 @@ enum ElectricalComponentCategory {
8787
ELECTRICAL_COMPONENT_CATEGORY_HVAC = 14;
8888
}
8989

90-
// ElectricalComponentStatus defines the possible statuses for a component.
91-
//
92-
// !!! note
93-
// The status indicates the status set by the user via the user interface.
94-
// The status is not yet included in the Component messages and should be
95-
// added.
96-
//
97-
enum ElectricalComponentStatus {
98-
// The status is unspecified. This should not be used.
99-
ELECTRICAL_COMPONENT_STATUS_UNSPECIFIED = 0;
100-
101-
// The component is active.
102-
ELECTRICAL_COMPONENT_STATUS_ACTIVE = 1;
103-
104-
// The component is inactive.
105-
ELECTRICAL_COMPONENT_STATUS_INACTIVE = 2;
106-
}
107-
10890
// Enum to represent the various states that a component can be in.
10991
// This enum is unified across all component categories for consistency.
11092
enum ElectricalComponentStateCode {
@@ -182,6 +164,54 @@ enum ElectricalComponentStateCode {
182164
ELECTRICAL_COMPONENT_STATE_CODE_PRECHARGER_CLOSED = 42;
183165
}
184166

167+
// `ElectricalComponentControlMode` explicitly defines whether an electrical
168+
// component is intended to be active (enabled) or inactive (disabled). This
169+
// intentional setting directly determines component availability to downstream
170+
// agents, applications, and services.
171+
//
172+
// !!! note "Control Mode & Component Availability"
173+
// The Control Mode explicitly represents the user's or automation's
174+
// intention to make the component either ACTIVE or INACTIVE. This directly
175+
// impacts availability:
176+
// - ACTIVE indicates the component is intended to be available and usable
177+
// by downstream agents and services.
178+
// - INACTIVE indicates the component is intended to be unavailable for use
179+
// by downstream agents and services.
180+
//
181+
// !!! note "Relationship with Operational State"
182+
// Control Mode explicitly represents intention, distinct from the
183+
// component's actual internal Operational State.
184+
// Operational State is independently reported by the component hardware
185+
// (e.g., READY, CHARGING, DISCHARGING, ERROR).
186+
//
187+
// !!! caution "Immediate Operational Impact"
188+
// Changing the Control Mode of an electrical component (e.g., via the
189+
// Microgrid API) takes immediate effect on its availability to downstream
190+
// agents and services. Setting a component to `INACTIVE` can thus instantly
191+
// interrupt ongoing operations or cause service disruptions. Setting a
192+
// component to `ACTIVE` may immediately connect it with other components,
193+
// potentially causing electrical damage. Therefore, ensure changes are
194+
// coordinated or planned appropriately to avoid unintended impact and/or
195+
// damages.
196+
//
197+
// !!! example "Control Mode Change Impact"
198+
// If a battery component's Control Mode is switched from `ACTIVE` to
199+
// `INACTIVE`, it immediately becomes unavailable to downstream
200+
// services and agents, potentially disrupting scheduled
201+
// charging/discharging cycles.
202+
enum ElectricalComponentControlMode {
203+
// The control mode is unspecified (should never be explicitly used).
204+
ELECTRICAL_COMPONENT_CONTROL_MODE_UNSPECIFIED = 0;
205+
206+
// The component is explicitly enabled and intended to be available for
207+
// downstream usage.
208+
ELECTRICAL_COMPONENT_CONTROL_MODE_ACTIVE = 1;
209+
210+
// The component is explicitly disabled and intended to be unavailable for
211+
// downstream usage.
212+
ELECTRICAL_COMPONENT_CONTROL_MODE_INACTIVE = 2;
213+
}
214+
185215
// A representation of all possible diagnostic codes that can occur for
186216
// electrical component, across all their categories. These diagnostic codes
187217
// can be used to refer to warnings or errors that are reported by the
@@ -357,8 +387,8 @@ message ElectricalComponent {
357387
// The model name of the component.
358388
string model_name = 7;
359389

360-
// The status of the component.
361-
ElectricalComponentStatus status = 8;
390+
// The control mode of the component.
391+
ElectricalComponentControlMode control_mode = 8;
362392

363393
// The operational lifetime of the component.
364394
frequenz.api.common.v1.microgrid.Lifetime operational_lifetime = 9;

0 commit comments

Comments
 (0)