Aggregation

Aggregations are special sample points that can, take values from other sample points and use them in calculations and condition monitoring.

An example of a calculation is that a PLC reads a temperature sensor with the value 3400 as a representation of 34.0 degrees celcius. So by dividing the value by 100 and delivering as a comma value you deliver a human readable value to the cloud, with no need to do after calculation in the cloud.

A condition monitoring aggregation (also mentioned as eventbased triggering) could be an aggregation that monitors a sample point value and the trigger changes to sampleinterval on 1 or more samplepoints when a certain condition is met (true).



Besides the normal samplepoint values

"SampleName" : "Name",
"SampleDescription" : "Description",
"SamplesSaved" : 0,
"SampleDataType" : "int16" 

The Aggregation object contains the following fields:

  • Function (string-enum, mandatory). This is the aggregation function to be performed. The currently possible values are: "max", "min", "avg", "mavg", "derived", "compute" and "eventcompute".
  • Values (array is strings, maybe-optional). This is a list of sampleref references, whose values will be arguments to the aggregation function. Mandatory for all values of Function except "compute" and "eventcompute".
  • TriggerSample : (string, mandatory). This is a sampleref to the sample that will trigger the evaluation of the aggregation function. Only when the sample is updated (either by sampling from a device or from another aggregation), will this aggregation function evaluate and create a new sample value itself.
  • Expression (string, maybe-optional). This is an arithmetic expression using Reverse Polish Notation (RPN) with sampleref , numeric constants and operators separated by commas. See the section on RPN expressions. This field is mandatory if Function is "compute" or "eventcompute".
  • TriggerNewInterval (integer > 0, optional). This is a new sample interval (in secs) for the TriggerSample that should be in effect when the event is triggered. When the event is not triggered, the TriggerSample 's normal interval is used. Only used when the Function is "eventcompute". If more than one "eventcompute" event forces a new sample interval for the same sample, the lowest new interval is used.

Examples:



Condition monitor (Eventbased logging)

{
"SampleName" : "EventValue",
"SampleDescription" : "When Test1_REG107 value >= 50, sample REG107 and Reg108 fast",
"SamplesSaved" : 0,
"SampleDataType" : "uint32",
"Aggregation" : {
"Function" : "eventcompute",
"Expression" : "Test1_REG107,50,>=",
"Values" : [ "Test1_REG108","Test1_REG107" ],
"TriggerSample" : "Test1_REG107",
"TriggerNewInterval" : 2
}
}


Division

{
"SampleName": "Test1_REG100_DIV",
"SampleDescription": "Register 1 value divided by 100",
"SamplesSaved": 10,
"SampleDataType": "double",
"Aggregation" : {
"Function" : "compute",
"Expression" : "Test1_REG100, 100, /",
"TriggerSample" : "Test1_REG100"
}
}
Creation date: 11/12/2019 14:10 (skr@secomea.com)      Updated: 11/12/2019 14:10 ()