Control / Operation

class icspacket.proto.iec61850.control.ControlError(*values)[source]

Control error codes for IEC 61850 control operations.

These values indicate the error category for a failed control request or response.

Added in version 0.2.4.

NO_ERROR = 0

No error occurred during control execution.

UNKNOWN = 1

An unknown error occurred.

TIMEOUT = 2

The control operation timed out.

OPERATOR_TEST_FAIL = 3

The operation failed during an operator test.

class icspacket.proto.iec61850.control.Cause(*values)[source]

Detailed causes for IEC 61850 control operation responses.

Added in version 0.2.4.

exception icspacket.proto.iec61850.control.LastApplError(ctrl_obj: str, error: ControlError, ctlnum: int, cause: Cause, *args: object)[source]

Exception representing the LastApplError diagnostic from IEC 61850 control services.

Raised when a control service returns an error response containing both a control error and a cause.

Added in version 0.2.4.

Parameters:
  • ctrl_obj (str) – The control object reference string.

  • error (ControlError) – The control error category.

  • ctlnum (int) – The control number associated with the request.

  • cause (Cause) – Detailed cause of the error.

class icspacket.proto.iec61850.control.ControlObject(ref: ObjectReference, spec: TypeDescription, model: ControlModel)[source]

Represents an IEC 61850 control object reference.

Provides access to control object properties, origin parameters, and the ability to generate operate data structures for issuing control commands.

Implements context manager protocol for safe usage in connection-based operations.

Added in version 0.2.4.

Parameters:
  • ref (ObjectReference) – The object reference for the control point.

  • spec (TypeDescription) – ASN.1 type description of the control object.

  • model (ControlModel) – Control model (e.g., DIRECT_NORMAL or SBO_ENHANCED).

origin_cat: int

Origin category (integer identifier of the source).

origin_ident: bytes | None

Origin identifier (client or system identifier).

ctl_num: int

Control number for tracking SBO and direct operations.

test: bool

Test flag indicating test vs. normal operation.

interlock_check: bool

Enable or disable interlock condition checking.

synchro_check: bool

Enable or disable synchrocheck condition checking.

property ctrl_object_ref: ObjectReference

Reference to the underlying control object node.

property has_time_activated_oper: bool

Whether this control object supports time-activated operate requests.

property has_ctl_num: bool

Whether this control object includes a control number field.

property model: ControlModel

Return the configured control model for this object.

origin() list[dict[str, int | bytes]][source]

Return the origin structure as defined in IEC 61850-7-2.

Returns:

Origin information consisting of category and identifier.

Return type:

list[dict[str, int | bytes]]

get_operate_data(ctl_val: Any, oper_time: Timestamp | None = None, check=True) Data[source]

Construct an MMS Data structure representing an operate request.

The resulting structure includes mandatory control fields such as ctlVal, T, origin, and optionally operTm, ctlNum, Test, and Check.

Parameters:
  • ctl_val (Any) – The control value to apply.

  • oper_time (Timestamp | None) – Optional timestamp for time-activated control.

  • check (bool) – Whether to include interlock and synchrocheck parameters.

Returns:

ASN.1 encoded Data structure for the operate request.

Return type:

Data

property T: Timestamp

Return the current control timestamp (T).

Returns:

Timestamp of the control request.

Return type:

Timestamp