OPC 20 How To Use
OPC 20 How To Use
OPC 20 How To Use
Title:
CoDeSys OPC-Server V2.0
Installation and Usage
CONTENTS
7 BRIEF CHECKLIST 18
History of Changes 19
The CoDeSys OPC-Server V2.0 is able to communicate with all controllers programmed with
CoDeSys. It complies with the requirements of the OPC standard V2.0.
COM / DCOM
Item list
CoDeSys generated
OPC-Server from a
symbol file
Symbol file
for projects Gateway
on PLC1
and/or
PLC2
simultaneous
TCP/IP, Serial, Pipe etc. connection to several
controllers possible
PLC 1 PLC 2
The CoDeSys OPC server is based on the CoDeSys Gateway Server (Gateway).
1
OPC = OLE for Process Control; OLE = Object Linking and Embedding
For further information see www.opcfoundation.org and www.opc_europe.org
2
COM = Component Object Model (Basis for OLE); DCOM = Distributed Component Object Model
The symbol file is the basis for the exchange of data via the CoDeSys OPC server.
At the same time that a project is loaded form the CoDeSys programming system onto the controller a
symbol file (*.sym or *.sdb) can be generated and placed in the Gateway resp. possibly on the
controller. The symbol file contains so called items. One item (data object) corresponds exactly with
one variable in the control application program. The variables on the controller can be reached via
these items. (More information on the symbol file see in document symbolfile_e.pdf !)
The OPC server requests the Gateway to submit the contents of the symbol files and then produces
an item list using the received information. As the contents of the item list is determined by the
accessibility of variables in the controller it can not be influenced by the OPC client. In each case the
OPC server reads the symbol file which was last loaded over the Gateway channel for a project. Items
of different projects, meaning of different application programs, can be reached simultaneously if the
symbol file was provided by the same Gateway channel.
The item list in the OPC server is updated with the data from the controller or controllers at fixed
intervals. In comparison to direct access to the controller, reading and writing of variables via this
cache list leads to an increase in access time (max. approx. 1ms per item).
Figures drawn from past experience show that the OPC can well cope with quantities of
around 15 000 items and symbol files with an approximate size of 1,5 MB when loading into
the item list. The capacity utilisation when reading and writing the variables depends on how
many of the items are active and therefore also have to be taken into consideration when
updating the data.
The OPC server allows for the grouping of the data. When doing so we differentiate between public
groups which are provided by the OPC server and private groups which the client sets up himself. If
the corresponding option is activated in the configuration, the OPC server groups the items i.e. the
variables of a project according to the POUs (Project Organization Units) where they are used. One
public group is set up per POU.
The private groups can be put together in the client from different items arbitrarily. Initially they have
no influence on the groupings in the OPC server but can be transformed into public groups when
necessary. It is sensible to work with private groups in order to be able to activate or deactivate certain
groups of variables with only one single command depending on whether they are to be accessible or
not.
Grouped files should be read from the OPC server consistently which means that all variables are
read simultaneously. It is, however, important to know that this is not always possible when working
with targets with limited communication buffers.
It is possible to gain access to an OPC server located on a different computer in the network if
there is also an OPC server on the local computer.
"Offline Load" of the symbols, possible with new versions of OPC-Server (V2.3.8.4 and higher)
and Gateway-Server (V2.3.3.3 and higher):
Up to now: If at start of the OPC-client the corresponding controller was not running resp. no
communication could be built up, then no symbol information at all was shown, although usually
already a symbol file was available in the local upload directory (defined in the CoDeSys project
options, category Directories) or in the Gateway upload directory, due to previous communications
with the target.
3S - Smart Software Solutions GmbH
OPC_20_how_to_use_E.doc Page 3 of 19
CoDeSys OPC-Server V2.0
Now: Now in such cases a symbol file will be searched, first in the project upload directory and if
nothing is found there, in the Gateway upload directory, and the symbols at least will be displayed in
the client ("Offline Load") even if of course with quality "Bad". This will only work however, if in the
OPC configuration (see chapter 3.2) the respective project name is defined !
only registers the OPC server. The installation of the necessary files must have been done
beforehand. A message informs the user whether the registration was successful or not.
This separate-registration-feature is important for updates or the creation of setups.
(for registry entries see also 3.2.5)
Start the configurator OPCConfig.exe to configure the OPC server and to edit the corresponding
registry entries (see 3.2.5).
! It is very important to configure the communication channel which is used by the OPC server
and which corresponds with the one used in the CoDeSys project.
The commands of the menu 'File' and 'Edit' as well as the special dialogues for the single PLC and the
multi PLC configuration are explained below.
A single PLC configuration is set by default this means that only one controller is connected to the
server (for multi PLC see 3.2.4). The following possible settings apply for the single PLC configuration:
Server, Controller (PLC) and Connection are displayed in a tree control in the left hand corner of the
window. They can be selected with the mouse. The dialogue to configure the entry marked in the tree
control appears on the right hand side . The menu 'Edit' is not needed for the single PLC
configuration.
If the uppermost entry ‚server’ is marked in the tree control the following settings for the server can be
made:
- Update Rate (ms): Default: 200
Basic update rate of the OPC-Servers in milliseconds = cycle time with which all item data are
read from the controller (this data is written into the cash with which the client communicates
with a separately defined update rate)
- Public Groups: Default: active (tick)
The OPC server sets up a public group for every IEC module as well as for the global
variables.
- Sync Init: Default: active (tick)
Synchronous initialisation: Only when the symbol configuration has been loaded does the
OPC server react when starting.
- Log Events: Default: active (tick)
The actions that take place on the OPC server as well as the mistakes that appear are
recorded and saved in a log file. This file is set up in the project directory and receives the
name OPCServer.log. After shutting down the OPC server the log file can be looked into. The
messages of several OPC sessions are lined up in one log file until it reaches the size of 1
MB. When this happens the current date will be added in the filename (OPCServer<date>.log,
e.g. OPCServer12.10.2000.log) and the file will be saved. A new log file OPCServer.log will
be created.
The following Settings for PLCx can be made on the right hand side of the window if the entry PLCx
under the entry server in the tree control is marked:
3S - Smart Software Solutions GmbH
OPC_20_how_to_use_E.doc Page 9 of 19
CoDeSys OPC-Server V2.0
- Projectname: Name of the loaded project. This entry is not obligatory when working with
single PLC, except you want to make possible an "Offline Load" of the symbols (see note a
the end of the chapter 1).
- Timeout (ms): 3
Should the OPC server not receive any feedback on a sent service from the controller after
this period of time it will close down automatically.
- Number of Tries:
Number of attempts which the gateway communication driver will make to transfer a block
correctly. As soon as the last attempt has failed, a communication error will be produced. (this
entry is only relevant for drivers which support a communication via blocks, Level 2).
- Buffer Size (Byte): 0
Size of the communication buffer on target system; if the entry is “0” the attempt is made to
get this information from the device driver. If there is no such information in the device driver it
is assumed that the buffer is unlimited.
- Wait Time (s): 60
Time in seconds the OPC server waits until the controller is ready (important during the
automatic start of the controller)
- Reconnect Time (s): 5
Time interval, in which the OPC server repeatedly tries to reconnect with the controller via the
gateway.
- Active: not available (only available in the multi PLC sector)
- Motorola Byteorder: not active
The target system of the project does not use the Motorola byte order (this aspect is to be
given special regard when working with 68K, 8051, Power PC !).
- No Login Service: active
This option has to be activated for specific target systems which necessitate the sending of a
login service.
If the entry 'Connection' is marked, the 'Settings for the connection to PLCx' can be defined on the
right hand side of the window.
If there already is a configuration this is stated in the specifications behind 'Gateway' and 'Device' as
well as in the table. Should the connection to the Gateway not be “local”, specifications concerning the
address and the port of the target computer will additionally be mentioned above the table. These
specifications have to be equivalent with those made in CoDeSys under 'Online' 'Communication
Parameters' for the corresponding project.
If the settings have not jet been specified or if the specified settings are to be changed the dialogue
Communication Parameters is opened via the button Edit. This dialogue is identical with the one
available in CoDeSys under Online. For information on how to use this dialogue please see chapter
3.1, step 3 or the user manual for CoDeSys.
- The name of the project which was loaded onto this controller via the Gateway must be entered
behind Projectname in the dialogue 'Settings for PLCx'.
- By turning on or off the option Active in the dialogue 'Settings for PLCx' it can be defined whether
the controller is to be considered by the OPC server or not.
- It is not possible at the moment for the OPC server to communicate over different
Gateways.
"Waittime"="10"
"Reconnecttime"=5"
"Nologin"="true"
"Buffersize"="1"
"Activ"="true"
If you click on this symbol with the right mouse button you will receive information on the version of the
OPC server under 'About'.
Entry Meaning
[Server] Settings for the OPC server
updaterate=200 Update Rate
publicgroups=0 Public Groups
syncinit=1 Sync Init
PLCs=2 Connection to two controllers is planned
PLC0=PLC_A Name of the first controller: PLC_A
PLC1=PLC_B Name of the second controller: PLC_B
Entry Meaning
[PLC:PLC_B] Settings for PLC_B
active=1 See above
motorola=0
nologin=0
timeout=2000
tries=3
waittime=10
reconnecttime=5
buffersize=0
project=opc_test_s.pro
gateway=Tcp/Ip Connection to the gateway on the local computer over TCP/IP
(has to correspond to the one already used for PLC-A!)
gatewayaddress=localhost
gatewayport=1210
device=Tcp/Ip Parameter for connection to target computer where controller
PLC2 is running
parameters=3
parameter0=Address
value0=Sabine
parameter1=Port
value1=1200
parameter2=Motorola byteorder
value2=No
7 Brief Checklist
Should you encounter problems with the communication via OPC please check the following points:
1. Gateway installed and running ? Symbol in task bar in the right hand corner active ?
2. Installation and Registration of the OPC-Server OK ?
takes place automatically by executing: „CoDeSysOPC /Install“ (Installation + Registration) or .
„CoDeSysOPC /RegServer“ (only registration)
3. Preparation of the project or settings in the CoDeSys programming system OK?
- Project options: ‘Dump symbol entries’ selected?
- communication parameters: selected Gateway channel OK?
- Project saved, translated, download executed?
4. Should you want to use OPC on another computer (only possible, if the OPC server is also
operating locally and the user is not additionally logged into the CoDeSys project on the other
computer):
Connect to the other computer via DCOMCNFG.EXE (in the system directory):
- select OPC server in 'Applications'
- enter desired computer under 'Properties' 'Location' 'Execute application on the following
computer'
5. Check the connection and the server settings: OPCConfig.exe:
- connection: (Entry has to correspond with the valid Gateway set up in the CoDeSys
communication parameters)
- normal server settings: Motorola Byteorder: no (Attention when using 68K, 8051, PowerPC),
set up public groups, synchronous initialisation, Notification on quality change, Update Rate
200ms, waiting time target system 60s, Reconnect-Interval 5s, communication timeout 3s,
buffer size: 0 or fitting for target system?
- Save -> new configuration becomes effective when new connection to the OPC server is
established
6. Check, whether there are symbol entries disposable: DiagnosticOPCClient.exe (this diagnostic
client is not part of the installation but can be delivered on demand)
Establish connection (Connect OPC-Server) -> click on Private Groups in right hand side window
with right mouse button, confirm dialogue with OK, click on the group entry which appears now
with right mouse button -> Add all items -> all generated symbol entries (variables) should appear
• The OPC server shuts down automatically when all clients have cut the connection to the
it
• The OPC server appears as a process in the task manager.
History of Changes
(starting with V1.1)
V1.1 Multi-PLC Configuration not only via TCP/IP, but also local
V1.2 Chapter 3.2.3: "Number of Tries" Description corrected
V1.3 Chapter 7: Item 5: "OPCConfig.exe", Item6: Diagnostic Client only available on demand
V1.4 Chapter 1: Note concerning "Offline Load" of the symbol file; reference on documentation for symbol
file; Chapter 3.2.3: Remark added at 'Projectname'