hat.drivers.iec60870.encodings.iec104

IEC 60870-5-104 messages

  1"""IEC 60870-5-104 messages"""
  2
  3from hat.drivers.iec60870.encodings.iec104.common import (
  4    AsduTypeError,
  5    TimeSize,
  6    Time,
  7    time_from_datetime,
  8    time_to_datetime,
  9    OriginatorAddress,
 10    AsduAddress,
 11    IoAddress,
 12    AsduType,
 13    CauseType,
 14    OtherCauseType,
 15    Cause,
 16    QualityType,
 17    IndicationQuality,
 18    MeasurementQuality,
 19    CounterQuality,
 20    ProtectionQuality,
 21    Quality,
 22    FreezeCode,
 23    SingleValue,
 24    DoubleValue,
 25    RegulatingValue,
 26    StepPositionValue,
 27    BitstringValue,
 28    NormalizedValue,
 29    ScaledValue,
 30    FloatingValue,
 31    BinaryCounterValue,
 32    ProtectionValue,
 33    ProtectionStartValue,
 34    ProtectionCommandValue,
 35    StatusValue,
 36    IoElement_M_SP_NA,
 37    IoElement_M_DP_NA,
 38    IoElement_M_ST_NA,
 39    IoElement_M_BO_NA,
 40    IoElement_M_ME_NA,
 41    IoElement_M_ME_NB,
 42    IoElement_M_ME_NC,
 43    IoElement_M_IT_NA,
 44    IoElement_M_PS_NA,
 45    IoElement_M_ME_ND,
 46    IoElement_M_SP_TB,
 47    IoElement_M_DP_TB,
 48    IoElement_M_ST_TB,
 49    IoElement_M_BO_TB,
 50    IoElement_M_ME_TD,
 51    IoElement_M_ME_TE,
 52    IoElement_M_ME_TF,
 53    IoElement_M_IT_TB,
 54    IoElement_M_EP_TD,
 55    IoElement_M_EP_TE,
 56    IoElement_M_EP_TF,
 57    IoElement_C_SC_NA,
 58    IoElement_C_DC_NA,
 59    IoElement_C_RC_NA,
 60    IoElement_C_SE_NA,
 61    IoElement_C_SE_NB,
 62    IoElement_C_SE_NC,
 63    IoElement_C_BO_NA,
 64    IoElement_M_EI_NA,
 65    IoElement_C_IC_NA,
 66    IoElement_C_CI_NA,
 67    IoElement_C_RD_NA,
 68    IoElement_C_CS_NA,
 69    IoElement_C_RP_NA,
 70    IoElement_P_ME_NA,
 71    IoElement_P_ME_NB,
 72    IoElement_P_ME_NC,
 73    IoElement_P_AC_NA,
 74    IoElement_F_FR_NA,
 75    IoElement_F_SR_NA,
 76    IoElement_F_SC_NA,
 77    IoElement_F_LS_NA,
 78    IoElement_F_AF_NA,
 79    IoElement_F_SG_NA,
 80    IoElement_F_DR_TA,
 81    IoElement_C_SC_TA,
 82    IoElement_C_DC_TA,
 83    IoElement_C_RC_TA,
 84    IoElement_C_SE_TA,
 85    IoElement_C_SE_TB,
 86    IoElement_C_SE_TC,
 87    IoElement_C_BO_TA,
 88    IoElement_C_TS_TA,
 89    IoElement,
 90    IO,
 91    ASDU)
 92from hat.drivers.iec60870.encodings.iec104.encoder import (
 93    iec101_asdu_types,
 94    Encoder)
 95
 96
 97__all__ = ['AsduTypeError',
 98           'TimeSize',
 99           'Time',
100           'time_from_datetime',
101           'time_to_datetime',
102           'OriginatorAddress',
103           'AsduAddress',
104           'IoAddress',
105           'AsduType',
106           'CauseType',
107           'OtherCauseType',
108           'Cause',
109           'QualityType',
110           'IndicationQuality',
111           'MeasurementQuality',
112           'CounterQuality',
113           'ProtectionQuality',
114           'Quality',
115           'FreezeCode',
116           'SingleValue',
117           'DoubleValue',
118           'RegulatingValue',
119           'StepPositionValue',
120           'BitstringValue',
121           'NormalizedValue',
122           'ScaledValue',
123           'FloatingValue',
124           'BinaryCounterValue',
125           'ProtectionValue',
126           'ProtectionStartValue',
127           'ProtectionCommandValue',
128           'StatusValue',
129           'IoElement_M_SP_NA',
130           'IoElement_M_DP_NA',
131           'IoElement_M_ST_NA',
132           'IoElement_M_BO_NA',
133           'IoElement_M_ME_NA',
134           'IoElement_M_ME_NB',
135           'IoElement_M_ME_NC',
136           'IoElement_M_IT_NA',
137           'IoElement_M_PS_NA',
138           'IoElement_M_ME_ND',
139           'IoElement_M_SP_TB',
140           'IoElement_M_DP_TB',
141           'IoElement_M_ST_TB',
142           'IoElement_M_BO_TB',
143           'IoElement_M_ME_TD',
144           'IoElement_M_ME_TE',
145           'IoElement_M_ME_TF',
146           'IoElement_M_IT_TB',
147           'IoElement_M_EP_TD',
148           'IoElement_M_EP_TE',
149           'IoElement_M_EP_TF',
150           'IoElement_C_SC_NA',
151           'IoElement_C_DC_NA',
152           'IoElement_C_RC_NA',
153           'IoElement_C_SE_NA',
154           'IoElement_C_SE_NB',
155           'IoElement_C_SE_NC',
156           'IoElement_C_BO_NA',
157           'IoElement_M_EI_NA',
158           'IoElement_C_IC_NA',
159           'IoElement_C_CI_NA',
160           'IoElement_C_RD_NA',
161           'IoElement_C_CS_NA',
162           'IoElement_C_RP_NA',
163           'IoElement_P_ME_NA',
164           'IoElement_P_ME_NB',
165           'IoElement_P_ME_NC',
166           'IoElement_P_AC_NA',
167           'IoElement_F_FR_NA',
168           'IoElement_F_SR_NA',
169           'IoElement_F_SC_NA',
170           'IoElement_F_LS_NA',
171           'IoElement_F_AF_NA',
172           'IoElement_F_SG_NA',
173           'IoElement_F_DR_TA',
174           'IoElement_C_SC_TA',
175           'IoElement_C_DC_TA',
176           'IoElement_C_RC_TA',
177           'IoElement_C_SE_TA',
178           'IoElement_C_SE_TB',
179           'IoElement_C_SE_TC',
180           'IoElement_C_BO_TA',
181           'IoElement_C_TS_TA',
182           'IoElement',
183           'IO',
184           'ASDU',
185           'iec101_asdu_types',
186           'Encoder']
class AsduTypeError(builtins.Exception):
12class AsduTypeError(Exception):
13    pass

Common base class for all non-exit exceptions.

class TimeSize(enum.Enum):
24class TimeSize(enum.Enum):
25    TWO = 2
26    THREE = 3
27    FOUR = 4
28    SEVEN = 7

An enumeration.

TWO = <TimeSize.TWO: 2>
THREE = <TimeSize.THREE: 3>
FOUR = <TimeSize.FOUR: 4>
SEVEN = <TimeSize.SEVEN: 7>
class Time(typing.NamedTuple):
31class Time(typing.NamedTuple):
32    size: TimeSize
33    milliseconds: int
34    """milliseconds in range [0, 59999]"""
35    invalid: bool | None
36    """available for size THREE, FOUR, SEVEN"""
37    minutes: int | None
38    """available for size THREE, FOUR, SEVEN (minutes in range [0, 59])"""
39    summer_time: bool | None
40    """available for size FOUR, SEVEN"""
41    hours: int | None
42    """available for size FOUR, SEVEN (hours in range [0, 23])"""
43    day_of_week: int | None
44    """available for size SEVEN (day_of_week in range [1, 7])"""
45    day_of_month: int | None
46    """available for size SEVEN (day_of_month in range [1, 31])"""
47    months: int | None
48    """available for size SEVEN (months in range [1, 12])"""
49    years: int | None
50    """available for size SEVEN (years in range [0, 99])"""

Time(size, milliseconds, invalid, minutes, summer_time, hours, day_of_week, day_of_month, months, years)

Time( size: TimeSize, milliseconds: int, invalid: bool | None, minutes: int | None, summer_time: bool | None, hours: int | None, day_of_week: int | None, day_of_month: int | None, months: int | None, years: int | None)

Create new instance of Time(size, milliseconds, invalid, minutes, summer_time, hours, day_of_week, day_of_month, months, years)

size: TimeSize

Alias for field number 0

milliseconds: int

milliseconds in range [0, 59999]

invalid: bool | None

available for size THREE, FOUR, SEVEN

minutes: int | None

available for size THREE, FOUR, SEVEN (minutes in range [0, 59])

summer_time: bool | None

available for size FOUR, SEVEN

hours: int | None

available for size FOUR, SEVEN (hours in range [0, 23])

day_of_week: int | None

available for size SEVEN (day_of_week in range [1, 7])

day_of_month: int | None

available for size SEVEN (day_of_month in range [1, 31])

months: int | None

available for size SEVEN (months in range [1, 12])

years: int | None

available for size SEVEN (years in range [0, 99])

def time_from_datetime( dt: datetime.datetime, invalid: bool = False) -> Time:
66def time_from_datetime(dt: datetime.datetime,
67                       invalid: bool = False
68                       ) -> Time:
69    """Create Time from datetime.datetime"""
70    # TODO document edge cases (local time, os implementation, ...)
71    #  rounding microseconds to the nearest millisecond
72    dt_rounded = (
73        dt.replace(microsecond=0) +
74        datetime.timedelta(milliseconds=round(dt.microsecond / 1000)))
75    local_time = time.localtime(dt_rounded.timestamp())
76
77    return Time(
78        size=TimeSize.SEVEN,
79        milliseconds=(local_time.tm_sec * 1000 +
80                      dt_rounded.microsecond // 1000),
81        invalid=invalid,
82        minutes=local_time.tm_min,
83        summer_time=bool(local_time.tm_isdst),
84        hours=local_time.tm_hour,
85        day_of_week=local_time.tm_wday + 1,
86        day_of_month=local_time.tm_mday,
87        months=local_time.tm_mon,
88        years=local_time.tm_year % 100)

Create Time from datetime.datetime

def time_to_datetime(t: Time) -> datetime.datetime:
 91def time_to_datetime(t: Time
 92                     ) -> datetime.datetime:
 93    """Convert Time to datetime.datetime"""
 94    # TODO document edge cases (local time, os implementation, ...)
 95    # TODO maybe allow diferent time size (use now for time)
 96    if t.size != TimeSize.SEVEN:
 97        raise ValueError('unsupported time size')
 98
 99    local_dt = datetime.datetime(
100        year=2000 + t.years if t.years < 70 else 1900 + t.years,
101        month=t.months,
102        day=t.day_of_month,
103        hour=t.hours,
104        minute=t.minutes,
105        second=int(t.milliseconds / 1000),
106        microsecond=(t.milliseconds % 1000) * 1000,
107        fold=not t.summer_time)
108
109    return local_dt.astimezone(tz=datetime.timezone.utc)

Convert Time to datetime.datetime

OriginatorAddress = <class 'int'>
AsduAddress = <class 'int'>
IoAddress = <class 'int'>
class AsduType(enum.Enum):
24class AsduType(enum.Enum):
25    M_SP_NA = iec101.AsduType.M_SP_NA.value
26    M_DP_NA = iec101.AsduType.M_DP_NA.value
27    M_ST_NA = iec101.AsduType.M_ST_NA.value
28    M_BO_NA = iec101.AsduType.M_BO_NA.value
29    M_ME_NA = iec101.AsduType.M_ME_NA.value
30    M_ME_NB = iec101.AsduType.M_ME_NB.value
31    M_ME_NC = iec101.AsduType.M_ME_NC.value
32    M_IT_NA = iec101.AsduType.M_IT_NA.value
33    M_PS_NA = iec101.AsduType.M_PS_NA.value
34    M_ME_ND = iec101.AsduType.M_ME_ND.value
35    M_SP_TB = iec101.AsduType.M_SP_TB.value
36    M_DP_TB = iec101.AsduType.M_DP_TB.value
37    M_ST_TB = iec101.AsduType.M_ST_TB.value
38    M_BO_TB = iec101.AsduType.M_BO_TB.value
39    M_ME_TD = iec101.AsduType.M_ME_TD.value
40    M_ME_TE = iec101.AsduType.M_ME_TE.value
41    M_ME_TF = iec101.AsduType.M_ME_TF.value
42    M_IT_TB = iec101.AsduType.M_IT_TB.value
43    M_EP_TD = iec101.AsduType.M_EP_TD.value
44    M_EP_TE = iec101.AsduType.M_EP_TE.value
45    M_EP_TF = iec101.AsduType.M_EP_TF.value
46    C_SC_NA = iec101.AsduType.C_SC_NA.value
47    C_DC_NA = iec101.AsduType.C_DC_NA.value
48    C_RC_NA = iec101.AsduType.C_RC_NA.value
49    C_SE_NA = iec101.AsduType.C_SE_NA.value
50    C_SE_NB = iec101.AsduType.C_SE_NB.value
51    C_SE_NC = iec101.AsduType.C_SE_NC.value
52    C_BO_NA = iec101.AsduType.C_BO_NA.value
53    C_SC_TA = 58
54    C_DC_TA = 59
55    C_RC_TA = 60
56    C_SE_TA = 61
57    C_SE_TB = 62
58    C_SE_TC = 63
59    C_BO_TA = 64
60    M_EI_NA = iec101.AsduType.M_EI_NA.value
61    C_IC_NA = iec101.AsduType.C_IC_NA.value
62    C_CI_NA = iec101.AsduType.C_CI_NA.value
63    C_RD_NA = iec101.AsduType.C_RD_NA.value
64    C_CS_NA = iec101.AsduType.C_CS_NA.value
65    C_RP_NA = iec101.AsduType.C_RP_NA.value
66    C_TS_TA = 107
67    P_ME_NA = iec101.AsduType.P_ME_NA.value
68    P_ME_NB = iec101.AsduType.P_ME_NB.value
69    P_ME_NC = iec101.AsduType.P_ME_NC.value
70    P_AC_NA = iec101.AsduType.P_AC_NA.value
71    F_FR_NA = iec101.AsduType.F_FR_NA.value
72    F_SR_NA = iec101.AsduType.F_SR_NA.value
73    F_SC_NA = iec101.AsduType.F_SC_NA.value
74    F_LS_NA = iec101.AsduType.F_LS_NA.value
75    F_AF_NA = iec101.AsduType.F_AF_NA.value
76    F_SG_NA = iec101.AsduType.F_SG_NA.value
77    F_DR_TA = iec101.AsduType.F_DR_TA.value

An enumeration.

M_SP_NA = <AsduType.M_SP_NA: 1>
M_DP_NA = <AsduType.M_DP_NA: 3>
M_ST_NA = <AsduType.M_ST_NA: 5>
M_BO_NA = <AsduType.M_BO_NA: 7>
M_ME_NA = <AsduType.M_ME_NA: 9>
M_ME_NB = <AsduType.M_ME_NB: 11>
M_ME_NC = <AsduType.M_ME_NC: 13>
M_IT_NA = <AsduType.M_IT_NA: 15>
M_PS_NA = <AsduType.M_PS_NA: 20>
M_ME_ND = <AsduType.M_ME_ND: 21>
M_SP_TB = <AsduType.M_SP_TB: 30>
M_DP_TB = <AsduType.M_DP_TB: 31>
M_ST_TB = <AsduType.M_ST_TB: 32>
M_BO_TB = <AsduType.M_BO_TB: 33>
M_ME_TD = <AsduType.M_ME_TD: 34>
M_ME_TE = <AsduType.M_ME_TE: 35>
M_ME_TF = <AsduType.M_ME_TF: 36>
M_IT_TB = <AsduType.M_IT_TB: 37>
M_EP_TD = <AsduType.M_EP_TD: 38>
M_EP_TE = <AsduType.M_EP_TE: 39>
M_EP_TF = <AsduType.M_EP_TF: 40>
C_SC_NA = <AsduType.C_SC_NA: 45>
C_DC_NA = <AsduType.C_DC_NA: 46>
C_RC_NA = <AsduType.C_RC_NA: 47>
C_SE_NA = <AsduType.C_SE_NA: 48>
C_SE_NB = <AsduType.C_SE_NB: 49>
C_SE_NC = <AsduType.C_SE_NC: 50>
C_BO_NA = <AsduType.C_BO_NA: 51>
C_SC_TA = <AsduType.C_SC_TA: 58>
C_DC_TA = <AsduType.C_DC_TA: 59>
C_RC_TA = <AsduType.C_RC_TA: 60>
C_SE_TA = <AsduType.C_SE_TA: 61>
C_SE_TB = <AsduType.C_SE_TB: 62>
C_SE_TC = <AsduType.C_SE_TC: 63>
C_BO_TA = <AsduType.C_BO_TA: 64>
M_EI_NA = <AsduType.M_EI_NA: 70>
C_IC_NA = <AsduType.C_IC_NA: 100>
C_CI_NA = <AsduType.C_CI_NA: 101>
C_RD_NA = <AsduType.C_RD_NA: 102>
C_CS_NA = <AsduType.C_CS_NA: 103>
C_RP_NA = <AsduType.C_RP_NA: 105>
C_TS_TA = <AsduType.C_TS_TA: 107>
P_ME_NA = <AsduType.P_ME_NA: 110>
P_ME_NB = <AsduType.P_ME_NB: 111>
P_ME_NC = <AsduType.P_ME_NC: 112>
P_AC_NA = <AsduType.P_AC_NA: 113>
F_FR_NA = <AsduType.F_FR_NA: 120>
F_SR_NA = <AsduType.F_SR_NA: 121>
F_SC_NA = <AsduType.F_SC_NA: 122>
F_LS_NA = <AsduType.F_LS_NA: 123>
F_AF_NA = <AsduType.F_AF_NA: 124>
F_SG_NA = <AsduType.F_SG_NA: 125>
F_DR_TA = <AsduType.F_DR_TA: 126>
class CauseType(enum.Enum):
 90class CauseType(enum.Enum):
 91    UNDEFINED = 0
 92    PERIODIC = 1
 93    BACKGROUND_SCAN = 2
 94    SPONTANEOUS = 3
 95    INITIALIZED = 4
 96    REQUEST = 5
 97    ACTIVATION = 6
 98    ACTIVATION_CONFIRMATION = 7
 99    DEACTIVATION = 8
100    DEACTIVATION_CONFIRMATION = 9
101    ACTIVATION_TERMINATION = 10
102    REMOTE_COMMAND = 11
103    LOCAL_COMMAND = 12
104    FILE_TRANSFER = 13
105    INTERROGATED_STATION = 20
106    INTERROGATED_GROUP01 = 21
107    INTERROGATED_GROUP02 = 22
108    INTERROGATED_GROUP03 = 23
109    INTERROGATED_GROUP04 = 24
110    INTERROGATED_GROUP05 = 25
111    INTERROGATED_GROUP06 = 26
112    INTERROGATED_GROUP07 = 27
113    INTERROGATED_GROUP08 = 28
114    INTERROGATED_GROUP09 = 29
115    INTERROGATED_GROUP10 = 30
116    INTERROGATED_GROUP11 = 31
117    INTERROGATED_GROUP12 = 32
118    INTERROGATED_GROUP13 = 33
119    INTERROGATED_GROUP14 = 34
120    INTERROGATED_GROUP15 = 35
121    INTERROGATED_GROUP16 = 36
122    INTERROGATED_COUNTER = 37
123    INTERROGATED_COUNTER01 = 38
124    INTERROGATED_COUNTER02 = 39
125    INTERROGATED_COUNTER03 = 40
126    INTERROGATED_COUNTER04 = 41
127    UNKNOWN_TYPE = 44
128    UNKNOWN_CAUSE = 45
129    UNKNOWN_ASDU_ADDRESS = 46
130    UNKNOWN_IO_ADDRESS = 47

An enumeration.

UNDEFINED = <CauseType.UNDEFINED: 0>
PERIODIC = <CauseType.PERIODIC: 1>
BACKGROUND_SCAN = <CauseType.BACKGROUND_SCAN: 2>
SPONTANEOUS = <CauseType.SPONTANEOUS: 3>
INITIALIZED = <CauseType.INITIALIZED: 4>
REQUEST = <CauseType.REQUEST: 5>
ACTIVATION = <CauseType.ACTIVATION: 6>
ACTIVATION_CONFIRMATION = <CauseType.ACTIVATION_CONFIRMATION: 7>
DEACTIVATION = <CauseType.DEACTIVATION: 8>
DEACTIVATION_CONFIRMATION = <CauseType.DEACTIVATION_CONFIRMATION: 9>
ACTIVATION_TERMINATION = <CauseType.ACTIVATION_TERMINATION: 10>
REMOTE_COMMAND = <CauseType.REMOTE_COMMAND: 11>
LOCAL_COMMAND = <CauseType.LOCAL_COMMAND: 12>
FILE_TRANSFER = <CauseType.FILE_TRANSFER: 13>
INTERROGATED_STATION = <CauseType.INTERROGATED_STATION: 20>
INTERROGATED_GROUP01 = <CauseType.INTERROGATED_GROUP01: 21>
INTERROGATED_GROUP02 = <CauseType.INTERROGATED_GROUP02: 22>
INTERROGATED_GROUP03 = <CauseType.INTERROGATED_GROUP03: 23>
INTERROGATED_GROUP04 = <CauseType.INTERROGATED_GROUP04: 24>
INTERROGATED_GROUP05 = <CauseType.INTERROGATED_GROUP05: 25>
INTERROGATED_GROUP06 = <CauseType.INTERROGATED_GROUP06: 26>
INTERROGATED_GROUP07 = <CauseType.INTERROGATED_GROUP07: 27>
INTERROGATED_GROUP08 = <CauseType.INTERROGATED_GROUP08: 28>
INTERROGATED_GROUP09 = <CauseType.INTERROGATED_GROUP09: 29>
INTERROGATED_GROUP10 = <CauseType.INTERROGATED_GROUP10: 30>
INTERROGATED_GROUP11 = <CauseType.INTERROGATED_GROUP11: 31>
INTERROGATED_GROUP12 = <CauseType.INTERROGATED_GROUP12: 32>
INTERROGATED_GROUP13 = <CauseType.INTERROGATED_GROUP13: 33>
INTERROGATED_GROUP14 = <CauseType.INTERROGATED_GROUP14: 34>
INTERROGATED_GROUP15 = <CauseType.INTERROGATED_GROUP15: 35>
INTERROGATED_GROUP16 = <CauseType.INTERROGATED_GROUP16: 36>
INTERROGATED_COUNTER = <CauseType.INTERROGATED_COUNTER: 37>
INTERROGATED_COUNTER01 = <CauseType.INTERROGATED_COUNTER01: 38>
INTERROGATED_COUNTER02 = <CauseType.INTERROGATED_COUNTER02: 39>
INTERROGATED_COUNTER03 = <CauseType.INTERROGATED_COUNTER03: 40>
INTERROGATED_COUNTER04 = <CauseType.INTERROGATED_COUNTER04: 41>
UNKNOWN_TYPE = <CauseType.UNKNOWN_TYPE: 44>
UNKNOWN_CAUSE = <CauseType.UNKNOWN_CAUSE: 45>
UNKNOWN_ASDU_ADDRESS = <CauseType.UNKNOWN_ASDU_ADDRESS: 46>
UNKNOWN_IO_ADDRESS = <CauseType.UNKNOWN_IO_ADDRESS: 47>
OtherCauseType = <class 'int'>
class Cause(typing.NamedTuple):
133class Cause(typing.NamedTuple):
134    type: CauseType | OtherCauseType
135    is_negative_confirm: bool
136    is_test: bool
137    originator_address: OriginatorAddress

Cause(type, is_negative_confirm, is_test, originator_address)

Cause( type: CauseType | int, is_negative_confirm: bool, is_test: bool, originator_address: int)

Create new instance of Cause(type, is_negative_confirm, is_test, originator_address)

type: CauseType | int

Alias for field number 0

is_negative_confirm: bool

Alias for field number 1

is_test: bool

Alias for field number 2

originator_address: int

Alias for field number 3

class QualityType(enum.Enum):
140class QualityType(enum.Enum):
141    INDICATION = 0
142    MEASUREMENT = 1
143    COUNTER = 2
144    PROTECTION = 3

An enumeration.

INDICATION = <QualityType.INDICATION: 0>
MEASUREMENT = <QualityType.MEASUREMENT: 1>
COUNTER = <QualityType.COUNTER: 2>
PROTECTION = <QualityType.PROTECTION: 3>
class IndicationQuality(typing.NamedTuple):
147class IndicationQuality(typing.NamedTuple):
148    invalid: bool
149    not_topical: bool
150    substituted: bool
151    blocked: bool

IndicationQuality(invalid, not_topical, substituted, blocked)

IndicationQuality(invalid: bool, not_topical: bool, substituted: bool, blocked: bool)

Create new instance of IndicationQuality(invalid, not_topical, substituted, blocked)

invalid: bool

Alias for field number 0

not_topical: bool

Alias for field number 1

substituted: bool

Alias for field number 2

blocked: bool

Alias for field number 3

class MeasurementQuality(typing.NamedTuple):
154class MeasurementQuality(typing.NamedTuple):
155    invalid: bool
156    not_topical: bool
157    substituted: bool
158    blocked: bool
159    overflow: bool

MeasurementQuality(invalid, not_topical, substituted, blocked, overflow)

MeasurementQuality( invalid: bool, not_topical: bool, substituted: bool, blocked: bool, overflow: bool)

Create new instance of MeasurementQuality(invalid, not_topical, substituted, blocked, overflow)

invalid: bool

Alias for field number 0

not_topical: bool

Alias for field number 1

substituted: bool

Alias for field number 2

blocked: bool

Alias for field number 3

overflow: bool

Alias for field number 4

class CounterQuality(typing.NamedTuple):
162class CounterQuality(typing.NamedTuple):
163    invalid: bool
164    adjusted: bool
165    overflow: bool
166    sequence: int
167    """sequence in range [0, 31]"""

CounterQuality(invalid, adjusted, overflow, sequence)

CounterQuality(invalid: bool, adjusted: bool, overflow: bool, sequence: int)

Create new instance of CounterQuality(invalid, adjusted, overflow, sequence)

invalid: bool

Alias for field number 0

adjusted: bool

Alias for field number 1

overflow: bool

Alias for field number 2

sequence: int

sequence in range [0, 31]

class ProtectionQuality(typing.NamedTuple):
170class ProtectionQuality(typing.NamedTuple):
171    invalid: bool
172    not_topical: bool
173    substituted: bool
174    blocked: bool
175    time_invalid: bool

ProtectionQuality(invalid, not_topical, substituted, blocked, time_invalid)

ProtectionQuality( invalid: bool, not_topical: bool, substituted: bool, blocked: bool, time_invalid: bool)

Create new instance of ProtectionQuality(invalid, not_topical, substituted, blocked, time_invalid)

invalid: bool

Alias for field number 0

not_topical: bool

Alias for field number 1

substituted: bool

Alias for field number 2

blocked: bool

Alias for field number 3

time_invalid: bool

Alias for field number 4

class FreezeCode(enum.Enum):
184class FreezeCode(enum.Enum):
185    READ = 0
186    FREEZE = 1
187    FREEZE_AND_RESET = 2
188    RESET = 3

An enumeration.

READ = <FreezeCode.READ: 0>
FREEZE = <FreezeCode.FREEZE: 1>
FREEZE_AND_RESET = <FreezeCode.FREEZE_AND_RESET: 2>
RESET = <FreezeCode.RESET: 3>
class SingleValue(enum.Enum):
191class SingleValue(enum.Enum):
192    OFF = 0
193    ON = 1

An enumeration.

OFF = <SingleValue.OFF: 0>
ON = <SingleValue.ON: 1>
class DoubleValue(enum.Enum):
196class DoubleValue(enum.Enum):
197    """DoubleDataValue
198
199    `FAULT` stands for value 3, defined in the protocol as *INDETERMINATE*.
200    This is in order to make it more distinguishable from ``INTERMEDIATE``.
201
202    """
203    INTERMEDIATE = 0
204    OFF = 1
205    ON = 2
206    FAULT = 3

DoubleDataValue

FAULT stands for value 3, defined in the protocol as INDETERMINATE. This is in order to make it more distinguishable from INTERMEDIATE.

INTERMEDIATE = <DoubleValue.INTERMEDIATE: 0>
OFF = <DoubleValue.OFF: 1>
ON = <DoubleValue.ON: 2>
FAULT = <DoubleValue.FAULT: 3>
class RegulatingValue(enum.Enum):
209class RegulatingValue(enum.Enum):
210    LOWER = 1
211    HIGHER = 2

An enumeration.

LOWER = <RegulatingValue.LOWER: 1>
HIGHER = <RegulatingValue.HIGHER: 2>
class StepPositionValue(typing.NamedTuple):
214class StepPositionValue(typing.NamedTuple):
215    value: int
216    """value in range [-64, 63]"""
217    transient: bool

StepPositionValue(value, transient)

StepPositionValue(value: int, transient: bool)

Create new instance of StepPositionValue(value, transient)

value: int

value in range [-64, 63]

transient: bool

Alias for field number 1

class BitstringValue(typing.NamedTuple):
220class BitstringValue(typing.NamedTuple):
221    value: util.Bytes
222    """bitstring encoded as 4 bytes"""

BitstringValue(value,)

BitstringValue(value: bytes | bytearray | memoryview)

Create new instance of BitstringValue(value,)

value: bytes | bytearray | memoryview

bitstring encoded as 4 bytes

class NormalizedValue(typing.NamedTuple):
225class NormalizedValue(typing.NamedTuple):
226    value: float
227    """value in range [-1.0, 1.0)"""

NormalizedValue(value,)

NormalizedValue(value: float)

Create new instance of NormalizedValue(value,)

value: float

value in range [-1.0, 1.0)

class ScaledValue(typing.NamedTuple):
230class ScaledValue(typing.NamedTuple):
231    value: int
232    """value in range [-2^15, 2^15-1]"""

ScaledValue(value,)

ScaledValue(value: int)

Create new instance of ScaledValue(value,)

value: int

value in range [-2^15, 2^15-1]

class FloatingValue(typing.NamedTuple):
235class FloatingValue(typing.NamedTuple):
236    value: float

FloatingValue(value,)

FloatingValue(value: float)

Create new instance of FloatingValue(value,)

value: float

Alias for field number 0

class BinaryCounterValue(typing.NamedTuple):
239class BinaryCounterValue(typing.NamedTuple):
240    value: int
241    """value in range [-2^31, 2^31-1]"""

BinaryCounterValue(value,)

BinaryCounterValue(value: int)

Create new instance of BinaryCounterValue(value,)

value: int

value in range [-2^31, 2^31-1]

class ProtectionValue(enum.Enum):
244class ProtectionValue(enum.Enum):
245    OFF = 1
246    ON = 2

An enumeration.

OFF = <ProtectionValue.OFF: 1>
ON = <ProtectionValue.ON: 2>
class ProtectionStartValue(typing.NamedTuple):
249class ProtectionStartValue(typing.NamedTuple):
250    general: bool
251    l1: bool
252    l2: bool
253    l3: bool
254    ie: bool
255    reverse: bool

ProtectionStartValue(general, l1, l2, l3, ie, reverse)

ProtectionStartValue(general: bool, l1: bool, l2: bool, l3: bool, ie: bool, reverse: bool)

Create new instance of ProtectionStartValue(general, l1, l2, l3, ie, reverse)

general: bool

Alias for field number 0

l1: bool

Alias for field number 1

l2: bool

Alias for field number 2

l3: bool

Alias for field number 3

ie: bool

Alias for field number 4

reverse: bool

Alias for field number 5

class ProtectionCommandValue(typing.NamedTuple):
258class ProtectionCommandValue(typing.NamedTuple):
259    general: bool
260    l1: bool
261    l2: bool
262    l3: bool

ProtectionCommandValue(general, l1, l2, l3)

ProtectionCommandValue(general: bool, l1: bool, l2: bool, l3: bool)

Create new instance of ProtectionCommandValue(general, l1, l2, l3)

general: bool

Alias for field number 0

l1: bool

Alias for field number 1

l2: bool

Alias for field number 2

l3: bool

Alias for field number 3

class StatusValue(typing.NamedTuple):
265class StatusValue(typing.NamedTuple):
266    value: list[bool]
267    """value length is 16"""
268    change: list[bool]
269    """change length is 16"""

StatusValue(value, change)

StatusValue(value: list[bool], change: list[bool])

Create new instance of StatusValue(value, change)

value: list[bool]

value length is 16

change: list[bool]

change length is 16

class IoElement_M_SP_NA(typing.NamedTuple):
272class IoElement_M_SP_NA(typing.NamedTuple):
273    value: SingleValue
274    quality: IndicationQuality

IoElement_M_SP_NA(value, quality)

IoElement_M_SP_NA( value: SingleValue, quality: IndicationQuality)

Create new instance of IoElement_M_SP_NA(value, quality)

value: SingleValue

Alias for field number 0

Alias for field number 1

class IoElement_M_DP_NA(typing.NamedTuple):
282class IoElement_M_DP_NA(typing.NamedTuple):
283    value: DoubleValue
284    quality: IndicationQuality

IoElement_M_DP_NA(value, quality)

IoElement_M_DP_NA( value: DoubleValue, quality: IndicationQuality)

Create new instance of IoElement_M_DP_NA(value, quality)

value: DoubleValue

Alias for field number 0

Alias for field number 1

class IoElement_M_ST_NA(typing.NamedTuple):
292class IoElement_M_ST_NA(typing.NamedTuple):
293    value: StepPositionValue
294    quality: MeasurementQuality

IoElement_M_ST_NA(value, quality)

IoElement_M_ST_NA( value: StepPositionValue, quality: MeasurementQuality)

Create new instance of IoElement_M_ST_NA(value, quality)

Alias for field number 0

Alias for field number 1

class IoElement_M_BO_NA(typing.NamedTuple):
302class IoElement_M_BO_NA(typing.NamedTuple):
303    value: BitstringValue
304    quality: MeasurementQuality

IoElement_M_BO_NA(value, quality)

IoElement_M_BO_NA( value: BitstringValue, quality: MeasurementQuality)

Create new instance of IoElement_M_BO_NA(value, quality)

Alias for field number 0

Alias for field number 1

class IoElement_M_ME_NA(typing.NamedTuple):
312class IoElement_M_ME_NA(typing.NamedTuple):
313    value: NormalizedValue
314    quality: MeasurementQuality

IoElement_M_ME_NA(value, quality)

IoElement_M_ME_NA( value: NormalizedValue, quality: MeasurementQuality)

Create new instance of IoElement_M_ME_NA(value, quality)

Alias for field number 0

Alias for field number 1

class IoElement_M_ME_NB(typing.NamedTuple):
322class IoElement_M_ME_NB(typing.NamedTuple):
323    value: ScaledValue
324    quality: MeasurementQuality

IoElement_M_ME_NB(value, quality)

IoElement_M_ME_NB( value: ScaledValue, quality: MeasurementQuality)

Create new instance of IoElement_M_ME_NB(value, quality)

value: ScaledValue

Alias for field number 0

Alias for field number 1

class IoElement_M_ME_NC(typing.NamedTuple):
332class IoElement_M_ME_NC(typing.NamedTuple):
333    value: FloatingValue
334    quality: MeasurementQuality

IoElement_M_ME_NC(value, quality)

IoElement_M_ME_NC( value: FloatingValue, quality: MeasurementQuality)

Create new instance of IoElement_M_ME_NC(value, quality)

value: FloatingValue

Alias for field number 0

Alias for field number 1

class IoElement_M_IT_NA(typing.NamedTuple):
342class IoElement_M_IT_NA(typing.NamedTuple):
343    value: BinaryCounterValue
344    quality: CounterQuality

IoElement_M_IT_NA(value, quality)

IoElement_M_IT_NA( value: BinaryCounterValue, quality: CounterQuality)

Create new instance of IoElement_M_IT_NA(value, quality)

Alias for field number 0

quality: CounterQuality

Alias for field number 1

class IoElement_M_PS_NA(typing.NamedTuple):
373class IoElement_M_PS_NA(typing.NamedTuple):
374    value: StatusValue
375    quality: MeasurementQuality

IoElement_M_PS_NA(value, quality)

IoElement_M_PS_NA( value: StatusValue, quality: MeasurementQuality)

Create new instance of IoElement_M_PS_NA(value, quality)

value: StatusValue

Alias for field number 0

Alias for field number 1

class IoElement_M_ME_ND(typing.NamedTuple):
378class IoElement_M_ME_ND(typing.NamedTuple):
379    value: NormalizedValue

IoElement_M_ME_ND(value,)

IoElement_M_ME_ND(value: NormalizedValue)

Create new instance of IoElement_M_ME_ND(value,)

Alias for field number 0

class IoElement_M_SP_TB(typing.NamedTuple):
382class IoElement_M_SP_TB(typing.NamedTuple):
383    value: SingleValue
384    quality: IndicationQuality

IoElement_M_SP_TB(value, quality)

IoElement_M_SP_TB( value: SingleValue, quality: IndicationQuality)

Create new instance of IoElement_M_SP_TB(value, quality)

value: SingleValue

Alias for field number 0

Alias for field number 1

class IoElement_M_DP_TB(typing.NamedTuple):
387class IoElement_M_DP_TB(typing.NamedTuple):
388    value: DoubleValue
389    quality: IndicationQuality

IoElement_M_DP_TB(value, quality)

IoElement_M_DP_TB( value: DoubleValue, quality: IndicationQuality)

Create new instance of IoElement_M_DP_TB(value, quality)

value: DoubleValue

Alias for field number 0

Alias for field number 1

class IoElement_M_ST_TB(typing.NamedTuple):
392class IoElement_M_ST_TB(typing.NamedTuple):
393    value: StepPositionValue
394    quality: MeasurementQuality

IoElement_M_ST_TB(value, quality)

IoElement_M_ST_TB( value: StepPositionValue, quality: MeasurementQuality)

Create new instance of IoElement_M_ST_TB(value, quality)

Alias for field number 0

Alias for field number 1

class IoElement_M_BO_TB(typing.NamedTuple):
397class IoElement_M_BO_TB(typing.NamedTuple):
398    value: BitstringValue
399    quality: MeasurementQuality

IoElement_M_BO_TB(value, quality)

IoElement_M_BO_TB( value: BitstringValue, quality: MeasurementQuality)

Create new instance of IoElement_M_BO_TB(value, quality)

Alias for field number 0

Alias for field number 1

class IoElement_M_ME_TD(typing.NamedTuple):
402class IoElement_M_ME_TD(typing.NamedTuple):
403    value: NormalizedValue
404    quality: MeasurementQuality

IoElement_M_ME_TD(value, quality)

IoElement_M_ME_TD( value: NormalizedValue, quality: MeasurementQuality)

Create new instance of IoElement_M_ME_TD(value, quality)

Alias for field number 0

Alias for field number 1

class IoElement_M_ME_TE(typing.NamedTuple):
407class IoElement_M_ME_TE(typing.NamedTuple):
408    value: ScaledValue
409    quality: MeasurementQuality

IoElement_M_ME_TE(value, quality)

IoElement_M_ME_TE( value: ScaledValue, quality: MeasurementQuality)

Create new instance of IoElement_M_ME_TE(value, quality)

value: ScaledValue

Alias for field number 0

Alias for field number 1

class IoElement_M_ME_TF(typing.NamedTuple):
412class IoElement_M_ME_TF(typing.NamedTuple):
413    value: FloatingValue
414    quality: MeasurementQuality

IoElement_M_ME_TF(value, quality)

IoElement_M_ME_TF( value: FloatingValue, quality: MeasurementQuality)

Create new instance of IoElement_M_ME_TF(value, quality)

value: FloatingValue

Alias for field number 0

Alias for field number 1

class IoElement_M_IT_TB(typing.NamedTuple):
417class IoElement_M_IT_TB(typing.NamedTuple):
418    value: BinaryCounterValue
419    quality: CounterQuality

IoElement_M_IT_TB(value, quality)

IoElement_M_IT_TB( value: BinaryCounterValue, quality: CounterQuality)

Create new instance of IoElement_M_IT_TB(value, quality)

Alias for field number 0

quality: CounterQuality

Alias for field number 1

class IoElement_M_EP_TD(typing.NamedTuple):
422class IoElement_M_EP_TD(typing.NamedTuple):
423    value: ProtectionValue
424    quality: ProtectionQuality
425    elapsed_time: int
426    """elapsed_time in range [0, 65535]"""

IoElement_M_EP_TD(value, quality, elapsed_time)

IoElement_M_EP_TD( value: ProtectionValue, quality: ProtectionQuality, elapsed_time: int)

Create new instance of IoElement_M_EP_TD(value, quality, elapsed_time)

Alias for field number 0

Alias for field number 1

elapsed_time: int

elapsed_time in range [0, 65535]

class IoElement_M_EP_TE(typing.NamedTuple):
429class IoElement_M_EP_TE(typing.NamedTuple):
430    value: ProtectionStartValue
431    quality: ProtectionQuality
432    duration_time: int
433    """duration_time in range [0, 65535]"""

IoElement_M_EP_TE(value, quality, duration_time)

IoElement_M_EP_TE( value: ProtectionStartValue, quality: ProtectionQuality, duration_time: int)

Create new instance of IoElement_M_EP_TE(value, quality, duration_time)

Alias for field number 0

Alias for field number 1

duration_time: int

duration_time in range [0, 65535]

class IoElement_M_EP_TF(typing.NamedTuple):
436class IoElement_M_EP_TF(typing.NamedTuple):
437    value: ProtectionCommandValue
438    quality: ProtectionQuality
439    operating_time: int
440    """operating_time in range [0, 65535]"""

IoElement_M_EP_TF(value, quality, operating_time)

IoElement_M_EP_TF( value: ProtectionCommandValue, quality: ProtectionQuality, operating_time: int)

Create new instance of IoElement_M_EP_TF(value, quality, operating_time)

Alias for field number 0

Alias for field number 1

operating_time: int

operating_time in range [0, 65535]

class IoElement_C_SC_NA(typing.NamedTuple):
443class IoElement_C_SC_NA(typing.NamedTuple):
444    value: SingleValue
445    select: bool
446    qualifier: int
447    """qualifier in range [0, 31]"""

IoElement_C_SC_NA(value, select, qualifier)

IoElement_C_SC_NA( value: SingleValue, select: bool, qualifier: int)

Create new instance of IoElement_C_SC_NA(value, select, qualifier)

value: SingleValue

Alias for field number 0

select: bool

Alias for field number 1

qualifier: int

qualifier in range [0, 31]

class IoElement_C_DC_NA(typing.NamedTuple):
450class IoElement_C_DC_NA(typing.NamedTuple):
451    value: DoubleValue
452    select: bool
453    qualifier: int
454    """qualifier in range [0, 31]"""

IoElement_C_DC_NA(value, select, qualifier)

IoElement_C_DC_NA( value: DoubleValue, select: bool, qualifier: int)

Create new instance of IoElement_C_DC_NA(value, select, qualifier)

value: DoubleValue

Alias for field number 0

select: bool

Alias for field number 1

qualifier: int

qualifier in range [0, 31]

class IoElement_C_RC_NA(typing.NamedTuple):
457class IoElement_C_RC_NA(typing.NamedTuple):
458    value: RegulatingValue
459    select: bool
460    qualifier: int
461    """qualifier in range [0, 31]"""

IoElement_C_RC_NA(value, select, qualifier)

IoElement_C_RC_NA( value: RegulatingValue, select: bool, qualifier: int)

Create new instance of IoElement_C_RC_NA(value, select, qualifier)

Alias for field number 0

select: bool

Alias for field number 1

qualifier: int

qualifier in range [0, 31]

class IoElement_C_SE_NA(typing.NamedTuple):
464class IoElement_C_SE_NA(typing.NamedTuple):
465    value: NormalizedValue
466    select: bool

IoElement_C_SE_NA(value, select)

IoElement_C_SE_NA( value: NormalizedValue, select: bool)

Create new instance of IoElement_C_SE_NA(value, select)

Alias for field number 0

select: bool

Alias for field number 1

class IoElement_C_SE_NB(typing.NamedTuple):
469class IoElement_C_SE_NB(typing.NamedTuple):
470    value: ScaledValue
471    select: bool

IoElement_C_SE_NB(value, select)

IoElement_C_SE_NB( value: ScaledValue, select: bool)

Create new instance of IoElement_C_SE_NB(value, select)

value: ScaledValue

Alias for field number 0

select: bool

Alias for field number 1

class IoElement_C_SE_NC(typing.NamedTuple):
474class IoElement_C_SE_NC(typing.NamedTuple):
475    value: FloatingValue
476    select: bool

IoElement_C_SE_NC(value, select)

IoElement_C_SE_NC( value: FloatingValue, select: bool)

Create new instance of IoElement_C_SE_NC(value, select)

value: FloatingValue

Alias for field number 0

select: bool

Alias for field number 1

class IoElement_C_BO_NA(typing.NamedTuple):
479class IoElement_C_BO_NA(typing.NamedTuple):
480    value: BitstringValue

IoElement_C_BO_NA(value,)

IoElement_C_BO_NA(value: BitstringValue)

Create new instance of IoElement_C_BO_NA(value,)

Alias for field number 0

class IoElement_M_EI_NA(typing.NamedTuple):
483class IoElement_M_EI_NA(typing.NamedTuple):
484    param_change: bool
485    cause: int
486    """cause in range [0, 127]"""

IoElement_M_EI_NA(param_change, cause)

IoElement_M_EI_NA(param_change: bool, cause: int)

Create new instance of IoElement_M_EI_NA(param_change, cause)

param_change: bool

Alias for field number 0

cause: int

cause in range [0, 127]

class IoElement_C_IC_NA(typing.NamedTuple):
489class IoElement_C_IC_NA(typing.NamedTuple):
490    qualifier: int
491    """qualifier in range [0, 255]"""

IoElement_C_IC_NA(qualifier,)

IoElement_C_IC_NA(qualifier: int)

Create new instance of IoElement_C_IC_NA(qualifier,)

qualifier: int

qualifier in range [0, 255]

class IoElement_C_CI_NA(typing.NamedTuple):
494class IoElement_C_CI_NA(typing.NamedTuple):
495    request: int
496    """request in range [0, 63]"""
497    freeze: FreezeCode

IoElement_C_CI_NA(request, freeze)

IoElement_C_CI_NA( request: int, freeze: FreezeCode)

Create new instance of IoElement_C_CI_NA(request, freeze)

request: int

request in range [0, 63]

freeze: FreezeCode

Alias for field number 1

class IoElement_C_RD_NA(typing.NamedTuple):
500class IoElement_C_RD_NA(typing.NamedTuple):
501    pass

IoElement_C_RD_NA()

IoElement_C_RD_NA()

Create new instance of IoElement_C_RD_NA()

class IoElement_C_CS_NA(typing.NamedTuple):
504class IoElement_C_CS_NA(typing.NamedTuple):
505    time: Time
506    """time size is SEVEN"""

IoElement_C_CS_NA(time,)

IoElement_C_CS_NA(time: Time)

Create new instance of IoElement_C_CS_NA(time,)

time: Time

time size is SEVEN

class IoElement_C_RP_NA(typing.NamedTuple):
513class IoElement_C_RP_NA(typing.NamedTuple):
514    qualifier: int
515    """qualifier in range [0, 255]"""

IoElement_C_RP_NA(qualifier,)

IoElement_C_RP_NA(qualifier: int)

Create new instance of IoElement_C_RP_NA(qualifier,)

qualifier: int

qualifier in range [0, 255]

class IoElement_P_ME_NA(typing.NamedTuple):
523class IoElement_P_ME_NA(typing.NamedTuple):
524    value: NormalizedValue
525    qualifier: int
526    """qualifier in range [0, 255]"""

IoElement_P_ME_NA(value, qualifier)

IoElement_P_ME_NA( value: NormalizedValue, qualifier: int)

Create new instance of IoElement_P_ME_NA(value, qualifier)

Alias for field number 0

qualifier: int

qualifier in range [0, 255]

class IoElement_P_ME_NB(typing.NamedTuple):
529class IoElement_P_ME_NB(typing.NamedTuple):
530    value: ScaledValue
531    qualifier: int
532    """qualifier in range [0, 255]"""

IoElement_P_ME_NB(value, qualifier)

IoElement_P_ME_NB( value: ScaledValue, qualifier: int)

Create new instance of IoElement_P_ME_NB(value, qualifier)

value: ScaledValue

Alias for field number 0

qualifier: int

qualifier in range [0, 255]

class IoElement_P_ME_NC(typing.NamedTuple):
535class IoElement_P_ME_NC(typing.NamedTuple):
536    value: FloatingValue
537    qualifier: int
538    """qualifier in range [0, 255]"""

IoElement_P_ME_NC(value, qualifier)

IoElement_P_ME_NC( value: FloatingValue, qualifier: int)

Create new instance of IoElement_P_ME_NC(value, qualifier)

value: FloatingValue

Alias for field number 0

qualifier: int

qualifier in range [0, 255]

class IoElement_P_AC_NA(typing.NamedTuple):
541class IoElement_P_AC_NA(typing.NamedTuple):
542    qualifier: int
543    """qualifier in range [0, 255]"""

IoElement_P_AC_NA(qualifier,)

IoElement_P_AC_NA(qualifier: int)

Create new instance of IoElement_P_AC_NA(qualifier,)

qualifier: int

qualifier in range [0, 255]

class IoElement_F_FR_NA(typing.NamedTuple):
546class IoElement_F_FR_NA(typing.NamedTuple):
547    file_name: int
548    """file_name in range [0, 65535]"""
549    file_length: int
550    """file_length in range [0, 16777215]"""
551    ready: bool

IoElement_F_FR_NA(file_name, file_length, ready)

IoElement_F_FR_NA(file_name: int, file_length: int, ready: bool)

Create new instance of IoElement_F_FR_NA(file_name, file_length, ready)

file_name: int

file_name in range [0, 65535]

file_length: int

file_length in range [0, 16777215]

ready: bool

Alias for field number 2

class IoElement_F_SR_NA(typing.NamedTuple):
554class IoElement_F_SR_NA(typing.NamedTuple):
555    file_name: int
556    """file_name in range [0, 65535]"""
557    section_name: int
558    """section_name in range [0, 255]"""
559    section_length: int
560    """section_length in range [0, 16777215]"""
561    ready: bool

IoElement_F_SR_NA(file_name, section_name, section_length, ready)

IoElement_F_SR_NA(file_name: int, section_name: int, section_length: int, ready: bool)

Create new instance of IoElement_F_SR_NA(file_name, section_name, section_length, ready)

file_name: int

file_name in range [0, 65535]

section_name: int

section_name in range [0, 255]

section_length: int

section_length in range [0, 16777215]

ready: bool

Alias for field number 3

class IoElement_F_SC_NA(typing.NamedTuple):
564class IoElement_F_SC_NA(typing.NamedTuple):
565    file_name: int
566    """file_name in range [0, 65535]"""
567    section_name: int
568    """section_name in range [0, 255]"""
569    qualifier: int
570    """qualifier in range [0, 255]"""

IoElement_F_SC_NA(file_name, section_name, qualifier)

IoElement_F_SC_NA(file_name: int, section_name: int, qualifier: int)

Create new instance of IoElement_F_SC_NA(file_name, section_name, qualifier)

file_name: int

file_name in range [0, 65535]

section_name: int

section_name in range [0, 255]

qualifier: int

qualifier in range [0, 255]

class IoElement_F_LS_NA(typing.NamedTuple):
573class IoElement_F_LS_NA(typing.NamedTuple):
574    file_name: int
575    """file_name in range [0, 65535]"""
576    section_name: int
577    """section_name in range [0, 255]"""
578    last_qualifier: int
579    """last_qualifier in range [0, 255]"""
580    checksum: int
581    """checksum in range [0, 255]"""

IoElement_F_LS_NA(file_name, section_name, last_qualifier, checksum)

IoElement_F_LS_NA( file_name: int, section_name: int, last_qualifier: int, checksum: int)

Create new instance of IoElement_F_LS_NA(file_name, section_name, last_qualifier, checksum)

file_name: int

file_name in range [0, 65535]

section_name: int

section_name in range [0, 255]

last_qualifier: int

last_qualifier in range [0, 255]

checksum: int

checksum in range [0, 255]

class IoElement_F_AF_NA(typing.NamedTuple):
584class IoElement_F_AF_NA(typing.NamedTuple):
585    file_name: int
586    """file_name in range [0, 65535]"""
587    section_name: int
588    """section_name in range [0, 255]"""
589    qualifier: int
590    """qualifier in range [0, 255]"""

IoElement_F_AF_NA(file_name, section_name, qualifier)

IoElement_F_AF_NA(file_name: int, section_name: int, qualifier: int)

Create new instance of IoElement_F_AF_NA(file_name, section_name, qualifier)

file_name: int

file_name in range [0, 65535]

section_name: int

section_name in range [0, 255]

qualifier: int

qualifier in range [0, 255]

class IoElement_F_SG_NA(typing.NamedTuple):
593class IoElement_F_SG_NA(typing.NamedTuple):
594    file_name: int
595    """file_name in range [0, 65535]"""
596    section_name: int
597    """section_name in range [0, 255]"""
598    segment: util.Bytes

IoElement_F_SG_NA(file_name, section_name, segment)

IoElement_F_SG_NA( file_name: int, section_name: int, segment: bytes | bytearray | memoryview)

Create new instance of IoElement_F_SG_NA(file_name, section_name, segment)

file_name: int

file_name in range [0, 65535]

section_name: int

section_name in range [0, 255]

segment: bytes | bytearray | memoryview

Alias for field number 2

class IoElement_F_DR_TA(typing.NamedTuple):
601class IoElement_F_DR_TA(typing.NamedTuple):
602    file_name: int
603    """file_name in range [0, 65535]"""
604    file_length: int
605    """file_length in range [0, 16777215]"""
606    more_follows: bool
607    is_directory: bool
608    transfer_active: bool
609    creation_time: Time

IoElement_F_DR_TA(file_name, file_length, more_follows, is_directory, transfer_active, creation_time)

IoElement_F_DR_TA( file_name: int, file_length: int, more_follows: bool, is_directory: bool, transfer_active: bool, creation_time: Time)

Create new instance of IoElement_F_DR_TA(file_name, file_length, more_follows, is_directory, transfer_active, creation_time)

file_name: int

file_name in range [0, 65535]

file_length: int

file_length in range [0, 16777215]

more_follows: bool

Alias for field number 2

is_directory: bool

Alias for field number 3

transfer_active: bool

Alias for field number 4

creation_time: Time

Alias for field number 5

class IoElement_C_SC_TA(typing.NamedTuple):
154class IoElement_C_SC_TA(typing.NamedTuple):
155    value: SingleValue
156    select: bool
157    qualifier: int
158    """qualifier in range [0, 31]"""

IoElement_C_SC_TA(value, select, qualifier)

IoElement_C_SC_TA( value: SingleValue, select: bool, qualifier: int)

Create new instance of IoElement_C_SC_TA(value, select, qualifier)

value: SingleValue

Alias for field number 0

select: bool

Alias for field number 1

qualifier: int

qualifier in range [0, 31]

class IoElement_C_DC_TA(typing.NamedTuple):
161class IoElement_C_DC_TA(typing.NamedTuple):
162    value: DoubleValue
163    select: bool
164    qualifier: int
165    """qualifier in range [0, 31]"""

IoElement_C_DC_TA(value, select, qualifier)

IoElement_C_DC_TA( value: DoubleValue, select: bool, qualifier: int)

Create new instance of IoElement_C_DC_TA(value, select, qualifier)

value: DoubleValue

Alias for field number 0

select: bool

Alias for field number 1

qualifier: int

qualifier in range [0, 31]

class IoElement_C_RC_TA(typing.NamedTuple):
168class IoElement_C_RC_TA(typing.NamedTuple):
169    value: RegulatingValue
170    select: bool
171    qualifier: int
172    """qualifier in range [0, 31]"""

IoElement_C_RC_TA(value, select, qualifier)

IoElement_C_RC_TA( value: RegulatingValue, select: bool, qualifier: int)

Create new instance of IoElement_C_RC_TA(value, select, qualifier)

Alias for field number 0

select: bool

Alias for field number 1

qualifier: int

qualifier in range [0, 31]

class IoElement_C_SE_TA(typing.NamedTuple):
175class IoElement_C_SE_TA(typing.NamedTuple):
176    value: NormalizedValue
177    select: bool

IoElement_C_SE_TA(value, select)

IoElement_C_SE_TA( value: NormalizedValue, select: bool)

Create new instance of IoElement_C_SE_TA(value, select)

Alias for field number 0

select: bool

Alias for field number 1

class IoElement_C_SE_TB(typing.NamedTuple):
180class IoElement_C_SE_TB(typing.NamedTuple):
181    value: ScaledValue
182    select: bool

IoElement_C_SE_TB(value, select)

IoElement_C_SE_TB( value: ScaledValue, select: bool)

Create new instance of IoElement_C_SE_TB(value, select)

value: ScaledValue

Alias for field number 0

select: bool

Alias for field number 1

class IoElement_C_SE_TC(typing.NamedTuple):
185class IoElement_C_SE_TC(typing.NamedTuple):
186    value: FloatingValue
187    select: bool

IoElement_C_SE_TC(value, select)

IoElement_C_SE_TC( value: FloatingValue, select: bool)

Create new instance of IoElement_C_SE_TC(value, select)

value: FloatingValue

Alias for field number 0

select: bool

Alias for field number 1

class IoElement_C_BO_TA(typing.NamedTuple):
190class IoElement_C_BO_TA(typing.NamedTuple):
191    value: BitstringValue

IoElement_C_BO_TA(value,)

IoElement_C_BO_TA(value: BitstringValue)

Create new instance of IoElement_C_BO_TA(value,)

Alias for field number 0

class IoElement_C_TS_TA(typing.NamedTuple):
194class IoElement_C_TS_TA(typing.NamedTuple):
195    counter: int
196    """counter in range [0, 65535]"""

IoElement_C_TS_TA(counter,)

IoElement_C_TS_TA(counter: int)

Create new instance of IoElement_C_TS_TA(counter,)

counter: int

counter in range [0, 65535]

class IO(typing.NamedTuple):
254class IO(typing.NamedTuple):
255    address: IoAddress
256    elements: list[IoElement]
257    time: Time | None

IO(address, elements, time)

address: int

Alias for field number 0

time: Time | None

Alias for field number 2

class ASDU(typing.NamedTuple):
260class ASDU(typing.NamedTuple):
261    type: AsduType
262    cause: Cause
263    address: AsduAddress
264    ios: list[IO]

ASDU(type, cause, address, ios)

ASDU( type: AsduType, cause: Cause, address: int, ios: list[IO])

Create new instance of ASDU(type, cause, address, ios)

type: AsduType

Alias for field number 0

cause: Cause

Alias for field number 1

address: int

Alias for field number 2

ios: list[IO]

Alias for field number 3

iec101_asdu_types = {1, 3, 5, 7, 9, 11, 13, 15, 20, 21, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 51, 70, 100, 101, 102, 103, 105, 110, 111, 112, 113, 120, 121, 122, 123, 124, 125, 126}
class Encoder:
 56class Encoder:
 57
 58    def __init__(self, max_asdu_size: int = 249):
 59        self._max_asdu_size = max_asdu_size
 60        self._encoder = encoder.Encoder(
 61            cause_size=common.CauseSize.TWO,
 62            asdu_address_size=common.AsduAddressSize.TWO,
 63            io_address_size=common.IoAddressSize.THREE,
 64            asdu_type_time_sizes=_asdu_type_time_sizes,
 65            inverted_sequence_bit=False,
 66            decode_io_element_cb=_decode_io_element,
 67            encode_io_element_cb=_encode_io_element)
 68
 69    @property
 70    def max_asdu_size(self) -> int:
 71        return self._max_asdu_size
 72
 73    @property
 74    def cause_size(self) -> common.CauseSize:
 75        return self._encoder.cause_size
 76
 77    @property
 78    def asdu_address_size(self) -> common.AsduAddressSize:
 79        return self._encoder.asdu_address_size
 80
 81    @property
 82    def io_address_size(self) -> common.IoAddressSize:
 83        return self._encoder.io_address_size
 84
 85    def decode_asdu(self,
 86                    asdu_bytes: util.Bytes
 87                    ) -> tuple[common.ASDU, util.Bytes]:
 88        asdu, rest = self._encoder.decode_asdu(asdu_bytes)
 89
 90        asdu_type = _decode_asdu_type(asdu.type)
 91
 92        cause = iec101.decode_cause(asdu.cause, common.CauseSize.TWO)
 93        address = asdu.address
 94        ios = [common.IO(address=io.address,
 95                         elements=io.elements,
 96                         time=io.time)
 97               for io in asdu.ios]
 98
 99        asdu = common.ASDU(type=asdu_type,
100                           cause=cause,
101                           address=address,
102                           ios=ios)
103        return asdu, rest
104
105    def encode_asdu(self, asdu: common.ASDU) -> util.Bytes:
106        asdu_type = asdu.type.value
107        cause = iec101.encode_cause(asdu.cause, common.CauseSize.TWO)
108        address = asdu.address
109        ios = [encoder.common.IO(address=io.address,
110                                 elements=io.elements,
111                                 time=io.time)
112               for io in asdu.ios]
113
114        asdu = encoder.common.ASDU(type=asdu_type,
115                                   cause=cause,
116                                   address=address,
117                                   ios=ios)
118
119        return self._encoder.encode_asdu(asdu)
Encoder(max_asdu_size: int = 249)
58    def __init__(self, max_asdu_size: int = 249):
59        self._max_asdu_size = max_asdu_size
60        self._encoder = encoder.Encoder(
61            cause_size=common.CauseSize.TWO,
62            asdu_address_size=common.AsduAddressSize.TWO,
63            io_address_size=common.IoAddressSize.THREE,
64            asdu_type_time_sizes=_asdu_type_time_sizes,
65            inverted_sequence_bit=False,
66            decode_io_element_cb=_decode_io_element,
67            encode_io_element_cb=_encode_io_element)
max_asdu_size: int
69    @property
70    def max_asdu_size(self) -> int:
71        return self._max_asdu_size
73    @property
74    def cause_size(self) -> common.CauseSize:
75        return self._encoder.cause_size
77    @property
78    def asdu_address_size(self) -> common.AsduAddressSize:
79        return self._encoder.asdu_address_size
81    @property
82    def io_address_size(self) -> common.IoAddressSize:
83        return self._encoder.io_address_size
def decode_asdu( self, asdu_bytes: bytes | bytearray | memoryview) -> tuple[ASDU, bytes | bytearray | memoryview]:
 85    def decode_asdu(self,
 86                    asdu_bytes: util.Bytes
 87                    ) -> tuple[common.ASDU, util.Bytes]:
 88        asdu, rest = self._encoder.decode_asdu(asdu_bytes)
 89
 90        asdu_type = _decode_asdu_type(asdu.type)
 91
 92        cause = iec101.decode_cause(asdu.cause, common.CauseSize.TWO)
 93        address = asdu.address
 94        ios = [common.IO(address=io.address,
 95                         elements=io.elements,
 96                         time=io.time)
 97               for io in asdu.ios]
 98
 99        asdu = common.ASDU(type=asdu_type,
100                           cause=cause,
101                           address=address,
102                           ios=ios)
103        return asdu, rest
def encode_asdu( self, asdu: ASDU) -> bytes | bytearray | memoryview:
105    def encode_asdu(self, asdu: common.ASDU) -> util.Bytes:
106        asdu_type = asdu.type.value
107        cause = iec101.encode_cause(asdu.cause, common.CauseSize.TWO)
108        address = asdu.address
109        ios = [encoder.common.IO(address=io.address,
110                                 elements=io.elements,
111                                 time=io.time)
112               for io in asdu.ios]
113
114        asdu = encoder.common.ASDU(type=asdu_type,
115                                   cause=cause,
116                                   address=address,
117                                   ios=ios)
118
119        return self._encoder.encode_asdu(asdu)