Skip to Main Content Skip to Search
Product Documentation

Preparing to Use OPC Toolbox Software

Introduction

Before you can communicate with OPC servers on your network, you need to prepare your workstation (and possibly the OPC server host computer) to use the technologies on which OPC Toolbox software is built. These technologies, described in About OPC, allow you to browse for and connect to OPC servers on your network, and allow those OPC servers to interact with your MATLAB session using OPC Toolbox software.

The specific steps are described in the following sections.

Installing the OPC Foundation Core Components

The OPC Foundation has provided a set of tools for browsing other computers on your network for OPC servers, and for communicating with the OPC servers. These tools are called the OPC Foundation Core Components, and are shipped with OPC Toolbox software.

To install the OPC Foundation Core Components, you use the opcregister function. You can also use the opcregister function to remove or repair the OPC Foundation Core Components installation.

Installing, repairing, and removing the OPC Foundation Core Components follows the same steps:

  1. If you are repairing or removing the OPC Foundation Core Components, make sure that you do not have any OPC Toolbox objects in memory. Use the opcreset function to clear all objects from memory.

    opcreset;
  2. Run opcregister with the action you would like to perform. If you do not supply an option, the function assumes that you want to install the components. Otherwise, use 'repair' to repair an installation (reinstall the files), or 'remove' to remove the components.

    opcregister('install')
  3. You will be prompted to type Yes to confirm the action you want to perform. You must type Yes exactly as shown, without any quotes. This confirmation question is used to ensure that you acknowledge the action that is about to take place.

  4. The OPC Foundation Core Components will be installed, repaired, or removed from your system.

  5. If you receive a warning about having to reboot your computer, you must quit MATLAB and restart your computer for the changes to take effect.

Configuring DCOM

DCOM is a client-server based architecture for enabling communication between two applications running on distributed computers. The OPC DA and HDA specifications utilize DCOM for communication between the OPC client (for example, OPC Toolbox software) and the OPC server. To successfully use DCOM, those two computers must share a common security configuration so that the two applications are granted the necessary rights to communicate with each other.

This section describes two typical DCOM configuration options to allow OPC Toolbox software to work. Other DCOM options might provide sufficient permissions for the toolbox to work with an OPC server; the options described here are known to work with tested vendors' OPC servers.

There are two configuration types described in this section:

You should use the named user configuration, unless your system administrator indicates that no security is required for OPC access.

Configuring DCOM to Use Named User Security

To configure DCOM to use named user security, you will have to ensure that both the server machine and client machine have a common user who is granted DCOM access rights on both the server and client machines. You should consult the following sections for information on configuring each machine:

OPC Server Machine Configuration.  On the machines hosting the OPC servers, perform the following steps:

  1. Create a new local user. (You can also create a domain user if the server and client machines are part of the same domain.) The name used in these instructions is opc but you can choose any name, as long as you remain consistent throughout these instructions.

  2. Select Start > Settings > Control Panel. Double-click Administrative Tools and then double-click Component Services. The Component Services dialog appears.

  3. Browse to Component Services > Computers > My Computer > DCOM Config.

  4. Locate your OPC server in the DCOM Config list. The example below shows the Matrikon™ OPC Server for Simulation.

  5. Right-click the OPC server object, and choose Properties.

  6. In the General tab, ensure that the Authentication Level is set to Default.

  7. In the Security tab, choose Customize for the Launch and Activation Permissions, then click Edit. Ensure that the opc user is granted local Launch and Activation permissions.

  8. In the Security tab, choose Customize for the Access Permissions, then click Edit. Ensure that the opc user is granted local Access permissions.

  9. In the Identity tab, select This user and type the name and password for the opc user (created in step 1).

  10. If the OPC server runs as a service, make sure that the service runs as the opc user (created in step 1) and not as the system account.

  11. Repeat steps 4 through 10 for each of the servers you want to connect to.

Client Machine Configuration.  On the machine(s) that will be running MATLAB and OPC Toolbox software, perform the following steps:

  1. On the client machine(s), create the identical local user with the same name and password permissions as you set up in step 1 of OPC Server Machine Configuration.

  2. Select Start > Settings > Control Panel. Double-click Administrative Tools and then double-click Component Services. The Component Services dialog appears.

  3. Browse to Component Services > Computers > My Computer. Click Configure My Computer in the Component Services toolbar as shown below.

  4. Click the Default Properties tab, and ensure that Enable Distributed COM is checked, and that the Default Authentication Level is set to Connect and the Default Impersonation Level is set to Identify.

  5. Click the COM Security tab.

  6. For the Access Permissions, click Edit Default and ensure that the opc user is included in the Default Security list, and is granted both Local Access and Remote Access permissions.

  7. For the Launch and Activation permissions, click Edit Default and ensure that the opc user is included in the Default Security list, and is granted all rights (Local Launch, Remote Launch, Local Activation, and Remote Activation).

Your local client machine and server applications are now configured to use the same username when the server attempts to establish a connection back to the client.

Configuring DCOM to Use No Security

You must complete the following steps on both the client and server machines.

  1. Select Start > Settings > Control Panel. Double-click Administrative Tools and then double-click Component Services. The Component Services dialog appears.

  2. Browse to Component Services > Computers > My Computer. Click the Configure My Computer button in the Component Services toolbar.

  3. In the Default Properties tab, make sure that Enable Distributed COM On This Computer is selected. Select None as the Default Authentication Level, and Anonymous as the Default Impersonation Level.

  4. In the COM Security tab, select Edit Limits from the Access Permissions and ensure that Everyone and ANONYMOUS LOGON are both granted Local Access and Remote Access.

  5. In the COM Security tab, select Edit Limits from the Launch and Activation Permissions and ensure that Everyone and ANONYMOUS LOGON are both granted Local and Remote permissions (Local Launch, Remote Launch, Local Activation and Remote Activation).

Both the client and the server are now configured so that anybody can access any COM object on either machine.

Installing the Matrikon OPC Simulation Server

All examples in this guide and in the OPC Toolbox online help make use of a Matrikon demonstration server that you can download free of charge from:

http://www.matrikonopc.com

On that page, select Downloads > Product Software, then select MatrikonOPC Simulation Server Download.

To install the Matrikon OPC Simulation Server, follow the installation instructions with the software. When prompted for a server ID, use the standard server ID assigned to the Simulation Server ('Matrikon.OPC.Simulation').

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS