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:

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 forecast
  • Forecast1 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 day
  • 1D defines the duration of the range as 1 day.

Disclaimer

ClearSCADA 2017 R3