Generic User Protocol
Generic User Protocol is intended to support an application-level implementation of simple and lightweight communication protocols directly in the D2000 Event process via an ESL script or Java code. It supports several types of lines including line-redundant and system-redundant ones. Data read from the communication are published into input I/O tags (IN) without waiting for any confirmation from the ESL script's side, therefore it is recommended to implement data handling via Server Event using the action ON CHANGE, eventually by a trigger event with a request queue configured, eventually by enabling multiple executions of the script (action ENABLE) so that all the published data is handled even under heavier load.
Category of communication line:
SerialOverUDP Device Redundant, SerialOverUDP Line Redundant, SerialOverUDP System&Line Redundant
TCP/IP-TCP, TCP/IP-TCP Redundant: it is possible to enter several IP addresses/symbolic names separated by commas or semicolons.
Note: if a TCP/IP-TCP or TCP/IP-TCP Redundant line has all stations set to StOFF, the TCP connection will be closed. Thus it is possible to control TCP communication from the ESL script using a STSTAT tell command.File I/O: reading from a file is supported (line by line or the entire file at once according to the File Read Mode protocol parameter.
As an "Input file" parameter, a specific file (e.g. C:\temp\input.txt) or a mask (e.g. C:\temp\*.txt) can be specified.
As an "Archive" parameter, the following can be specified:value #DELETE# - the input file is deleted after reading the data
directory name - the input file is moved to the specified directory after reading the data
empty value - the input file is not manipulated after reading the data
For both the "Input file" and "Archive" parameters, the symbolic constant #APPDIR# can be used to indicate the application directory (e.g. "#APPDIR#\input.txt").
Configuration line dialog box - tab Protocol parameters.
They influence some of the optional protocol parameters. The following line parameters can be set:
Table 1
Keyword | Full name | Description | Unit | Default value |
|---|---|---|---|---|
TS | TCP Server | Activates server mode on the TCP/IP-TCP line. In this mode, the D2000 KOM process listens to the client connection. After the client is connected, the D2000 KOM process communicates with it (i.e., it is a single-server implementation handling a single client). After the client is disconnected, the D2000 KOM process listens again. | - | False |
RT | Read Wait Timeout | Waiting between individual data readouts from the communication. If no data was received during this period and previously some data was read, it will be published as a value of input I/O tag IN. | sec.mss | 1.000 |
CE | Character encoding | The method for text encoding/decoding for writing/reading. Implemented are:
Note: ISO_8859_1 mode is suitable for the transmission of 8-bit ASCII characters and implementation of binary protocols. | - | ISO_8859_1 |
RS | Read Size | Maximum size (in bytes) of input data. Longer data will be published in several chunks. | - | 1024 |
FRM | File Read Mode | Method of reading data from a file:
| - | Read one row |
LE | Log Each Read | If this parameter is set to True, data will be published immediately regardless of the value of the parameter Read Wait Timeout. | - | False |
LF | Log Format | Format of data traces in log files: "0 - Hexa log" or "1 - Text log". | - | 0 - Hexa log |
SL | Single Log | Setting this parameter to True will make all logs to be written to a single file on redundant lines. | - | False |
Communication protocol Generic User.
The station address is not configured; it is recommended to configure a single station per line, but multiple stations are supported too. In this case, when data is received from the communication, it will be published via input I/O tags IN on all configured stations. Likewise, it will be possible to use output I/O tags OUT on any configured station.
Possible value types of I/O tag: TxtI, TxtO.
Input I/O tags:
The input I/O tag has an address IN.
Note: on redundant lines an I/O tag with address IN receives values read from any line (primary/secondary), eventually from any system (A/B).on line-redundant lines (Serial Line Redundant, SerialOverUDP Line Redundant, TCP/IP-TCP Redundant) it is possible to configure I/O tags with addresses IN_A and IN_B to distinguish inputs from primary/secondary line
on system-redundant lines (Serial System&Line Redundant, SerialOverUDP System&Line Redundant) it is possible to configure I/O tags with addresses IN_A, IN_B, IN_C, IN_D to distinguish inputs from primary/secondary line of system A/B
Output I/O tags:
The output I/O tag has an address OUT.
Note: on redundant lines values written to an I/O tag with address OUT are written to both lines (primary/secondary), eventually to both systems (A/B).on line-redundant lines (Serial Line Redundant, SerialOverUDP Line Redundant, TCP/IP-TCP Redundant) it is possible to configure I/O tags with addresses OUT_A and OUT_B to write data to primary/secondary line only
on system-redundant lines (Serial System&Line Redundant, SerialOverUDP System&Line Redundant) it is possible to configure I/O tags with addresses OUT_A, OUT_B, OUT_C, OUT_D to write data to primary/secondary line of system A/B only
Note: it is possible to configure and use an I/O tag with the address IN and I/O tags IN_A, IN_B, IN_C, IN_D on a single station at the same time.
In a similar way, it is possible to configure and use an I/O tag with the address OUT and I/O tags OUT_A, OUT_B, OUT_C, OUT_D on a single station at the same time.
Blog
You can read blogs about Generic User Protocol:
-
Ver. 1.0 - October 15, 2015 - Creating the document.
Ver. 1.1 - December 12, 2021 - Implementation of TCP Server and Character Encoding parameters.
Related pages: