Skip to content

Data Aggregation at the Inport

Combine data received from multiple components with slightly different nanosecond timestamps into one record for each configured window width, then write the records.

These are the project files used in this case study. A standard version and a version with the PLC Collectors configured in simulation mode are available.

Note: Import requires SpeeDBee Synapse version 4.9.9 or later.

  • Why data from multiple components is output as separate records
  • How to use the aggregation function in the inport settings to combine data into one record

Collect temperature and pressure from each PLC with PLC Collectors connected to PLC-A and PLC-B, and input the data into the same inport of the CSV Serializer. Divide the input data by the configured window width and combine the data within each window into one record.

ComponentDataAddressDescription
PLC Collector (PLC-A)temperatureD0100Temperature (°C)
PLC Collector (PLC-A)pressureD0101Pressure (kPa)
PLC Collector (PLC-B)temperatureD0100Temperature (°C)
PLC Collector (PLC-B)pressureD0101Pressure (kPa)

Even when PLC-A and PLC-B collect the same types of data, their collection timings do not completely match. Because timestamps are assigned with nanosecond precision, the slight timing difference causes the timestamps to differ and the records to be separated.

When aggregation is not configured, the CSV Serializer outputs data as follows. Because the PLC-A and PLC-B data have different timestamps, each record contains data from only one PLC.

timestampPLC-A:pressurePLC-A:temperaturePLC-B:pressurePLC-B:temperature
13:08:04.947378445+09006825
13:08:04.949666433+09008231
13:08:05.947378445+09006825
13:08:05.949666433+09008331

Note: The date portion (YYYY-MM-DD) is omitted.

Because data with different timestamps is output as separate records, use the aggregation function to combine data within the same window into one record.

  • PLC Collector (collects data from PLC-A and PLC-B)
  • CSV Serializer (converts aggregated data to CSV)
  1. Collect data from PLC-A and PLC-B with the PLC Collectors
  2. Input the data collected from PLC-A and PLC-B into the CSV Serializer
  3. Use the aggregation function in the CSV Serializer’s inport settings to combine data within each configured window into one record
  4. Output the aggregated data as one CSV record
  1. Configure the PLC Collectors. Specify the connection target, addresses to collect, data types, and other settings for PLC-A and PLC-B so that temperature and pressure can be collected. In this configuration, collect temperature from D0100 and pressure from D0101 on each PLC.

  2. Configure the CSV Serializer. In this case, set the file switch count to 10 so that one file is output for every 10 records.

  3. After configuring the CSV Serializer, connect each PLC Collector to the CSV Serializer’s inport. Configure the flow so that data from multiple components is input to the same inport.

  4. Right-click the CSV Serializer’s inport, open the inport settings, and turn Aggregation ON. Specify the Window width. In this case, set it to 1 second and combine data within each window interval (1 second) into the same record.

  5. Configure aggregation for the input data. In this case, specify the target using regular expressions. Set the component name to .* and the data name to .* to target all data input to the CSV Serializer.

  6. To output only aggregated values, turn off RAW DATA. Click the aggregation toggle for the specified input data and select newer from the aggregation options. In this case, only the newer value within the window is used.

  7. Save the settings and start each component.

Data within the same window interval is output as one CSV record.

Download the aggregated CSV sample

The following is an excerpt from the CSV output after aggregation. Even when timestamps assigned to data from each component differ at nanosecond precision, data within the same window can be output as one record.

timestampPLC-A:pressure.newerPLC-A:temperature.newerPLC-B:pressure.newerPLC-B:temperature.newer
14:37:13.551084040+090071268634
14:37:14.551084040+090071268734
14:37:15.551084040+090071278735
14:37:16.551084040+090072278835
14:37:17.551084040+090068258231
14:37:18.551084040+090068258331

Note: The date portion (YYYY-MM-DD) is omitted.