RDC – Remote data connection

Block SymbolLicensing group: ADVANCED
Qt SVG Document Exported by REXYGEN Studio HLD u0 u1 u2 u3 u4 u5 u6 u7 u8 u9 u10 u11 u12 u13 u14 u15 iE fresh y0 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 RDC

Function Description
The RDC block is a special input-output block. The values are passed between two blocks with the same number, but on different computers (or between two Simulinks or between Simulink and the REXYGEN system). Values are passed using the UDP/IP protocol. Communication works on all local LAN networks and on Internet links. The algorithm performs the following operations at each step:

  • If HLD=on, the block execution is terminated.
  • If the period parameter is a positive number, the difference between the system timer and the time of the last packet sending is evaluated. The block execution is stopped if the difference does not exceed the period parameter. If the period parameter is zero or negative, the time difference is not checked.
  • A data packet is created. The packet includes block number, the so-called invoke number (serial number of the packet) and the values u0 to u15. All values are stored in the commonly used so-called network byte order, therefore the application is computer and/or processor independent.
  • The packet is sent to the specified IP address and port.
  • The invoke number is increased by 1.
  • It is checked whether any incoming packets have been received.
  • If so, the packet validity is checked (size, id number, invoke number).
  • If the data is valid, all outputs y0 to y15 are set to the values contained in the packet received.
  • The fresh output is updated. In case of error, the error code is displayed by the err output.

There are 16 values transmitted in each direction periodically between two blocks with the same id number. The u(i) input of the first block is transmitted the y(i) output of the other block. Unlike the TCP/IP protocol, the UDP/IP protocol does not have any mechanism for dealing with lost or duplicate packets, so it must be handled by the algorithm itself. The invoke number is used for this purpose. This state variable is increased by 1 each time a packet is sent. The block stores also the invoke number of the last received packet. It is possible to distinguish between various events by comparing these two invoke numbers. The packets with invoke numbers lower than the invoke number of the last received packet are denied unless the difference is grater than 10. This solves the situation when one of the RDC blocks is restarted and with it its invoke number.

Note: All RDC blocks in the same application must have the same local port and the count of RDC blocks is limited to 64 for implementation reasons. If there are two applications using the RDC block running on the same machine, then each of them must use a different local port.

Examples
The constants 3 and 5 are sent from Computer1 to Computer2, where they appear at the y0 and y1 outputs of the RDC2 block. The constants are then summed and multiplied and sent back to Computer1 via the u11 and u12 inputs of the RDC2 block. The displays connected to the y11 and y12 outputs of the RDC1 block show the results of mathematical operations 3 + 5 and (3 + 5) 5. The signal from the SG generator running on Computer2 is transmitted to the y0 output of the RDC1 block, where it can be easily displayed.

image/svg+xmltarget computer name = "Computer2" Block ID = 1 Computer1 Computer 2 target computer name = "Computer1" Block ID = 1 ||||||||||||||||||||| Scope2 SLEEP SLEEP y SG HLDu0u1u2u3u4u5u6u7u8u9u10u11u12u13u14u15iEfreshy0y1y2y3y4y5y6y7y8y9y10y11y12y13y14y15 RDC2 HLDu0u1u2u3u4u5u6u7u8u9u10u11u12u13u14u15iEfreshy0y1y2y3y4y5y6y7y8y9y10y11y12y13y14y15 RDC1 u1u2y MUL 0 Display1 0 Display 5 CNI1 3 CNI u1u2y ADD

The simplicity of the example is intentional. The goal is to demonstrate the functionality of the block, not the complexity of the system. In reality, the RDC block is used in more complex tasks, e.g. for remote tuning of the PID controller as shown below. The PID control algorithm is running on Computer1 while the tuning algorithm is executed by Computer2. See the PIDU, PIDMA and SSW blocks for more details.

image/svg+xmltarget computer name = "Computer2" Block ID = 1 Computer1 Computer 2 target computer name = "Computer1" Block ID = 1 Scope1 Scope u1u2SWy SSW SLEEP1 SLEEP HLDu0u1u2u3u4u5u6u7u8u9u10u11u12u13u14u15iEfreshy0y1y2y3y4y5y6y7y8y9y10y11y12y13y14y15 RDC2 HLDu0u1u2u3u4u5u6u7u8u9u10u11u12u13u14u15iEfreshy0y1y2y3y4y5y6y7y8y9y10y11y12y13y14y15 RDC1 dvsppvtvhvMANIHmvdmvdeSAT PIDU dvsppvtvhvMANIHTUNETBRKTAFFipsmvdmvdeSATTBSYTEitetrempkptiptdpndpbpc PIDMA uy MDL tvUPDNrvLOCy MCU [proces_pv] [proces_mv] [proces_mv] [proces_pv] 0 Display 1 CNB

This block does not propagate the signal quality. More information can be found in the 1.4 section.

Input

HLD

Hold

Bool

u0..u15

Signal to send to the remote RDC block

Double (F64)

Parameter

target

Remote computer name/IP address

String

rport

Remote port number  1288

Word (U16)

lport

Local port number  1288

Word (U16)

id

Block ID   1  32767 1

Long (I32)

period

Minimum communication period [s]

Double (F64)

Output

iE

Error code

Long (I32)

0 ....

No error

-1 ...

Maximum number of blocks exceeded (>64)

-2 ...

Local ports mismatch

-3 ...

Error opening socket

-4 ...

Error assigning local port

-5 ...

Error setting the so-called non-blocking socket mode

-6 ...

Error resolving IP address

-10 ..

Error initializing the socket library

1 ....

Initialization successful, no data received

2 ....

Packet consistency error or service/application conflict

4 ....

Error receiving packet

8 ....

Error sending packet

fresh

Elapsed time since the last received packet [s]

Double (F64)

y0..y15

Signal received from remote RDC block

Double (F64)

2024 © REX Controls s.r.o., www.rexygen.com