Syntax of an OPC Historic Tag
NOTE: Tags do not apply to Template expressions, instead you use Template Parameters.
You can use a historic tag to calculate a value from a database item's historic data. The historic tag performs a specific calculation on the item's historic data and returns a single value. A historic tag has the following syntax:
"<Item>.<Database Aggregate>;<OPC Historic Algorithm>;<Start Date>;<Interval>"
"<Item>;<OPC Historic Algorithm>;<Start Date>;<Interval>"
Where:
<Item>
is the location of the database item. 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 algorithm derived from the CDBHisBase table (see Understanding the Database in the ClearSCADA Guide to the Database).<OPC Historic Algorithm>
is the name of the calculation that is to be performed on the historic data (see OPC Historic Aggregates (Algorithms)).<Start Date>
is the beginning of the time period for which historic data is taken. The Start Date has to be entered in the OPC relative time format (see Using OPC Time Formats in the ClearSCADA Guide to Core Configuration).<Interval>
is the period of time over which the value is calculated. The interval has to 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 < > .
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.
Example:
The following expression is used to animate the Value property of a text box on a Mimic:
".Region.DEC System.AI;Average;H;1H"
The text box displays the average value since the start of the current hour for a point called 'AI'. The 'AI' point is located in a sub-group called 'Region.DEC System'.
The same result could be achieved by entering:
".Region.DEC System.AI.Historic;Average;H;1H"
If the expression was to reference a database item that has multiple historic database aggregates, such as a forecast, the database aggregate part of the expression has to be included. For example, if a text box on a Mimic was animated to show the maximum value since the start of the current day for a forecast called 'D1Forecast', the expression would be:
".Region.DEC System.D1Forecast.Forecast1;Max;D;1D"
Where:
Region.DEC System.D1Forecast
is the name and location of the forecastForecast1
is the name of the required database aggregate. Each forecast database item can contain up to eight forecasts and is stored in its own database aggregate. By defining the database aggregate in the expression, you specify which of the eight forecasts are to be used in the calculation, in this case, Forecast1.Max
is the name of the OPC historic algorithm (this calculates the maximum value)D
defines the start range as the start of the current day1D
defines the duration of the range as 1 day.