IEC 60870-5-103 devices

Together with IEC103 specific events, generic enable and running events are also supported.

Supported data types (<data_type>):

  • ‘double’

  • ‘m1_i_l2’

  • ‘m1_u_l12’

  • ‘m1_p’

  • ‘m1_q’

  • ‘m2_i_l1’

  • ‘m2_i_l2’

  • ‘m2_i_l3’

  • ‘m2_u_l1e’

  • ‘m2_u_l2e’

  • ‘m2_u_l3e’

  • ‘m2_p’

  • ‘m2_q’

  • ‘m2_f’

Master device

IEC103 master device configuration is specified by hat-gateway://iec103.yaml#/$defs/master.

According to gateway specification, all IEC103 master device event types have prefix:

gateway/iec103_master/<device_name>/<source>/...

Todo

  • create master loop (open serial endpoint) (serial port reconnect delay)

  • enable/disable remote device (query last state on enable device and listen for changes)

  • reconnect procedure when serial endpoint available and remote device is enabled (remote device reconnect delay)

  • iec103 messages are sent to device only as reaction to system events

  • only “automatic” driver action is reconnect loop

  • new gateway events are generated only as reaction to:
    • receiving iec103 messages

    • change of connection state

  • time sync loop for each enabled remote device

Gateway events

Events registered by gateway have event type starting with:

gateway/iec103_master/<device_name>/gateway/...

Available gateway events are:

  • …/status

    Represents change in serial endpoint status. Upon enabling device, new CONNECTING status should be registered, and CONNECTED once serial endpoint is opened. Once device is disabled, DISCONNECTED status should be assumed regardless of last registered status event (registration of DISCONNECTED status event during device disabling is mandatory but should not be relied upon).

    Source timestamp is None.

    Payload is specified by hat-gateway://iec103.yaml#/$defs/events/master/gateway/status.

  • …/remote_device/<device_address>/status

    Represents change in remote device connection status. Once serial endpoint is opened and remote device enabled, new CONNECTING status should be registered. Once device is disabled or remote device is disabled, DISCONNECTED status should be assumed regardless of last registered status event (registration of DISCONNECTED status event during device disabling or remote device disabling is mandatory but should not be relied upon).

    Source timestamp is None.

    Payload is specified by hat-gateway://iec103.yaml#/$defs/events/master/gateway/status.

  • …/remote_device/<device_address>/data/<data_type>/<asdu_address>/<io_function>/<io_information>

    Represents received IEC103 data message.

    Source timestamp represents IEC103 data time.

    Payload is specified by hat-gateway://iec103.yaml#/$defs/events/master/gateway/data.

  • …/remote_device/<device_address>/command/<asdu_address>/<io_function>/<io_information>

    Represents received IEC103 command message.

    Source timestamp is None.

    Payload is specified by hat-gateway://iec103.yaml#/$defs/events/master/gateway/command.

  • …/remote_device/<device_address>/interrogation/<asdu_address>

    Represents received IEC103 end of interrogation message.

    Source timestamp is None.

    Payload is None.

System events

Events registered by other Hat components, which are consumed by gateway, have event type starting with:

gateway/iec103_master/<device_name>/system/...

Available system events are:

  • …/remote_device/<device_address>/enable

    Represents request for enable/disable remote device.

    Source timestamp is None.

    Payload is specified by hat-gateway://iec103.yaml#/$defs/events/master/system/enable.

  • …/remote_device/<device_address>/command/<asdu_address>/<io_function>/<io_information>

    Represents request for command execution.

    Source timestamp is None.

    Payload is specified by hat-gateway://iec103.yaml#/$defs/events/master/system/command.

  • …/remote_device/<device_address>/interrogation/<asdu_address>

    Represents request for interrogation.

    Source timestamp is None.

    Payload is None.

Configurations and event payloads

$schema: "https://json-schema.org/draft/2020-12/schema"
$id: "hat-gateway://iec103.yaml"
$defs:
    master:
        type: object
        required:
            - port
            - baudrate
            - bytesize
            - parity
            - stopbits
            - flow_control
            - silent_interval
            - reconnect_delay
            - remote_devices
        properties:
            port:
                type: string
            baudrate:
                type: integer
            bytesize:
                enum:
                    - FIVEBITS
                    - SIXBITS
                    - SEVENBITS
                    - EIGHTBITS
            parity:
                enum:
                    - NONE
                    - EVEN
                    - ODD
                    - MARK
                    - SPACE
            stopbits:
                enum:
                    - ONE
                    - ONE_POINT_FIVE
                    - TWO
            flow_control:
                type: object
                required:
                    - xonxoff
                    - rtscts
                    - dsrdtr
                properties:
                    xonxoff:
                        type: boolean
                    rtscts:
                        type: boolean
                    dsrdtr:
                        type: boolean
            silent_interval:
                type: number
            reconnect_delay:
                type: number
            remote_devices:
                type: array
                items:
                    type: object
                    required:
                        - address
                        - response_timeout
                        - send_retry_count
                        - poll_class1_delay
                        - poll_class2_delay
                        - reconnect_delay
                        - time_sync_delay
                    properties:
                        address:
                            type: integer
                        response_timeout:
                            type: number
                        send_retry_count:
                            type: integer
                        poll_class1_delay:
                            type:
                                - "null"
                                - number
                        poll_class2_delay:
                            type:
                                - "null"
                                - number
                        reconnect_delay:
                            type: number
                        time_sync_delay:
                            type:
                                - "null"
                                - number
    events:
        master:
            gateway:
                status:
                    enum:
                        - CONNECTING
                        - CONNECTED
                        - DISCONNECTED
                data:
                    type: object
                    required:
                        - cause
                        - value
                    properties:
                        cause:
                            oneOf:
                              - enum:
                                    - SPONTANEOUS
                                    - CYCLIC
                                    - TEST_MODE
                                    - GENERAL_INTERROGATION
                                    - LOCAL_OPERATION
                                    - REMOTE_OPERATION
                              - type: integer
                                description: |
                                    other cause in range [0, 255]
                        value:
                            oneOf:
                              - $ref: "hat-gateway://iec103.yaml#/$defs/values/double"
                              - $ref: "hat-gateway://iec103.yaml#/$defs/values/measurand"
                command:
                    type: object
                    required:
                        - session_id
                        - success
                    properties:
                        success:
                            type: boolean
            system:
                enable:
                    type: boolean
                command:
                    type: object
                    required:
                        - session_id
                        - value
                    properties:
                        value:
                            $ref: "hat-gateway://iec103.yaml#/$defs/values/double"
    values:
        double:
            enum:
                - "TRANSIENT"
                - "OFF"
                - "ON"
                - "ERROR"
        measurand:
            type: object
            required:
                - overflow
                - invalid
                - value
            properties:
                overflow:
                    type: boolean
                invalid:
                    type: boolean
                value:
                    type: number