Applies To:
  • CitectSCADA

Summary:
Guide to logging Active Alarms/Alarm Summary data to a SQL Database

Solution:
Step 1. Create the database tables as shown below:



Step 2. Create a DSN Record (Control Panel | Administrative Tools | Data Sources (ODBC) ), to point to the SQL database created as part of the above step.



Step 3. Configure Devices and Alarm Categories as shown in the screenshot below:



Note: 
  1. The Alarm 'DESC' field cannot be logged. The field name 'DESC' is reserved within SQL, as a result using this causes errors during Inserting of Records due to the way CitectSCADA builds the SQL INSERT Query. A way around this issue is to append an Underscore at the end of the word DESC (eg. DESC_) as shown in the screenshot above. Note that the corresponding Field name defined in the SQL table also requires an underscore.
  2. The Data Type for fields to be logged within the SQL database table needs to be 'varchar' (nvarchar - is not supported). CitectSCADA exposes the Data as a String Value.
  3. The length of the fields defined in the SQL database table needs to be greater than or equal to the field length defined in CitectSCADA format field (e.g {Date,12} implies that the Date related data can contain a maximum of 12 characters. Therefore the related field within the SQL database needs to have a capacity of at least 12 characters to aviod loss of Data resulting from data being truncated during SQL INSERT).

CitectSCADA Devices Configuration:

Format  The Format field must match the Alarm/Summary Format (Except for the 'DESC' field which needs to be to have an underscore appended to it - See Note 1)   
 
Header  ODBC Connection String. The above screenshot shows connecting using a DSN. The following can also be used: 
Driver={SQL Native Client};Server=<Server>;Database=<DB>; Uid=<user>;Pwd=<pass>
Where:
    <Server> - Name of the SQL Server
    <DB> - The Database name which contains the tables where data needs to be logged
    <user> - User Name for connecting to the SQL Database
    <pass> - Password for the above User Name
Type Used by CitectSCADA to determine the Device Type (SQL_Dev)
FileName  The SQL database table where data is to be logged
Process  The Process responsible for logging (Alarm_Server)

An alternative to the above approach is to use the AlarmEventQue() together with custom cicode to push the alarm records into the SQL database.

Keywords:
 

Attachments