Appendix B. Configuration Files

The OPC DataHub comes with several configuration files, including a default configuration file called default.cfg. When the program is started for the first time, it uses default.cfg to create its primary configuration file, OPC DataHub.cfg. This file gets edited automatically every time you make changes in the Properties window. Occasionally an experienced user might have reason to edit the OPC DataHub.cfg directly, but in general it should be edited through the Properties window. When you shut down and restart the DataHub, it reads the configuration in OPC DataHub.cfg to pick up where you left off.

Configuration and License Files Location

The OPC DataHub stores its configuration and license (licenses.lic) files in the current user's Application Data directory, in a subdirectory named OPC DataHub. Here is the typical location:

C:\Documents and Settings\User Name\Application Data\OPC DataHub\OPC DataHub.cfg


If you ever need to back up the DataHub configuration, you need to copy everything in the Application Data\OPC DataHub\ directory. To copy the configuration from one DataHub to another PC, you need to copy everything except your license file.


The Application Data directory might be a hidden directory.

If there is no private configuration when the DataHub starts, it will search for configuration files and license files from previous versions in the application installation directory, and copy them to the user's private configuration. If there are no old configuration files, the DataHub will copy all the current configuration files from the application installation directory. Thereafter, changes to the OPC DataHub's properties (made through the Properties window) will only change the user's private configuration.

A user can modify this behaviour in two ways with the following command line options:

    Provide the -H home option which will indicate to the DataHub that it should store the private configuration and license files in the directory specified by home, rather than in a subdirectory of Application Data. The OPC DataHub will still search for previous and default configuration files and licenses in the application installation directory as described above.

    Provide the -U option which will indicate to the DataHub that it should not create private configuration files for each user, but store its configuration in the application installation directory.

If both -H and -U are specified, the -U flag is ignored.

Custom Configuration Files

When the OPC DataHub starts up, you may wish to have certain points and data structures get created immediately. To do this, you can create one or more custom configuration files. These files must be listed in the bottom of the Scripting option of the Properties Window.


Creating and editing custom configuration files should only be attempted by experienced users. If you do create a custom configuration file, we strongly recommend that it only be used for creating points and data structures, and not for standard configuration commands, such as those that are created and modified through entries in the Properties window. Doing otherwise could result in irregular behavior in the OPC DataHub.

The following sets of commands are the only ones that should be used in a custom configuration file:

General commands allowed in config files

create mult
set div
cset lock
write quality
cwrite secure
force append
cforce dump
add include

Model-related commands allowed in config files

alias private_attribute
assembly property
attribute subassembly
defaultprop type

Only allowed in Windows config files

execute_plugin show_debug_messages
load_plugin show_event_log
unload_plugin show_icon
load_scripts show_properties
show_data show_script_log

Custom configuration files can be created using a text editor like Notepad, and are written in Lisp syntax. They should be put in the same directory as the OPC DataHub executable, such as C:\Program Files\Cogent\OPC DataHub\ (it may be different for your installation). Each entry of the file contains either a command or a comment. Comments are marked with a semicolon character (;) at the beginning of each line.

For more information about commands and their syntax, please refer to OPC DataHub Command Set.

A small custom configuration file might look like this:

;;; Create some points in the default data domain
(create default:Point1)
(create default:Point2)
(create default:Point3)

;;; Assign values and confidences to the points
(set default:Point1 5 100)
(set default:Point2 67.234 100)
(set default:Point3 Hello 100)

;;; Create a new data domain
(create_domain NewDomain)

;;; Create some points in that data domain
(create NewDomain:Point1)
(create NewDomain:Point2)
(create NewDomain:Point3)

;;; Assign a value and confidence to the point
(set NewDomain:Point1 "A string" 100)
(set NewDomain:Point2 95 100)
(set NewDomain:Point3 3.1519 100)