hat.drivers.iec60870.encodings.iec103

IEC 60870-5-103 messages

  1"""IEC 60870-5-103 messages"""
  2
  3from hat.drivers.iec60870.encodings.iec103.common import (
  4    TimeSize,
  5    Time,
  6    time_from_datetime,
  7    time_to_datetime,
  8    AsduAddress,
  9    OtherCause,
 10    AsduType,
 11    Cause,
 12    Description,
 13    OrderType,
 14    Channel,
 15    IoAddress,
 16    Identification,
 17    ValueType,
 18    NoneValue,
 19    TextValue,
 20    BitstringValue,
 21    UIntValue,
 22    IntValue,
 23    UFixedValue,
 24    FixedValue,
 25    Real32Value,
 26    Real64Value,
 27    DoubleValue,
 28    SingleValue,
 29    ExtendedDoubleValue,
 30    MeasurandValue,
 31    TimeValue,
 32    IdentificationValue,
 33    RelativeTimeValue,
 34    IoAddressValue,
 35    DoubleWithTimeValue,
 36    DoubleWithRelativeTimeValue,
 37    MeasurandWithRelativeTimeValue,
 38    TextNumberValue,
 39    ReplyValue,
 40    ArrayValue,
 41    IndexValue,
 42    Value,
 43    DescriptiveData,
 44    IoElement_TIME_TAGGED_MESSAGE,
 45    IoElement_TIME_TAGGED_MESSAGE_WITH_RELATIVE_TIME,
 46    IoElement_MEASURANDS_1,
 47    IoElement_TIME_TAGGED_MEASURANDS_WITH_RELATIVE_TIME,
 48    IoElement_IDENTIFICATION,
 49    IoElement_TIME_SYNCHRONIZATION,
 50    IoElement_GENERAL_INTERROGATION,
 51    IoElement_GENERAL_INTERROGATION_TERMINATION,
 52    IoElement_MEASURANDS_2,
 53    IoElement_GENERIC_DATA,
 54    IoElement_GENERIC_IDENTIFICATION,
 55    IoElement_GENERAL_COMMAND,
 56    IoElement_GENERIC_COMMAND,
 57    IoElement_LIST_OF_RECORDED_DISTURBANCES,
 58    IoElement_ORDER_FOR_DISTURBANCE_DATA_TRANSMISSION,
 59    IoElement_ACKNOWLEDGEMENT_FOR_DISTURBANCE_DATA_TRANSMISSION,
 60    IoElement_READY_FOR_TRANSMISSION_OF_DISTURBANCE_DATA,
 61    IoElement_READY_FOR_TRANSMISSION_OF_A_CHANNEL,
 62    IoElement_READY_FOR_TRANSMISSION_OF_TAGS,
 63    IoElement_TRANSMISSION_OF_TAGS,
 64    IoElement_TRANSMISSION_OF_DISTURBANCE_VALUES,
 65    IoElement_END_OF_TRANSMISSION,
 66    IoElement,
 67    IO,
 68    ASDU)
 69from hat.drivers.iec60870.encodings.iec103.encoder import Encoder
 70
 71
 72__all__ = ['TimeSize',
 73           'Time',
 74           'time_from_datetime',
 75           'time_to_datetime',
 76           'AsduAddress',
 77           'OtherCause',
 78           'AsduType',
 79           'Cause',
 80           'Description',
 81           'OrderType',
 82           'Channel',
 83           'IoAddress',
 84           'Identification',
 85           'ValueType',
 86           'NoneValue',
 87           'TextValue',
 88           'BitstringValue',
 89           'UIntValue',
 90           'IntValue',
 91           'UFixedValue',
 92           'FixedValue',
 93           'Real32Value',
 94           'Real64Value',
 95           'DoubleValue',
 96           'SingleValue',
 97           'ExtendedDoubleValue',
 98           'MeasurandValue',
 99           'TimeValue',
100           'IdentificationValue',
101           'RelativeTimeValue',
102           'IoAddressValue',
103           'DoubleWithTimeValue',
104           'DoubleWithRelativeTimeValue',
105           'MeasurandWithRelativeTimeValue',
106           'TextNumberValue',
107           'ReplyValue',
108           'ArrayValue',
109           'IndexValue',
110           'Value',
111           'DescriptiveData',
112           'IoElement_TIME_TAGGED_MESSAGE',
113           'IoElement_TIME_TAGGED_MESSAGE_WITH_RELATIVE_TIME',
114           'IoElement_MEASURANDS_1',
115           'IoElement_TIME_TAGGED_MEASURANDS_WITH_RELATIVE_TIME',
116           'IoElement_IDENTIFICATION',
117           'IoElement_TIME_SYNCHRONIZATION',
118           'IoElement_GENERAL_INTERROGATION',
119           'IoElement_GENERAL_INTERROGATION_TERMINATION',
120           'IoElement_MEASURANDS_2',
121           'IoElement_GENERIC_DATA',
122           'IoElement_GENERIC_IDENTIFICATION',
123           'IoElement_GENERAL_COMMAND',
124           'IoElement_GENERIC_COMMAND',
125           'IoElement_LIST_OF_RECORDED_DISTURBANCES',
126           'IoElement_ORDER_FOR_DISTURBANCE_DATA_TRANSMISSION',
127           'IoElement_ACKNOWLEDGEMENT_FOR_DISTURBANCE_DATA_TRANSMISSION',
128           'IoElement_READY_FOR_TRANSMISSION_OF_DISTURBANCE_DATA',
129           'IoElement_READY_FOR_TRANSMISSION_OF_A_CHANNEL',
130           'IoElement_READY_FOR_TRANSMISSION_OF_TAGS',
131           'IoElement_TRANSMISSION_OF_TAGS',
132           'IoElement_TRANSMISSION_OF_DISTURBANCE_VALUES',
133           'IoElement_END_OF_TRANSMISSION',
134           'IoElement',
135           'IO',
136           'ASDU',
137           'Encoder']
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

AsduAddress = <class 'int'>
OtherCause = <class 'int'>
class AsduType(enum.Enum):
19class AsduType(enum.Enum):
20    TIME_TAGGED_MESSAGE = 1
21    TIME_TAGGED_MESSAGE_WITH_RELATIVE_TIME = 2
22    MEASURANDS_1 = 3
23    TIME_TAGGED_MEASURANDS_WITH_RELATIVE_TIME = 4
24    IDENTIFICATION = 5
25    TIME_SYNCHRONIZATION = 6
26    GENERAL_INTERROGATION = 7
27    GENERAL_INTERROGATION_TERMINATION = 8
28    MEASURANDS_2 = 9
29    GENERIC_DATA = 10
30    GENERIC_IDENTIFICATION = 11
31    GENERAL_COMMAND = 20
32    GENERIC_COMMAND = 21
33    LIST_OF_RECORDED_DISTURBANCES = 23
34    ORDER_FOR_DISTURBANCE_DATA_TRANSMISSION = 24
35    ACKNOWLEDGEMENT_FOR_DISTURBANCE_DATA_TRANSMISSION = 25
36    READY_FOR_TRANSMISSION_OF_DISTURBANCE_DATA = 26
37    READY_FOR_TRANSMISSION_OF_A_CHANNEL = 27
38    READY_FOR_TRANSMISSION_OF_TAGS = 28
39    TRANSMISSION_OF_TAGS = 29
40    TRANSMISSION_OF_DISTURBANCE_VALUES = 30
41    END_OF_TRANSMISSION = 31

An enumeration.

TIME_TAGGED_MESSAGE = <AsduType.TIME_TAGGED_MESSAGE: 1>
TIME_TAGGED_MESSAGE_WITH_RELATIVE_TIME = <AsduType.TIME_TAGGED_MESSAGE_WITH_RELATIVE_TIME: 2>
MEASURANDS_1 = <AsduType.MEASURANDS_1: 3>
TIME_TAGGED_MEASURANDS_WITH_RELATIVE_TIME = <AsduType.TIME_TAGGED_MEASURANDS_WITH_RELATIVE_TIME: 4>
IDENTIFICATION = <AsduType.IDENTIFICATION: 5>
TIME_SYNCHRONIZATION = <AsduType.TIME_SYNCHRONIZATION: 6>
GENERAL_INTERROGATION = <AsduType.GENERAL_INTERROGATION: 7>
GENERAL_INTERROGATION_TERMINATION = <AsduType.GENERAL_INTERROGATION_TERMINATION: 8>
MEASURANDS_2 = <AsduType.MEASURANDS_2: 9>
GENERIC_DATA = <AsduType.GENERIC_DATA: 10>
GENERIC_IDENTIFICATION = <AsduType.GENERIC_IDENTIFICATION: 11>
GENERAL_COMMAND = <AsduType.GENERAL_COMMAND: 20>
GENERIC_COMMAND = <AsduType.GENERIC_COMMAND: 21>
LIST_OF_RECORDED_DISTURBANCES = <AsduType.LIST_OF_RECORDED_DISTURBANCES: 23>
ORDER_FOR_DISTURBANCE_DATA_TRANSMISSION = <AsduType.ORDER_FOR_DISTURBANCE_DATA_TRANSMISSION: 24>
ACKNOWLEDGEMENT_FOR_DISTURBANCE_DATA_TRANSMISSION = <AsduType.ACKNOWLEDGEMENT_FOR_DISTURBANCE_DATA_TRANSMISSION: 25>
READY_FOR_TRANSMISSION_OF_DISTURBANCE_DATA = <AsduType.READY_FOR_TRANSMISSION_OF_DISTURBANCE_DATA: 26>
READY_FOR_TRANSMISSION_OF_A_CHANNEL = <AsduType.READY_FOR_TRANSMISSION_OF_A_CHANNEL: 27>
READY_FOR_TRANSMISSION_OF_TAGS = <AsduType.READY_FOR_TRANSMISSION_OF_TAGS: 28>
TRANSMISSION_OF_TAGS = <AsduType.TRANSMISSION_OF_TAGS: 29>
TRANSMISSION_OF_DISTURBANCE_VALUES = <AsduType.TRANSMISSION_OF_DISTURBANCE_VALUES: 30>
END_OF_TRANSMISSION = <AsduType.END_OF_TRANSMISSION: 31>
class Cause(enum.Enum):
44class Cause(enum.Enum):
45    SPONTANEOUS = 1
46    CYCLIC = 2
47    RESET_FRAME_COUNT_BIT = 3
48    RESET_COMMUNICATION_UNIT = 4
49    START_RESTART = 5
50    POWER_ON = 6
51    TEST_MODE = 7
52    TIME_SYNCHRONIZATION = 8
53    GENERAL_INTERROGATION = 9
54    TERMINATION_OF_GENERAL_INTERROGATION = 10
55    LOCAL_OPERATION = 11
56    REMOTE_OPERATION = 12
57    GENERAL_COMMAND = 20
58    GENERAL_COMMAND_NACK = 21
59    TRANSMISSION_OF_DISTURBANCE_DATA = 31
60    GENERIC_WRITE_COMMAND = 40
61    GENERIC_WRITE_COMMAND_NACK = 41
62    GENERIC_READ_COMMAND = 42
63    GENERIC_READ_COMMAND_NACK = 43
64    GENERIC_WRITE_CONFIRMATION = 44

An enumeration.

SPONTANEOUS = <Cause.SPONTANEOUS: 1>
CYCLIC = <Cause.CYCLIC: 2>
RESET_FRAME_COUNT_BIT = <Cause.RESET_FRAME_COUNT_BIT: 3>
RESET_COMMUNICATION_UNIT = <Cause.RESET_COMMUNICATION_UNIT: 4>
START_RESTART = <Cause.START_RESTART: 5>
POWER_ON = <Cause.POWER_ON: 6>
TEST_MODE = <Cause.TEST_MODE: 7>
TIME_SYNCHRONIZATION = <Cause.TIME_SYNCHRONIZATION: 8>
GENERAL_INTERROGATION = <Cause.GENERAL_INTERROGATION: 9>
TERMINATION_OF_GENERAL_INTERROGATION = <Cause.TERMINATION_OF_GENERAL_INTERROGATION: 10>
LOCAL_OPERATION = <Cause.LOCAL_OPERATION: 11>
REMOTE_OPERATION = <Cause.REMOTE_OPERATION: 12>
GENERAL_COMMAND = <Cause.GENERAL_COMMAND: 20>
GENERAL_COMMAND_NACK = <Cause.GENERAL_COMMAND_NACK: 21>
TRANSMISSION_OF_DISTURBANCE_DATA = <Cause.TRANSMISSION_OF_DISTURBANCE_DATA: 31>
GENERIC_WRITE_COMMAND = <Cause.GENERIC_WRITE_COMMAND: 40>
GENERIC_WRITE_COMMAND_NACK = <Cause.GENERIC_WRITE_COMMAND_NACK: 41>
GENERIC_READ_COMMAND = <Cause.GENERIC_READ_COMMAND: 42>
GENERIC_READ_COMMAND_NACK = <Cause.GENERIC_READ_COMMAND_NACK: 43>
GENERIC_WRITE_CONFIRMATION = <Cause.GENERIC_WRITE_CONFIRMATION: 44>
class Description(enum.Enum):
67class Description(enum.Enum):
68    NOT_SPECIFIED = 0
69    ACTUAL_VALUE = 1
70    DEFAULT_VALUE = 2
71    RANGE = 3
72    PRECISION = 5
73    FACTOR = 6
74    REFERENCE = 7
75    ENUMERATION = 8
76    DIMENSION = 9
77    DESCRIPTION = 10
78    PASSWORD = 12
79    READ_ONLY = 13
80    WRITE_ONLY = 14
81    IO_ADDRESS = 19
82    EVENT = 20
83    TEXT_ARRAY = 21
84    VALUE_ARRAY = 22
85    RELATED = 23

An enumeration.

NOT_SPECIFIED = <Description.NOT_SPECIFIED: 0>
ACTUAL_VALUE = <Description.ACTUAL_VALUE: 1>
DEFAULT_VALUE = <Description.DEFAULT_VALUE: 2>
RANGE = <Description.RANGE: 3>
PRECISION = <Description.PRECISION: 5>
FACTOR = <Description.FACTOR: 6>
REFERENCE = <Description.REFERENCE: 7>
ENUMERATION = <Description.ENUMERATION: 8>
DIMENSION = <Description.DIMENSION: 9>
DESCRIPTION = <Description.DESCRIPTION: 10>
PASSWORD = <Description.PASSWORD: 12>
READ_ONLY = <Description.READ_ONLY: 13>
WRITE_ONLY = <Description.WRITE_ONLY: 14>
IO_ADDRESS = <Description.IO_ADDRESS: 19>
EVENT = <Description.EVENT: 20>
TEXT_ARRAY = <Description.TEXT_ARRAY: 21>
VALUE_ARRAY = <Description.VALUE_ARRAY: 22>
RELATED = <Description.RELATED: 23>
class OrderType(enum.Enum):
 88class OrderType(enum.Enum):
 89    SELECTION_OF_FAULT = 1
 90    REQUEST_FOR_DISTURBANCE_DATA = 2
 91    ABORTION_OF_DISTURBANCE_DATA = 3
 92    REQUEST_FOR_CHANNEL = 8
 93    ABORTION_OF_CHANNEL = 9
 94    REQUEST_FOR_TAGS = 16
 95    ABORTION_OF_TAGS = 17
 96    REQUEST_FOR_LIST_OF_RECORDED_DISTURBANCES = 24
 97    END_OF_DISTURBANCE_DATA_TRANSMISSION_WITHOUT_ABORTION = 32
 98    END_OF_DISTURBANCE_DATA_TRANSMISSION_WITH_ABORTION_BY_CONTROL_SYSTEM = 33
 99    END_OF_DISTURBANCE_DATA_TRANSMISSION_WITH_ABORTION_BY_THE_PROTECTION_EQUIPMENT = 34  # NOQA
100    END_OF_CHANNEL_TRANSMISSION_WITHOUT_ABORTION = 35
101    END_OF_CHANNEL_TRANSMISSION_WITH_ABORTION_BY_CONTROL_SYSTEM = 36
102    END_OF_CHANNEL_TRANSMISSION_WITH_ABORTION_BY_THE_PROTECTION_EQUIPMENT = 37
103    END_OF_TAG_TRANSMISSION_WITHOUT_ABORTION = 38
104    END_OF_TAG_TRANSMISSION_WITH_ABORTION_BY_CONTROL_SYSTEM = 39
105    END_OF_TAG_TRANSMISSION_WITH_ABORTION_BY_THE_PROTECTION_EQUIPMENT = 40
106    DISTURBANCE_DATA_TRANSMITTED_SUCCESSFULLY = 64
107    DISTURBANCE_DATA_TRANSMITTED_NOT_SUCCESSFULLY = 65
108    CHANNEL_TRANSMITTED_SUCCESSFULLY = 66
109    CHANNEL_TRANSMITTED_NOT_SUCCESSFULLY = 67
110    TAGS_TRANSMITTED_SUCCESSFULLY = 68
111    TAGS_TRANSMITTED_NOT_SUCCESSFULLY = 69

An enumeration.

SELECTION_OF_FAULT = <OrderType.SELECTION_OF_FAULT: 1>
REQUEST_FOR_DISTURBANCE_DATA = <OrderType.REQUEST_FOR_DISTURBANCE_DATA: 2>
ABORTION_OF_DISTURBANCE_DATA = <OrderType.ABORTION_OF_DISTURBANCE_DATA: 3>
REQUEST_FOR_CHANNEL = <OrderType.REQUEST_FOR_CHANNEL: 8>
ABORTION_OF_CHANNEL = <OrderType.ABORTION_OF_CHANNEL: 9>
REQUEST_FOR_TAGS = <OrderType.REQUEST_FOR_TAGS: 16>
ABORTION_OF_TAGS = <OrderType.ABORTION_OF_TAGS: 17>
REQUEST_FOR_LIST_OF_RECORDED_DISTURBANCES = <OrderType.REQUEST_FOR_LIST_OF_RECORDED_DISTURBANCES: 24>
END_OF_DISTURBANCE_DATA_TRANSMISSION_WITHOUT_ABORTION = <OrderType.END_OF_DISTURBANCE_DATA_TRANSMISSION_WITHOUT_ABORTION: 32>
END_OF_DISTURBANCE_DATA_TRANSMISSION_WITH_ABORTION_BY_CONTROL_SYSTEM = <OrderType.END_OF_DISTURBANCE_DATA_TRANSMISSION_WITH_ABORTION_BY_CONTROL_SYSTEM: 33>
END_OF_DISTURBANCE_DATA_TRANSMISSION_WITH_ABORTION_BY_THE_PROTECTION_EQUIPMENT = <OrderType.END_OF_DISTURBANCE_DATA_TRANSMISSION_WITH_ABORTION_BY_THE_PROTECTION_EQUIPMENT: 34>
END_OF_CHANNEL_TRANSMISSION_WITHOUT_ABORTION = <OrderType.END_OF_CHANNEL_TRANSMISSION_WITHOUT_ABORTION: 35>
END_OF_CHANNEL_TRANSMISSION_WITH_ABORTION_BY_CONTROL_SYSTEM = <OrderType.END_OF_CHANNEL_TRANSMISSION_WITH_ABORTION_BY_CONTROL_SYSTEM: 36>
END_OF_CHANNEL_TRANSMISSION_WITH_ABORTION_BY_THE_PROTECTION_EQUIPMENT = <OrderType.END_OF_CHANNEL_TRANSMISSION_WITH_ABORTION_BY_THE_PROTECTION_EQUIPMENT: 37>
END_OF_TAG_TRANSMISSION_WITHOUT_ABORTION = <OrderType.END_OF_TAG_TRANSMISSION_WITHOUT_ABORTION: 38>
END_OF_TAG_TRANSMISSION_WITH_ABORTION_BY_CONTROL_SYSTEM = <OrderType.END_OF_TAG_TRANSMISSION_WITH_ABORTION_BY_CONTROL_SYSTEM: 39>
END_OF_TAG_TRANSMISSION_WITH_ABORTION_BY_THE_PROTECTION_EQUIPMENT = <OrderType.END_OF_TAG_TRANSMISSION_WITH_ABORTION_BY_THE_PROTECTION_EQUIPMENT: 40>
DISTURBANCE_DATA_TRANSMITTED_SUCCESSFULLY = <OrderType.DISTURBANCE_DATA_TRANSMITTED_SUCCESSFULLY: 64>
DISTURBANCE_DATA_TRANSMITTED_NOT_SUCCESSFULLY = <OrderType.DISTURBANCE_DATA_TRANSMITTED_NOT_SUCCESSFULLY: 65>
CHANNEL_TRANSMITTED_SUCCESSFULLY = <OrderType.CHANNEL_TRANSMITTED_SUCCESSFULLY: 66>
CHANNEL_TRANSMITTED_NOT_SUCCESSFULLY = <OrderType.CHANNEL_TRANSMITTED_NOT_SUCCESSFULLY: 67>
TAGS_TRANSMITTED_SUCCESSFULLY = <OrderType.TAGS_TRANSMITTED_SUCCESSFULLY: 68>
TAGS_TRANSMITTED_NOT_SUCCESSFULLY = <OrderType.TAGS_TRANSMITTED_NOT_SUCCESSFULLY: 69>
class Channel(enum.Enum):
114class Channel(enum.Enum):
115    GLOBAL = 0
116    I_L1 = 1
117    I_L2 = 2
118    I_L3 = 3
119    I_N = 4
120    V_L1E = 5
121    V_L2E = 6
122    V_L3E = 7
123    V_EN = 8

An enumeration.

GLOBAL = <Channel.GLOBAL: 0>
I_L1 = <Channel.I_L1: 1>
I_L2 = <Channel.I_L2: 2>
I_L3 = <Channel.I_L3: 3>
I_N = <Channel.I_N: 4>
V_L1E = <Channel.V_L1E: 5>
V_L2E = <Channel.V_L2E: 6>
V_L3E = <Channel.V_L3E: 7>
V_EN = <Channel.V_EN: 8>
class IoAddress(typing.NamedTuple):
126class IoAddress(typing.NamedTuple):
127    function_type: int
128    """function_type is in range [0, 255]"""
129    information_number: int
130    """information_number is in range [0, 255]"""

IoAddress(function_type, information_number)

IoAddress(function_type: int, information_number: int)

Create new instance of IoAddress(function_type, information_number)

function_type: int

function_type is in range [0, 255]

information_number: int

information_number is in range [0, 255]

class Identification(typing.NamedTuple):
133class Identification(typing.NamedTuple):
134    group_id: int
135    """group_id in range [0, 255]"""
136    entry_id: int
137    """entry_id in range [0, 255]"""

Identification(group_id, entry_id)

Identification(group_id: int, entry_id: int)

Create new instance of Identification(group_id, entry_id)

group_id: int

group_id in range [0, 255]

entry_id: int

entry_id in range [0, 255]

class ValueType(enum.Enum):
140class ValueType(enum.Enum):
141    NONE = 0
142    TEXT = 1
143    BITSTRING = 2
144    UINT = 3
145    INT = 4
146    UFIXED = 5
147    FIXED = 6
148    REAL32 = 7
149    REAL64 = 8
150    DOUBLE = 9
151    SINGLE = 10
152    EXTENDED_DOUBLE = 11
153    MEASURAND = 12
154    TIME = 14
155    IDENTIFICATION = 15
156    RELATIVE_TIME = 16
157    IO_ADDRESS = 17
158    DOUBLE_WITH_TIME = 18
159    DOUBLE_WITH_RELATIVE_TIME = 19
160    MEASURAND_WITH_RELATIVE_TIME = 20
161    TEXT_NUMBER = 21
162    REPLY = 22
163    ARRAY = 23
164    INDEX = 24

An enumeration.

NONE = <ValueType.NONE: 0>
TEXT = <ValueType.TEXT: 1>
BITSTRING = <ValueType.BITSTRING: 2>
UINT = <ValueType.UINT: 3>
INT = <ValueType.INT: 4>
UFIXED = <ValueType.UFIXED: 5>
FIXED = <ValueType.FIXED: 6>
REAL32 = <ValueType.REAL32: 7>
REAL64 = <ValueType.REAL64: 8>
DOUBLE = <ValueType.DOUBLE: 9>
SINGLE = <ValueType.SINGLE: 10>
EXTENDED_DOUBLE = <ValueType.EXTENDED_DOUBLE: 11>
MEASURAND = <ValueType.MEASURAND: 12>
TIME = <ValueType.TIME: 14>
IDENTIFICATION = <ValueType.IDENTIFICATION: 15>
RELATIVE_TIME = <ValueType.RELATIVE_TIME: 16>
IO_ADDRESS = <ValueType.IO_ADDRESS: 17>
DOUBLE_WITH_TIME = <ValueType.DOUBLE_WITH_TIME: 18>
DOUBLE_WITH_RELATIVE_TIME = <ValueType.DOUBLE_WITH_RELATIVE_TIME: 19>
MEASURAND_WITH_RELATIVE_TIME = <ValueType.MEASURAND_WITH_RELATIVE_TIME: 20>
TEXT_NUMBER = <ValueType.TEXT_NUMBER: 21>
REPLY = <ValueType.REPLY: 22>
ARRAY = <ValueType.ARRAY: 23>
INDEX = <ValueType.INDEX: 24>
class NoneValue(typing.NamedTuple):
167class NoneValue(typing.NamedTuple):
168    pass

NoneValue()

NoneValue()

Create new instance of NoneValue()

class TextValue(typing.NamedTuple):
171class TextValue(typing.NamedTuple):
172    value: util.Bytes

TextValue(value,)

TextValue(value: bytes | bytearray | memoryview)

Create new instance of TextValue(value,)

value: bytes | bytearray | memoryview

Alias for field number 0

class BitstringValue(typing.NamedTuple):
175class BitstringValue(typing.NamedTuple):
176    value: list[bool]

BitstringValue(value,)

BitstringValue(value: list[bool])

Create new instance of BitstringValue(value,)

value: list[bool]

Alias for field number 0

class UIntValue(typing.NamedTuple):
179class UIntValue(typing.NamedTuple):
180    value: int

UIntValue(value,)

UIntValue(value: int)

Create new instance of UIntValue(value,)

value: int

Alias for field number 0

class IntValue(typing.NamedTuple):
183class IntValue(typing.NamedTuple):
184    value: int

IntValue(value,)

IntValue(value: int)

Create new instance of IntValue(value,)

value: int

Alias for field number 0

class UFixedValue(typing.NamedTuple):
187class UFixedValue(typing.NamedTuple):
188    value: float
189    """value in range [0, 1.0]"""

UFixedValue(value,)

UFixedValue(value: float)

Create new instance of UFixedValue(value,)

value: float

value in range [0, 1.0]

class FixedValue(typing.NamedTuple):
192class FixedValue(typing.NamedTuple):
193    value: float
194    """value in range [-1.0, 1.0)"""

FixedValue(value,)

FixedValue(value: float)

Create new instance of FixedValue(value,)

value: float

value in range [-1.0, 1.0)

class Real32Value(typing.NamedTuple):
197class Real32Value(typing.NamedTuple):
198    value: float

Real32Value(value,)

Real32Value(value: float)

Create new instance of Real32Value(value,)

value: float

Alias for field number 0

class Real64Value(typing.NamedTuple):
201class Real64Value(typing.NamedTuple):
202    value: float

Real64Value(value,)

Real64Value(value: float)

Create new instance of Real64Value(value,)

value: float

Alias for field number 0

class DoubleValue(enum.Enum):
205class DoubleValue(enum.Enum):
206    TRANSIENT = 0
207    OFF = 1
208    ON = 2
209    ERROR = 3

An enumeration.

TRANSIENT = <DoubleValue.TRANSIENT: 0>
OFF = <DoubleValue.OFF: 1>
ON = <DoubleValue.ON: 2>
ERROR = <DoubleValue.ERROR: 3>
class SingleValue(enum.Enum):
212class SingleValue(enum.Enum):
213    OFF = 0
214    ON = 1

An enumeration.

OFF = <SingleValue.OFF: 0>
ON = <SingleValue.ON: 1>
class ExtendedDoubleValue(enum.Enum):
217class ExtendedDoubleValue(enum.Enum):
218    TRANSIENT = 0
219    OFF = 1
220    ON = 2
221    ERROR = 3

An enumeration.

class MeasurandValue(typing.NamedTuple):
224class MeasurandValue(typing.NamedTuple):
225    overflow: bool
226    invalid: bool
227    value: float
228    """value in range [-1.0, 1.0)"""

MeasurandValue(overflow, invalid, value)

MeasurandValue(overflow: bool, invalid: bool, value: float)

Create new instance of MeasurandValue(overflow, invalid, value)

overflow: bool

Alias for field number 0

invalid: bool

Alias for field number 1

value: float

value in range [-1.0, 1.0)

class TimeValue(typing.NamedTuple):
231class TimeValue(typing.NamedTuple):
232    value: Time
233    """time size is SEVEN"""

TimeValue(value,)

TimeValue(value: Time)

Create new instance of TimeValue(value,)

value: Time

time size is SEVEN

class IdentificationValue(typing.NamedTuple):
236class IdentificationValue(typing.NamedTuple):
237    value: Identification

IdentificationValue(value,)

IdentificationValue(value: Identification)

Create new instance of IdentificationValue(value,)

Alias for field number 0

class RelativeTimeValue(typing.NamedTuple):
240class RelativeTimeValue(typing.NamedTuple):
241    value: int
242    """value in range [0, 65535]"""

RelativeTimeValue(value,)

RelativeTimeValue(value: int)

Create new instance of RelativeTimeValue(value,)

value: int

value in range [0, 65535]

class IoAddressValue(typing.NamedTuple):
245class IoAddressValue(typing.NamedTuple):
246    value: IoAddress

IoAddressValue(value,)

IoAddressValue(value: IoAddress)

Create new instance of IoAddressValue(value,)

value: IoAddress

Alias for field number 0

class DoubleWithTimeValue(typing.NamedTuple):
249class DoubleWithTimeValue(typing.NamedTuple):
250    value: DoubleValue
251    time: Time
252    """time size is FOUR"""
253    supplementary: int
254    """supplementary in range [0, 255]"""

DoubleWithTimeValue(value, time, supplementary)

DoubleWithTimeValue( value: DoubleValue, time: Time, supplementary: int)

Create new instance of DoubleWithTimeValue(value, time, supplementary)

value: DoubleValue

Alias for field number 0

time: Time

time size is FOUR

supplementary: int

supplementary in range [0, 255]

class DoubleWithRelativeTimeValue(typing.NamedTuple):
257class DoubleWithRelativeTimeValue(typing.NamedTuple):
258    value: DoubleValue
259    relative_time: int
260    """relative_time in range [0, 65535]"""
261    fault_number: int
262    """fault_number in range [0, 65535]"""
263    time: Time
264    """time size is FOUR"""
265    supplementary: int
266    """supplementary in range [0, 255]"""

DoubleWithRelativeTimeValue(value, relative_time, fault_number, time, supplementary)

DoubleWithRelativeTimeValue( value: DoubleValue, relative_time: int, fault_number: int, time: Time, supplementary: int)

Create new instance of DoubleWithRelativeTimeValue(value, relative_time, fault_number, time, supplementary)

value: DoubleValue

Alias for field number 0

relative_time: int

relative_time in range [0, 65535]

fault_number: int

fault_number in range [0, 65535]

time: Time

time size is FOUR

supplementary: int

supplementary in range [0, 255]

class MeasurandWithRelativeTimeValue(typing.NamedTuple):
269class MeasurandWithRelativeTimeValue(typing.NamedTuple):
270    value: float
271    relative_time: int
272    """relative_time in range [0, 65535]"""
273    fault_number: int
274    """fault_number in range [0, 65535]"""
275    time: Time
276    """time size is FOUR"""

MeasurandWithRelativeTimeValue(value, relative_time, fault_number, time)

MeasurandWithRelativeTimeValue( value: float, relative_time: int, fault_number: int, time: Time)

Create new instance of MeasurandWithRelativeTimeValue(value, relative_time, fault_number, time)

value: float

Alias for field number 0

relative_time: int

relative_time in range [0, 65535]

fault_number: int

fault_number in range [0, 65535]

time: Time

time size is FOUR

class TextNumberValue(typing.NamedTuple):
279class TextNumberValue(typing.NamedTuple):
280    value: int

TextNumberValue(value,)

TextNumberValue(value: int)

Create new instance of TextNumberValue(value,)

value: int

Alias for field number 0

class ReplyValue(enum.Enum):
283class ReplyValue(enum.Enum):
284    ACK = 0
285    INVALID_IDENTIFICATION = 1
286    DATA_NOT_EXISTS = 2
287    DATA_NOT_AVAILABLE = 3
288    VERIFY_ERROR = 4
289    OUT_OF_RANGE = 5
290    ENTRY_TO_LARGE = 6
291    TOO_MANY_COMMANDS = 7
292    ENTRY_READ_ONLY = 8
293    PASSWORD_PROTECTED = 9
294    IN_PROGRESS = 10
295    FOLLOWING_DESCRIPTION = 11

An enumeration.

ACK = <ReplyValue.ACK: 0>
INVALID_IDENTIFICATION = <ReplyValue.INVALID_IDENTIFICATION: 1>
DATA_NOT_EXISTS = <ReplyValue.DATA_NOT_EXISTS: 2>
DATA_NOT_AVAILABLE = <ReplyValue.DATA_NOT_AVAILABLE: 3>
VERIFY_ERROR = <ReplyValue.VERIFY_ERROR: 4>
OUT_OF_RANGE = <ReplyValue.OUT_OF_RANGE: 5>
ENTRY_TO_LARGE = <ReplyValue.ENTRY_TO_LARGE: 6>
TOO_MANY_COMMANDS = <ReplyValue.TOO_MANY_COMMANDS: 7>
ENTRY_READ_ONLY = <ReplyValue.ENTRY_READ_ONLY: 8>
PASSWORD_PROTECTED = <ReplyValue.PASSWORD_PROTECTED: 9>
IN_PROGRESS = <ReplyValue.IN_PROGRESS: 10>
FOLLOWING_DESCRIPTION = <ReplyValue.FOLLOWING_DESCRIPTION: 11>
class ArrayValue(typing.NamedTuple):
298class ArrayValue(typing.NamedTuple):
299    value_type: ValueType
300    more_follows: bool
301    values: typing.List['Value']

ArrayValue(value_type, more_follows, values)

ArrayValue( value_type: ValueType, more_follows: bool, values: List[ForwardRef('Value')])

Create new instance of ArrayValue(value_type, more_follows, values)

value_type: ValueType

Alias for field number 0

more_follows: bool

Alias for field number 1

class IndexValue(typing.NamedTuple):
304class IndexValue(typing.NamedTuple):
305    value: int

IndexValue(value,)

IndexValue(value: int)

Create new instance of IndexValue(value,)

value: int

Alias for field number 0

class DescriptiveData(typing.NamedTuple):
334class DescriptiveData(typing.NamedTuple):
335    description: Description
336    value: ArrayValue

DescriptiveData(description, value)

DescriptiveData( description: Description, value: ArrayValue)

Create new instance of DescriptiveData(description, value)

description: Description

Alias for field number 0

value: ArrayValue

Alias for field number 1

class IoElement_TIME_TAGGED_MESSAGE(typing.NamedTuple):
339class IoElement_TIME_TAGGED_MESSAGE(typing.NamedTuple):
340    value: DoubleWithTimeValue

IoElement_TIME_TAGGED_MESSAGE(value,)

IoElement_TIME_TAGGED_MESSAGE( value: DoubleWithTimeValue)

Create new instance of IoElement_TIME_TAGGED_MESSAGE(value,)

Alias for field number 0

class IoElement_TIME_TAGGED_MESSAGE_WITH_RELATIVE_TIME(typing.NamedTuple):
343class IoElement_TIME_TAGGED_MESSAGE_WITH_RELATIVE_TIME(typing.NamedTuple):
344    value: DoubleWithRelativeTimeValue

IoElement_TIME_TAGGED_MESSAGE_WITH_RELATIVE_TIME(value,)

IoElement_TIME_TAGGED_MESSAGE_WITH_RELATIVE_TIME( value: DoubleWithRelativeTimeValue)

Create new instance of IoElement_TIME_TAGGED_MESSAGE_WITH_RELATIVE_TIME(value,)

Alias for field number 0

class IoElement_MEASURANDS_1(typing.NamedTuple):
347class IoElement_MEASURANDS_1(typing.NamedTuple):
348    value: MeasurandValue

IoElement_MEASURANDS_1(value,)

IoElement_MEASURANDS_1(value: MeasurandValue)

Create new instance of IoElement_MEASURANDS_1(value,)

Alias for field number 0

class IoElement_TIME_TAGGED_MEASURANDS_WITH_RELATIVE_TIME(typing.NamedTuple):
351class IoElement_TIME_TAGGED_MEASURANDS_WITH_RELATIVE_TIME(typing.NamedTuple):
352    value: MeasurandWithRelativeTimeValue

IoElement_TIME_TAGGED_MEASURANDS_WITH_RELATIVE_TIME(value,)

IoElement_TIME_TAGGED_MEASURANDS_WITH_RELATIVE_TIME( value: MeasurandWithRelativeTimeValue)

Create new instance of IoElement_TIME_TAGGED_MEASURANDS_WITH_RELATIVE_TIME(value,)

Alias for field number 0

class IoElement_IDENTIFICATION(typing.NamedTuple):
355class IoElement_IDENTIFICATION(typing.NamedTuple):
356    compatibility: int
357    """compatibility in range [0, 255]"""
358    value: util.Bytes
359    """value length is 8"""
360    software: util.Bytes
361    """software length is 4"""

IoElement_IDENTIFICATION(compatibility, value, software)

IoElement_IDENTIFICATION( compatibility: int, value: bytes | bytearray | memoryview, software: bytes | bytearray | memoryview)

Create new instance of IoElement_IDENTIFICATION(compatibility, value, software)

compatibility: int

compatibility in range [0, 255]

value: bytes | bytearray | memoryview

value length is 8

software: bytes | bytearray | memoryview

software length is 4

class IoElement_TIME_SYNCHRONIZATION(typing.NamedTuple):
364class IoElement_TIME_SYNCHRONIZATION(typing.NamedTuple):
365    time: Time
366    """time size is SEVEN"""

IoElement_TIME_SYNCHRONIZATION(time,)

IoElement_TIME_SYNCHRONIZATION(time: Time)

Create new instance of IoElement_TIME_SYNCHRONIZATION(time,)

time: Time

time size is SEVEN

class IoElement_GENERAL_INTERROGATION(typing.NamedTuple):
369class IoElement_GENERAL_INTERROGATION(typing.NamedTuple):
370    scan_number: int
371    """scan_number in range [0, 255]"""

IoElement_GENERAL_INTERROGATION(scan_number,)

IoElement_GENERAL_INTERROGATION(scan_number: int)

Create new instance of IoElement_GENERAL_INTERROGATION(scan_number,)

scan_number: int

scan_number in range [0, 255]

class IoElement_GENERAL_INTERROGATION_TERMINATION(typing.NamedTuple):
374class IoElement_GENERAL_INTERROGATION_TERMINATION(typing.NamedTuple):
375    scan_number: int
376    """scan_number in range [0, 255]"""

IoElement_GENERAL_INTERROGATION_TERMINATION(scan_number,)

IoElement_GENERAL_INTERROGATION_TERMINATION(scan_number: int)

Create new instance of IoElement_GENERAL_INTERROGATION_TERMINATION(scan_number,)

scan_number: int

scan_number in range [0, 255]

class IoElement_MEASURANDS_2(typing.NamedTuple):
379class IoElement_MEASURANDS_2(typing.NamedTuple):
380    value: MeasurandValue

IoElement_MEASURANDS_2(value,)

IoElement_MEASURANDS_2(value: MeasurandValue)

Create new instance of IoElement_MEASURANDS_2(value,)

Alias for field number 0

class IoElement_GENERIC_DATA(typing.NamedTuple):
383class IoElement_GENERIC_DATA(typing.NamedTuple):
384    return_identifier: int
385    """return_identifier in range [0, 255]"""
386    counter: bool
387    more_follows: bool
388    data: list[tuple[Identification, DescriptiveData]]

IoElement_GENERIC_DATA(return_identifier, counter, more_follows, data)

IoElement_GENERIC_DATA( return_identifier: int, counter: bool, more_follows: bool, data: list[tuple[Identification, DescriptiveData]])

Create new instance of IoElement_GENERIC_DATA(return_identifier, counter, more_follows, data)

return_identifier: int

return_identifier in range [0, 255]

counter: bool

Alias for field number 1

more_follows: bool

Alias for field number 2

data: list[tuple[Identification, DescriptiveData]]

Alias for field number 3

class IoElement_GENERIC_IDENTIFICATION(typing.NamedTuple):
391class IoElement_GENERIC_IDENTIFICATION(typing.NamedTuple):
392    return_identifier: int
393    """return_identifier in range [0, 255]"""
394    identification: Identification
395    counter: bool
396    more_follows: bool
397    data: list[DescriptiveData]

IoElement_GENERIC_IDENTIFICATION(return_identifier, identification, counter, more_follows, data)

IoElement_GENERIC_IDENTIFICATION( return_identifier: int, identification: Identification, counter: bool, more_follows: bool, data: list[DescriptiveData])

Create new instance of IoElement_GENERIC_IDENTIFICATION(return_identifier, identification, counter, more_follows, data)

return_identifier: int

return_identifier in range [0, 255]

identification: Identification

Alias for field number 1

counter: bool

Alias for field number 2

more_follows: bool

Alias for field number 3

data: list[DescriptiveData]

Alias for field number 4

class IoElement_GENERAL_COMMAND(typing.NamedTuple):
400class IoElement_GENERAL_COMMAND(typing.NamedTuple):
401    value: DoubleValue
402    return_identifier: int
403    """return_identifier in range [0, 255]"""

IoElement_GENERAL_COMMAND(value, return_identifier)

IoElement_GENERAL_COMMAND( value: DoubleValue, return_identifier: int)

Create new instance of IoElement_GENERAL_COMMAND(value, return_identifier)

value: DoubleValue

Alias for field number 0

return_identifier: int

return_identifier in range [0, 255]

class IoElement_GENERIC_COMMAND(typing.NamedTuple):
406class IoElement_GENERIC_COMMAND(typing.NamedTuple):
407    return_identifier: int
408    """return_identifier in range [0, 255]"""
409    data: list[tuple[Identification, Description]]

IoElement_GENERIC_COMMAND(return_identifier, data)

IoElement_GENERIC_COMMAND( return_identifier: int, data: list[tuple[Identification, Description]])

Create new instance of IoElement_GENERIC_COMMAND(return_identifier, data)

return_identifier: int

return_identifier in range [0, 255]

data: list[tuple[Identification, Description]]

Alias for field number 1

class IoElement_LIST_OF_RECORDED_DISTURBANCES(typing.NamedTuple):
412class IoElement_LIST_OF_RECORDED_DISTURBANCES(typing.NamedTuple):
413    fault_number: int
414    """fault_number in range [0, 65535]"""
415    trip: bool
416    transmitted: bool
417    test: bool
418    other: bool
419    time: Time
420    """time size is SEVEN"""

IoElement_LIST_OF_RECORDED_DISTURBANCES(fault_number, trip, transmitted, test, other, time)

IoElement_LIST_OF_RECORDED_DISTURBANCES( fault_number: int, trip: bool, transmitted: bool, test: bool, other: bool, time: Time)

Create new instance of IoElement_LIST_OF_RECORDED_DISTURBANCES(fault_number, trip, transmitted, test, other, time)

fault_number: int

fault_number in range [0, 65535]

trip: bool

Alias for field number 1

transmitted: bool

Alias for field number 2

test: bool

Alias for field number 3

other: bool

Alias for field number 4

time: Time

time size is SEVEN

class IoElement_ORDER_FOR_DISTURBANCE_DATA_TRANSMISSION(typing.NamedTuple):
423class IoElement_ORDER_FOR_DISTURBANCE_DATA_TRANSMISSION(typing.NamedTuple):
424    order_type: OrderType
425    fault_number: int
426    """fault_number in range [0, 65535]"""
427    channel: Channel

IoElement_ORDER_FOR_DISTURBANCE_DATA_TRANSMISSION(order_type, fault_number, channel)

IoElement_ORDER_FOR_DISTURBANCE_DATA_TRANSMISSION( order_type: OrderType, fault_number: int, channel: Channel)

Create new instance of IoElement_ORDER_FOR_DISTURBANCE_DATA_TRANSMISSION(order_type, fault_number, channel)

order_type: OrderType

Alias for field number 0

fault_number: int

fault_number in range [0, 65535]

channel: Channel

Alias for field number 2

class IoElement_ACKNOWLEDGEMENT_FOR_DISTURBANCE_DATA_TRANSMISSION(typing.NamedTuple):
430class IoElement_ACKNOWLEDGEMENT_FOR_DISTURBANCE_DATA_TRANSMISSION(typing.NamedTuple):  # NOQA
431    order_type: OrderType
432    fault_number: int
433    """fault_number in range [0, 65535]"""
434    channel: Channel

IoElement_ACKNOWLEDGEMENT_FOR_DISTURBANCE_DATA_TRANSMISSION(order_type, fault_number, channel)

IoElement_ACKNOWLEDGEMENT_FOR_DISTURBANCE_DATA_TRANSMISSION( order_type: OrderType, fault_number: int, channel: Channel)

Create new instance of IoElement_ACKNOWLEDGEMENT_FOR_DISTURBANCE_DATA_TRANSMISSION(order_type, fault_number, channel)

order_type: OrderType

Alias for field number 0

fault_number: int

fault_number in range [0, 65535]

channel: Channel

Alias for field number 2

class IoElement_READY_FOR_TRANSMISSION_OF_DISTURBANCE_DATA(typing.NamedTuple):
437class IoElement_READY_FOR_TRANSMISSION_OF_DISTURBANCE_DATA(typing.NamedTuple):
438    fault_number: int
439    """fault_number in range [0, 65535]"""
440    number_of_faults: int
441    """number_of_faults in range [0, 65535]"""
442    number_of_channels: int
443    """number_of_channels in range [0, 255]"""
444    number_of_elements: int
445    """number_of_elements in range [1, 65535]"""
446    interval: int
447    """interval in range [1, 65535]"""
448    time: Time
449    """time size is FOUR"""

IoElement_READY_FOR_TRANSMISSION_OF_DISTURBANCE_DATA(fault_number, number_of_faults, number_of_channels, number_of_elements, interval, time)

IoElement_READY_FOR_TRANSMISSION_OF_DISTURBANCE_DATA( fault_number: int, number_of_faults: int, number_of_channels: int, number_of_elements: int, interval: int, time: Time)

Create new instance of IoElement_READY_FOR_TRANSMISSION_OF_DISTURBANCE_DATA(fault_number, number_of_faults, number_of_channels, number_of_elements, interval, time)

fault_number: int

fault_number in range [0, 65535]

number_of_faults: int

number_of_faults in range [0, 65535]

number_of_channels: int

number_of_channels in range [0, 255]

number_of_elements: int

number_of_elements in range [1, 65535]

interval: int

interval in range [1, 65535]

time: Time

time size is FOUR

class IoElement_READY_FOR_TRANSMISSION_OF_A_CHANNEL(typing.NamedTuple):
452class IoElement_READY_FOR_TRANSMISSION_OF_A_CHANNEL(typing.NamedTuple):
453    fault_number: int
454    """fault_number in range [0, 65535]"""
455    channel: Channel
456    primary: Real32Value
457    secondary: Real32Value
458    reference: Real32Value

IoElement_READY_FOR_TRANSMISSION_OF_A_CHANNEL(fault_number, channel, primary, secondary, reference)

IoElement_READY_FOR_TRANSMISSION_OF_A_CHANNEL( fault_number: int, channel: Channel, primary: Real32Value, secondary: Real32Value, reference: Real32Value)

Create new instance of IoElement_READY_FOR_TRANSMISSION_OF_A_CHANNEL(fault_number, channel, primary, secondary, reference)

fault_number: int

fault_number in range [0, 65535]

channel: Channel

Alias for field number 1

primary: Real32Value

Alias for field number 2

secondary: Real32Value

Alias for field number 3

reference: Real32Value

Alias for field number 4

class IoElement_READY_FOR_TRANSMISSION_OF_TAGS(typing.NamedTuple):
461class IoElement_READY_FOR_TRANSMISSION_OF_TAGS(typing.NamedTuple):
462    fault_number: int
463    """fault_number in range [0, 65535]"""

IoElement_READY_FOR_TRANSMISSION_OF_TAGS(fault_number,)

IoElement_READY_FOR_TRANSMISSION_OF_TAGS(fault_number: int)

Create new instance of IoElement_READY_FOR_TRANSMISSION_OF_TAGS(fault_number,)

fault_number: int

fault_number in range [0, 65535]

class IoElement_TRANSMISSION_OF_TAGS(typing.NamedTuple):
466class IoElement_TRANSMISSION_OF_TAGS(typing.NamedTuple):
467    fault_number: int
468    """fault_number in range [0, 65535]"""
469    tag_position: int
470    """tag_position in range [0, 65535]"""
471    values: list[tuple[IoAddress, DoubleValue]]

IoElement_TRANSMISSION_OF_TAGS(fault_number, tag_position, values)

IoElement_TRANSMISSION_OF_TAGS( fault_number: int, tag_position: int, values: list[tuple[IoAddress, DoubleValue]])

Create new instance of IoElement_TRANSMISSION_OF_TAGS(fault_number, tag_position, values)

fault_number: int

fault_number in range [0, 65535]

tag_position: int

tag_position in range [0, 65535]

values: list[tuple[IoAddress, DoubleValue]]

Alias for field number 2

class IoElement_TRANSMISSION_OF_DISTURBANCE_VALUES(typing.NamedTuple):
474class IoElement_TRANSMISSION_OF_DISTURBANCE_VALUES(typing.NamedTuple):
475    fault_number: int
476    """fault_number in range [0, 65535]"""
477    channel: Channel
478    element_number: int
479    """element_number in range [0, 65535]"""
480    values: list[float]
481    """values are in range [-1.0, 1.0)"""

IoElement_TRANSMISSION_OF_DISTURBANCE_VALUES(fault_number, channel, element_number, values)

IoElement_TRANSMISSION_OF_DISTURBANCE_VALUES( fault_number: int, channel: Channel, element_number: int, values: list[float])

Create new instance of IoElement_TRANSMISSION_OF_DISTURBANCE_VALUES(fault_number, channel, element_number, values)

fault_number: int

fault_number in range [0, 65535]

channel: Channel

Alias for field number 1

element_number: int

element_number in range [0, 65535]

values: list[float]

values are in range [-1.0, 1.0)

class IoElement_END_OF_TRANSMISSION(typing.NamedTuple):
484class IoElement_END_OF_TRANSMISSION(typing.NamedTuple):
485    order_type: OrderType
486    fault_number: int
487    """fault_number in range [0, 65535]"""
488    channel: Channel

IoElement_END_OF_TRANSMISSION(order_type, fault_number, channel)

IoElement_END_OF_TRANSMISSION( order_type: OrderType, fault_number: int, channel: Channel)

Create new instance of IoElement_END_OF_TRANSMISSION(order_type, fault_number, channel)

order_type: OrderType

Alias for field number 0

fault_number: int

fault_number in range [0, 65535]

channel: Channel

Alias for field number 2

class IO(typing.NamedTuple):
516class IO(typing.NamedTuple):
517    address: IoAddress
518    elements: list[IoElement]

IO(address, elements)

address: IoAddress

Alias for field number 0

class ASDU(typing.NamedTuple):
521class ASDU(typing.NamedTuple):
522    type: AsduType
523    cause: Cause | OtherCause
524    address: AsduAddress
525    ios: list[IO]

ASDU(type, cause, address, ios)

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

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

type: AsduType

Alias for field number 0

cause: Cause | int

Alias for field number 1

address: int

Alias for field number 2

ios: list[IO]

Alias for field number 3

class Encoder:
14class Encoder:
15
16    def __init__(self):
17        self._encoder = encoder.Encoder(
18            cause_size=common.CauseSize.ONE,
19            asdu_address_size=common.AsduAddressSize.ONE,
20            io_address_size=common.IoAddressSize.TWO,
21            asdu_type_time_sizes={},
22            inverted_sequence_bit=True,
23            decode_io_element_cb=_decode_io_element,
24            encode_io_element_cb=_encode_io_element)
25
26    def decode_asdu(self,
27                    asdu_bytes: util.Bytes
28                    ) -> tuple[common.ASDU, util.Bytes]:
29        asdu, rest = self._encoder.decode_asdu(asdu_bytes)
30
31        asdu_type = common.AsduType(asdu.type)
32        cause = _decode_cause(asdu.cause)
33        address = asdu.address
34        ios = [common.IO(address=_decode_io_address(io.address),
35                         elements=io.elements)
36               for io in asdu.ios]
37
38        # TODO assert len(asdu.ios) == 1
39
40        asdu = common.ASDU(type=asdu_type,
41                           cause=cause,
42                           address=address,
43                           ios=ios)
44        return asdu, rest
45
46    def encode_asdu(self, asdu: common.ASDU) -> util.Bytes:
47        asdu_type = asdu.type.value
48        cause = _encode_cause(asdu.cause)
49        address = asdu.address
50        ios = [encoder.common.IO(address=_encode_io_address(io.address),
51                                 elements=io.elements,
52                                 time=None)
53               for io in asdu.ios]
54
55        asdu = encoder.common.ASDU(type=asdu_type,
56                                   cause=cause,
57                                   address=address,
58                                   ios=ios)
59
60        return self._encoder.encode_asdu(asdu)
def decode_asdu( self, asdu_bytes: bytes | bytearray | memoryview) -> tuple[ASDU, bytes | bytearray | memoryview]:
26    def decode_asdu(self,
27                    asdu_bytes: util.Bytes
28                    ) -> tuple[common.ASDU, util.Bytes]:
29        asdu, rest = self._encoder.decode_asdu(asdu_bytes)
30
31        asdu_type = common.AsduType(asdu.type)
32        cause = _decode_cause(asdu.cause)
33        address = asdu.address
34        ios = [common.IO(address=_decode_io_address(io.address),
35                         elements=io.elements)
36               for io in asdu.ios]
37
38        # TODO assert len(asdu.ios) == 1
39
40        asdu = common.ASDU(type=asdu_type,
41                           cause=cause,
42                           address=address,
43                           ios=ios)
44        return asdu, rest
def encode_asdu( self, asdu: ASDU) -> bytes | bytearray | memoryview:
46    def encode_asdu(self, asdu: common.ASDU) -> util.Bytes:
47        asdu_type = asdu.type.value
48        cause = _encode_cause(asdu.cause)
49        address = asdu.address
50        ios = [encoder.common.IO(address=_encode_io_address(io.address),
51                                 elements=io.elements,
52                                 time=None)
53               for io in asdu.ios]
54
55        asdu = encoder.common.ASDU(type=asdu_type,
56                                   cause=cause,
57                                   address=address,
58                                   ios=ios)
59
60        return self._encoder.encode_asdu(asdu)