The OPC Client task/worksheet is used to
communicate with any system that implements the OPC Server
protocol.
This task implements the OPC standard as described in
the OLE for Process Control Data Access Standard
Version 1.0A document, which is available at the OPC
Foundation web site.
Note: Before
using the OPC Client task/worksheet in your project, you must make
sure the OPC server software is properly installed and configured
on the system to which you want to connect.
To configure a new connection, insert a new OPC Client
worksheet on the Comm tab of the
Project Explorer.
Figure 1. Sample OPC
Client worksheet
Use the following parameters in the configuration
table for OPC:
- Description text
box: Type a description of the OPC task for documentation purposes
only. (The OPC Client task ignores this information.)
- Server Identifier:
Type the name of the server you want to connect. If the server is
already installed on the computer, you can select the server name
from the list.
- Disable: Type a
tag or a constant with a value other than 0, to disable communication with the OPC server.
Specify 0, or leave the field blank
to enable communication.
- Read Update Rate:
Specify how often the server should update this group (in
milliseconds). Specify 0 to indicate
the server should use the fastest practical rate.
- Percent Deadband
(valid for analog items only): Specify how much percent change in
an item value should cause a notification by the server.
- Status: Type the
name of a tag to receive the status of the connection. Good status
is 1.
- Remote Server
Name: Node name or IP address of server on node
network.
- Read before
writing checkbox: Check this option to force your project to
read the original values of items on the OPC server just before
writing new values to the server. The project does this by first
buffering the new values to be written and then reading the
original values from the server. Only after the project is
synchronized with the server are the new values written from the
buffer to the server.
- Read after writing
checkbox: Check this option to force your project to read back the
new values of items on the OPC server just after the project has
written those values.
CAUTION:
The
Read
before writing and
Read after
writing options are offered because the OPC Client/Server
specification says that the value of an item on the client — in
this case, your project — should not change unless the server sends
the change. That way, the client always stays in sync with the
server.
Your project, however, may be designed to change
those values according to runtime processes or user input.
Therefore, the best way to change the values while staying in sync
with the server is to make it seem like the changes originate on
the server. With both options enabled, the following sequence of
events happens on every scan of the OPC worksheet:
- The new values on the client are buffered.
- The original values on the server are read to the
client — that is, the client is synchronized with the server.
- The new values are written from the buffer to the
server.
- The new values on the server are read to the client
— that is, the client is again synchronized with the server.
At the end of each scan, the values reflect what's
happening in your project even though, technically speaking, the
project is merely staying in sync with the server.
Both options should be enabled in most projects. In
some projects, however, this may cause items to bounce between the
original values and the new values. If this is a problem, try
moving those items to another OPC worksheet where the Read before writing and Read after writing options are
disabled.
- Accept Tag Name in the
Item column checkbox: When this option is checked, the text
configured between curly brackets in the Item field is resolved as
a Tag Name (string tag). In this case, the value of this tag is
used as the name of the item from the OPC Server, allowing the user
to point to different item names during runtime, by changing the
value of the tag(s) configured in the OPC Client worksheet (Item
column).
When the Accept Tag Name in
the Item column option is unchecked, all characters
configured in the Item column are considered part of the Item name
(including the curly brackets).
- Tag Name: Type the
names of tags linked to the server items.
- Item: Enter the
name of the server's items. After selecting an OPC Server, you can
select items from the Server using the OPC Browser. Right-click in
the Item field and select the
OPC Browser option.
Tip: You can
configure a tag name between curly brackets (e.g., {TagName} ) in this field, allowing the
user to change the item names dynamically, during
runtime.
- Scan field:
Specify the condition under which the tag value is read from the
remote device or server and then updated in the project database,
using one of the following options:
- Always means the
tag is read and updated during every scan of the communication
worksheet, regardless of whether the tag is used in any other
project screens, scripts, or worksheets.
This option is recommended for tags that must be
continuously monitored in the background, such as tags that trigger
alarms, tags used in recipes, tags that are recorded in the
historical database, and so on.
- Screen means the
tag is read and updated only if it is being used in at least one
open project screen, either locally or on another client station.
This option is recommended for tags that are used in
screen objects, because the project may not need to update tags
that are not being visualized anywhere. Selecting this option can
improve project performance.
- Auto means the
project will automatically choose either Always or Screen, depending on where the tag is used in
your project. If the tag is only used in a screen object on a
project screen, then the scan will default to Screen. But if the tag is configured in any
other interface (e.g., Script, Math, Alarm, Trend, Recipe, Report,
Scheduler), then the scan will switch to Always and remain there until the project is
stopped.
If you are not sure of which option to select, select
Always. This will guarantee the
tag is read and updated.
- Div field: Specify
the division constant when scale adjustment is required. This value
is a division factor in a read operation and a multiplication
factor in a write operation.
- Add field: Specify
the addition constant when scale adjustment is required. This value
is a addition factor in a read operation and a subtraction factor
in a write operation.
To run the OPC Client runtime task, you can choose to
run it automatically on start up, or run the task manually by
clicking Tasks (either local or
remote) on the Home tab of the ribbon. After running this program,
a small icon displays in your system tray.
To close the OPC Client runtime task, right-click the
icon in the system tray, and click Exit.
Note:
IWS and CEView also
provide an OPC Server communication task named
Studio.Scada.OPC. This task starts automatically
when any OPC Client (local or remote) attempts to connect to the
Studio.Scada.OPC server. An OPC
Client can exchange data with the tags database (Project Tags,
System Tags, and Shared tags) using the OPC interface.
In addition, you can start the OPC Server task
automatically when you run the project. Select the OPC Server task
in the Execution Tasks dialog
(Tasks on the Home tab of the
ribbon), click the Startup
button, and specify Automatic.
Tip: You can
also use the OPC interface to exchange data between remote stations
running InduSoft Web
Studio or CEView. You must configure the OPC Client
in one station and you must execute the OPC Server in the other
station.
OPC Troubleshooting
When you are using OPC and have problems establishing
communication, you should first verify the messages in the
LogWin.
If you are running the project on a Windows Embedded
target system, there are two ways to check the log:
- Remote LogWin
- Local Log
For information about using these logs, please refer
to Using the LogWin
task.
If you find error messages in the log, look them up in
this manual/help system, and follow the documented steps for
solving the problems. (Use <CTRL> + F to find them in the
manual; use the Index to find them in the context sensitive help
system.)
If you feel that you need to contact your
distributor for technical support, make sure that you provide them
with the following information:
- Log file
- Software vendor and product name of the OPC
Server/Client that you are using
- If possible, a copy or an evaluation version of the
OPC Server for testing purposes
- The contact information for your OPC Server/Client
technical support
Three possible errors and their resolutions are listed
below…
Security
Error Code: 0x80070005 or
-2147024891
Reason for error: When the OPC Client tries to connect
to the OPC Server, the DCOM layer usually requires authentication.
The computer that is running the OPC Server needs to recognize the
user logged on to the OPC Client computer, and such a user needs to
have privileges to access the OPC Server.
Solution: The first step is to create a single user in
both computers that has Administrator privileges and the same
password. Log on with this user to both ends, and then try to
establish the connection.
If you cannot use the same user in both computers
because of some specific requirement of your project, or if the
problem persists even after you have logged on as the same user,
please read the documents below. They will help you solve the
security issues:
Name Resolution
Error: Couldn't create
connection with advise sink, error: -2147022986
(0x80070776)
Reason for error: There is a problem resolving the
computer name.
Solution: This problem can be solved by specifying the
IP address of the server instead of specifying the computer
name.
Proxy for Windows CE
Error: OPCServer:
IIndCP::Advise - Could not query callback interface:
0x80040155
Reason for error: Your Windows Embedded device is
missing the OPCCOMN_PS.dll.
Solution: You should download the .dll to the device
and register it. The .dll should be available with your
IWS distribution,
most probably in […]\InduSoft Web Studio
v7.0\Redist\Wince
x.x\processor\
If you do not find the .dll in the folder for your processor, contact
your IWS
distributor.