VILLASframework
Modular co-simulation framework
Format-types

Some of the VILLASnode Node-types are transports which can exchange arbitrary payloads. Examples for these node-types are: MQTT, Advanced Messaging & Queuing Protocol (AMQP) and Sockets.

The format of the payload for these node-types is configurable. New formats can be added via plugins.

Currently, the following formats are supported (or planned):

Type Description Status
csv Comma-separated values stable
gtnet Raw binary values stable
iotagent-ul FIWARE IoTAgent Ultralight 2.0 Protocol stable
json.kakfa Kafka Schema/Payload Javascript Object Notation stable
json Javascript Object Notation stable
protobuf Google Protobuf stable
raw Raw binary values stable
tsv Tabulator-separated values stable
value Single value text stable
villas.binary Custom VILLAS Binary stable
villas.human Custom VILLAS Human Readable stable

File format

To use one of the format-types above, a setting named format must be present in the configuration of the respective node instance. The value of the format setting can be eiter a simple string identifying one of the available format-types from the table above. Alternatively, a JSON dictionary can be used to provide additional configuration settings to the payload format. Please see below for examples of both approaches.

If the format-type is provided as an argument to a VILLASnode command-line tool (see Usage), also both variants are supported:

# Simple
villas signal -f json -v 5 sine
# Advanced
villas signal -f '{ "type": "json", "indent": 4, "precision": 4 }' -v 5 sine

Please note, that depending on you system configuration not all format-types might be available. Use the following command to get a list of all available types on your system: villas node -h.

All format-types support the following generic options:

real_precision (integer) = 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) = true

If set, include the origin timestamp in the output.

sequence (boolean)

If set, include the sequence number in the output.

data (boolean)

If set, include the data in the output.

offset (boolean)

If set, include the offset between origin and received timestamp in the output.

Example

Simple

nodes = {
udp_json_node = {
type = "socket"
layer = "udp"
format = "json"
...
}
}

Advanced

nodes = {
udp_json_node = {
type = "socket"
layer = "udp"
format = {
"type": "json",
"precision": 4,
"indent": 4
}
...
}
}

Abstract format-types