Calculation Server Methodology (version 24)
The Calculation Server is a useful tool for adding additional context to your historical tag data. System administrators use the the Calc Server to create new calculated tags that are derived from a series of expressions.
These expressions can be created using various tag values from both the historical archive or from Virtual Views, as well as use any metadata associated with those tag records. In addition to basic NCalc functions, OPC Foundation aggregates, as well as custom Canary functions, are provided.
Based on the configuration of the calculated tag, new calculated values can be scheduled to occur periodically (e.g., every 30 seconds, every 4 hours, once per day, etc.) or when one or more tags contained within the expression(s) experience a value change.
Once a calculated tag has been defined, it can then be written to the Canary Historian, either as a single tag or as part of an asset type. When applied to an asset type, all associated asset instances will receive the new calculated tag.
The Calculation Server writes tags to the Historian using the Sender/Receiver service, thus following the same data flow as tags that are being logged using Canary Data Collectors.
Additionally, the tag may be backfilled using the existing historical records in the Canary Historian. The action of backfilling provides immediate validation of the calculation and has proven to be very useful.
Examples of Calculated Tags
There are many different ways you can use calculated tags and many types of calculations. Here are a few common calculation types.
Single tag transformations
Completes a data transformation of a single tag value. For instance, converting a temperature from Celsius to Fahrenheit.
Multiple tag expressions
Using data from more than one tag to create a new tag value; such as using two pressure tags to calculate an average pressure.
Conditional statements
Creates an output based on the condition of another tag or tag group using logic statements. This could be as simple as 'If the line is running and temperature is less than 212, output a FALSE, otherwise output TRUE'. Multiple nested logic statements may be used, as may other tag transformations and/or calculations.
Statistical calculations
Multiple functions are provided that allow calculations to be made that output maximums, minimums, means, standard deviations, variances, and other standard statistical calculations. These calculations can be run over specific time frames and have many configurable settings.
Time since or time remaining
Allows for a value to be output that determines the amount of time that has passed since or until a point in time. This output can then be used in other calculations. For instance, if the shift started when the process status tag equaled TRUE, you can calculate the amount of time since the shift started and then use that as a variable in other calculations.