TN - 1116 How to determine time between samples
Description
This article from InSource shows how to use the built in column of the Historian Server (called wwResolution) to return the time between samples of a queried result set. This can be useful to understand how long something spent in a given state or how long it has been since the value of X was something.
- Author: Lewis Talley
- Published: 02/22/21
- Applies to: Historian Server (various versions)
Details
when querying the Historian, you can specify which columns are returned in the result set as shown below. Although most commonly we are only concerned with the tagname, datetime, value and quality. The Historian Client allows you a visual list to pick which columns you want (or you can look in the documentation for a full list):
One of the often overlooked columns available is the wwResolution column, and this column is used to show the time difference between the samples returned the result set. This can be displayed in the Historian Client, but clicking the checkbox to turn it on or by specifying it in part of the select statement in the SQL query. Below shows what this looks like using the system second, and system minute counter. You will notice the time difference between the two is expressed in milliseconds for each
To specify this in a query looks like this: