The UDP port allows efficient broadcasting, enabling a system that autonomously transmits updates when values change.
Introduction
This UDP port facilitates the implementation of comprehensive broadcasting capabilities to a device. Through this functionality, you can establish a system that doesn't necessitate data requests. Instead, it continuously listens for updates and transmits information only when required or when a value undergoes a change. This marks a departure from a rigid client/server architecture. Following the initial configuration of the Broadcast Port ASCII UDP (which should occur once after controller power-up, or cyclically if retriggering is configured), the system operates autonomously. Moreover, it becomes more convenient to incorporate multiple participants into the network, as they can all simultaneously listen due to the broadcast mechanism. The data content transmitted is contingent upon the selected Transfer Data Theme and is in raw binary format.
In order to enable frame identification or perform handshaking, every outgoing frame initiates with two extra data elements at the outset. The first element, known as the Receive Data Element, is directly influenced by the incoming frame that incorporates this data element at its commencement. The second element, referred to as the Send Data Element, serves as a counter managed by the controller itself, incrementing by 1 with the introduction of each new frame.
Through the specification of offset and length for send/receive data, it becomes feasible to create a data window spanning the entire available data field. This ensures that only the necessary data is transmitted. For security considerations, it is possible to establish a retrigger time. To stay in the TransferON state, a retrigger command must be executed within this defined time interval.
Distributor port possibilities
PC to Controller
The host PC is employed for configuring the controller's Distributor Port using BroadcastPort ASCII UDP. Depending on the setup, the PC has the capability to transmit a cyclic retrigger, preventing the transmission of data in instances when the PC is not in a ready state.
Controller to Controller
The host PC is solely used for configuring the controller's Distributor Port via BroadcastPort ASCII UDP. In scenarios where Retriggering is deactivated, the data transmission between controllers becomes independent of the host PC.
Configuration
-
ReceivePort = 5566 (default)
-
IPAddress = broadcast IP address of used network or known device IP address
e.g. existing network:
IPAddress = 192.168.1.18
SubnetMask = 255.255.255.0
⇒ Broadcast IP address = 192.168.1.255
-
SendToPort = 5567 (default)
-
SendToIPAddress = Broadcast IP address (default)
The Distributor Port has to be configured with the SETDISTRIBUTORPORTPROPERTIES command. See Broadcast Port ASCII/UDP for configuration details.
It can also be configured using the 'preconf.ini' file, which must be transferred to the controller via an FTP connection using the username '0' and password '0'. An example of the 'preconf.ini' file is as follows:
preconf.ini[AUTORUNDISTRIBUTORPORT]
; SetDistributorPortPropertiesAll[TAB]
; ...
; 0[TAB]TransferDataTheme
; 1[TAB]OffsetRecvFrom
; 2[TAB]LengthRecvFrom
; 3[TAB]OffsetSendTo
; 4[TAB]LengthSendTo
; 5[TAB]FrequencySendTo
; 6[TAB]RetriggerTimeS
; 7[TAB]IPAddressSendTo
; 8[TAB]IPPortSendTo
; 9[TAB]IPPortRecvFrom
; 10[TAB]UseTransferCounters => 0: Off / >0: On
; 1000[TAB]TransferON => 0: Off / >0: On (or Retrigger)
; x[TAB]<0 request specific identifier value
; ...
; [CR][LF]
; e.g. SeqItem0=SetDistributorPortPropertiesAll[TAB]5[TAB]-1[CR][LF]
SeqItemsCount=3
SeqItem0=SetDistributorPortPropertiesAll[TAB]6[TAB]0[CR][LF]
SeqItem1=SetDistributorPortPropertiesAll[TAB]7[TAB]192.168.5.59[CR][LF]
SeqItem2=SetDistributorPortPropertiesAll[TAB]1000[TAB]1[CR][LF]
Protocol Description
The Distributor Port data frames contain data in binary format. The amount of data to be sent is defined with Distributor Port properties and can be set with Broadcast Port ASCII/UDP.
Receive Frame:
([ReceiveDataElement – 4Bytes Integer]) **Only if TransferCounters are active
[ReceiveFrame – (Length-Offset)]
Send Frame:
([ReceiveDataElement – 4Bytes Integer]) **Only if TransferCounters are active
([SendDataElement – 4Byte Integer]) **Only if TransferCounters are active
[SendFrame – (Length-Offset)]
👉 See chapter SetDistributorportProperty about how to set up TransferCounter usage.
Byte order
Depending on the controller type, the data byte order has to be considered.
Controller type | Byte order |
---|---|
e.gate / e.pac | Big Endian (Motorola) |
Q.gate / Q.pac | Big Endian (Motorola) |
Q.station 101 | Little Endian (Intel) |
Q.station X | Little Endian (Intel) |
In the event that the byte order on the host device varies from the byte order on the controller, a byte swap is necessary for all multi-byte elements. To determine the correct byte order, it is recommended to initially read and decode the #summary.sta file from the controller. This file can be downloaded from the controller, for instance, using FTP (username: 6 / password: 6). The byte order information (under the key "IsBigEndian") can be located in the [GENERAL] section.
Furthermore, this file contains essential variable information, such as the number of variables, data types, etc. This information is crucial for accurately decoding the received data.
[GENERAL]
Type=MK175007#
MID=175-7-6381921-0#
UUID=e23a9238-f3d5-11e8-8f8f-90e2ba38d8cd
IsBigEndian=0
Location=Testing
SNR=123456
AppName=Q.station 101 DT
AppVersion=V2.14 B11
Vendor=GANTNER instruments
SampleRate=1.000000e+04
VariablesCount=26
SlavesCount=10
[FEATURES]
DeviceDiagEx=1
ReadBufferSingleWithStateResponse=1
MaxFullCirclebufferSize=250000000
CircleBufferCount=1
CircleBuffer0_UUID=e2f18ad9-f3d5-11e8-b463-90e2ba38d8cd
CircleBuffer0_IsSynchronous=1
CircleBuffer0_Frequency=10000.000000
CircleBuffer0_Size=40000001
PostProcessBufferCount=0
IntLogBuffs_Count=0
StartTime=3.652600e+04
StartTimeToDayFactor=1
dActTimeToSecondFactor=1.000000e-09
[V0]
Name=INT/---/VI#1
UUID=e2e7787c-f3d5-11e8-8bec-90e2ba38d8cd
VarType=ARI
DataDirection=I
DataType=USINT64
Format=%8.0f
RangeMin=-nan
RangeMax=-nan
Unit=
AccessIndex=0
InpSplitDataFieldOffs=0x0000
InpCombDataFieldOffs=0x0000
... continuing with all variables sections...
Command Description
This chapter explains receive and send data frames for different TransferDataThemes. The Data Theme for the connection has to be chosen with BroadcastPort ASCII/UDP – SetDistributorportProperty: identifier=”0” (TransferDataTheme).
TransferDataTheme = Variables
This data theme is used for sending and receiving online data frames.
Receive Frame | |||
---|---|---|---|
Byte | Data Type | Description | |
00 00 00 00 | 4 Byte Integer | Receive data element | Optional: If UseTransferCounters = 1 |
dd….dd | Binary data | Content is depending on controller configuration. Detailed information of how data can be accessed, is available in file #summary.sta or in GI.bench. Essential key to look for is “OutSplitDataFieldOffs”, which indicates starting offset of corresponding variable (have in mind, that to gain the correct offset value in the full frame, you need to add the HeaderSendFrame length to this offset values). LengthRecvFrom-parameter is set to full data frame with default and need to be set to a value, which counts data without header. |
|
Send Frame | |||
Byte | Data Type | Description | |
00 00 00 00 | 4 Byte Integer | Receive data element | Optional: If UseTransferCounters = 1 |
00 00 00 00 | 4 Byte Integer | Send data event | |
dd….dd | Binary data | Content is depending on controller configuration. Detailed information of how data can be accessed is available in file #summary.sta or in GI.bench. Essential key to look for is “InpSplitDataFieldOffs”, which indicates starting offset of corresponding variable (have in mind, that to gain the correct offset value in the full frame, you need to add the HeaderSendFrame length to this offset values). LengthSendTo-parameter is set to full data frame with default and need to be set to a value, which counts data without header. |
TransferDataTheme = States
This data theme is used to send state information from the controller.
Receive Frame | |||
---|---|---|---|
Not accessible in this direction! | |||
Send Frame | |||
Byte | Data Type | Description | |
00 00 00 00 | 4 Byte Integer | Receive data element | Optional: If UseTransferCounters = 1 |
00 00 00 00 | 4 Byte Integer | Send data event | |
gg gg gg gg | 4 Byte Integer | General States | |
rr rr rr rr | 4 Byte Integer | Run States | |
ee ee ee ee | 4 Byte Integer | Error States |
TransferDataTheme = RTC
This data theme is used to read or send Real Time Clock information.
Receive Frame | |||
---|---|---|---|
Byte | Data Type | Description | |
00 00 00 00 | 4 Byte Integer | Receive data element | Optional: If UseTransferCounters = 1 |
YY YY | 2 Byte Integer | Year | |
MM | 1 Byte Integer | Month | |
DD | 1 Byte Integer | Day | |
hh | 1 Byte Integer | Hour | |
mm | 1 Byte Integer | Minute | |
ss | 1 Byte Integer | Second | |
ms ms | 2 Byte Integer | Millisecond | |
Send Frame | |||
Byte | Data Type | Description | |
00 00 00 00 | 4 Byte Integer | Receive data element | Optional: If UseTransferCounters = 1 |
00 00 00 00 | 4 Byte Integer | Send data event | |
YY YY | 2 Byte Interger | Year | |
MM | 1 Byte Integer | Month | |
DD | 1 Byte Integer | Day | |
hh | 1 Byte Integer | Hour | |
mm | 1 Byte Integer | Minute | |
ss | 1 Byte Integer | Second | |
ms ms | 2 Byte Integer | Millisecond |
TransferDataTheme = Diagnostics
This data theme is used to send diagnostic data from the controller.
Receive Frame | |||
---|---|---|---|
Not accessible in this direction! | |||
Send Frame | |||
Byte | Data Type | Description | |
00 00 00 00 | 4 Byte Integer | Receive data element | Optional: If UseTransferCounters = 1 |
00 00 00 00 | 4 Byte Integer | Send data event | |
dd .. dd | Binary Data | See chapter HighSpeedPort TCPIP - Diagnostics EX for diagnostic data coding. |
Testing
For testing the Distributor Port UDP communication, you can download some testing tools in the following link:
DistributorPortUDP_TestTools.zip
user: support
pw: gins
It includes:
-
UDPClient: Tool to configure the Distributor Port on a controller manually. data traffic needs to be monitored via WireShark.
-
UDPCollector: Configures the distributor port on a controller automatically and receives the UDP stream on PC. Data is stored into .dat file.
UDPClient
Start the UDPClient.exe to set up the Distributor Port on your controller.
For example:
-
Controller IP address: 192.168.5.96
-
Port: 5565 → fixed port for Broadcast ASCII/UDP. This port is used to send commands.
-
Setup the configuration as mentioned in the example above (see General → Configuration: preconf.ini).
Set RetriggerTimeS command and click on the Start button to send:
Send to the IP address of the PC (in this case 192.168.5.143)
Turn sending on:
This tool is not able to record/visualize data. If data is sent correctly, use WireShark to monitor your network traffic.
UDPCollector
Use UDPCollector.exe to capture data on your PC. The received data will be saved in a .dat file located next to the .exe file. UDPCollector automatically configures the distributor port settings of your controller. Proceed with the following steps:
-
Create an empty text file next to the UDPCollector.exe with the name (for example 192.168.5.96_#summary.sta)
<ControllerIP>_#summary.sta
-
The tool will connect on startup to the device IP address to read all necessary information from its #summary.sta to decode the received data correctly.
-
Start UDPCollector.exe
-
Select the correct network adapter to receive data (in the example: 192.168.5.143)
-
Click on the Start button
-
“Received data file size [byte]” increases after start
-
Sample rate here is 250 (approx. rate of send/received data) → no buffered data is transferred! 250 is the default value if the max. sample rate in the controller is > 250.
-
Data is written into a .dat file next to the UDPCollector.exe
-
Samples might not be time equidistant.