Syntax of a Historic Calculation Tag
NOTE: Tags do not apply to Template expressions, instead you use Template Parameters.
A historic calculation tag has the following syntax:
"<Item>.<Database Aggregate>:<Offset>:<Period>:<Maximum Period>"
"<Item>:<Offset>:<Period>:<Maximum Period>"
Where:
<Item>
is the location of the source point or forecast. This can be a relative or absolute reference (see Relative and Absolute References)<Database Aggregate>
is the name of the database aggregate that contains the historic data that is to be used in the calculation. The<database aggregate>
can be any of the historic database aggregates that are available to the database item. A historic database aggregate is an aggregate derived from the CDBHisBase table (see Understanding the Database in the ClearSCADA Guide to the Database).If the item only has a single historic database aggregate, you can leave out the
<Database Aggregate>
part of the expression For example, points only have a single historic database aggregate and so the<Database Aggregate>
part of the expression is not required. If there are multiple historic database aggregates, you have to include the<Database Aggregate>
so that ClearSCADA knows which database aggregate to use. For example, forecasts have multiple historic database aggregates, so a database aggregate has to be specified in a historic tag to define which forecast is required.<Offset>
is any time stamp adjustment (see Selecting a Historic Calculation Tag). The <Offset> must be entered in the OPC time format (see Using OPC Time Formats in the ClearSCADA Guide to Core Configuration).<Period>
is the search range (see Selecting a Historic Calculation Tag). The <Period> must be entered in the OPC time format (see Using OPC Time Formats in the ClearSCADA Guide to Core Configuration).<Maximum Period>
is the maximum search range (see Selecting a Historic Calculation Tag). The <Maximum Period> must be entered in the OPC time format (see Using OPC Time Formats in the ClearSCADA Guide to Core Configuration).
Do not enter the angle brackets <>.
Example:
The flow of gas in a pipe is measured by two points:
- 'Point 1'—This point stores data for a signal that has a range of 0-20. When the gas flow is less than 20, the data from this point is regarded as more accurate than the data from 'Point 2'.
- 'Point 2'—This point stores data for a signal that has a range of 0-200. When the gas flow is equal to or greater than 20, this point is regarded as being more accurate than 'Point 1'.
A historic calculation is used to produce 3 days' worth of historic data based on the values from the two points. The historic calculation is named 'PipeFlow' and calculates the values at 15 minute intervals. It is configured to have a 'target' point named 'Flow'.
The 'Flow' point is an analog point that stores the result of the 'PipeFlow' historic calculation. It has a range of 0-200.
The historic calculation and the points are stored in the same group.
When the flow of gas is lower than 20, the historic calculation is to base its calculations on the values from 'Point 1'. When the flow of gas is 20 or higher, the historic calculation is to base its calculations on the values from 'Point 2'. The results of the calculations are stored by the 'Flow' point. To achieve this, the following expression is defined for the 'PipeFlow' historic calculation:
IIF (".Point 2:0:15M:30M" <20, ".Point 1:0:15M:30M", ".Point 2:0:15M:30M")
Where:
- The IIF function is used to test the value of a point. In this case, if the 'Point 2' value is less than 20, the historic calculation will use the value from 'Point 1'. If the 'Point 2' value is 20 or more, the historic calculation will use the value from 'Point 2'.
- The first expression:
".Point 2:0:15M:30M" <20
This compares the value of 'Point 2' against the number 20.
- The second expression:
".Point 1:0:15M:30M"
defines the value that is to be used by the historic calculation when the first expression is TRUE.
- The third expression:
".Point 2:0:15M:30M"
defines the value that is to be used by the historic calculation when the first expression is FALSE.
- Each tag (within the entire expression) consists of:
<Item>:<Offset>:<Period>:<Maximum Period>
For example, the first tag has:
The Search Range setting defines a time period within the Max Search Range. If a source value is available within the Search Range period, the source value is deemed to have Good quality data. The historic calculation will use the latest source value that has been time stamped before the time that the expression is to be evaluated.
If there are no source values within the Search Range period, the historic calculation will look for a source value in the remaining part of the Max Search Range period. If it uses a source value from the remaining part of the Max Search Range period, the value is deemed to have Uncertain quality. If the historic calculation has to look in the Max Search Range for a source value, it will use the latest usable value.