2.4. Working with Data

2.4.1. Data Points

Each value stored in the Cascade DataHub is called a point. A point has the following attributes:

  • Name: a character string. Currently the only limit on length is internal buffer size, about 1000 bytes by default.
  • Value: an integer, floating-point number, or character string.
  • Time: the date and time of the last significant change to the point's value, confidence, quality or other status information.
  • Quality: the quality of the connection, assigned by the DataHub for this point, such as Good, Bad, Last known, Local override, etc. The possible values are those supported by OPC in Microsoft Windows.
  • Confidence: a value from 0 to 100 that indicates as a percentage the probability that the value shown for the point is actually its true value. This feature can be accessed and changed only by using the API. The DataHub never uses confidence itself, but carries it for use by client applications.

The Cascade DataHub does not require you to configure the names or types of data points you will be using in your system. If your program writes a data value to the DataHub and the point does not exist, the DataHub will create the point. If a program registers for exceptions for named points that currently do not exist in the DataHub then the DataHub will create those points and register the client program at the same time. If a program tries to read the value of a point that doesn't exist in the DataHub, then the DataHub will create the point and return a default zero value with a zero confidence to the client program.

The DataHub does not limit the size of a point data message. The only limits are those imposed by the operating system. This limit is 64000 bytes in QNX using SRR, 128000 bytes in Linux using the SRRIPC Module, and unlimited for TCP. Bear in mind that very large values will take more time to be transmitted over a network.

Typically, the Cascade DataHub is started before other application modules. Then, other tasks are started that communicate with the DataHub (to request exceptions, send data, or both). Memory (RAM) is allocated for the points as they are created by the DataHub.

It is not possible to directly delete points from the DataHub. Should a point no longer be in use by any participating program, when the DataHub is shut down and restarted, the point will no longer appear.

2.4.2. Registering for Exceptions

The normal way to receive data is to have your program register for an exception on a data point. Once you have registered for an exception, the DataHub will send you an update whenever the value for that point changes.

The waiter utility registers for exceptions with a DataHub and displays any new point values that it receives. The source code for this example will help you develop applications that effectively utilize the DataHub. See waiter for details about the syntax for waiter, and see its source code in the Registering for exceptions from the Cascade DataHub appendix of the Cogent C API manual.

2.4.3. Domains and Names

The Cascade DataHub divides data into domains. This provides namespace separation and avoid conflicts when working with multiple third-party data sources. In addition, using domains for a large network can significantly reduce network traffic. All references for point values that reside in a domain other than default are referenced using a domain prefix of the following format: domain:pointname

The Cascade NameServer assigns the DataHub a name for each domain. These names are used for communication with other programs, and can be viewed using the nsnames command. For example:

[sh]$  datahub -d test1 -d test2
[sh]$  nsnames
Name      Domain Queue      NID PID
/dh/test1 test1  /dh/test1  0   13446
/dh/test2 test2  /dh/test1  0   13446

In some cases the DataHub will only register its name with a process ID on it. This is useful if you don't specify a domain with the -d option or in the configuration file, and the DataHub is acting as a TCP master (see below). For example:

[sh]$ datahub
[sh]$ nsnames
Name        Domain  Queue      NID PID
/dh/13440   default /dh/13440  0   13440
/dh/default default /dh/13440  0   13440

As clients ask for points in various domains, the DataHub will register the appropriate names with nserve, if possible. If you have more than one DataHub serving the same domain name, only the first one will be allowed to register the /dh/domain name with nserve.