ConsumePLC 2.3.0.4.10.0.0-147

Bundle
com.cloudera | nifi-cdf-plc4x-processors-nar
Description
Processor able to read data from industrial PLCs using Apache PLC4X subscriptions
Tags
event, plc4x, read, source, subscription
Input Requirement
FORBIDDEN
Supports Sensitive Dynamic Properties
false
  • Additional Details for ConsumePLC 2.3.0.4.10.0.0-147

    ConsumePLC

    Purpose

    This processor is supposed to listen to events, generated on the PLC device, or in the loaded driver, and to generate NiFi records from these.

    General Concept

    A minimum setup requires an enabled PLC4X Connection Pool, a Record Writer, and any number of registers defined in the Address Map (dynamic properties). During execution, the processor configures the device driver to listen to events, associated with the specified registers. Most drivers create a background thread for this, which monitors the device. The events are asynchronously collected into an Event Queue, of which contents FlowFiles are generated, with each event converted to a NiFi record. The number of these records per FlowFile is limited by the Batch Size. The frequency of output is controlled by the Run Schedule.

    Address Map

    Address Map is defined as Dynamic Properties in the processor settings. Validation fails, if there is none defined. The generated record consists of fields, and the mapping defines which field should contain which PLC register’s value. The name (key) defines the record field, the value defines the PLC register’s address. (Please refer to the Driver documentation, to find the required address format.) You can define any number of fields, all of these will be monitored for events.

    Event Types

    There are 3 types of events supported by PLC4X technology:

    • Notify on Value Changes: Monitor the specified registers for value changes.
    • Cyclic Polling of Registers: Poll the specified registers periodically. Useful for high resolution data collection.
    • Listen to Events and Signals: Collect data sent from the PLC device, associated with the specified registers. Actual behavior is driver dependent, but a realistic use case would be listening to alarms: When the register value exceeds a predefined threshold on the device, that therefore requires attention, and event could be generated.

    Note: Not all drivers support all subscription types, or subscription at all. Refer to the driver documentation.

    Event Queue

    The events are collected into the memory, therefore it does not survive NiFi restarts, or fail-overs. The maximum number of collected events between processor schedules can be limited by configuration. In such case, when the queue is full, it does not store any more events, until at least one FlowFile is generated. This can cause data loss, so pick the value with care.

    Output

    In case of there is at least one event in the queue, the emitted FlowFile contain a number of NiFi records, written by the specified Record Writer. In case of any failure, there is no output.

    Type Mapping

    Due to the limitations of Avro, some data types are translated into plain string value, and the correct type information is not carried over in the generated records. You can find the exact mapping below:

    Mapping of PLC4X data types to Avro field types

    PLC Type Name Numeric Code (HEX) Avro Type
    NULL 0x00 stringType
    BOOL 0x01 booleanType
    BYTE 0x02 intType
    WORD 0x03 intType
    DWORD 0x04 longType
    LWORD 0x05 stringType
    USINT 0x11 intType
    UINT 0x12 intType
    UDINT 0x13 longType
    ULINT 0x14 stringType
    SINT 0x21 intType
    INT 0x22 intType
    DINT 0x23 intType
    LINT 0x24 longType
    REAL 0x31 floatType
    LREAL 0x32 doubleType
    CHAR 0x41 stringType
    WCHAR 0x42 stringType
    STRING 0x43 stringType
    WSTRING 0x44 stringType
    TIME 0x51 stringType
    LTIME 0x52 stringType
    DATE 0x53 stringType
    LDATE 0x54 stringType
    TIME_OF_DAY 0x55 stringType
    LTIME_OF_DAY 0x56 stringType
    DATE_AND_TIME 0x57 stringType
    LDATE_AND_TIME 0x58 stringType
    Struct 0x61 stringType
    List 0x62 array (of first element type)
    RAW_BYTE_ARRAY 0x71 bytesType

    PLC4X Documentation

    PLC4X Support

Properties
Dynamic Properties
Relationships
Name Description
success Successfully processed
Writes Attributes
Name Description
plc4x.listen.row.count Number of rows written into the output FlowFile
plc4x.listen.lastEvent Time elapsed from last subscription event (ms)
See Also