Open Automation Software
Moving Data From Anywhere to Anywhere
1-303-679-0898

Redundant Data Logging to the Same Table from Multiple Services

You can setup OPCDatabase.NET Data Logging to from multiple services to the same table. The following is a guideline of parameters to set to enable easy and reliable logging from multiple services to the same database table.

In the following example we will describe the steps to setup both double and triple redundancy when logging data from OPC Servers.

  • Server A will be the primary server. If its data quality is good it will be the master.
    Its IP Address will be 192.168.0.1
  • Server B will be the secondary server. If Server A data quality is bad and its own data quality is good it will be the active logging server.
    Its IP Address will be 192.168.0.2
  • Server C will be the tertiary server. If Server A and Server B data quality is bad and it own data quality is good it will be the active logging server.
    Its IP Address will be 192.168.0.3

Tags – Server A

In Server A create two (2) Tags as follows, one to an OPC Item in the OPC Server that is the primary data source. For each OPC Server in Server A define one item.

  1. TagName: OPCServer01.
    DataSource: OPC Item
    DataType: Set the same as the data type of the item you are monitoring in the server.
    OPC Item: OPC Server and OPC Item path of the local OPC Server Item.
  2. TagName: EnableLogging.
    DataSource: Calculation
    DataType: Boolean.
    Calculation: [OPCServer01.Quality]
    Note: This Tag is created just to make it possible so the Logging Groups in all servers can have the same Tag Name on the Data Logging Groups to make them Active.

Tags – Server B

In Server B create two (2) Tags as follows:

  1. TagName: OPCServer01.
    DataSource: OPC Item
    DataType: Set the same as the data type of the item you are monitoring in the server.
    OPC Item: OPC Server and OPC Item path of the local OPC Server Item.
  2. TagName: EnableLogging.
    DataSource: Calculation
    DataType: Boolean.
    Calculation: ![\ 192.168.0.1 OPCServer01.Quality] & [OPCServer01.Quality]
    The Calculation is Not of Server A quality And local OPC Server 01 quality is good.
    Source When Bad: Set Sources To Default Value
    Default Value: False

Tags – Server C

As an option you can enable a third Server C with the following tags:

  1. TagName: OPCServer01.
    DataSource: OPC Item
    DataType: Set the same as the data type of the item you are monitoring in the server.
    OPC Item: OPC Server and OPC Item path of the local OPC Server Item.
  2. TagName: EnableLogging.
    DataSource: Calculation
    DataType: Boolean.
    Calculation: ![\ 192.168.0.1 OPCServer01.Quality] & ![\ 192.168.0.2 OPCServer01.Quality] & [OPCServer01.Quality]
    The Calculation is Not of Server A quality And Not of Server B quality And local OPC Server 01 quality is good.
    Source When Bad: Set Sources To Default Value
    Default Value: False

Note: If you have multiple OPC Servers on each server PC you can create a master EnableLogging Tag that ANDs all of the .Quality parameters of each OPCServer##Quality Tag.

The safest implementation is to create separate groups of tags for each OPC Server and log the values from each OPC Server in their own separate Data Logging Groups.

So in same active states data logging from some OPC Server items will be logged from Server A, some from Server B, and if a tertiary is used possible the remaining in Server C.

Data Logging Groups

In each Data Logging Group enable the property Activate Logging With Tag.

Set the Tag for Activate Logging to EnableLogging.Value.

Enable the property Do Not Buffer When Nulls Are Not Allowed In Database.

Enable the property Do Not Buffer On Primary Index Failure

Log the OPCServer01.Value Tag value in each Logging Group.

Tables

For each database table make sure there is a Primary Index on the DateAndTime field.

Set the field for the OPCServer01.Value Tag to not allow nulls in the database. Only this one field needs to be set this way along with the DateAndTime.  All others can be left to allow nulls.

Make sure the enable Store Data Logging Buffer To Disk on each Server under Configure-Options-Data Buffer.