Custom VILLAS Human Readable
This is a simple human-readable format commonly used for logging or debugging: The format is similar to a conventional CSV (comma separated values) file. Every line in a file correspondents to a message / sample of simulation data. The columns of a line are separated by whitespaces (tabs or spaces). The columns are defined as follows:
seconds.nanoseconds+offset(sequenceno) value0 value1 ... valueN
-
The first column contains a timestamp which is composed of up to 4 parts:
- Number of seconds after 1970-01-01 00:00:00 UTC
- A dot: '.'
- Number of nano seconds of the current second (optional)
- An offset between the point in time when a message was sent and received (optional)
- The sequence number of the message (optional)
A valid timestamp can be generated by the following Unix command:
date +%s.%N. Important: The second field is not the fractional part of the second!!! -
Maximum
MSG_VALUESfloating point values per sample. The values are separated by whitespaces as well.
Implementation
The source code of the format-type is available here: https://github.com/VILLASframework/node/blob/master/lib/formats/villas_human.cpp
Configuration
| delimiter | string Default: "\\n" The character that separates lines. |
| header | boolean Default: true Whether or not to emit a header. |
| skip_first_line | boolean Default: false Whether or not to skip the first line of the input. |
| comment_prefix | string Default: "#" Lines starting with this prefix are ignored. |
| 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": "\\n",
- "header": true,
- "skip_first_line": false,
- "comment_prefix": "#",
- "real_precision": 17,
- "ts_origin": true,
- "ts_received": true,
- "sequence": true,
- "data": true,
- "offset": true
}Example Configuration
nodes = {
node = {
type = "file"
uri = "/dev/null"
format = {
type = "villas.human"
comment_prefix = "#"
header = false
}
}
}
Example Payload
This example shows a dump with three values per sample:
# seconds.nanoseconds(sequence) signal0 signal1 signal2
1438959964.162102394(6) 3.489760 -1.882725 0.860070