OPAL-RT AsyncIP Example Format
VILLASnode supports the payload format used by OPAL-RT's AsyncIP example project shipped with their RT-Lab environment.
In the example project, the payload is defined by the following lines from the AsyncIP.c file as:
// ****** FORMAT TO SPECIFIC PROTOCOL HERE ******************************
//
// Define the structure of the data that we send out. This is used in the
// SendToIPPort function
struct data_out
{
short dev_id; // (2 bytes) Sender device ID
int msg_id; // (4 bytes) Message ID
short msg_len; // (2 bytes) Message length (data only)
double data[MAXSENDSIZE]; // Up to MAXSENDSIZE doubles (8 bytes each)
};
//
// Define the structure of the data that we receive. This is used in the
// RecvFromIPPort function
struct data_in
{
short dev_id; // (2 bytes) Sender device ID
int msg_id; // (4 bytes) Message ID
short msg_len; // (2 bytes) Message length (data only)
double data[MAXRECVSIZE]; // Up to MAXRECVSIZE doubles (8 bytes each)
};
// **********************************************************************
Implementation
The source code of the format-type is available here: https://github.com/VILLASframework/node/blob/master/lib/formats/opal_asyncip.cpp
Configuration
| delimiter | string |
| real_precision | integer Default: 17 Output all real numbers with at most n digits of precision. The valid range for this setting is between 0 and 31 (inclusive), and other values result in an undefined behavior. By default, the precision is 17, to correctly and losslessly encode all IEEE 754 double precision floating point numbers. |
| ts_origin | boolean Default: true If set, include the origin timestamp in the output. |
| ts_received | boolean Default: true If set, include the received timestamp in the output. |
| sequence | boolean Default: true If set, include the sequence number in the output. |
| data | boolean Default: true If set, include the data in the output. |
| offset | boolean Default: true If set, include the offset between origin and received timestamp in the output. |
{- "delimiter": "string",
- "real_precision": 17,
- "ts_origin": true,
- "ts_received": true,
- "sequence": true,
- "data": true,
- "offset": true
}Example Configuration
nodes = {
node = {
type = "socket"
layer = "udp"
format = {
type = "opal.asyncip"
dev_id = 99
}
in = {
# Port number specified in Asynchronous Process block of RTlab project
address = ":12000"
signals = {
count = 64
# The Asynchronous Process block only supports floating point values!
type = "float"
}
}
out = {
# IP address and port of OPAL-RT Target
address = "192.168.0.44:12000"
}
}
}