LogDataAggregator
LogDataAggregator
The LogDataAggregator is a sequencer block, that collects value sample events from CDP Logger, aggregates them by Path and sends out compacted value series using Protocol Buffers encoding.
The block can be useful when CDPLogger data needs to be sent over a slow or expensive communication line, to speed up the communication and reduce the bandwidth usage.
Block receives ValueLogReader Data events (i.e. Path plus value sample data like Timestamp, Value and ValueType) and groups them by the Path. When some sample groups become larger than the configured maximum or the ValueType has been changed, then the previously collected value samples for the Path will be encoded and sent to the block output, together with the Path value. The following Protocol Buffers message is used to encode value sample list:
syntax = "proto3"; message AggregatedData { string valuetype = 1; repeated uint64 timestamp_deltas = 2; repeated double d_values = 3; repeated float f_values = 4; repeated uint64 ui64_values = 5; repeated sint64 i64_values = 6; repeated uint32 ui32_values = 7; repeated sint32 i32_values = 8; repeated uint32 us_values = 9; repeated sint32 s_values = 10; repeated uint32 uc_values = 11; repeated int32 c_values = 12; repeated bool b_values = 13; repeated string str_values = 14; }
To decode these messages on the receiver end, a companion LogDataDisaggregator block can be used, that can decode these messages back to individual value samples again.
Events
Name | Input/Output | Description |
---|---|---|
Data | Input | A single input value sample. The event must have arguments Path, Timestamp, Value, ValueType. Usually to be routed from ValueLogReader sequencer block. |
Aggregated | Output | Aggregated and encoded value samples will be sent out via this event in AggregatedData argument, together with corresponding Path argument |
Flush | Input | Will encode gathered value samples for all Paths and send them out as Path, AggregatedData argument via Aggregated events |
Flushed | Output | Will be emitted after Flush is done |
Init | Input | Will clear all pending value sample data and reset the aggregator, then will emit Inited |
Inited | Output | Will be emitted after Init is done |
Arguments
Name | Description |
---|---|
Path | Node path of the value sample. Must be present in the incoming Data event. Will be sent out with the Aggregated events. |
Timestamp | Timestamp of the node value sample. Must be present in the incoming Data event. |
Value | The value of the node. Must be present in the incoming Data event. |
ValueType | The value type of the node value sample. Must be present in the incoming Data event. |
AggregatedData | Aggregated value samples for one Path encoded as Protocol Buffers message. Will be sent out with the Aggregated events. |
Properties
Name | Special flag | Description |
---|---|---|
MaxCount | When not zero, sets the maximum value sample count (per Path) to aggregate before sending them all out via Aggregated event | |
MaxSize | When not zero, sets the maximum size (in bytes) for the AggregatedData argument value to grow before it has to be sent out. Set this attribute to equal or less than the maximum message size of the communication protocol, for the messages not to exceed the communication protocol message size limit. | |
Empty | Read-only | Is set to true when no value samples are waiting to be aggregated and sent out for any Path |
Note: Note, that the encoded message (AggregatedData argument) may contain non-printable characters, therefore the Command attribute of Aggregated event has to be set to any other value than CM_TEXTCOMMAND (`20100_16`) - which will instruct the CDP to send the event data over in binary form. Also, make sure you set the Command attribute to the very same value on the event receiver side.
See also LogDataDisaggregator.
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.