Google Protobuf
Specification: https://developers.google.com/protocol-buffers
Protocol Definition
The .proto Protocol Buffers Version Language Specification of the payload used by VILLASnode is available in the Git repository:
https://github.com/VILLASframework/node/blob/master/lib/formats/villas.proto
// Protobuf schema based on msg_format.h
//
// @file
// Author: Steffen Vogel <post@steffenvogel.de>
// SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
// SPDX-License-Identifier: Apache-2.0
syntax = "proto2";
package villas.node;
message Message {
repeated Sample samples = 1;
}
message Sample {
enum Type {
DATA = 1; // Message contains float / integer data values
START = 2; // Message marks the beginning of a new simulation case
STOP = 3; // Message marks the end of a simulation case
};
required Type type = 1 [default = DATA];
optional uint64 sequence = 2; // The sequence number is incremented for consecutive samples.
optional Timestamp ts_origin = 3;
optional Timestamp ts_received = 4;
optional bool new_frame = 5;
repeated Value values = 100;
}
message Timestamp {
required uint32 sec = 1; // Seconds since 1970-01-01 00:00:00
required uint32 nsec = 2; // Nanoseconds of the current second.
}
message Value {
oneof value {
double f = 1; // Floating point values.
int64 i = 2; // Integer values.
bool b = 3; // Boolean values.
Complex z = 4; // Complex values.
}
}
message Complex {
required float real = 1; // Real component
required float imag = 2; // Imaginary component
}
Implementation
The source code of the format-type is available here: https://github.com/VILLASframework/node/blob/master/lib/formats/protobuf.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 = "file"
uri = "/dev/null"
format = "protobuf"
}
}