Skip to content

Index

frequenz.client.common.microgrid.electrical_components ¤

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

Classes¤

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

Bases: Enum

Possible types of microgrid electrical component.

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

    UNSPECIFIED = 0
    """An unknown component category.

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

    GRID_CONNECTION_POINT = 1
    """The point where the local microgrid is connected to the grid."""

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

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

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

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

    EV_CHARGER = 6
    """A station for charging electrical vehicles."""

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

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

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

    ELECTROLYZER = 10
    """A device for splitting water into hydrogen and oxygen using electricity."""

    POWER_TRANSFORMER = 11
    """A transformer, used for changing the voltage of electrical circuits."""

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

    PLC = 13
    """A programmable logic controller (PLC)."""

    CRYPTO_MINER = 14
    """A device for mining cryptocurrencies."""

    STATIC_TRANSFER_SWITCH = 15
    """A static transfer switch, used for switching between power sources."""

    UNINTERRUPTIBLE_POWER_SUPPLY = 16
    """An uninterruptible power supply (UPS), used to provide backup power."""

    CAPACITOR_BANK = 17
    """A capacitor bank, used for power factor correction and reactive power compensation."""

    WIND_TURBINE = 18
    """A wind turbine, used to generate electricity from wind energy."""

    STEAM_BOILER = 19
    """A steam boiler, used to generate steam for heating or industrial processes."""
Attributes¤
BATTERY class-attribute instance-attribute ¤
BATTERY = 5

A storage system for electrical energy, used by inverters.

BREAKER class-attribute instance-attribute ¤
BREAKER = 7

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

CAPACITOR_BANK class-attribute instance-attribute ¤
CAPACITOR_BANK = 17

A capacitor bank, used for power factor correction and reactive power compensation.

CHP class-attribute instance-attribute ¤
CHP = 9

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

CONVERTER class-attribute instance-attribute ¤
CONVERTER = 4

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

CRYPTO_MINER class-attribute instance-attribute ¤
CRYPTO_MINER = 14

A device for mining cryptocurrencies.

ELECTROLYZER class-attribute instance-attribute ¤
ELECTROLYZER = 10

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

EV_CHARGER class-attribute instance-attribute ¤
EV_CHARGER = 6

A station for charging electrical vehicles.

GRID_CONNECTION_POINT class-attribute instance-attribute ¤
GRID_CONNECTION_POINT = 1

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

HVAC class-attribute instance-attribute ¤
HVAC = 12

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

INVERTER class-attribute instance-attribute ¤
INVERTER = 3

An electricity generator, with batteries or solar energy.

METER class-attribute instance-attribute ¤
METER = 2

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

PLC class-attribute instance-attribute ¤
PLC = 13

A programmable logic controller (PLC).

POWER_TRANSFORMER class-attribute instance-attribute ¤
POWER_TRANSFORMER = 11

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

PRECHARGER class-attribute instance-attribute ¤
PRECHARGER = 8

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

STATIC_TRANSFER_SWITCH class-attribute instance-attribute ¤
STATIC_TRANSFER_SWITCH = 15

A static transfer switch, used for switching between power sources.

STEAM_BOILER class-attribute instance-attribute ¤
STEAM_BOILER = 19

A steam boiler, used to generate steam for heating or industrial processes.

UNINTERRUPTIBLE_POWER_SUPPLY class-attribute instance-attribute ¤
UNINTERRUPTIBLE_POWER_SUPPLY = 16

An uninterruptible power supply (UPS), used to provide backup power.

UNSPECIFIED class-attribute instance-attribute ¤
UNSPECIFIED = 0

An unknown component category.

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

WIND_TURBINE class-attribute instance-attribute ¤
WIND_TURBINE = 18

A wind turbine, used to generate electricity from wind energy.

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

Bases: Enum

All diagnostics that can occur across electrical component categories.

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

    UNSPECIFIED = 0
    """Default value. No specific error is specified."""

    UNKNOWN = 1
    """The component is reporting an unknown or an undefined error.

    The sender cannot parse the component error to any of the variants below.
    """

    SWITCH_ON_FAULT = 2
    """The component could not be switched on."""

    UNDERVOLTAGE = 3
    """The component is operating under the minimum rated voltage."""

    OVERVOLTAGE = 4
    """The component is operating over the maximum rated voltage."""

    OVERCURRENT = 5
    """The component is drawing more current than the maximum rated value."""

    OVERCURRENT_CHARGING = 6
    """The component's consumption current is over the maximum rated value during charging."""

    OVERCURRENT_DISCHARGING = 7
    """The component's production current is over the maximum rated value during discharging."""

    OVERTEMPERATURE = 8
    """The component is operating over the maximum rated temperature."""

    UNDERTEMPERATURE = 9
    """The component is operating under the minimum rated temperature."""

    HIGH_HUMIDITY = 10
    """The component is exposed to high humidity levels over the maximum rated value."""

    FUSE_ERROR = 11
    """The component's fuse has blown."""

    PRECHARGE_ERROR = 12
    """The component's precharge unit has failed."""

    PLAUSIBILITY_ERROR = 13
    """Plausibility issues within the system involving this component."""

    FAULT_CURRENT = 14
    """Fault current detected in the component."""

    SHORT_CIRCUIT = 15
    """Short circuit detected in the component."""

    CONFIG_ERROR = 16
    """Configuration error related to the component."""

    ILLEGAL_COMPONENT_STATE_CODE_REQUESTED = 17
    """An illegal state was requested for the component."""

    HARDWARE_INACCESSIBLE = 18
    """The hardware of the component is inaccessible."""

    INTERNAL = 19
    """An internal error within the component."""

    UNAUTHORIZED = 20
    """The component is unauthorized to perform the last requested action."""

    EXCESS_LEAKAGE_CURRENT = 21
    """Excess leakage current was detected in the component."""

    LOW_SYSTEM_INSULATION_RESISTANCE = 22
    """Low system insulation resistance detected in the component."""

    GROUND_FAULT = 23
    """Ground fault detected in the component."""

    ARC_FAULT = 24
    """Arc fault detected in the component."""

    FAN_FAULT = 25
    """Fan fault detected in the component."""

    HARDWARE_FAULT = 26
    """Hardware fault detected in the component."""

    PROTECTIVE_SHUTDOWN = 27
    """The component performed a protective shutdown."""

    GRID_OVERVOLTAGE = 30
    """The grid voltage is over the maximum rated value."""

    GRID_UNDERVOLTAGE = 31
    """The grid voltage is under the minimum rated value."""

    GRID_OVERFREQUENCY = 32
    """The grid frequency is over the maximum rated value."""

    GRID_UNDERFREQUENCY = 33
    """The grid frequency is under the minimum rated value."""

    GRID_DISCONNECTED = 34
    """The grid is disconnected."""

    GRID_VOLTAGE_IMBALANCE = 35
    """Voltage imbalance between grid phases."""

    GRID_ABNORMAL = 36
    """The grid is in an abnormal condition not covered by other grid-specific diagnostic codes."""

    EV_UNEXPECTED_PILOT_FAILURE = 40
    """Unexpected pilot failure in an electric vehicle (EV) component."""

    EV_CHARGING_CABLE_UNPLUGGED_FROM_STATION = 41
    """Electric vehicle (EV) cable was abruptly unplugged from the charging station."""

    EV_CHARGING_CABLE_UNPLUGGED_FROM_EV = 42
    """Electric vehicle (EV) cable was abruptly unplugged from the vehicle."""

    EV_CHARGING_CABLE_LOCK_FAILED = 43
    """Electric vehicle (EV) cable lock failure."""

    EV_CHARGING_CABLE_INVALID = 44
    """Invalid electric vehicle (EV) cable."""

    EV_CONSUMER_INCOMPATIBLE = 45
    """Incompatible electric vehicle (EV) plug."""

    BATTERY_IMBALANCE = 50
    """Battery system imbalance detected."""

    BATTERY_LOW_SOH = 51
    """Low state of health (SOH) detected in the battery."""

    BATTERY_BLOCK_ERROR = 52
    """Battery block error detected."""

    BATTERY_CONTROLLER_ERROR = 53
    """Battery controller error detected."""

    BATTERY_RELAY_ERROR = 54
    """Battery relay error detected."""

    BATTERY_CALIBRATION_NEEDED = 56
    """Battery calibration is needed."""

    RELAY_CYCLE_LIMIT_REACHED = 60
    """The relays have been cycled for the maximum number of times."""

    PV_REVERSAL_POLARITY = 70
    """Reverse polarity condition detected on the photovoltaic (PV) side."""

    PV_UNDERPERFORMANCE = 71
    """The photovoltaic (PV) system is underperforming."""

    PV_FAULT = 72
    """Fault in the photovoltaic (PV) system."""

    PV_REVERSE_CURRENT = 73
    """Reverse current condition detected on the photovoltaic (PV) side."""

    PV_GROUND_FAULT = 74
    """Ground fault detected on the photovoltaic (PV) side."""

    INVERTER_DC_UNDERVOLTAGE = 80
    """The inverter DC bus voltage is under the minimum rated value."""

    INVERTER_DC_OVERVOLTAGE = 81
    """The inverter DC bus voltage is over the maximum rated value."""
Attributes¤
ARC_FAULT class-attribute instance-attribute ¤
ARC_FAULT = 24

Arc fault detected in the component.

BATTERY_BLOCK_ERROR class-attribute instance-attribute ¤
BATTERY_BLOCK_ERROR = 52

Battery block error detected.

BATTERY_CALIBRATION_NEEDED class-attribute instance-attribute ¤
BATTERY_CALIBRATION_NEEDED = 56

Battery calibration is needed.

BATTERY_CONTROLLER_ERROR class-attribute instance-attribute ¤
BATTERY_CONTROLLER_ERROR = 53

Battery controller error detected.

BATTERY_IMBALANCE class-attribute instance-attribute ¤
BATTERY_IMBALANCE = 50

Battery system imbalance detected.

BATTERY_LOW_SOH class-attribute instance-attribute ¤
BATTERY_LOW_SOH = 51

Low state of health (SOH) detected in the battery.

BATTERY_RELAY_ERROR class-attribute instance-attribute ¤
BATTERY_RELAY_ERROR = 54

Battery relay error detected.

CONFIG_ERROR class-attribute instance-attribute ¤
CONFIG_ERROR = 16

Configuration error related to the component.

EV_CHARGING_CABLE_INVALID class-attribute instance-attribute ¤
EV_CHARGING_CABLE_INVALID = 44

Invalid electric vehicle (EV) cable.

EV_CHARGING_CABLE_LOCK_FAILED class-attribute instance-attribute ¤
EV_CHARGING_CABLE_LOCK_FAILED = 43

Electric vehicle (EV) cable lock failure.

EV_CHARGING_CABLE_UNPLUGGED_FROM_EV class-attribute instance-attribute ¤
EV_CHARGING_CABLE_UNPLUGGED_FROM_EV = 42

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 = 41

Electric vehicle (EV) cable was abruptly unplugged from the charging station.

EV_CONSUMER_INCOMPATIBLE class-attribute instance-attribute ¤
EV_CONSUMER_INCOMPATIBLE = 45

Incompatible electric vehicle (EV) plug.

EV_UNEXPECTED_PILOT_FAILURE class-attribute instance-attribute ¤
EV_UNEXPECTED_PILOT_FAILURE = 40

Unexpected pilot failure in an electric vehicle (EV) component.

EXCESS_LEAKAGE_CURRENT class-attribute instance-attribute ¤
EXCESS_LEAKAGE_CURRENT = 21

Excess leakage current was detected in the component.

FAN_FAULT class-attribute instance-attribute ¤
FAN_FAULT = 25

Fan fault detected in the component.

FAULT_CURRENT class-attribute instance-attribute ¤
FAULT_CURRENT = 14

Fault current detected in the component.

FUSE_ERROR class-attribute instance-attribute ¤
FUSE_ERROR = 11

The component's fuse has blown.

GRID_ABNORMAL class-attribute instance-attribute ¤
GRID_ABNORMAL = 36

The grid is in an abnormal condition not covered by other grid-specific diagnostic codes.

GRID_DISCONNECTED class-attribute instance-attribute ¤
GRID_DISCONNECTED = 34

The grid is disconnected.

GRID_OVERFREQUENCY class-attribute instance-attribute ¤
GRID_OVERFREQUENCY = 32

The grid frequency is over the maximum rated value.

GRID_OVERVOLTAGE class-attribute instance-attribute ¤
GRID_OVERVOLTAGE = 30

The grid voltage is over the maximum rated value.

GRID_UNDERFREQUENCY class-attribute instance-attribute ¤
GRID_UNDERFREQUENCY = 33

The grid frequency is under the minimum rated value.

GRID_UNDERVOLTAGE class-attribute instance-attribute ¤
GRID_UNDERVOLTAGE = 31

The grid voltage is under the minimum rated value.

GRID_VOLTAGE_IMBALANCE class-attribute instance-attribute ¤
GRID_VOLTAGE_IMBALANCE = 35

Voltage imbalance between grid phases.

GROUND_FAULT class-attribute instance-attribute ¤
GROUND_FAULT = 23

Ground fault detected in the component.

HARDWARE_FAULT class-attribute instance-attribute ¤
HARDWARE_FAULT = 26

Hardware fault detected in the component.

HARDWARE_INACCESSIBLE class-attribute instance-attribute ¤
HARDWARE_INACCESSIBLE = 18

The hardware of the component is inaccessible.

HIGH_HUMIDITY class-attribute instance-attribute ¤
HIGH_HUMIDITY = 10

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 = 17

An illegal state was requested for the component.

INTERNAL class-attribute instance-attribute ¤
INTERNAL = 19

An internal error within the component.

INVERTER_DC_OVERVOLTAGE class-attribute instance-attribute ¤
INVERTER_DC_OVERVOLTAGE = 81

The inverter DC bus voltage is over the maximum rated value.

INVERTER_DC_UNDERVOLTAGE class-attribute instance-attribute ¤
INVERTER_DC_UNDERVOLTAGE = 80

The inverter DC bus voltage is under the minimum rated value.

LOW_SYSTEM_INSULATION_RESISTANCE class-attribute instance-attribute ¤
LOW_SYSTEM_INSULATION_RESISTANCE = 22

Low system insulation resistance detected in the component.

OVERCURRENT class-attribute instance-attribute ¤
OVERCURRENT = 5

The component is drawing more current than the maximum rated value.

OVERCURRENT_CHARGING class-attribute instance-attribute ¤
OVERCURRENT_CHARGING = 6

The component's consumption current is over the maximum rated value during charging.

OVERCURRENT_DISCHARGING class-attribute instance-attribute ¤
OVERCURRENT_DISCHARGING = 7

The component's production current is over the maximum rated value during discharging.

OVERTEMPERATURE class-attribute instance-attribute ¤
OVERTEMPERATURE = 8

The component is operating over the maximum rated temperature.

OVERVOLTAGE class-attribute instance-attribute ¤
OVERVOLTAGE = 4

The component is operating over the maximum rated voltage.

PLAUSIBILITY_ERROR class-attribute instance-attribute ¤
PLAUSIBILITY_ERROR = 13

Plausibility issues within the system involving this component.

PRECHARGE_ERROR class-attribute instance-attribute ¤
PRECHARGE_ERROR = 12

The component's precharge unit has failed.

PROTECTIVE_SHUTDOWN class-attribute instance-attribute ¤
PROTECTIVE_SHUTDOWN = 27

The component performed a protective shutdown.

PV_FAULT class-attribute instance-attribute ¤
PV_FAULT = 72

Fault in the photovoltaic (PV) system.

PV_GROUND_FAULT class-attribute instance-attribute ¤
PV_GROUND_FAULT = 74

Ground fault detected on the photovoltaic (PV) side.

PV_REVERSAL_POLARITY class-attribute instance-attribute ¤
PV_REVERSAL_POLARITY = 70

Reverse polarity condition detected on the photovoltaic (PV) side.

PV_REVERSE_CURRENT class-attribute instance-attribute ¤
PV_REVERSE_CURRENT = 73

Reverse current condition detected on the photovoltaic (PV) side.

PV_UNDERPERFORMANCE class-attribute instance-attribute ¤
PV_UNDERPERFORMANCE = 71

The photovoltaic (PV) system is underperforming.

RELAY_CYCLE_LIMIT_REACHED class-attribute instance-attribute ¤
RELAY_CYCLE_LIMIT_REACHED = 60

The relays have been cycled for the maximum number of times.

SHORT_CIRCUIT class-attribute instance-attribute ¤
SHORT_CIRCUIT = 15

Short circuit detected in the component.

SWITCH_ON_FAULT class-attribute instance-attribute ¤
SWITCH_ON_FAULT = 2

The component could not be switched on.

UNAUTHORIZED class-attribute instance-attribute ¤
UNAUTHORIZED = 20

The component is unauthorized to perform the last requested action.

UNDERTEMPERATURE class-attribute instance-attribute ¤
UNDERTEMPERATURE = 9

The component is operating under the minimum rated temperature.

UNDERVOLTAGE class-attribute instance-attribute ¤
UNDERVOLTAGE = 3

The component is operating under the minimum rated voltage.

UNKNOWN class-attribute instance-attribute ¤
UNKNOWN = 1

The component is reporting an unknown or an undefined error.

The sender cannot parse the component error to any of the variants below.

UNSPECIFIED class-attribute instance-attribute ¤
UNSPECIFIED = 0

Default value. No specific error is specified.

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

Bases: BaseId

A unique identifier for a microgrid electrical component.

Source code in src/frequenz/client/common/microgrid/electrical_components/_ids.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.microgrid.electrical_components.ElectricalComponentStateCode ¤

Bases: Enum

All possible states of a microgrid electrical component.

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

    UNSPECIFIED = 0
    """Default value when the component state is not explicitly set."""

    UNKNOWN = 1
    """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 = 2
    """The component is not available for use."""

    SWITCHING_OFF = 3
    """The component is in the process of switching off."""

    OFF = 4
    """The component has successfully switched off."""

    SWITCHING_ON = 5
    """The component is in the process of switching on from an off state."""

    STANDBY = 6
    """The component is in standby mode, and not immediately ready for operation."""

    READY = 7
    """The component is fully operational and ready for use."""

    CHARGING = 8
    """The component is actively consuming energy."""

    DISCHARGING = 9
    """The component is actively producing or releasing energy."""

    ERROR = 10
    """The component is in an error state and may need attention."""

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

    EV_CHARGING_CABLE_PLUGGED_AT_STATION = 21
    """The EV charging cable is plugged into the charging station."""

    EV_CHARGING_CABLE_PLUGGED_AT_EV = 22
    """The EV charging cable is plugged into the vehicle."""

    EV_CHARGING_CABLE_LOCKED_AT_STATION = 23
    """The EV charging cable is locked at the charging station end, ready for charging."""

    EV_CHARGING_CABLE_LOCKED_AT_EV = 24
    """The EV charging cable is locked at the vehicle end, indicating that charging is active."""

    RELAY_OPEN = 30
    """The relay is in an open state, meaning no current can flow through."""

    RELAY_CLOSED = 31
    """The relay is in a closed state, allowing current to flow."""

    PRECHARGER_OPEN = 40
    """The precharger circuit is open, meaning it's not currently active."""

    PRECHARGER_PRECHARGING = 41
    """The precharger is in a precharging state, preparing the main circuit for activation."""

    PRECHARGER_CLOSED = 42
    """The precharger circuit is closed, allowing full current to flow to the main circuit."""
Attributes¤
CHARGING class-attribute instance-attribute ¤
CHARGING = 8

The component is actively consuming energy.

DISCHARGING class-attribute instance-attribute ¤
DISCHARGING = 9

The component is actively producing or releasing energy.

ERROR class-attribute instance-attribute ¤
ERROR = 10

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 = 24

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 = 23

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

EV_CHARGING_CABLE_PLUGGED_AT_EV class-attribute instance-attribute ¤
EV_CHARGING_CABLE_PLUGGED_AT_EV = 22

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 = 21

The EV charging cable is plugged into the charging station.

EV_CHARGING_CABLE_UNPLUGGED class-attribute instance-attribute ¤
EV_CHARGING_CABLE_UNPLUGGED = 20

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

OFF class-attribute instance-attribute ¤
OFF = 4

The component has successfully switched off.

PRECHARGER_CLOSED class-attribute instance-attribute ¤
PRECHARGER_CLOSED = 42

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

PRECHARGER_OPEN class-attribute instance-attribute ¤
PRECHARGER_OPEN = 40

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

PRECHARGER_PRECHARGING class-attribute instance-attribute ¤
PRECHARGER_PRECHARGING = 41

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

READY class-attribute instance-attribute ¤
READY = 7

The component is fully operational and ready for use.

RELAY_CLOSED class-attribute instance-attribute ¤
RELAY_CLOSED = 31

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

RELAY_OPEN class-attribute instance-attribute ¤
RELAY_OPEN = 30

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

STANDBY class-attribute instance-attribute ¤
STANDBY = 6

The component is in standby mode, and not immediately ready for operation.

SWITCHING_OFF class-attribute instance-attribute ¤
SWITCHING_OFF = 3

The component is in the process of switching off.

SWITCHING_ON class-attribute instance-attribute ¤
SWITCHING_ON = 5

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

UNAVAILABLE class-attribute instance-attribute ¤
UNAVAILABLE = 2

The component is not available for use.

UNKNOWN class-attribute instance-attribute ¤
UNKNOWN = 1

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 = 0

Default value when the component state is not explicitly set.