3.23. Historian

The Historian option allows you to collect and store histories for groups of data points. It gets configured automatically by the Quick Trend option, and can be configured manually as well.

Check the Enable historical data collection box to enable the Historian. Histories for one or more points are created and stored in groups. You can create as many groups as your system resources will allow, and activate the data collection for that group using its corresponding On check box in the list. To edit a history group, double-click it here, or select it and press the Edit button to open the Configure Historical Data Capture window (see below). To remove a group, highlight it and click the Remove button.

Group Configuration

To add a history group, press the Add button, which opens the Configure Historical Data Capture window:

Group label:

Any text string, used to identify the group. The DataHub instance will assign a numbered label by default if nothing else is specified.

Base directory:

The directory in which the histories will be stored.

Change file every:

How often to close a recorded history file, and open another.

Keep data for:

How long to store data on disk.

Flush to disk every:

How often to flush the data from memory and write it to disk.

Example:

The directory tree and example filename that the history will be written to.

Deadband

A deadband is used to reduce the amount of data stored by only storing data if there is a significant change in value. This approach is superior to simply reducing the sampling frequency, which will lose information when data changes quickly, and will waste storage by saving the same values when data doesn't change. The deadband approach defines a resolution below which changes in data are deemed to be 'noise' and therefore ignored.

Absolute change:

Sets the deadband range to a single value. Any new value differing from the baseline (current value) by less than the number entered here will not be recorded. If a value's difference from the baseline is greater than or equal to this number, that value gets recorded and it becomes the new baseline for the absolute change deadband.

Percent change:

Sets the deadband range to be a percent of the last logged data value. Every new value is compared to that value, and if their percentage difference is less than the number entered here, the new value will not be recorded. If the difference is greater than or equal to this number, the value is recorded and that value becomes the new baseline for the percent change deadband.

[Note]

If absolute change and percent change are used together there is an AND relationship between them. The Historian will ignore any value falling within either deadband. Only those values falling outside all deadbands (or equal to the outermost) will be recorded.

Maximum time between values:

Sets the maximum time period (in seconds, a real number) to deadband. When the maximum time is reached, the next new value received will be recorded, even if its value doesn't exceed the deadband. Note that the system does not automatically generate and insert a value when the maximum time is reached; it waits for the next new value. Whenever a new value is recorded the time calculation is restarted. If the maximum time parameter is not used, there is no time limit on how many values are ignored within a deadband.

Maximum number of skipped values:

Sets a maximum number of values to skip for the deadband. When the maximum number is reached, the next new value will be recorded, even if it doesn't exceed the deadband. Whenever a new value is recorded the countlimit is restarted. If the countlimit parameter is not used, there is no count limit on how many values are ignored within a deadband.

In-Memory Cache

In-memory cache size (# of values):

Determines the amount of memory allocated to storing values. This is specified by entering a number of values.

Select Points Using These Settings

Any number of points can be selected for the group, using the selection tree.

Click the OK button to save the group configuration and return to the Historian section of the Properties window. Then click the OK or Apply button in the Properties window to ensure t

Querying Data in the Historian

It is possible to query the Historian to extract raw data as well as statistics like minimums, maximums, averages, variances, standard deviations and so on over a given time period. This is done with a script that accesses the Historian class, explained in detail with an example in the DataHub Scripting manual.

Historian File Format

The format for the Historian files consists of consecutive records as follows:

timestamp

An 8-byte floating point number indicating the number of seconds since January 1, 1970 00:00:00, UTC time, in IEEE floating point format.

value

An 8-byte floating point number, in IEEE floating point format.

quality

A 2-byte integer number encoding OPC quality, in little-endian order (Intel byte order):

OPC_QUALITY_MASK = 0xc0;
OPC_STATUS_MASK = 0xfc;
OPC_LIMIT_MASK = 0x3;
OPC_QUALITY_BAD = 0;
OPC_QUALITY_UNCERTAIN = 0x40;
OPC_QUALITY_GOOD = 0xc0;
OPC_QUALITY_CONFIG_ERROR = 0x4;
OPC_QUALITY_NOT_CONNECTED = 0x8;
OPC_QUALITY_DEVICE_FAILURE = 0xc;
OPC_QUALITY_SENSOR_FAILURE = 0x10;
OPC_QUALITY_LAST_KNOWN = 0x14;
OPC_QUALITY_COMM_FAILURE = 0x18;
OPC_QUALITY_OUT_OF_SERVICE = 0x1c;
OPC_QUALITY_WAITING_FOR_INITIAL_DATA = 0x20;
OPC_QUALITY_LAST_USABLE = 0x44;
OPC_QUALITY_SENSOR_CAL = 0x50;
OPC_QUALITY_EGU_EXCEEDED = 0x54;
OPC_QUALITY_SUB_NORMAL = 0x58;
OPC_QUALITY_LOCAL_OVERRIDE = 0xd8;