add

add — adds a single value at a specified time.

Syntax

(add point value [sec nsec])
    

Arguments

point

The name of a Cascade DataHub point.

value

A value for the point.

sec

The time in seconds when the point had the value.

nsec

The nanosecond of the second when the point had the value.

[Note]

If neither sec nor nsec are specified or both are zero, then the current system time is used.

Returns

t (true) on success, otherwise (error).

Description

This command lets you add points and their values manually to the Cascade Historian. It injects a single value at the specified time, in seconds and nanoseconds. This is useful for sending data directly to the historian (without using Cascade Datahub) as well as for testing and debugging, where one or more points' values can be changed in a controlled way.

In order to guarantee the time-series data is ordered, the time of the previous data point is checked and if a time reversal is detected (i.e., the current timestamp preceeds that of the last one) then the timestamp of the data is modified to a small increment (1 micro-second) relative to the previous timestamp. This situation should only occur when there is more than one source of the same data, a situation that is never recommended.

The value for the point is stored internally as a HI_stVALUE structure, where HI_stVALUE.xaxis is the time, represented as a double-precision floating point number, and HI_stVALUE.value is the value.

Since the Cascade Historian handles points sequentially on a time-stamped basis, if you call this command several times on the same point each call should have increasing sec and/or nsec parameters.

This command corresponds to the Cogent C API function HI_Add.

Example

(add pt7562 67.5 972397502 5000)
(add pt7562 62.7 972397502 6000)
(add pt7562 59.3 972397502 7000)
(add pt7562 72.6 972397502 8000)
(add pt7562 69.3 972397502 9000)