Information Object Library#
The per-Type-ID information-object catalog: reusable field-level elements
(elements, e.g. SIQ/DIQ/QDS/VTI),
the structs built from them for each ASDU Type-ID
(information, e.g. M_SP_NA_1,
M_ME_NB_1, C_SC_NA_1), and the registry that maps a
TypeID to its struct
(coding).
Information elements: the reusable field-level building blocks that the
per-Type-ID structs in icspacket.proto.iec104.objects.information are
composed from.
- class icspacket.proto.iec104.objects.elements.BCR(*, value: int = 0, flags: int = 0)[source]#
Binary Counter Reading (BCR).
Unlike
NVA/SVA/R32, the standard defines BCR as a single fused 5-octet element (counter value plus its own sequence/carry/adjusted/invalid flags) rather than a bare value expected to be paired with a separateQDS. (See IEC 60870-5-101, clause 7.2.6.9)- value: int = 0#
32-bit signed binary counter value.
- flags: int = 0#
Raw flags octet: bit 7 = invalid, bit 6 = adjusted, bit 5 = carry, bits 0-4 = sequence number.
- property invalid: bool#
Invalid: the counter value is not valid.
- property adjusted: bool#
Adjusted: the counter value was adjusted (e.g. after a clock sync).
- property carry: bool#
Carry: an overflow occurred since the last freeze/reset.
- property sequence: int#
Sequence number, incremented on every freeze/reset.
- icspacket.proto.iec104.objects.elements.BSI32#
Bitstring of 32 bit (BSI) - a bare 32-bit bitstring value. (See IEC 60870-5-101, clause 7.2.6.13)
alias of
Annotated[int, <int32>]
- class icspacket.proto.iec104.objects.elements.COI(i: bool = False, cause: int = 0)[source]#
Cause Of Initialization (COI) - carried by
M_EI_NA_1(end of initialization). (See IEC 60870-5-101, clause 7.2.6.21)- i: bool = False#
Trueif (re)initialization was caused by a local change of parameters;Falsefor a plain (re)start.
- class icspacket.proto.iec104.objects.elements.DCO(se: bool = False, qu: int = QOC.NO_ADDITIONAL_DEFINITION, dcs: int = DoublePointValue.INTERMEDIATE)[source]#
Double Command (DCO). (See IEC 60870-5-101, clause 7.2.6.16)
- se: bool = False#
Select/Execute.
- dcs: int = 0#
Double command state, see
DoublePointValue.
- class icspacket.proto.iec104.objects.elements.DIQ(iv: bool = False, nt: bool = False, sb: bool = False, bl: bool = False, reserved: int = 0, dpi: int = DoublePointValue.INTERMEDIATE)[source]#
Double-point Information with quality descriptor (DIQ). (See IEC 60870-5-101, clause 7.2.6.2)
- iv: bool = False#
Invalid.
- nt: bool = False#
Not topical.
- sb: bool = False#
Substituted.
- bl: bool = False#
Blocked.
- reserved: int = 0#
Reserved, always transmitted as 0.
- dpi: int = 0#
Double-point information value, see
DoublePointValue.
- icspacket.proto.iec104.objects.elements.NVA#
Normalized value (NVA) - a bare 16-bit signed fixed-point value spanning the range -1 (0x8000) to 1 - 2^-15 (0x7FFF). (See IEC 60870-5-101, clause 7.2.6.6)
alias of
Annotated[int, <int16>]
- icspacket.proto.iec104.objects.elements.QCC#
Qualifier Of Counter interrogation Command (QCC) - a bare octet built by OR-ing a
QCC_Freezevalue (already pre-shifted into bits 6-7) with aQCC_Requestvalue (bits 0-5), e.g.int(QCC_Freeze.FREEZE_WITH_RESET) | int(QCC_Request.GENERAL). (See IEC 60870-5-101, clause 7.2.6.23)alias of
Annotated[int, <int8>]
- class icspacket.proto.iec104.objects.elements.QDP(iv: bool = False, nt: bool = False, sb: bool = False, bl: bool = False, ei: bool = False, reserved: int = 0)[source]#
Quality Descriptor for events of Protection equipment (QDP), used as a standalone element alongside
StartEvent/OutputCircuitInfo. (See IEC 60870-5-101, clause 7.2.6.4)- iv: bool = False#
Invalid.
- nt: bool = False#
Not topical.
- sb: bool = False#
Substituted.
- bl: bool = False#
Blocked.
- ei: bool = False#
Elapsed time invalid.
- reserved: int = 0#
Reserved, always transmitted as 0.
- class icspacket.proto.iec104.objects.elements.QDS(iv: bool = False, nt: bool = False, sb: bool = False, bl: bool = False, reserved: int = 0, ov: bool = False)[source]#
Quality Descriptor (QDS), used as a standalone element following a bare value (e.g.
NVA,SVA,R32,BSI32). (See IEC 60870-5-101, clause 7.2.6.3)- iv: bool = False#
Invalid.
- nt: bool = False#
Not topical.
- sb: bool = False#
Substituted.
- bl: bool = False#
Blocked.
- reserved: int = 0#
Reserved, always transmitted as 0.
- ov: bool = False#
Overflow: the value is beyond its representable range.
- class icspacket.proto.iec104.objects.elements.QOS(se: bool = False, ql: int = 0)[source]#
Qualifier Of Set-point command (QOS).
Accompanies
C_SE_NA_1/NB_1/NC_1set-point commands. UnlikeQOC, the qualifier value (ql) has no broadly standardized enumeration beyond0(default/no additional definition) - it is left as a plain integer rather than an enum. (See IEC 60870-5-101, clause 7.2.6.39)- se: bool = False#
Select/Execute.
- ql: int = 0#
Qualifier value;
0means “default”, other values are reserved/vendor-specific.
- class icspacket.proto.iec104.objects.elements.QPM(pop: bool = False, lpc: bool = False, kpa: int = 0)[source]#
Qualifier of Parameter of Measured value (QPM). (See IEC 60870-5-101, clause 7.2.6.24)
- pop: bool = False#
Parameter Operation:
Truemeans the parameter is currently not in operation.
- lpc: bool = False#
Local Parameter Change: the parameter was changed locally at the outstation since the last transmission.
- icspacket.proto.iec104.objects.elements.R32#
Short floating point number (R32/FLT) - IEEE 754 single-precision. (See IEC 60870-5-101, clause 7.2.6.8)
alias of
Annotated[float, <float32>]
- class icspacket.proto.iec104.objects.elements.RCO(se: bool = False, qu: int = QOC.NO_ADDITIONAL_DEFINITION, rcs: int = StepCommandValue.INVALID_0)[source]#
Regulating step Command (RCO). (See IEC 60870-5-101, clause 7.2.6.17)
- se: bool = False#
Select/Execute.
- rcs: int = 0#
Regulating step command state, see
StepCommandValue.
- class icspacket.proto.iec104.objects.elements.SCD(status: int = 0, changed: int = 0)[source]#
Status and status Change Detection (SCD) - 16 packed single-point statuses plus their change-detection flags, used by
M_PS_NA_1. (See IEC 60870-5-101, clause 7.2.6.40)- status: int = 0#
Bit
n(0-15) is the current status of pointnin the group.
- changed: int = 0#
Bit
n(0-15) is set if pointn’s status changed since the last transmission.
- class icspacket.proto.iec104.objects.elements.SCO(se: bool = False, qu: int = QOC.NO_ADDITIONAL_DEFINITION, reserved: bool = 0, scs: bool = False)[source]#
Single Command (SCO). (See IEC 60870-5-101, clause 7.2.6.15)
- se: bool = False#
Select/Execute:
Trueselects the command for later execution (see clause 7.2.7 select-before-operate);Falseexecutes directly.
- reserved: bool = 0#
Reserved, always transmitted as 0.
- scs: bool = False#
Single command state (the commanded on/off value).
- class icspacket.proto.iec104.objects.elements.SEP(iv: bool = False, nt: bool = False, sb: bool = False, bl: bool = False, ei: bool = False, reserved: bool = 0, es: int = DoublePointValue.INTERMEDIATE)[source]#
Single Event of Protection equipment (SEP).
Unlike
StartEvent/OutputCircuitInfo(which are transmitted as a bit-flag byte alongside a separateQDPbyte), SEP fuses a 2-bit event state withQDP’s quality bits into one byte - matching the standard’s own definition of SEP as a single element (mirrorsSIQ/DIQ’s value+quality fusion). (See IEC 60870-5-101, clause 7.2.6.10)- iv: bool = False#
Invalid.
- nt: bool = False#
Not topical.
- sb: bool = False#
Substituted.
- bl: bool = False#
Blocked.
- ei: bool = False#
Elapsed time invalid.
- reserved: bool = 0#
Reserved, always transmitted as 0.
- es: int = 0#
Event state (reuses
DoublePointValue’s numbering: 0=indeterminate, 1=off, 2=on, 3=indeterminate).
- class icspacket.proto.iec104.objects.elements.SIQ(iv: bool = False, nt: bool = False, sb: bool = False, bl: bool = False, reserved: int = 0, spi: bool = False)[source]#
Single-point Information with quality descriptor (SIQ). (See IEC 60870-5-101, clause 7.2.6.1)
- iv: bool = False#
Invalid: the value is not correctly determined by the source.
- nt: bool = False#
Not topical: the most recent update was not received.
- sb: bool = False#
Substituted: the value was provided by input of an operator/automatic source instead of the process.
- bl: bool = False#
Blocked: the value is blocked from transmission/update at the source (e.g. maintenance).
- reserved: int = 0#
Reserved, always transmitted as 0.
- spi: bool = False#
Single-point information value (the actual on/off state).
- icspacket.proto.iec104.objects.elements.SVA#
Scaled value (SVA) - a bare 16-bit signed integer value. (See IEC 60870-5-101, clause 7.2.6.7)
alias of
Annotated[int, <int16>]
- class icspacket.proto.iec104.objects.elements.VTI(*, octet: int = 0)[source]#
Value with Transient state Indication (VTI) - a transformer/tap-changer step position.
The raw octet packs a signed 7-bit step position with the transient flag at bit 7; since
bitfield()sub-byte fields only support unsigned values (seeraw_value), the signed value is exposed via thevalueproperty using the same +/-128 wraparound rule as the reference implementations. (See IEC 60870-5-101, clause 7.2.6.5)- octet: int = 0#
Raw octet: bit 7 = transient flag, bits 0-6 = unsigned step position.
- property transient: bool#
Whether the addressed device is currently in a transient (moving) state.
- property raw_value: int#
Unsigned 7-bit step position (0-127), as transmitted on the wire.
- property value: int#
Signed step position (-64..63).
- icspacket.proto.iec104.objects.elements.CP16Time2a#
Two-octet binary time (CP16Time2a) - a bare elapsed-time value in milliseconds (0-65535), with no validity flag. Used by protection- equipment elapsed-time fields and
C_CD_NA_1. (See IEC 60870-5-101, clause 7.2.6.20)alias of
Annotated[int, <int16>]
- class icspacket.proto.iec104.objects.elements.CP24Time2a(*, milliseconds: int = 0, octet3: int = 0)[source]#
Three-octet binary time CP24Time2a. (See IEC 60870-5-101, clause 7.2.6.19)
- milliseconds: int = 0#
Milliseconds within the current minute (0-59999); combines both the seconds and millisecond parts, see
second/millisecond.
- octet3: int = 0#
Raw octet: bit 7 = invalid, bit 6 = substituted, bits 0-5 = minute.
- property second: int#
The whole-seconds part of
milliseconds.
- property millisecond: int#
The sub-second remainder part of
milliseconds.
- property minute: int#
Minute within the hour (0-59).
- property substituted: bool#
The value was provided by input of an operator/automatic source.
- property invalid: bool#
Invalid: the value is not correctly determined by the source.
- class icspacket.proto.iec104.objects.elements.CP56Time2a(*, milliseconds: int = 0, octet3: int = 0, octet4: int = 0, octet5: int = 1, octet6: int = 1, octet7: int = 0)[source]#
Seven-octet binary time CP56Time2a - the 104-preferred, fully-qualified time tag (date plus time-of-day). (See IEC 60870-5-101, clause 7.2.6.18)
- milliseconds: int = 0#
Milliseconds within the current minute (0-59999); combines both the seconds and millisecond parts, see
second/millisecond.
- octet3: int = 0#
Raw octet: bit 7 = invalid, bit 6 = substituted, bits 0-5 = minute.
- octet4: int = 0#
Raw octet: bit 7 = summer time, bits 5-6 = reserved, bits 0-4 = hour.
- octet5: int = 1#
Raw octet: bits 5-7 = day of week, bits 0-4 = day of month.
- octet6: int = 1#
Raw octet: bits 4-7 = reserved, bits 0-3 = month.
- octet7: int = 0#
Raw octet: bit 7 = reserved, bits 0-6 = year.
- property second: int#
The whole-seconds part of
milliseconds.
- property millisecond: int#
The sub-second remainder part of
milliseconds.
- property minute: int#
Minute within the hour (0-59).
- property substituted: bool#
The value was provided by input of an operator/automatic source.
- property invalid: bool#
Invalid: the value is not correctly determined by the source.
- property hour: int#
Hour within the day (0-23).
- property summer_time: bool#
Daylight saving/summer time is in effect.
- property day_of_month: int#
Day of the month (1-31).
- property day_of_week: int#
ISO-8601 day of the week (1=Monday..7=Sunday);
0if unused.
- property month: int#
Month within the year (1-12).
- property year: int#
Year within the century (0-99), relative to a locally-configured reference century.
- classmethod from_datetime(dt: datetime) CP56Time2a[source]#
Build a
CP56Time2afrom adatetime.datetime.- Parameters:
dt (datetime.datetime) – The timestamp to encode; only
second/microsecondthroughyearare used (invalid/substituted/summer_timeall default toFalse).- Returns:
The encoded timestamp.
- class icspacket.proto.iec104.objects.elements.OutputCircuitInfo(*values)[source]#
Output Circuit Information (OCI) bit flags - which phase(s) a protective relay commanded its output circuit(s) on. (See IEC 60870-5-101, clause 7.2.6.12)
- GC = 1#
General command to output circuit.
- CL1 = 2#
Command to output circuit, phase L1.
- CL2 = 4#
Command to output circuit, phase L2.
- CL3 = 8#
Command to output circuit, phase L3.
- class icspacket.proto.iec104.objects.elements.StartEvent(*values)[source]#
Start Event of protection equipment (SPE) bit flags - which phase(s) of a protective relay started operating. (See IEC 60870-5-101, clause 7.2.6.11)
- GS = 1#
General start of operation.
- SL1 = 2#
Start of operation, phase L1.
- SL2 = 4#
Start of operation, phase L2.
- SL3 = 8#
Start of operation, phase L3.
- SIE = 16#
Start of operation, IE (earth current).
- SRD = 32#
Start of operation in reverse direction.
Per-Type-ID information-object structs.
Each class here models the information-object payload of exactly one ASDU
Type-ID (see icspacket.proto.iec104.const.TypeID), composed from
the reusable primitives in icspacket.proto.iec104.objects.elements.
Every class self-registers with
icspacket.proto.iec104.objects.coding.asdu_type() at import time.
Field order matches wire order: a value/status element first, its
QDS quality descriptor
(when the standard keeps it separate) second, and a time tag
(CP56Time2a or
CP16Time2a) last.
Not implemented yet:
file-transfer types (F_*, 120-126), the S_* security-extension
types, and legacy CP24Time2a-tagged monitor types (M_*_TA_1, the
101-only time form superseded by CP56Time2a in 104 deployments).
- class icspacket.proto.iec104.objects.information.Bitstring32(*, value: int = 0, quality: QDS = <factory>)[source]#
Bitstring of 32 bit.
- class icspacket.proto.iec104.objects.information.Bitstring32Command(*, value: int = 0)[source]#
Bitstring of 32 bit command.
- value: int = 0#
See
BSI32. Bare - unlikeBitstring32, noQDSfollows for this Type-ID.
- class icspacket.proto.iec104.objects.information.Bitstring32CommandWithCP56Time2a(*, value: int = 0, timestamp: CP56Time2a = <factory>)[source]#
Bitstring of 32 bit command with CP56Time2a time tag.
- value: int = 0#
See
BSI32. Bare, seeBitstring32Command.
- timestamp: CP56Time2a#
See
CP56Time2a.
- class icspacket.proto.iec104.objects.information.Bitstring32WithCP56Time2a(*, value: int = 0, quality: QDS = <factory>, timestamp: CP56Time2a = <factory>)[source]#
Bitstring of 32 bit with CP56Time2a time tag.
- timestamp: CP56Time2a#
See
CP56Time2a.
- class icspacket.proto.iec104.objects.information.ClockSynchronizationCommand(*, timestamp: CP56Time2a = <factory>)[source]#
Clock synchronization command.
- timestamp: CP56Time2a#
See
CP56Time2a.
- class icspacket.proto.iec104.objects.information.CounterInterrogationCommand(*, qualifier: int = 0)[source]#
Counter interrogation command.
- class icspacket.proto.iec104.objects.information.DelayAcquisitionCommand(*, delay: int = 0)[source]#
Delay acquisition command.
- delay: int = 0#
Transmission delay in milliseconds, see
CP16Time2a.
- class icspacket.proto.iec104.objects.information.DoubleCommand(*, command: DCO = <factory>)[source]#
Double command.
- class icspacket.proto.iec104.objects.information.DoubleCommandWithCP56Time2a(*, command: DCO = <factory>, timestamp: CP56Time2a = <factory>)[source]#
Double command with CP56Time2a time tag.
- timestamp: CP56Time2a#
See
CP56Time2a.
- class icspacket.proto.iec104.objects.information.DoublePointInformation(*, status: DIQ = <factory>)[source]#
Double-point information.
- class icspacket.proto.iec104.objects.information.DoublePointWithCP56Time2a(*, status: DIQ = <factory>, timestamp: CP56Time2a = <factory>)[source]#
Double-point information with CP56Time2a time tag.
- timestamp: CP56Time2a#
See
CP56Time2a.
- class icspacket.proto.iec104.objects.information.EndOfInitialization(*, cause: COI = <factory>)[source]#
End of initialization.
- class icspacket.proto.iec104.objects.information.EventOfProtectionEquipment(*, status: SEP = <factory>, elapsed_time: int = 0, timestamp: CP56Time2a = <factory>)[source]#
Event of protection equipment with CP56Time2a time tag.
- elapsed_time: int = 0#
Relay operating/elapsed time, see
CP16Time2a.
- timestamp: CP56Time2a#
See
CP56Time2a.
- class icspacket.proto.iec104.objects.information.IntegratedTotals(*, value: BCR = <factory>)[source]#
Integrated totals.
- class icspacket.proto.iec104.objects.information.IntegratedTotalsWithCP56Time2a(*, value: BCR = <factory>, timestamp: CP56Time2a = <factory>)[source]#
Integrated totals with CP56Time2a time tag.
- timestamp: CP56Time2a#
See
CP56Time2a.
- class icspacket.proto.iec104.objects.information.InterrogationCommand(*, qualifier: QOI | int = QOI.STATION)[source]#
General interrogation command.
- class icspacket.proto.iec104.objects.information.MeasuredValueNormalized(*, value: int = 0, quality: QDS = <factory>)[source]#
Measured value, normalized value.
- class icspacket.proto.iec104.objects.information.MeasuredValueNormalizedNoQuality(*, value: int = 0)[source]#
Measured value, normalized value without quality descriptor.
- class icspacket.proto.iec104.objects.information.MeasuredValueNormalizedWithCP56Time2a(*, value: int = 0, quality: QDS = <factory>, timestamp: CP56Time2a = <factory>)[source]#
Measured value, normalized value with CP56Time2a time tag.
- timestamp: CP56Time2a#
See
CP56Time2a.
- class icspacket.proto.iec104.objects.information.MeasuredValueScaled(*, value: int = 0, quality: QDS = <factory>)[source]#
Measured value, scaled value.
- class icspacket.proto.iec104.objects.information.MeasuredValueScaledWithCP56Time2a(*, value: int = 0, quality: QDS = <factory>, timestamp: CP56Time2a = <factory>)[source]#
Measured value, scaled value with CP56Time2a time tag.
- timestamp: CP56Time2a#
See
CP56Time2a.
- class icspacket.proto.iec104.objects.information.MeasuredValueShort(*, value: float = 0.0, quality: QDS = <factory>)[source]#
Measured value, short floating point number.
- class icspacket.proto.iec104.objects.information.MeasuredValueShortWithCP56Time2a(*, value: float = 0.0, quality: QDS = <factory>, timestamp: CP56Time2a = <factory>)[source]#
Measured value, short floating point number with CP56Time2a time tag.
- timestamp: CP56Time2a#
See
CP56Time2a.
- class icspacket.proto.iec104.objects.information.PackedOutputCircuitInfo(*, info: OutputCircuitInfo | int = <OutputCircuitInfo: 0>, quality: QDP = <factory>, operating_time: int = 0, timestamp: CP56Time2a = <factory>)[source]#
Packed output circuit information of protection equipment with CP56Time2a time tag.
- info: OutputCircuitInfo | int = 0#
See
OutputCircuitInfo.
- operating_time: int = 0#
Relay operating time, see
CP16Time2a.
- timestamp: CP56Time2a#
See
CP56Time2a.
- class icspacket.proto.iec104.objects.information.PackedSinglePointWithSCD(*, status: SCD = <factory>, quality: QDS = <factory>)[source]#
Packed single-point information with status change detection.
- class icspacket.proto.iec104.objects.information.PackedStartEventsOfProtectionEquipment(*, events: StartEvent | int = <StartEvent: 0>, quality: QDP = <factory>, relay_duration: int = 0, timestamp: CP56Time2a = <factory>)[source]#
Packed start events of protection equipment with CP56Time2a time tag.
- events: StartEvent | int = 0#
See
StartEvent.
- relay_duration: int = 0#
Relay duration time, see
CP16Time2a.
- timestamp: CP56Time2a#
See
CP56Time2a.
- class icspacket.proto.iec104.objects.information.ParameterActivation(*, qualifier: QPA | int = QPA.NOT_USED)[source]#
Parameter activation.
- class icspacket.proto.iec104.objects.information.ParameterNormalizedValue(*, value: int = 0, qualifier: QPM = <factory>)[source]#
Parameter of measured value, normalized value.
- class icspacket.proto.iec104.objects.information.ParameterScaledValue(*, value: int = 0, qualifier: QPM = <factory>)[source]#
Parameter of measured value, scaled value.
- class icspacket.proto.iec104.objects.information.ParameterShortValue(*, value: float = 0.0, qualifier: QPM = <factory>)[source]#
Parameter of measured value, short floating point number.
- class icspacket.proto.iec104.objects.information.ReadCommand[source]#
Read command.
Carries no element payload at all - only the Information Object Address of the point being polled (modeled by the enclosing
InformationObject, not by this class).
- class icspacket.proto.iec104.objects.information.ResetProcessCommand(*, qualifier: QRP | int = QRP.NOT_USED)[source]#
Reset process command.
- class icspacket.proto.iec104.objects.information.SetpointCommandNormalized(*, value: int = 0, qualifier: QOS = <factory>)[source]#
Set-point command, normalized value.
- class icspacket.proto.iec104.objects.information.SetpointCommandNormalizedWithCP56Time2a(*, value: int = 0, qualifier: QOS = <factory>, timestamp: CP56Time2a = <factory>)[source]#
Set-point command, normalized value with CP56Time2a time tag.
- timestamp: CP56Time2a#
See
CP56Time2a.
- class icspacket.proto.iec104.objects.information.SetpointCommandScaled(*, value: int = 0, qualifier: QOS = <factory>)[source]#
Set-point command, scaled value.
- class icspacket.proto.iec104.objects.information.SetpointCommandScaledWithCP56Time2a(*, value: int = 0, qualifier: QOS = <factory>, timestamp: CP56Time2a = <factory>)[source]#
Set-point command, scaled value with CP56Time2a time tag.
- timestamp: CP56Time2a#
See
CP56Time2a.
- class icspacket.proto.iec104.objects.information.SetpointCommandShort(*, value: float = 0.0, qualifier: QOS = <factory>)[source]#
Set-point command, short floating point number.
- class icspacket.proto.iec104.objects.information.SetpointCommandShortWithCP56Time2a(*, value: float = 0.0, qualifier: QOS = <factory>, timestamp: CP56Time2a = <factory>)[source]#
Set-point command, short floating point number with CP56Time2a time tag.
- timestamp: CP56Time2a#
See
CP56Time2a.
- class icspacket.proto.iec104.objects.information.SingleCommand(*, command: SCO = <factory>)[source]#
Single command.
- class icspacket.proto.iec104.objects.information.SingleCommandWithCP56Time2a(*, command: SCO = <factory>, timestamp: CP56Time2a = <factory>)[source]#
Single command with CP56Time2a time tag.
- timestamp: CP56Time2a#
See
CP56Time2a.
- class icspacket.proto.iec104.objects.information.SinglePointInformation(*, status: SIQ = <factory>)[source]#
Single-point information.
- class icspacket.proto.iec104.objects.information.SinglePointWithCP56Time2a(*, status: SIQ = <factory>, timestamp: CP56Time2a = <factory>)[source]#
Single-point information with CP56Time2a time tag.
- timestamp: CP56Time2a#
See
CP56Time2a.
- class icspacket.proto.iec104.objects.information.StepCommand(*, command: RCO = <factory>)[source]#
Regulating step command.
- class icspacket.proto.iec104.objects.information.StepCommandWithCP56Time2a(*, command: RCO = <factory>, timestamp: CP56Time2a = <factory>)[source]#
Regulating step command with CP56Time2a time tag.
- timestamp: CP56Time2a#
See
CP56Time2a.
- class icspacket.proto.iec104.objects.information.StepPositionInformation(*, value: VTI = <factory>, quality: QDS = <factory>)[source]#
Step position information (transformer/tap-changer position).
- class icspacket.proto.iec104.objects.information.StepPositionWithCP56Time2a(*, value: VTI = <factory>, quality: QDS = <factory>, timestamp: CP56Time2a = <factory>)[source]#
Step position information with CP56Time2a time tag.
- timestamp: CP56Time2a#
See
CP56Time2a.
- class icspacket.proto.iec104.objects.information.TestCommand(*, fbp: int = 21930)[source]#
Test command.
Carries a Fixed test Bit Pattern (FBP) rather than any real value - used only to exercise the link without side effects. (See IEC 60870-5-101, clause 7.2.6.14)
- fbp: int = 21930#
Fixed test bit pattern; conventionally
0x55AA(wire bytesAA 55, little-endian) on both activation and confirmation.
- class icspacket.proto.iec104.objects.information.TestCommandWithCP56Time2a(*, fbp: int = 21930, timestamp: CP56Time2a = <factory>)[source]#
Test command with CP56Time2a time tag.
- fbp: int = 21930#
See
TestCommand.
- timestamp: CP56Time2a#
See
CP56Time2a.
This module implements the registry that maps an ASDU
TypeID to the information-element
struct used to encode/decode its objects, together with the SQ-aware
(sq)
packing/unpacking of a whole information-object list.
Every IEC 60870-5-101/104 ASDU Type-ID has exactly one on-the-wire
information-element layout, so the registry is keyed by a single
type_id value.
- icspacket.proto.iec104.objects.coding.IOA_STRUCT = <uint24>#
Wire format of an Information Object Address: an unsigned 24-bit little-endian integer. (See IEC 60870-5-101, clause 7.2.5)
- class icspacket.proto.iec104.objects.coding.InformationObject(ioa: int, element: Any)[source]#
A single decoded information object: its address plus payload.
elementholds whatever struct instance is registered for the owning ASDU’s Type-ID (e.g. anSIQforM_SP_NA_1).- ioa: int#
Information Object Address (0 - 16777215).
- element: Any#
The decoded information element, or
None/opaque bytes for unregistered Type-IDs.
- class icspacket.proto.iec104.objects.coding.ASDUType(type_id: TypeID, struct_ty: type | _StructLike, desc: str)[source]#
A single registered Type-ID -> information-element struct mapping.
- Parameters:
type_id – The ASDU Type-ID this entry describes.
struct_ty – The struct type/instance used to encode/decode a single information element for this Type-ID.
desc – Human-readable description (e.g.
"Single-point information").
- icspacket.proto.iec104.objects.coding.get_asdu_type(type_id: TypeID) ASDUType | None[source]#
Look up a registered information-element struct by Type-ID.
- Parameters:
type_id – The ASDU Type-ID to look up.
- Returns:
The registered entry, or
Noneiftype_idis not (yet) implemented.
- icspacket.proto.iec104.objects.coding.get_asdu_type_desc(type_id: TypeID | int) str | None[source]#
Retrieve the human-readable description of a Type-ID, if registered.
- icspacket.proto.iec104.objects.coding.register_asdu_type(type_id: TypeID, struct_ty: type | _StructLike, desc: str) ASDUType[source]#
Register the information-element struct used for a given Type-ID.
Most callers should use the
asdu_type()decorator instead, which derivesdescautomatically and calls this function under the hood; this is exposed directly for cases where a struct is registered without also being decorated (e.g. reusing one struct for several Type-IDs).- Parameters:
type_id – The ASDU Type-ID this entry describes.
struct_ty – The struct type/instance used to encode/decode a single information element for this Type-ID.
desc – Human-readable description.
- Returns:
The created registry entry.
- icspacket.proto.iec104.objects.coding.asdu_type(cls: type[_T]) type[_T][source]#
- icspacket.proto.iec104.objects.coding.asdu_type(cls: None = None) Callable[[type[_T]], type[_T]]
Decorator to register an information-object struct for its Type-ID.
Reads the Type-ID from the decorated class’
TYPE_IDattribute and the registry description from the first sentence of its docstring, then registers both viaregister_asdu_type().
- icspacket.proto.iec104.objects.coding.unpack_information_objects(type_id: TypeID, sq: bool, number: int, data: bytes) list[InformationObject][source]#
Decode the information-object list carried by an ASDU.
(See IEC 60870-5-101, clause 7.2.1 - structure of ASDU, for the SQ bit’s effect on Information Object Address repetition.)
- Parameters:
type_id – The owning ASDU’s Type-ID, selects which registered struct decodes each element.
sq – The owning ASDU’s VSQ
sqbit. WhenFalse, every object carries its own 3-octet IOA; whenTrue, only the first object does and subsequent objects useioa + 1,ioa + 2, …number – The owning ASDU’s VSQ
numberfield - how many objects to decode.data – Raw object bytes (an ASDU’s payload after its 6-octet header).
- Raises:
ValueError – If
type_idhas no registered information element struct.- Returns:
The decoded objects, always as a flat list regardless of the wire-level
sqgrouping.
- icspacket.proto.iec104.objects.coding.pack_information_objects(type_id: TypeID, objects: list[InformationObject], sq: bool = False) bytes[source]#
Encode an information-object list the way an ASDU carries it.
This is the inverse of
unpack_information_objects(); callers are responsible for keeping the owning ASDU’svsq.number/vsq.sqfields in sync withobjects/sq(seebuild(), which does this automatically).- Parameters:
type_id – The owning ASDU’s Type-ID, selects which registered struct encodes each element.
objects – The objects to encode, in wire order.
sq – Whether to use the sequential-address form (
True: only the first object’s IOA is written; every other object must haveioa == objects[0].ioa + index) or the individually-addressed form (False: every object writes its own IOA).
- Raises:
ValueError – If
type_idhas no registered information element struct, or (whensqisTrue) ifobjects’ IOAs are not contiguous.- Returns:
The encoded raw object bytes.