Using In-Memory Aggregation
Calculating aggregated values over set time periods is a fundamental practice when monitoring data-producing items in a system, and is often the starting point for creating the simplest of KPIs. When evaluating processes, aggregated data can help to present a clear overview within a time period context. For example, it is often more useful for an operator to view the average value produced by a pressure sensor, over a minute or an hour rather than a raw value produced every second. Generating real-time aggregate values offers flexibility and the ability to limit the amount of archived data without compromising performance.
system:inmation allows you to generate real-time aggregates without having to make history calls. By buffering raw values in memory, aggregates can be calculated over seconds, minutes, hours and days without having to access data from the archive. The inmation.buffer() function creates a table of configurable size and duration to store real-time values from a data-producing item. A second buffer can then be created to aggregate and store values.
This Jump Start aims firstly to introduce the user to the concepts of buffering data in system:inmation and then to demonstrate how to calculate different aggregates over different time periods with working examples.
This Jump Start is aimed at administrators and power users who wish to create KPIs or new ways to automatically aggregate time series data. It is useful to have some knowledge of programming, and a basic knowledge of system:inmation and DataStudio before attempting these examples. It is also useful to read the Lua Scripting Jump Start as this gives an introduction to the Lua scripting engine in system:inmation. The examples in this JumpStart will use the process simulation DemoData objects created in the Lua Scripting Jump Start (MassConfig file containing DemoData Items can be found here). The examples will use the inmation Lua library, a series of functions and methods specifically designed for use with system:inmation. Full descriptions and examples of the inmation Lua library and information on Lua scripting within system inmation can be found on the Lua Scripting page. For further information on the Lua scripting language visit the Lua website.