2

Calculation Server

The Calculation Server, or Calc 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.

There are many different ways you can use calculated tags and many types of calculations.  Here are a few common calculation types.

Completes a data transformation of a single tag value.  For instance, converting a temperature from Celsius to Fahrenheit. 

Using data from more than one tag to create a new tag value; such as using two pressure tags to calculate an average pressure.

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.

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.

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.

 

Writing Expressions

The functions available within the Calculation Server can be categorized in three different ways:

  1. Standard OPC Foundation aggregates
  2. NCALC functions and operators
  3. Custom functions developed by Canary

See Available Functions of the Calc Service for more details.

4 replies

null
    • marcos_morales
    • 10 mths ago
    • Reported - view

    Is possible to create a custom calculation like (tag1*const1+tag2+tag3*tag4)/(const2+tag5)?

      • smason
      • 10 mths ago
      • Reported - view

      marcos. morales 
      Absolutely! Assuming those tags are within the Historian, that would be fine.

      • marcos_morales
      • 10 mths ago
      • Reported - view

      Steve Mason THK
      How we can implement custom calculatios, can you share some document?

      • smason
      • 10 mths ago
      • Reported - view

      marcos. morales 

      Maybe I'm misunderstanding. The example you gave is a custom calculation. You just have to input the tags and constants. Here's an example using tags from my historian:

      If you are talking about custom functions, we do not do this.