Using Context Time variable to display data from the past

Using Context Time variable to display data from the past

Info
This article explains how to use the Context Time variable available in Data Historian (or Hyper Historian in v. 10.x), so a GENESIS display can present data from a selected moment in the past. The display file and asset configuration used in the example below are added as attachments.

In a typical case, GENESIS displays are used to present current real-time data, even if that data is recorded as Data Historian tags. Historical data is usually displayed using graphs and/or tables. However, there is a way to configure standard controls and dynamics to use a Context Time variable, which gives the possibility for your entire visualization to "go back in time".

Asset configuration

In this example we have created a MyMachine asset with two simulated properties Position and Speed. Both Equipment Properties are configured as Historical Tags:


The selected Collector/Aggregate settings can be whatever you need for your application. Your visualization controls will always try to get the nearest available sample.

Configuration in GraphWorX

When connecting your Data Sources in GraphWorX, navigate to your assets not directly, but through Data Historian (Historical Data -> Data Historian -> Configuration -> !Assets). Don't select the Equipment Property you want to use, but expand the menu below it and use Data Replay as your Data Source:


This will create a syntax for your Data Source parameter with .#Context at the end:


To be able to modify the Context Time, add a Label with the TimeDate dynamic and connect Data Historian -> Configuration -> !Data Replay -> Context Time as your Data Source:


This will create a syntax with the #Context:Time variable. To be able to easily select the date and time using a simple calendar control, make sure to set the DataEntry and Picker parameters to True:


You will be able to change the Context Time in Runtime with a calendar picker:


From now on, the controls confgured like above will show historical values from the time you select.

Graph cursor synchronization

For an even quicker method of time setting, the value of a graph cursor position can be written to the Context Time variable. To use this option, configure the Cursors tab of your Trend Viewer chart like below:


With a configuration like this, after you freeze your trend, moving the cursor will update the Context Time for all other controls: