The <calculation>
XML element contains the configuration parameters for a calculation.
<calculation>
<inputs inputQualityStrategy="ONLY_WHEN_ALL_OK">
<single pointName="Model.Point1" variable="A"/>
<single pointName="Model.Point2" variable="B"/>
</inputs>
<triggering updateOnAnyChange="true"/>
<formula>SUM(A,B)</formula>
<output outputQualityStrategy="WORST_QUALITY"/>
</calculation>
The <input>
element defines one attribute, inputQualityStrategy
, and contains zero or more sub-elements for input Points.
Valid values for inputQualityStrategy
are:
ACCEPT_ALL
ONLY_WHEN_ALL_OK
REMOVE_BAD_AND_CALC
These correspond to the input quality strategies in the calculation module documentation.
Input sub-elements can be either <single>
or <multi>
elements, depending on whether they are intended to represent multiple values for the same Point. Each contain the pointName
and variable
attributes, which define the name of Point and the symbol it is represented by in the formula.
Additionally, the <multi>
element defines the following attributes:
Attribute | Value Type | Description |
---|---|---|
from |
long | Specifies an offset in milliseconds to the beginning of a time window of Measurement history to use for this input. An offset to past times should be negative. For example, a value of -5000 will create a range that includes all Measurements since five seconds before the current time. If the number of Measurements in that time window exceeds the limit field, the latest Measurements will be used. |
limit |
int | Provides a limit on the size of the Measurement sequence retained for the calculation input. The limit will also apply to the request for Measurement history when the calculation is initialized. If not specified, the measurement calculator will use a default value. |
sinceLastPublish |
boolean | If set to true , the input does not retrieve Measurement history and instead begins accumulating time-series values from the time the calculation endpoint came online. |
Example of a single input:
<single pointName="Model.Point1" variable="A"/>
Examples of multi input:
<multi pointName="Model.Point1" variable="A" from="5000" limit="100"/>
<multi pointName="Model.Point1" variable="A" from="5000" limit="100" sinceLastPublish="true"/>
The <triggering>
element is used to define the triggering stategy for the calculation. The element may have either the updateOnAnyChange
attribute set to true
, or the updateEveryPeriodInMilliseconds
attribute with a time interval in milliseconds.
Examples:
<triggering updateOnAnyChange="true"/>
<triggering updateEveryPeriodInMilliseconds="5000"/>
The <formula>
element contains a single expression made up of input variables, arithmetic operators, and function calls.
Example:
<formula>SUM(A,B)</formula>
The <output>
element configureds the output quality strategy for the calculation. It contains the single attribute, outputQualityStrategy
, which can be assigned the following values:
These correspond to the output quality strategies in the calculation module documentation.
Output example:
<output outputQualityStrategy="WORST_QUALITY"/>