Configuring a Calculated Tag
To create a calculated tag in Hyper Historian, follow the steps below. Each calculated tag that you create will store calculated values in the Hyper Historian database. You will be creating the calculated tag in the folder where the Hyper Historian tags you will be using as input are located. This is for organizational purposes only; the calculated tags that you create can reside anywhere in the Data Collections node. In fact, you can put them into a folder of their own if you like. For more information, refer to the Calculated Tags topic.
To create a calculated tag, follow these steps:
-
In the GENESIS64 Workbench, make sure you are looking at the Hyper Historian provider. Expand the Data Collections node so that you are in the folder where you want to create the calculated tag.
-
Right-click the folder where would like to add a new calculated tag, and select Calculated Tag, as shown below. This opens the Calculated Tag window with the Properties tab on top.
Adding a New Calculated Tag
-
A new calculated tag appears in the navigation tree. Note how the calculated tag's icon . The Hyper Historian Calculated Tag form opens (as shown below).
Calculated Tag - Properties Tab
-
Enter the Name of the calculated tag in the Name text box. The name should be short; it is used as a part of the browse name, and for that reason, you want to keep it short. The Display Name field, not the Name field, is where you want to provide lengthy detail so that the Name field is not long; tags are logged with the browse name that you provided in the Name field, so you want to keep the name short.
-
Optionally, you can enter a Display Name which appears for the calculated tag in the Project Explorer. Use the display name to supplement the shortened tag name that you entered in the Name field. If a Display Name is not provided, the Name appears in the Project Explorer instead.
Tip: The Description field can contain a detailed description of several lines for the calculated tag. Use the description for a complete definition of the calculated tag. -
Leave the Enabled checkbox unselected until you are ready to begin using the calculated tag. Enter a description that describes how the calculation is used; include information that will be helpful for later maintenance of the tag.
-
You can optionally put a check mark in the Support Operator Annotations check box to allow operators to comment on the signal in displays. Later, as the tag’s data values play or replay in the Trend Viewer, you may want to be able annotate the tag’s data values as you see them trending before you. For example, maybe you want to note an operator action that altered the data slightly, or highlight a piece of data for analysis later. Putting a check mark in the Support Operator Annotations check box lets you do that. Such annotations are saved with the tag’s data in its logger file, which makes the annotations available in a replay, accessible to the Hyper Historian SQL Server Interface, and archived with the tag’s data.
-
Select the data type from the Data Type drop-down menu. Among the options available to you are: Boolean, Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Float32, Float64, and String.
- Specify the minimum amount of time between samples. This option is helpful for limiting samples from high-frequency sampling.
-
Enter the engineering units or click the ellipsis button to select an alias tag for the Engineering Units using the Data Browser.
-
Put a check mark next to Stepped interpretation to enable this feature if it is desired. The Stepped Interpretation check box is used primarily during playback, for interpreting the tag’s data values. This feature is applied only if you request a value for a certain point of time. The returned value will be the nearest older value available. In general, if the data comes from a discrete signal such as an on/off switch (or a Boolean data type), put a check mark in this box; but if data comes from a sine wave or analog signal, leave the box empty.
-
Enter the ranges for the Lo Limit and Hi Limit. The high and low limits are used by the filter algorithms.
-
In the Trigger section, add the triggers that determine when the calculations will occur. The triggers that you can add here are calculation triggers that must be predefined as described in the Creating a Calculation Trigger topic. Note that you can use the Up and Down buttons (on the right) to sequence triggers in the list. The sequence becomes important only when two triggers execute at the same time; the trigger that is higher in the list will execute first.
-
Now go to the Expression tab to create an expression for the calculation. This expression should include the following:
-
The tag or tags whose data is to be used as input to the calculation. This can include values from Hyper Historian tags and signals as well as values from other calculated tags. Clicking the Variables button will open a dialog box that lets you choose any tag that is in the Hyper Historian tree in Project Explorer.
-
The historical time frame from which data is to be taken. The time frame should be relative to the execution date and time determined by the triggers. Do not hard code dates into the expression unless you always want those exact dates to be used for the calculation.
-
Any additional selection criteria to be used.
-
The calculation to be performed. Click the Arithmetic, Relational, Logical, Bitwise, and Functions buttons to incorporate syntactically correct elements into the calculation. Note that, from the Functions button, there are a number of functions that are specific to calculated tag logic; you can learn more about them by going to the Performance Calculation Functions topic. For tips on writing an expression and for all other elements that are available to you, refer to the Expression Editor topic.
Calculated Tag - Expression Tab
-
-
Click the Syntax button at the bottom of the window to check the logical syntax of the expression. Make any necessary corrections.
-
When you are satisfied with the calculation, make sure you put a check mark in the Enabled check box.
-
Click Apply when you are done.
-
At this point you can test the calculated tag to make sure the expression is calculating the result you are looking for.
See also:
Creating a Calculation Trigger
Scheduling Recalculation Tasks