Retrieving OPC Tags

You can to retrieve the tags available on an OPC server.


Before you begin:
  • The System and Device Designer workbench should be opened in the Live Simulation environement.
  • An External Controller is already created.
  • The connection to an OPC server must be active and the list of OPC tags available.
Related Topics
Creating Controller Ports
  1. Right-click the External Controller in the logic tree and select Communication Protocol.

    The Communication Protocol Properties dialog box appears.

  2. Fill the Overall OPC Parameters area to allow connection to the OPC server.



    1. Update the name of the External Control, if necessary.

    2. Fill the name of the server or its IP address if the OPC server is remote.

    3. Click Browse to review the list of OPC servers available on the machine.

  3. Set the OPC protocol parameters:




    • Write methods

      The Synchronous mode sends data to the OPC server and waits until the server has finished the update. This method is safe since no loss of data can occur, but can be slow depending on the hardware.

      The Asynchronous mode sends data to the OPC server and waits until the server notifies that it will do an update. This method is not blocking (so we can go faster) but since requests are stored in a stack, they may be lost if the stack is full (requests sent too quickly). This is the default write mode.

    • Read methods

      The Cache method uses the OPC cache of the server. This is a copy of the PLC data in the server which is refreshed depending on the Update rate selected by the user. If the server cannot refresh at the specified rate, the refresh rate is "as fast as possible" (However, you are not informed of this issue). This method is usually faster than direct access to the device since the data is read before the request. However, if requests are too close, the data will be stable.

      The Device method does not use the OPC cache but reads data directly in the PLC. This method is usually slower but you can be sure that you have data that is not stable.

      The default read method is Cache. The update rate is relevant only when using the OPC cache, so it will be deactivated when the read mode is set to Device.

  4. Click Connect.

    The OPC tags available on the OPC server are displayed in the OPC Items Browser dialog box.




    • Name column displays the structure of the OPC tags

    • OPC Tag column displays the OPC name and its path.

  5. In the example below, enter *CV1 in the Filter field and click Refresh.

    Only the first tag is displayed.



    The filter is applied on the OPC Tag column.

    Tip: Filter syntax for retrieving OPC tags is as follows:
    Characters in pattern Matches in string
    ? Any single character.
    * Zero or more characters.
    # Any single digit (0-9).
    [charlist] Any single character in charlist.
    [!charlist] Any single character not in charlist.

    A group of one or more characters (charlist) enclosed in brackets ([ ]) can be used to match any single character in the string and can include almost any character code, including digits.

    By using a hyphen (-) to separate the upper and lower bounds of the range, charlist can specify a range of characters. The characters must appear in ascending sort order (from lowest to highest). For example, [A-Z] results in a match if the corresponding character position in string contains any uppercase letters in the range A-Z. Multiple ranges are included within the brackets without delimiters.

    Note: To match the special characters left bracket ([), question mark (?), number sign (#), and asterisk (*), enclose them in brackets. The right bracket (]) cannot be used within a group to match itself, but it can be used outside a group as an individual character.

    Other rules for pattern matching include the following:


    • An exclamation mark (!) at the beginning of charlist means that a match is made if any character except the characters in charlist is found in the string. When used outside brackets, the exclamation mark matches itself.
    • A hyphen (-) can appear either at the beginning (after an exclamation mark if one is used) or at the end of charlist to match itself. In any other location, the hyphen is used to identify a range of characters.
    • When a range of characters is specified, they must appear in ascending sort order (from lowest to highest). [A-Z] is a valid pattern, but [Z-A] is not.
    • The character sequence [] is considered a zero-length string ("").
    • The filter is not case sensitive.