Home 

     Systems Engineering 
     Subsea Control Systems 
     Software Development 
     Products and Applications 
     Tech Info 
     Contacts & Key Personnel 
       WITS Level 0 OPC Server 
     Introduction 
    This document describes the installation and configuration of the WITS Level 0 OPC Server.

     Revision History 
    28 Oct 2004    Version 1.0
    • 'Ports' renamed to "Devices'
    • Parameter LocalUpdateOnWrite added
    • Statistics added
    • Minor cleanup in initialisation code
    15 Apr 2005    Version 1.2
    • AutoConfiguration option added
    • Support for string data types added
    03 Oct 2006    Version 2.0
    • Supports TCP/IP (both TCP/IP client and TCP/IP server)
    13 Dec 2006    Version 2.1
    • Supports TCP/IP (both TCP/IP client and TCP/IP server)
    01 Jun 2008    Version 2.2
    • Provides debug mode on writes, some unnecessary logging removed

     Installation 
    The OPC server is installed using a Microsoft Installer package - Download.


     OPC Registration 
    Following installation, the OPC server then needs to be registered. This can be done in two ways:

    1. Run the RegisterOPC.bat file
    2. Start the server manually (WITSLevel0Svr.exe), and use OPC->Register from the top menu bar


     Configuration 
    The OPC server uses an INI file for its main configuration data. It first looks for a file called 'YourMachineName'.INI (where 'YourMachineName' is the name of your PC), and if that is not found then it looks for a file called WitsOPC.INI.

    If the OPC server is licensed (see below), by default the license key will be written to a file called 'YourMachineName'.INI - this is just to simplify distribution of license keys. For example, if your PC is called JUPITER, the license key would be an entry in the file JUPITER.INI.

    Demo versions will therefore most likely use the WitsOPC.INI file as the configuration file.

    Two sample versions of the WitsOPC.INI file are included here:

    1. WitsOPC.Serial_TCP.ini
      This shows a configuration with 3 serial ports, a TCP/IP server and a TCP/IP client connection.
    2. WitsOPC.TCP_only.ini
      This shows a configuration having a single TCP/IP client connection. Here the WITS OPC server is a TCP/IP client.

    Note that these two files are just for showing how the INI files are set up. The actual file used will be WitsOPC.INI (or your machine-specific INI file), so if you are wanting to use one of the sample files, you will have to copy or rename it to WitsOPC.INI.

     

     Section [WITS Level 0 OPC] 
    The following directives are located in the root of the configuration file. Items (a) and (b) are both required, item (c) is optional.

    a. License Key
    The license key for the OPC server is a string in the configuration INI file. For example:

    LicenseKey=20CT-2K35-4E24-6F9-1E3F-BF4G
    The license key string is based on the machine name, combined with either the hard disk ID (for singe user installations) or the user name (for multiuser installations). Anything other than a valid string (for example LicenseKey=Demo) is treated as a demo license. The server will time out after 2 hours for a demo license.

    b. The number of WITS devices
    The maximum number of WITS devices currently supported is 10. The number of WITS devices is specified by the "Devices" entry, for example:

    Devices=3

    c. TCP/IP Server Port
    The third directive that can be included here is the port number if the WITS OPC server is also to act as a TCP/IP server.

    This specifies the TCP/IP port that the WITS OPC server will listen on, for example: TcpServerPort = 1001

    There is no default. If you do not specify a port, the TCP/IP server function will be disabled. Note that this directive is not required if you are only using the TCP/IP client functionality.

     
     Section [Device 1..N] - Serial Devices 
    For each serial WITS device, a number of additional parameters need to be specified:

    1. The physical comms port
    2. The comms parameters for each port
    3. A reference to the tag definition file for each device
    4. End of Frame timeout
    5. Local update on write directive

    These are specified in the respective sections of the INI file, [Device 1] through to [Device N].

    (a) The physical comms port is the Windows port number. This can be a hardware-based comms port, or it can be a virtual port such as those provided by USB-Serial converters. For example:

    CommPort=1

    (b) The comms parameters are expressed as a string stating baud rate, parity, data bits and stop bits. For example:

    Settings=9600,n,8,1

    This indicates 9600 bits/sec,no parity,8 data bits, 1 stop bit.

    For parity, the options are:
     n No parity
     o Odd parity
     e Even parity

    (c) The tag definition file is a comma delimited (CSV) file. There are five columns:

    1. Item - WITS Item ID, 0001 to 9999
    2. OPC Tag - Text string. This will be the tag in the OPC server
    3. Write - Indicates whether the item can be written to. The only requirement is that there be an entry in the field. An 'x' is used in the sample but any printing character can be used
    4. Max - Maximum value. This is a reasonableness check, used in the event of data corruption. If no maximum is specified, then no check is performed.
    5. Min - Minimum value. As for the maximum, this is a reasonableness check, used in the event of data corruption If no minimum is specified, then no check is performed.
    6. Data Type - This is the WITS data type, and will be one of the following:
      • A - ASCII data
      • F - Floating point
      • L - Long integer
      • S - Short integer
      If omitted, the data type is assumed to be floating point
    For example, the following lines are taken from the default WitsDevice.csv file:
    Item,OPC Tag,Write,Max,Min,Type
    110,HoleDepth,,20000,0
    108,BitDepth,,20000,0
    115,Hookload,,,0
    1129,TripTankVol,x,,0
    ...

    (d) The End of Frame timeout is the length of time (in milliseconds) that the OPC server should consider to be the end of a frame (or set of datasets) from the WITS device. The default is 500ms, and the lower limit is 100ms. This timeout is set using a directive such as:

    EndOfFrame=100

    (e) The Local Update on Write directive instructs the OPC server whether it should update the local copy of an OPC item when it performs a write.
    If the WITS device echoes back the written data as part of its WITS data set, then this parameter should be set to False.
    If the WITS device does not echo the written data, LocalUpdateOnWrite should be set to True. The default is False. The parameter is set using a directive such as:

    LocalUpdateOnWrite=True

     
     Section [Device 1..N] - TCP/IP Devices 
    For each TCP/IP networked WITS device, a number of additional parameters need to be specified:

    1. Whether the WITS OPC server is the TCP/IP client or server
    2. Remote Host IP address
    3. Remote Host Port number (only if the WITS OPC server is the TCP client)
    4. A reference to the tag definition file for each device (see above)
    5. Local update on write directive (see above)

    (a) TCP/IP Client or Server. The WITS OPC server will normally act as the TCP client, for example:

    TcpConfig=Client


     Auto Configuration 
    The AutoConfiguration facility assists the engineer with building the WITS configuration CSV files.

    From the main menu, select Options->AutoConfiguration

    For each device, the numerical WITS ID is shown, along with the current value. Also shown are three text columns:

    • WITS ID
    • Short ID
    • Description

    A list of OPC tags can then be built by simply using the WITS ID, the Short ID, or the Description.

    This is accomplished using the entries in the Save OPC Tag List box.

    1. Select the WITS ID, the Short ID, or the Description from the radio buttons on the left
    2. Enter the file name, using the browse button "..."
    3. Tick the "Remove blanks" or "Update INI file" boxes as required. The "Remove blanks" option removes blanks from the tag name (really only applicable if you are using the Description as the tag name), while "Update INI file" will update your INI file with the name of the CSV file that you have specified
    4. Press the Save button. You should then get a confirmation to say that a number of lines have been written to the CSV file

    Once the tag definition files have been created, it is necessary to restart the OPC server for the changes to take effect.

    Note that the AutoConfiguration option does not make entries in the following fields:

    • Enable Writes
    • Maximum
    • Minimum

    These fields need to be manually editted by the user.

    In the case of data that is being written to the WITS device, it may be necessary to add the WITS ID and OPC tag manually to the CSV file. This is because the WITS device may not send the data to the OPC server by default. It should, however, echo back the data once the OPC server has written data to it.

    For example, if you are wanting to write to the Survey/Directional Record (Record #7) Magnetic toolface, you could put an entry in the CSV file as follows:

      716,ToolfaceMTF,x,,0
    

    Assuming the WITS device echoes this data back, then AutoConfiguration will display the following data for item 716 -

      Wits ID:     SVYMTF
      Short ID:    SMTF
      Description: Svy Magnetic Toolface
    


     Diagnostics and Statistics 
    The OPC server provides several mechansims for reporting the status of the received WITS data and for assisting the engineer with diagnosis of any problems.

     OPC Status Codes 
    Each WITS item is mapped to an OPC item, which has a value and a status. WITS has two pre-defined status codes, -9999 and -8888, which correspond to a null value and a bad sensor reading. These have been mapped into OPC status codes 0x0C and 0x10 respectively, as shown in the following table. The table also indicates the other OPC errors codes that have been assigned.

    In the event that communications have failed, all OPC items which previously had a status of Good (0xC0) are assigned a status of 0x18 (Communications Failure). If their status was not good at the time of the comms failure, the existing (bad) status is retained.

    WITS Data/StatusOPC Status CodeDescription of OPC Code
    Good data0xC0Good
    -9999.00x0CBad, Device Failure
    -8888.00x10Bad, Sensor Failure
    Any non-numeric value0x0Bad (General)
    Out of range0x04Bad, Configuration Error
    Communications timeout with device0x18Bad, Communications Failure


     Statistics 
    The OPC server keeps statistics on the following:

    • Data Sets Sent. This is the number of scan packets sent by the OPC server.
    • Data Sets Received. This is the number of data sets received, where a WITS data set is enclosed in the "&&" and "!!" start and end delimiters.
    • Data Frames Received. Each WITS transmission can consist of one or more WITS data sets, termed a "frame" in this context.
    • BadData. This counter is incremented in the following cases:
      • Invalid WITS item number
      • Invalid (non-numeric) WITS value
    • Timeouts. The number of timeouts that have occurred when sending a WITS data set.
    The statistics can be reset to zero from an OPC client by writing any value (it need not be zero) to any of the five statistics counters. They will all automatically reset to zero when any one of them reaches 999999.


     Problems or Questions 
    Please get in touch by telephone or email if you have any problems with the installation or operation of the OPC server.
    Tel: +47 99724942
    Alternatively, from 0800 to 1800 Western European time: +47 55995483
    Email: