Control / Operation#
- class icspacket.proto.iec61850.control.ControlError(*values)[source]#
Outcome code the client decodes from the
errorfield of aLastApplErrordiagnostic for an IEC 61850 control request.Together with a
Cause, this tells the caller in what way a control request or response failed.Added in version 0.2.4.
- NO_ERROR = 0#
Indicates the control command completed without error.
- UNKNOWN = 1#
Indicates the failure reason could not be classified further.
- TIMEOUT = 2#
Indicates the control operation did not complete in time.
- OPERATOR_TEST_FAIL = 3#
Indicates the control operation failed while running as an operator test.
- class icspacket.proto.iec61850.control.Cause(*values)[source]#
Fine-grained reason the client decodes from the
causefield of aLastApplErrordiagnostic, alongside aControlError.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_NORMALorSBO_ENHANCED).
- origin_cat: int#
Numeric code for the source category, sent to the server as part of the origin block.
- origin_ident: bytes | None#
Byte-string naming or identifying the initiating client/system, sent together with
origin_cat.
- ctl_num: int#
Running counter that tracks SBO and direct control operations; advanced automatically for direct-operate models.
- test: bool#
Marks whether the server should treat this command as a test rather than a normal operation.
- interlock_check: bool#
Controls whether the interlock check is applied when the command executes.
- synchro_check: bool#
Controls whether the synchrocheck condition is applied when the command executes.
- 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.
- property ctl_val_type: str | None#
Return the ASN.1 Data CHOICE alternative name expected for
ctlVal(e.g."boolean","integer","visible_string"), orNoneif the control object has noOper.ctlValattribute.
- origin() list[dict[str, int | bytes]][source]#
Build the origin structure according to IEC 61850-7-2, used by
get_operate_data()when assembling a control request.- 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]#
Assemble the MMS
Datapayload written to a control object’sOperattribute to carry out an operate request.The value supplied in
ctl_valis combined with a freshTtimestamp and theoriginblock; depending on this control object’s capabilities and thecheckflag,operTm,ctlNum,Test, and/orCheckare folded in as well.