Skip to content

electrical_components

frequenz.client.common.v1alpha8.microgrid.electrical_components ¤

Defines the electrical components that can be used in a microgrid.

Classes¤

frequenz.client.common.v1alpha8.microgrid.electrical_components.ElectricalComponentCategory ¤

Bases: Enum

Possible types of microgrid electrical component.

Source code in frequenz/client/common/v1alpha8/microgrid/electrical_components/__init__.py
@enum.unique
class ElectricalComponentCategory(enum.Enum):
    """Possible types of microgrid electrical component."""

    UNSPECIFIED = (
        PBElectricalComponentCategory.ELECTRICAL_COMPONENT_CATEGORY_UNSPECIFIED
    )
    """An unknown component category.

    Useful for error handling, and marking unknown components in
    a list of components with otherwise known categories.
    """

    GRID_CONNECTION_POINT = (
        PBElectricalComponentCategory.ELECTRICAL_COMPONENT_CATEGORY_GRID_CONNECTION_POINT
    )
    """The point where the local microgrid is connected to the grid."""

    METER = PBElectricalComponentCategory.ELECTRICAL_COMPONENT_CATEGORY_METER
    """A meter, for measuring electrical metrics, e.g., current, voltage, etc."""

    INVERTER = PBElectricalComponentCategory.ELECTRICAL_COMPONENT_CATEGORY_INVERTER
    """An electricity generator, with batteries or solar energy."""

    CONVERTER = PBElectricalComponentCategory.ELECTRICAL_COMPONENT_CATEGORY_CONVERTER
    """An electricity converter, e.g., a DC-DC converter."""

    BATTERY = PBElectricalComponentCategory.ELECTRICAL_COMPONENT_CATEGORY_BATTERY
    """A storage system for electrical energy, used by inverters."""

    EV_CHARGER = PBElectricalComponentCategory.ELECTRICAL_COMPONENT_CATEGORY_EV_CHARGER
    """A station for charging electrical vehicles."""

    CRYPTO_MINER = (
        PBElectricalComponentCategory.ELECTRICAL_COMPONENT_CATEGORY_CRYPTO_MINER
    )
    """A device for mining cryptocurrencies."""

    ELECTROLYZER = (
        PBElectricalComponentCategory.ELECTRICAL_COMPONENT_CATEGORY_ELECTROLYZER
    )
    """A device for splitting water into hydrogen and oxygen using electricity."""

    CHP = PBElectricalComponentCategory.ELECTRICAL_COMPONENT_CATEGORY_CHP
    """A heat and power combustion plant (CHP stands for combined heat and power)."""

    BREAKER = PBElectricalComponentCategory.ELECTRICAL_COMPONENT_CATEGORY_BREAKER
    """A relay, used for switching electrical circuits on and off."""

    PRECHARGER = PBElectricalComponentCategory.ELECTRICAL_COMPONENT_CATEGORY_PRECHARGER
    """A precharger, used for preparing electrical circuits for switching on."""

    POWER_TRANSFORMER = (
        PBElectricalComponentCategory.ELECTRICAL_COMPONENT_CATEGORY_POWER_TRANSFORMER
    )
    """A transformer, used for changing the voltage of electrical circuits."""

    HVAC = PBElectricalComponentCategory.ELECTRICAL_COMPONENT_CATEGORY_HVAC
    """A heating, ventilation, and air conditioning (HVAC) system."""

    @classmethod
    @deprecated("Use `frequenz.client.common.enum_proto.enum_from_proto` instead.")
    def from_proto(
        cls, component_category: PBElectricalComponentCategory.ValueType
    ) -> ElectricalComponentCategory:
        """Convert a protobuf ElectricalComponentCategory message to enum.

        Args:
            component_category: protobuf enum to convert

        Returns:
            Enum value corresponding to the protobuf message.
        """
        if not any(t.value == component_category for t in ElectricalComponentCategory):
            return ElectricalComponentCategory.UNSPECIFIED
        return cls(component_category)

    def to_proto(self) -> PBElectricalComponentCategory.ValueType:
        """Convert a ElectricalComponentCategory enum to protobuf message.

        Returns:
            Enum value corresponding to the protobuf message.
        """
        return self.value
Attributes¤
BATTERY class-attribute instance-attribute ¤
BATTERY = ELECTRICAL_COMPONENT_CATEGORY_BATTERY

A storage system for electrical energy, used by inverters.

BREAKER class-attribute instance-attribute ¤
BREAKER = ELECTRICAL_COMPONENT_CATEGORY_BREAKER

A relay, used for switching electrical circuits on and off.

CHP class-attribute instance-attribute ¤
CHP = ELECTRICAL_COMPONENT_CATEGORY_CHP

A heat and power combustion plant (CHP stands for combined heat and power).

CONVERTER class-attribute instance-attribute ¤
CONVERTER = ELECTRICAL_COMPONENT_CATEGORY_CONVERTER

An electricity converter, e.g., a DC-DC converter.

CRYPTO_MINER class-attribute instance-attribute ¤
CRYPTO_MINER = ELECTRICAL_COMPONENT_CATEGORY_CRYPTO_MINER

A device for mining cryptocurrencies.

ELECTROLYZER class-attribute instance-attribute ¤
ELECTROLYZER = ELECTRICAL_COMPONENT_CATEGORY_ELECTROLYZER

A device for splitting water into hydrogen and oxygen using electricity.

EV_CHARGER class-attribute instance-attribute ¤
EV_CHARGER = ELECTRICAL_COMPONENT_CATEGORY_EV_CHARGER

A station for charging electrical vehicles.

GRID_CONNECTION_POINT class-attribute instance-attribute ¤
GRID_CONNECTION_POINT = (
    ELECTRICAL_COMPONENT_CATEGORY_GRID_CONNECTION_POINT
)

The point where the local microgrid is connected to the grid.

HVAC class-attribute instance-attribute ¤
HVAC = ELECTRICAL_COMPONENT_CATEGORY_HVAC

A heating, ventilation, and air conditioning (HVAC) system.

INVERTER class-attribute instance-attribute ¤
INVERTER = ELECTRICAL_COMPONENT_CATEGORY_INVERTER

An electricity generator, with batteries or solar energy.

METER class-attribute instance-attribute ¤
METER = ELECTRICAL_COMPONENT_CATEGORY_METER

A meter, for measuring electrical metrics, e.g., current, voltage, etc.

POWER_TRANSFORMER class-attribute instance-attribute ¤
POWER_TRANSFORMER = (
    ELECTRICAL_COMPONENT_CATEGORY_POWER_TRANSFORMER
)

A transformer, used for changing the voltage of electrical circuits.

PRECHARGER class-attribute instance-attribute ¤
PRECHARGER = ELECTRICAL_COMPONENT_CATEGORY_PRECHARGER

A precharger, used for preparing electrical circuits for switching on.

UNSPECIFIED class-attribute instance-attribute ¤
UNSPECIFIED = ELECTRICAL_COMPONENT_CATEGORY_UNSPECIFIED

An unknown component category.

Useful for error handling, and marking unknown components in a list of components with otherwise known categories.

Functions¤
from_proto classmethod ¤
from_proto(
    component_category: ValueType,
) -> ElectricalComponentCategory

Convert a protobuf ElectricalComponentCategory message to enum.

PARAMETER DESCRIPTION
component_category

protobuf enum to convert

TYPE: ValueType

RETURNS DESCRIPTION
ElectricalComponentCategory

Enum value corresponding to the protobuf message.

Source code in frequenz/client/common/v1alpha8/microgrid/electrical_components/__init__.py
@classmethod
@deprecated("Use `frequenz.client.common.enum_proto.enum_from_proto` instead.")
def from_proto(
    cls, component_category: PBElectricalComponentCategory.ValueType
) -> ElectricalComponentCategory:
    """Convert a protobuf ElectricalComponentCategory message to enum.

    Args:
        component_category: protobuf enum to convert

    Returns:
        Enum value corresponding to the protobuf message.
    """
    if not any(t.value == component_category for t in ElectricalComponentCategory):
        return ElectricalComponentCategory.UNSPECIFIED
    return cls(component_category)
to_proto ¤
to_proto() -> ValueType

Convert a ElectricalComponentCategory enum to protobuf message.

RETURNS DESCRIPTION
ValueType

Enum value corresponding to the protobuf message.

Source code in frequenz/client/common/v1alpha8/microgrid/electrical_components/__init__.py
def to_proto(self) -> PBElectricalComponentCategory.ValueType:
    """Convert a ElectricalComponentCategory enum to protobuf message.

    Returns:
        Enum value corresponding to the protobuf message.
    """
    return self.value

frequenz.client.common.v1alpha8.microgrid.electrical_components.ElectricalComponentDiagnosticCode ¤

Bases: Enum

All diagnostics that can occur across electrical component categories.

Source code in frequenz/client/common/v1alpha8/microgrid/electrical_components/__init__.py
@enum.unique
class ElectricalComponentDiagnosticCode(enum.Enum):
    """All diagnostics that can occur across electrical component categories."""

    UNSPECIFIED = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_UNSPECIFIED
    )
    """Default value. No specific error is specified."""

    UNKNOWN = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_UNKNOWN
    )
    """The component is reporting an unknown or an undefined error, and the sender
    cannot parse the component error to any of the variants below."""

    SWITCH_ON_FAULT = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_SWITCH_ON_FAULT
    )
    """Error indicating that the component could not be switched on."""

    UNDERVOLTAGE = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_UNDERVOLTAGE
    )
    """Error indicating that the component is operating under the minimum rated
    voltage."""

    OVERVOLTAGE = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_OVERVOLTAGE
    )
    """Error indicating that the component is operating over the maximum rated
    voltage."""

    OVERCURRENT = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_OVERCURRENT
    )
    """Error indicating that the component is drawing more current than the
    maximum rated value."""

    OVERCURRENT_CHARGING = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_OVERCURRENT_CHARGING  # noqa: E501
    )
    """Error indicating that the component's consumption current is over the
    maximum rated value during charging."""

    OVERCURRENT_DISCHARGING = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_OVERCURRENT_DISCHARGING  # noqa: E501
    )
    """Error indicating that the component's production current is over the
    maximum rated value during discharging."""

    OVERTEMPERATURE = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_OVERTEMPERATURE
    )
    """Error indicating that the component is operating over the maximum rated
    temperature."""

    UNDERTEMPERATURE = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_UNDERTEMPERATURE
    )
    """Error indicating that the component is operating under the minimum rated
    temperature."""

    HIGH_HUMIDITY = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_HIGH_HUMIDITY
    )
    """Error indicating that the component is exposed to high humidity levels over
    the maximum rated value."""

    FUSE_ERROR = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_FUSE_ERROR
    )
    """Error indicating that the component's fuse has blown."""

    PRECHARGE_ERROR = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_PRECHARGE_ERROR
    )
    """Error indicating that the component's precharge unit has failed."""

    PLAUSIBILITY_ERROR = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_PLAUSIBILITY_ERROR
    )
    """Error indicating plausibility issues within the system involving this
    component."""

    EV_UNEXPECTED_PILOT_FAILURE = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_EV_UNEXPECTED_PILOT_FAILURE  # noqa: E501
    )
    """Error indicating unexpected pilot failure in an electric vehicle (EV)
    component."""

    FAULT_CURRENT = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_FAULT_CURRENT
    )
    """Error indicating fault current detected in the component."""

    SHORT_CIRCUIT = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_SHORT_CIRCUIT
    )
    """Error indicating a short circuit detected in the component."""

    CONFIG_ERROR = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_CONFIG_ERROR
    )
    """Error indicating a configuration error related to the component."""

    ILLEGAL_COMPONENT_STATE_CODE_REQUESTED = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_ILLEGAL_COMPONENT_STATE_CODE_REQUESTED  # noqa: E501
    )
    """Error indicating an illegal state requested for the component."""

    HARDWARE_INACCESSIBLE = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_HARDWARE_INACCESSIBLE  # noqa: E501
    )
    """Error indicating that the hardware of the component is inaccessible."""

    INTERNAL = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_INTERNAL
    )
    """Error indicating an internal error within the component."""

    UNAUTHORIZED = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_UNAUTHORIZED
    )
    """Error indicating that the component is unauthorized to perform the
    last requested action."""

    EV_CHARGING_CABLE_UNPLUGGED_FROM_STATION = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_EV_CHARGING_CABLE_UNPLUGGED_FROM_STATION  # noqa: E501
    )
    """Error indicating electric vehicle (EV) cable was abruptly unplugged from
    the charging station."""

    EV_CHARGING_CABLE_UNPLUGGED_FROM_EV = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_EV_CHARGING_CABLE_UNPLUGGED_FROM_EV  # noqa: E501
    )
    """Error indicating electric vehicle (EV) cable was abruptly unplugged from
    the vehicle."""

    EV_CHARGING_CABLE_LOCK_FAILED = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_EV_CHARGING_CABLE_LOCK_FAILED  # noqa: E501
    )
    """Error indicating electric vehicle (EV) cable lock failure."""

    EV_CHARGING_CABLE_INVALID = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_EV_CHARGING_CABLE_INVALID  # noqa: E501
    )
    """Error indicating an invalid electric vehicle (EV) cable."""

    EV_CONSUMER_INCOMPATIBLE = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_EV_CONSUMER_INCOMPATIBLE  # noqa: E501
    )
    """Error indicating an incompatible electric vehicle (EV) plug."""

    BATTERY_IMBALANCE = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_BATTERY_IMBALANCE
    )
    """Error indicating a battery system imbalance."""

    BATTERY_LOW_SOH = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_BATTERY_LOW_SOH
    )
    """Error indicating a low state of health (SOH) detected in the battery."""

    BATTERY_BLOCK_ERROR = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_BATTERY_BLOCK_ERROR
    )
    """Error indicating a battery block error."""

    BATTERY_CONTROLLER_ERROR = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_BATTERY_CONTROLLER_ERROR  # noqa: E501
    )
    """Error indicating a battery controller error."""

    BATTERY_RELAY_ERROR = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_BATTERY_RELAY_ERROR
    )
    """Error indicating a battery relay error."""

    BATTERY_CALIBRATION_NEEDED = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_BATTERY_CALIBRATION_NEEDED  # noqa: E501
    )
    """Error indicating that battery calibration is needed."""

    RELAY_CYCLE_LIMIT_REACHED = (
        PBElectricalComponentDiagnosticCode.ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_RELAY_CYCLE_LIMIT_REACHED  # noqa: E501
    )
    """Error indicating that the relays have been cycled for the maximum number of
    times."""

    @classmethod
    @deprecated("Use `frequenz.client.common.enum_proto.enum_from_proto` instead.")
    def from_proto(
        cls, component_error_code: PBElectricalComponentDiagnosticCode.ValueType
    ) -> ElectricalComponentDiagnosticCode:
        """Convert a protobuf ElectricalComponentDiagnosticCode message to enum.

        Args:
            component_error_code: protobuf enum to convert

        Returns:
            Enum value corresponding to the protobuf message.
        """
        if not any(
            c.value == component_error_code for c in ElectricalComponentDiagnosticCode
        ):
            return ElectricalComponentDiagnosticCode.UNSPECIFIED
        return cls(component_error_code)

    def to_proto(self) -> PBElectricalComponentDiagnosticCode.ValueType:
        """Convert a ElectricalComponentDiagnosticCode enum to protobuf message.

        Returns:
            Enum value corresponding to the protobuf message.
        """
        return self.value
Attributes¤
BATTERY_BLOCK_ERROR class-attribute instance-attribute ¤
BATTERY_BLOCK_ERROR = (
    ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_BATTERY_BLOCK_ERROR
)

Error indicating a battery block error.

BATTERY_CALIBRATION_NEEDED class-attribute instance-attribute ¤
BATTERY_CALIBRATION_NEEDED = ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_BATTERY_CALIBRATION_NEEDED

Error indicating that battery calibration is needed.

BATTERY_CONTROLLER_ERROR class-attribute instance-attribute ¤
BATTERY_CONTROLLER_ERROR = ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_BATTERY_CONTROLLER_ERROR

Error indicating a battery controller error.

BATTERY_IMBALANCE class-attribute instance-attribute ¤
BATTERY_IMBALANCE = (
    ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_BATTERY_IMBALANCE
)

Error indicating a battery system imbalance.

BATTERY_LOW_SOH class-attribute instance-attribute ¤
BATTERY_LOW_SOH = (
    ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_BATTERY_LOW_SOH
)

Error indicating a low state of health (SOH) detected in the battery.

BATTERY_RELAY_ERROR class-attribute instance-attribute ¤
BATTERY_RELAY_ERROR = (
    ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_BATTERY_RELAY_ERROR
)

Error indicating a battery relay error.

CONFIG_ERROR class-attribute instance-attribute ¤
CONFIG_ERROR = (
    ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_CONFIG_ERROR
)

Error indicating a configuration error related to the component.

EV_CHARGING_CABLE_INVALID class-attribute instance-attribute ¤
EV_CHARGING_CABLE_INVALID = ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_EV_CHARGING_CABLE_INVALID

Error indicating an invalid electric vehicle (EV) cable.

EV_CHARGING_CABLE_LOCK_FAILED class-attribute instance-attribute ¤
EV_CHARGING_CABLE_LOCK_FAILED = ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_EV_CHARGING_CABLE_LOCK_FAILED

Error indicating electric vehicle (EV) cable lock failure.

EV_CHARGING_CABLE_UNPLUGGED_FROM_EV class-attribute instance-attribute ¤
EV_CHARGING_CABLE_UNPLUGGED_FROM_EV = ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_EV_CHARGING_CABLE_UNPLUGGED_FROM_EV

Error indicating electric vehicle (EV) cable was abruptly unplugged from the vehicle.

EV_CHARGING_CABLE_UNPLUGGED_FROM_STATION class-attribute instance-attribute ¤
EV_CHARGING_CABLE_UNPLUGGED_FROM_STATION = ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_EV_CHARGING_CABLE_UNPLUGGED_FROM_STATION

Error indicating electric vehicle (EV) cable was abruptly unplugged from the charging station.

EV_CONSUMER_INCOMPATIBLE class-attribute instance-attribute ¤
EV_CONSUMER_INCOMPATIBLE = ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_EV_CONSUMER_INCOMPATIBLE

Error indicating an incompatible electric vehicle (EV) plug.

EV_UNEXPECTED_PILOT_FAILURE class-attribute instance-attribute ¤
EV_UNEXPECTED_PILOT_FAILURE = ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_EV_UNEXPECTED_PILOT_FAILURE

Error indicating unexpected pilot failure in an electric vehicle (EV) component.

FAULT_CURRENT class-attribute instance-attribute ¤
FAULT_CURRENT = (
    ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_FAULT_CURRENT
)

Error indicating fault current detected in the component.

FUSE_ERROR class-attribute instance-attribute ¤
FUSE_ERROR = ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_FUSE_ERROR

Error indicating that the component's fuse has blown.

HARDWARE_INACCESSIBLE class-attribute instance-attribute ¤
HARDWARE_INACCESSIBLE = ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_HARDWARE_INACCESSIBLE

Error indicating that the hardware of the component is inaccessible.

HIGH_HUMIDITY class-attribute instance-attribute ¤
HIGH_HUMIDITY = (
    ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_HIGH_HUMIDITY
)

Error indicating that the component is exposed to high humidity levels over the maximum rated value.

ILLEGAL_COMPONENT_STATE_CODE_REQUESTED class-attribute instance-attribute ¤
ILLEGAL_COMPONENT_STATE_CODE_REQUESTED = ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_ILLEGAL_COMPONENT_STATE_CODE_REQUESTED

Error indicating an illegal state requested for the component.

INTERNAL class-attribute instance-attribute ¤
INTERNAL = ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_INTERNAL

Error indicating an internal error within the component.

OVERCURRENT class-attribute instance-attribute ¤
OVERCURRENT = (
    ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_OVERCURRENT
)

Error indicating that the component is drawing more current than the maximum rated value.

OVERCURRENT_CHARGING class-attribute instance-attribute ¤
OVERCURRENT_CHARGING = ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_OVERCURRENT_CHARGING

Error indicating that the component's consumption current is over the maximum rated value during charging.

OVERCURRENT_DISCHARGING class-attribute instance-attribute ¤
OVERCURRENT_DISCHARGING = ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_OVERCURRENT_DISCHARGING

Error indicating that the component's production current is over the maximum rated value during discharging.

OVERTEMPERATURE class-attribute instance-attribute ¤
OVERTEMPERATURE = (
    ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_OVERTEMPERATURE
)

Error indicating that the component is operating over the maximum rated temperature.

OVERVOLTAGE class-attribute instance-attribute ¤
OVERVOLTAGE = (
    ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_OVERVOLTAGE
)

Error indicating that the component is operating over the maximum rated voltage.

PLAUSIBILITY_ERROR class-attribute instance-attribute ¤
PLAUSIBILITY_ERROR = (
    ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_PLAUSIBILITY_ERROR
)

Error indicating plausibility issues within the system involving this component.

PRECHARGE_ERROR class-attribute instance-attribute ¤
PRECHARGE_ERROR = (
    ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_PRECHARGE_ERROR
)

Error indicating that the component's precharge unit has failed.

RELAY_CYCLE_LIMIT_REACHED class-attribute instance-attribute ¤
RELAY_CYCLE_LIMIT_REACHED = ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_RELAY_CYCLE_LIMIT_REACHED

Error indicating that the relays have been cycled for the maximum number of times.

SHORT_CIRCUIT class-attribute instance-attribute ¤
SHORT_CIRCUIT = (
    ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_SHORT_CIRCUIT
)

Error indicating a short circuit detected in the component.

SWITCH_ON_FAULT class-attribute instance-attribute ¤
SWITCH_ON_FAULT = (
    ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_SWITCH_ON_FAULT
)

Error indicating that the component could not be switched on.

UNAUTHORIZED class-attribute instance-attribute ¤
UNAUTHORIZED = (
    ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_UNAUTHORIZED
)

Error indicating that the component is unauthorized to perform the last requested action.

UNDERTEMPERATURE class-attribute instance-attribute ¤
UNDERTEMPERATURE = (
    ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_UNDERTEMPERATURE
)

Error indicating that the component is operating under the minimum rated temperature.

UNDERVOLTAGE class-attribute instance-attribute ¤
UNDERVOLTAGE = (
    ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_UNDERVOLTAGE
)

Error indicating that the component is operating under the minimum rated voltage.

UNKNOWN class-attribute instance-attribute ¤
UNKNOWN = ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_UNKNOWN

The component is reporting an unknown or an undefined error, and the sender cannot parse the component error to any of the variants below.

UNSPECIFIED class-attribute instance-attribute ¤
UNSPECIFIED = (
    ELECTRICAL_COMPONENT_DIAGNOSTIC_CODE_UNSPECIFIED
)

Default value. No specific error is specified.

Functions¤
from_proto classmethod ¤
from_proto(
    component_error_code: ValueType,
) -> ElectricalComponentDiagnosticCode

Convert a protobuf ElectricalComponentDiagnosticCode message to enum.

PARAMETER DESCRIPTION
component_error_code

protobuf enum to convert

TYPE: ValueType

RETURNS DESCRIPTION
ElectricalComponentDiagnosticCode

Enum value corresponding to the protobuf message.

Source code in frequenz/client/common/v1alpha8/microgrid/electrical_components/__init__.py
@classmethod
@deprecated("Use `frequenz.client.common.enum_proto.enum_from_proto` instead.")
def from_proto(
    cls, component_error_code: PBElectricalComponentDiagnosticCode.ValueType
) -> ElectricalComponentDiagnosticCode:
    """Convert a protobuf ElectricalComponentDiagnosticCode message to enum.

    Args:
        component_error_code: protobuf enum to convert

    Returns:
        Enum value corresponding to the protobuf message.
    """
    if not any(
        c.value == component_error_code for c in ElectricalComponentDiagnosticCode
    ):
        return ElectricalComponentDiagnosticCode.UNSPECIFIED
    return cls(component_error_code)
to_proto ¤
to_proto() -> ValueType

Convert a ElectricalComponentDiagnosticCode enum to protobuf message.

RETURNS DESCRIPTION
ValueType

Enum value corresponding to the protobuf message.

Source code in frequenz/client/common/v1alpha8/microgrid/electrical_components/__init__.py
def to_proto(self) -> PBElectricalComponentDiagnosticCode.ValueType:
    """Convert a ElectricalComponentDiagnosticCode enum to protobuf message.

    Returns:
        Enum value corresponding to the protobuf message.
    """
    return self.value

frequenz.client.common.v1alpha8.microgrid.electrical_components.ElectricalComponentId ¤

Bases: BaseId

A unique identifier for a microgrid electrical component.

Source code in frequenz/client/common/v1alpha8/microgrid/electrical_components/__init__.py
@final
class ElectricalComponentId(BaseId, str_prefix="CID"):
    """A unique identifier for a microgrid electrical component."""
Attributes¤
str_prefix property ¤
str_prefix: str

The prefix used for the string representation of this ID.

Functions¤
__eq__ ¤
__eq__(other: object) -> bool

Check if this instance is equal to another object.

Equality is defined as being of the exact same type and having the same underlying ID.

Source code in frequenz/core/id.py
def __eq__(self, other: object) -> bool:
    """Check if this instance is equal to another object.

    Equality is defined as being of the exact same type and having the same
    underlying ID.
    """
    # pylint thinks this is not an unidiomatic typecheck, but in this case
    # it is not. isinstance() returns True for subclasses, which is not
    # what we want here, as different ID types should never be equal.
    # pylint: disable-next=unidiomatic-typecheck
    if type(other) is not type(self):
        return NotImplemented
    # We already checked type(other) is type(self), but mypy doesn't
    # understand that, so we need to cast it to Self.
    other_id = cast(Self, other)
    return self._id == other_id._id
__hash__ ¤
__hash__() -> int

Return the hash of this instance.

The hash is based on the exact type and the underlying ID to ensure that IDs of different types but with the same numeric value have different hashes.

Source code in frequenz/core/id.py
def __hash__(self) -> int:
    """Return the hash of this instance.

    The hash is based on the exact type and the underlying ID to ensure
    that IDs of different types but with the same numeric value have different hashes.
    """
    return hash((type(self), self._id))
__init__ ¤
__init__(id_: int) -> None

Initialize this instance.

PARAMETER DESCRIPTION
id_

The numeric unique identifier.

TYPE: int

RAISES DESCRIPTION
ValueError

If the ID is negative.

Source code in frequenz/core/id.py
def __init__(self, id_: int, /) -> None:
    """Initialize this instance.

    Args:
        id_: The numeric unique identifier.

    Raises:
        ValueError: If the ID is negative.
    """
    if id_ < 0:
        raise ValueError(f"{type(self).__name__} can't be negative.")
    self._id = id_
__init_subclass__ ¤
__init_subclass__(
    *,
    str_prefix: str,
    allow_custom_name: bool = False,
    **kwargs: Any
) -> None

Initialize a subclass, set its string prefix, and perform checks.

PARAMETER DESCRIPTION
str_prefix

The string prefix for the ID type (e.g., "MID"). Must be unique across all ID types.

TYPE: str

allow_custom_name

If True, bypasses the check that the class name must end with "Id". Defaults to False.

TYPE: bool DEFAULT: False

**kwargs

Forwarded to the parent's init_subclass.

TYPE: Any DEFAULT: {}

RAISES DESCRIPTION
TypeError

If allow_custom_name is False and the class name does not end with "Id".

Source code in frequenz/core/id.py
def __init_subclass__(
    cls,
    *,
    str_prefix: str,
    allow_custom_name: bool = False,
    **kwargs: Any,
) -> None:
    """Initialize a subclass, set its string prefix, and perform checks.

    Args:
        str_prefix: The string prefix for the ID type (e.g., "MID").
            Must be unique across all ID types.
        allow_custom_name: If True, bypasses the check that the class name
            must end with "Id". Defaults to False.
        **kwargs: Forwarded to the parent's __init_subclass__.

    Raises:
        TypeError: If `allow_custom_name` is False and the class name
            does not end with "Id".
    """
    super().__init_subclass__(**kwargs)

    if str_prefix in BaseId._registered_prefixes:
        # We want to raise an exception here, but currently can't due to
        # https://github.com/frequenz-floss/frequenz-repo-config-python/issues/421
        _logger.warning(
            "Prefix '%s' is already registered. ID prefixes must be unique.",
            str_prefix,
        )
    BaseId._registered_prefixes.add(str_prefix)

    if not allow_custom_name and not cls.__name__.endswith("Id"):
        raise TypeError(
            f"Class name '{cls.__name__}' for an ID class must end with 'Id' "
            "(e.g., 'SomeId'), or use `allow_custom_name=True`."
        )

    cls._str_prefix = str_prefix
__int__ ¤
__int__() -> int

Return the numeric ID of this instance.

Source code in frequenz/core/id.py
def __int__(self) -> int:
    """Return the numeric ID of this instance."""
    return self._id
__lt__ ¤
__lt__(other: object) -> bool

Check if this instance is less than another object.

Comparison is only defined between instances of the exact same type.

Source code in frequenz/core/id.py
def __lt__(self, other: object) -> bool:
    """Check if this instance is less than another object.

    Comparison is only defined between instances of the exact same type.
    """
    # pylint: disable-next=unidiomatic-typecheck
    if type(other) is not type(self):
        return NotImplemented
    other_id = cast(Self, other)
    return self._id < other_id._id
__new__ ¤
__new__(*_: Any, **__: Any) -> Self

Create a new instance of the ID class, only if it is a subclass of BaseId.

Source code in frequenz/core/id.py
def __new__(cls, *_: Any, **__: Any) -> Self:
    """Create a new instance of the ID class, only if it is a subclass of BaseId."""
    if cls is BaseId:
        raise TypeError("BaseId cannot be instantiated directly. Use a subclass.")
    return super().__new__(cls)
__repr__ ¤
__repr__() -> str

Return the string representation of this instance.

Source code in frequenz/core/id.py
def __repr__(self) -> str:
    """Return the string representation of this instance."""
    return f"{type(self).__name__}({self._id!r})"
__str__ ¤
__str__() -> str

Return the short string representation of this instance.

Source code in frequenz/core/id.py
def __str__(self) -> str:
    """Return the short string representation of this instance."""
    return f"{self._str_prefix}{self._id}"

frequenz.client.common.v1alpha8.microgrid.electrical_components.ElectricalComponentStateCode ¤

Bases: Enum

All possible states of a microgrid electrical component.

Source code in frequenz/client/common/v1alpha8/microgrid/electrical_components/__init__.py
@enum.unique
class ElectricalComponentStateCode(enum.Enum):
    """All possible states of a microgrid electrical component."""

    UNSPECIFIED = (
        PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_UNSPECIFIED
    )
    """Default value when the component state is not explicitly set."""

    UNKNOWN = PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_UNKNOWN
    """State when the component is in an unknown or undefined condition.

    This is used when the sender is unable to classify the component into any
    other state.
    """

    UNAVAILABLE = (
        PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_UNAVAILABLE
    )
    """State when the component is not available for use."""

    SWITCHING_OFF = (
        PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_SWITCHING_OFF
    )
    """State when the component is in the process of switching off."""

    OFF = PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_OFF
    """State when the component has successfully switched off."""

    SWITCHING_ON = (
        PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_SWITCHING_ON
    )
    """State when the component is in the process of switching on from an off state."""

    STANDBY = PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_STANDBY
    """State when the component is in standby mode, and not immediately ready for operation."""

    READY = PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_READY
    """State when the component is fully operational and ready for use."""

    CHARGING = PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_CHARGING
    """State when the component is actively consuming energy."""

    DISCHARGING = (
        PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_DISCHARGING
    )
    """State when the component is actively producing or releasing energy."""

    ERROR = PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_ERROR
    """State when the component is in an error state and may need attention."""

    EV_CHARGING_CABLE_UNPLUGGED = (
        PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_EV_CHARGING_CABLE_UNPLUGGED
    )
    """The Electric Vehicle (EV) charging cable is unplugged from the charging station."""

    EV_CHARGING_CABLE_PLUGGED_AT_STATION = (
        PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_EV_CHARGING_CABLE_PLUGGED_AT_STATION  # noqa: E501
    )
    """The EV charging cable is plugged into the charging station."""

    EV_CHARGING_CABLE_PLUGGED_AT_EV = (
        PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_EV_CHARGING_CABLE_PLUGGED_AT_EV  # noqa: E501
    )
    """The EV charging cable is plugged into the vehicle."""

    EV_CHARGING_CABLE_LOCKED_AT_STATION = (
        PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_EV_CHARGING_CABLE_LOCKED_AT_STATION  # noqa: E501
    )
    """The EV charging cable is locked at the charging station end, indicating
    readiness for charging."""

    EV_CHARGING_CABLE_LOCKED_AT_EV = (
        PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_EV_CHARGING_CABLE_LOCKED_AT_EV  # noqa: E501
    )
    """The EV charging cable is locked at the vehicle end, indicating that charging is active."""

    RELAY_OPEN = (
        PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_RELAY_OPEN
    )
    """The relay is in an open state, meaning no current can flow through."""

    RELAY_CLOSED = (
        PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_RELAY_CLOSED
    )
    """The relay is in a closed state, allowing current to flow."""

    PRECHARGER_OPEN = (
        PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_PRECHARGER_OPEN
    )
    """The precharger circuit is open, meaning it's not currently active."""

    PRECHARGER_PRECHARGING = (
        PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_PRECHARGER_PRECHARGING
    )
    """The precharger is in a precharging state, preparing the main circuit for activation."""

    PRECHARGER_CLOSED = (
        PBElectricalComponentStateCode.ELECTRICAL_COMPONENT_STATE_CODE_PRECHARGER_CLOSED
    )
    """The precharger circuit is closed, allowing full current to flow to the main circuit."""

    @classmethod
    @deprecated("Use `frequenz.client.common.enum_proto.enum_from_proto` instead.")
    def from_proto(
        cls, component_state: PBElectricalComponentStateCode.ValueType
    ) -> ElectricalComponentStateCode:
        """Convert a protobuf ElectricalComponentStateCode message to enum.

        Args:
            component_state: protobuf enum to convert

        Returns:
            Enum value corresponding to the protobuf message.
        """
        if not any(c.value == component_state for c in ElectricalComponentStateCode):
            return ElectricalComponentStateCode.UNSPECIFIED
        return cls(component_state)

    def to_proto(self) -> PBElectricalComponentStateCode.ValueType:
        """Convert a ElectricalComponentStateCode enum to protobuf message.

        Returns:
            Enum value corresponding to the protobuf message.
        """
        return self.value
Attributes¤
CHARGING class-attribute instance-attribute ¤
CHARGING = ELECTRICAL_COMPONENT_STATE_CODE_CHARGING

State when the component is actively consuming energy.

DISCHARGING class-attribute instance-attribute ¤
DISCHARGING = ELECTRICAL_COMPONENT_STATE_CODE_DISCHARGING

State when the component is actively producing or releasing energy.

ERROR class-attribute instance-attribute ¤
ERROR = ELECTRICAL_COMPONENT_STATE_CODE_ERROR

State when the component is in an error state and may need attention.

EV_CHARGING_CABLE_LOCKED_AT_EV class-attribute instance-attribute ¤
EV_CHARGING_CABLE_LOCKED_AT_EV = ELECTRICAL_COMPONENT_STATE_CODE_EV_CHARGING_CABLE_LOCKED_AT_EV

The EV charging cable is locked at the vehicle end, indicating that charging is active.

EV_CHARGING_CABLE_LOCKED_AT_STATION class-attribute instance-attribute ¤
EV_CHARGING_CABLE_LOCKED_AT_STATION = ELECTRICAL_COMPONENT_STATE_CODE_EV_CHARGING_CABLE_LOCKED_AT_STATION

The EV charging cable is locked at the charging station end, indicating readiness for charging.

EV_CHARGING_CABLE_PLUGGED_AT_EV class-attribute instance-attribute ¤
EV_CHARGING_CABLE_PLUGGED_AT_EV = ELECTRICAL_COMPONENT_STATE_CODE_EV_CHARGING_CABLE_PLUGGED_AT_EV

The EV charging cable is plugged into the vehicle.

EV_CHARGING_CABLE_PLUGGED_AT_STATION class-attribute instance-attribute ¤
EV_CHARGING_CABLE_PLUGGED_AT_STATION = ELECTRICAL_COMPONENT_STATE_CODE_EV_CHARGING_CABLE_PLUGGED_AT_STATION

The EV charging cable is plugged into the charging station.

EV_CHARGING_CABLE_UNPLUGGED class-attribute instance-attribute ¤
EV_CHARGING_CABLE_UNPLUGGED = ELECTRICAL_COMPONENT_STATE_CODE_EV_CHARGING_CABLE_UNPLUGGED

The Electric Vehicle (EV) charging cable is unplugged from the charging station.

OFF class-attribute instance-attribute ¤
OFF = ELECTRICAL_COMPONENT_STATE_CODE_OFF

State when the component has successfully switched off.

PRECHARGER_CLOSED class-attribute instance-attribute ¤
PRECHARGER_CLOSED = (
    ELECTRICAL_COMPONENT_STATE_CODE_PRECHARGER_CLOSED
)

The precharger circuit is closed, allowing full current to flow to the main circuit.

PRECHARGER_OPEN class-attribute instance-attribute ¤
PRECHARGER_OPEN = (
    ELECTRICAL_COMPONENT_STATE_CODE_PRECHARGER_OPEN
)

The precharger circuit is open, meaning it's not currently active.

PRECHARGER_PRECHARGING class-attribute instance-attribute ¤
PRECHARGER_PRECHARGING = (
    ELECTRICAL_COMPONENT_STATE_CODE_PRECHARGER_PRECHARGING
)

The precharger is in a precharging state, preparing the main circuit for activation.

READY class-attribute instance-attribute ¤
READY = ELECTRICAL_COMPONENT_STATE_CODE_READY

State when the component is fully operational and ready for use.

RELAY_CLOSED class-attribute instance-attribute ¤
RELAY_CLOSED = ELECTRICAL_COMPONENT_STATE_CODE_RELAY_CLOSED

The relay is in a closed state, allowing current to flow.

RELAY_OPEN class-attribute instance-attribute ¤
RELAY_OPEN = ELECTRICAL_COMPONENT_STATE_CODE_RELAY_OPEN

The relay is in an open state, meaning no current can flow through.

STANDBY class-attribute instance-attribute ¤
STANDBY = ELECTRICAL_COMPONENT_STATE_CODE_STANDBY

State when the component is in standby mode, and not immediately ready for operation.

SWITCHING_OFF class-attribute instance-attribute ¤
SWITCHING_OFF = (
    ELECTRICAL_COMPONENT_STATE_CODE_SWITCHING_OFF
)

State when the component is in the process of switching off.

SWITCHING_ON class-attribute instance-attribute ¤
SWITCHING_ON = ELECTRICAL_COMPONENT_STATE_CODE_SWITCHING_ON

State when the component is in the process of switching on from an off state.

UNAVAILABLE class-attribute instance-attribute ¤
UNAVAILABLE = ELECTRICAL_COMPONENT_STATE_CODE_UNAVAILABLE

State when the component is not available for use.

UNKNOWN class-attribute instance-attribute ¤
UNKNOWN = ELECTRICAL_COMPONENT_STATE_CODE_UNKNOWN

State when the component is in an unknown or undefined condition.

This is used when the sender is unable to classify the component into any other state.

UNSPECIFIED class-attribute instance-attribute ¤
UNSPECIFIED = ELECTRICAL_COMPONENT_STATE_CODE_UNSPECIFIED

Default value when the component state is not explicitly set.

Functions¤
from_proto classmethod ¤
from_proto(
    component_state: ValueType,
) -> ElectricalComponentStateCode

Convert a protobuf ElectricalComponentStateCode message to enum.

PARAMETER DESCRIPTION
component_state

protobuf enum to convert

TYPE: ValueType

RETURNS DESCRIPTION
ElectricalComponentStateCode

Enum value corresponding to the protobuf message.

Source code in frequenz/client/common/v1alpha8/microgrid/electrical_components/__init__.py
@classmethod
@deprecated("Use `frequenz.client.common.enum_proto.enum_from_proto` instead.")
def from_proto(
    cls, component_state: PBElectricalComponentStateCode.ValueType
) -> ElectricalComponentStateCode:
    """Convert a protobuf ElectricalComponentStateCode message to enum.

    Args:
        component_state: protobuf enum to convert

    Returns:
        Enum value corresponding to the protobuf message.
    """
    if not any(c.value == component_state for c in ElectricalComponentStateCode):
        return ElectricalComponentStateCode.UNSPECIFIED
    return cls(component_state)
to_proto ¤
to_proto() -> ValueType

Convert a ElectricalComponentStateCode enum to protobuf message.

RETURNS DESCRIPTION
ValueType

Enum value corresponding to the protobuf message.

Source code in frequenz/client/common/v1alpha8/microgrid/electrical_components/__init__.py
def to_proto(self) -> PBElectricalComponentStateCode.ValueType:
    """Convert a ElectricalComponentStateCode enum to protobuf message.

    Returns:
        Enum value corresponding to the protobuf message.
    """
    return self.value