The OPCServer generated for each configured PLC two implicit variables, which provide information of the status of the OPC connection to the controller.
_CommStateOK
This variable indicates whether the OPC server can access the control (1) or not (0).
_CommState
This variable specifies what exactly the problem is, if there are problems.
The states are defined as follows:
Is it required to define a "Project name" in the config?
The project name is almost NOT necessary.
If you communicate via the same gateway as CoDeSys does with download, then the OPC server always adapted to the matching symbol file of the controller.
It should be empty.
Exeption is, if you wrok with Simulation mode.
We do not recommend to use the DCOM because the settings are various and if there is any different, it is very hard to find the reason.
Other users to tunnel the DCOM with a special kind of software. I think this is the better solution. Also if you give everyone all access rights it might no good solution for a protected system.
The main problem is the user management and DCOM. Please understand that we cannot support this windows related topic.
Question
I have a question regarding your OPC server and its update time.
We have in our plant some machines running Codesys RTE and gateway and OPS server.
Our symbol file has approximately 4000 entries. These are used to drive the visualisation screen.
With this many symbols we find that the best update rate is approx 100ms.
We would also like to collect a smaller amount of data, something like 16 boolean variables but at a much faster update rate.
I am not getting a fast enough item update rate from the server.
Any ideas how I can get an update rate of 10 to 20 ms to a 2nd OPC cliect?
Answer
A constant update rate of 10 to 20ms is almost impossible. Beside the fact that the communication is already busy there are several other reasons which prevent it in general:
- Windows applications can be interrupted anytime, earliest recall after 10ms
- overhead by several partners in the communication chain (OPC Client ßà OPC Server ßà Gateway Server ßà PLC)
- OPC architecture isn’t build for such a fast communication
If you really need it, we can show you a solution which is realized with the PLCHandler, a fee required C++ class which facilitates communication between a client (e.g. visualization) and the PLC. As the data is stored in a buffer on the PLC you can reach little update rates and cycle consistent data. But you must create an own windows application.
Example:
1. Generate the symbolconfig in CoDeSys and download the project to the PLC (ConrtolWin) / select the items which are read/writ able in Symbolconfig. (Compile and download Errorfree the project to the plc)
2. Generate OPC Config (Gateway 3 Connection with the same ID that on scan in CoDeSys: and save as OPCServer.ini
3. Connect with OPC Client (example Matrikon) / browse the items on CoDeSys.OP.DA
But the point were many user fail:
1. In OPC Config you must save the OPCConfig.ini in the directory where the OPCConfig.exe is.
mytestWago.ini for example will not work (wrong Name)
But this is not your case think this was right on your side (as I interpret your screenshots)
2. Add the wrong OPC Server
But the Point is for OPC V3: you have to add OPC.DA in Matrikon not the OPC.02 (this is V2.3)
opc.idl or opcda.idl can retrieved from "OPC Core Components SDK" from the OPC Foundation (free):
opc.idl
opcda.idl can be received from „OPC Core Components SDK“ from OPC-Foundation (http://www.opcfoundation.org/) for free.
Summary
In redundant mode, the error 0x80004005 occurs while writing
More information
E_FAIL and is a generic error, and is thrown by many causes.
In particular, the OPC Redundancy mode, this error can be delivered to the client, if none of the reports explicitly PLCs "I am master."
Solution:
If at least one of the master PLC variable is set to true,
then writing is possible.
How to stert OPCEnum?
For some reasons, OPCEnum is not active.
OPC Server Browser
Overview
The OPC Foundation supplied Server Browser OPCENUM.EXE can reside on any machine, will access the local Component Categories Manger and provides a new interface IOPCServerList which can be marshaled and used by remote clients. This server has a published classid (see below) and can be installed once on any machine which hosts OPC servers. The client still needs to know the nodename of the target machine however he can now create this object remotely and use it's IOPCServerList interface to determine what types and brands of servers are available on that machine.
Information for Users
The OPC Server Browser (OPCENUM.EXE) and the required proxy/stub (OPCCOMN_PS.DLL) can be obtained from the OPC Foundation Web Site. The EXE and DLL should be copied to the main WINDOWS directory (see the section “Installing OPC Binaries”, above).
The EXE is installed by running
OPCENUM/RegServer
or
```
OPCENUM /Service
to install the server as a service on Windows NT.
The DLL is installed by running
REGSVR32 OPCComn_ps.dll
```
No further user action is required. Doing the steps above will allow Client programs you have purchased which support this server browser capability to function properly. Note that the OPC Server Browser is designed to allow access by any user regardless of the DCOM security setup.
Information for Server Programmers
Note that the OPC Foundation provides the OPC Browser Object. OPC Servers should NOT implement this interface. OPC Servers should simply register themselves with the appropriate component category as described on the appropriate OPC Specification.
Information for Client Programmers
Client programmers should create the OPC Server Browser Object on the target machine by passing its class id (CLSID_OPCServerList as defined in opc_cats.c) to CoCreateInstanceEx. They should obtain the OPCServerList interface (IID_IOPCServerList as defined in opccomn_i.c). They can then use this interface to obtain lists of the available servers for particular component categories. The OPC Component categories for the various OPC Server types are defined in opc_cats.c. The marshalling for this interface is included in the OPCComn_ps.dll.
Windows Server 2008 & 2012 is not officially supported by 3S.
The reason is because we do not test the combination.
But several use this new OS without a known problem.
Just add a Symbol configuration and downlod the project to the plc
No additional OPCUA Server configuration is needed.
(sure the OPCUA Server component must be embedded in the runtime - all CODESYS SL products have the UA Server)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
How to use OPCUA?
Can I use OPCServer V3 to connect to V2.3 PLC?
OPC configuration without effect?
Is OPCServer certified?
What is _CommState and _CommStateOK?
Is it required to define a "Project name" in the config?
How to DCOM?
Can I use CODESYS OPCServer to connect to any other PLC?
OPC update rate, performance.
Does CODESYS support OPC UA?
How to configure OPC V3 with PLC V3?
It is possible to write a new OPC Client?
How to avoid the problem of failed OPC connections by changed plc ID's
Can I use GSM Modem?
Write Error 0x80004005
How to stert OPCEnum?
Why is my OPC connection slowly if not logged in as admin?
OPC with Win2008 or 2012 Server
Can I use OPCServer V3 to connect to V2.3 PLC?
Yes, you can use OPCServer V3 to connect to V2.3 PLC, too. The V3 Server contains Gateway V2.3.
Please note that the syntax of the items has changed.
When using Gateway (V2.3) Global and Local variables are treated with this (new) syntax:
<plcname>..<globalevariablenname>
<plcname>.<modulname>.<variablenname></variablenname></modulname></plcname></globalevariablenname></plcname>
Back to FAQ overview
The OPC configuration can be changed, but does not have any effect.
Please check the location, OPCServer is looking for the configuration:
32-Bit Systeme
HKEY_LOCAL_MACHINE\SOFTWARE\3S-Smart Software Solutions GmbH\CodesysOPC
64-Bit Systeme (Windows 7/Server 2008)HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\3S-Smart Software Solutions GmbH\CoDeSysOPC
Attention: The OPCServer.ini should not be renamed.
Back to FAQ overview
Is OPCServer a certified?
Yes, you can find her on OPCFoundation.org the official result of Compliance Test Tool (CTT).
www.opcfoundation.org/Products/ProductDetails
Back to FAQ overview
What is _CommState and _CommStateOK?
The OPCServer generated for each configured PLC two implicit variables, which provide information of the status of the OPC connection to the controller.
_CommStateOK
This variable indicates whether the OPC server can access the control (1) or not (0).
_CommState
This variable specifies what exactly the problem is, if there are problems.
The states are defined as follows:
Back to FAQ overview
Is it required to define a "Project name" in the config?
The project name is almost NOT necessary.
If you communicate via the same gateway as CoDeSys does with download, then the OPC server always adapted to the matching symbol file of the controller.
It should be empty.
Exeption is, if you wrok with Simulation mode.
Back to FAQ overview
How to DCOM?
We do not recommend to use the DCOM because the settings are various and if there is any different, it is very hard to find the reason.
Other users to tunnel the DCOM with a special kind of software. I think this is the better solution. Also if you give everyone all access rights it might no good solution for a protected system.
The main problem is the user management and DCOM. Please understand that we cannot support this windows related topic.
Please find attached:
Back to FAQ overview
How To DCOM Configuration.pdf [245.82 KiB]
Can I use CODESYS OPCServer to connect to any other PLC?
No, CODESYS OPCServer can connect to any CODESYS Runtime PLC.
Back to FAQ overview
Question
I have a question regarding your OPC server and its update time.
We have in our plant some machines running Codesys RTE and gateway and OPS server.
Our symbol file has approximately 4000 entries. These are used to drive the visualisation screen.
With this many symbols we find that the best update rate is approx 100ms.
We would also like to collect a smaller amount of data, something like 16 boolean variables but at a much faster update rate.
I am not getting a fast enough item update rate from the server.
Any ideas how I can get an update rate of 10 to 20 ms to a 2nd OPC cliect?
Answer
A constant update rate of 10 to 20ms is almost impossible. Beside the fact that the communication is already busy there are several other reasons which prevent it in general:
- Windows applications can be interrupted anytime, earliest recall after 10ms
- overhead by several partners in the communication chain (OPC Client ßà OPC Server ßà Gateway Server ßà PLC)
- OPC architecture isn’t build for such a fast communication
If you really need it, we can show you a solution which is realized with the PLCHandler, a fee required C++ class which facilitates communication between a client (e.g. visualization) and the PLC. As the data is stored in a buffer on the PLC you can reach little update rates and cycle consistent data. But you must create an own windows application.
Back to FAQ overview
Does CODESYS support OPC UA?
This new feature is scheduled to be release with V3.5 SP5.
How to configure OPC V3 with PLC V3?
Example:
1. Generate the symbolconfig in CoDeSys and download the project to the PLC (ConrtolWin) / select the items which are read/writ able in Symbolconfig. (Compile and download Errorfree the project to the plc)
2. Generate OPC Config (Gateway 3 Connection with the same ID that on scan in CoDeSys: and save as OPCServer.ini
3. Connect with OPC Client (example Matrikon) / browse the items on CoDeSys.OP.DA
But the point were many user fail:
1. In OPC Config you must save the OPCConfig.ini in the directory where the OPCConfig.exe is.
mytestWago.ini for example will not work (wrong Name)
But this is not your case think this was right on your side (as I interpret your screenshots)
2. Add the wrong OPC Server
But the Point is for OPC V3: you have to add OPC.DA in Matrikon not the OPC.02 (this is V2.3)
OK:
Then it looks like:
Back to FAQ overview
It is possible to write a new OPC Client?
Plese see also: Forum
You'll find a helpful example code here:
Tutorial
lhcb-online
opc.idl or opcda.idl can retrieved from "OPC Core Components SDK" from the OPC Foundation (free):
opc.idl
opcda.idl can be received from „OPC Core Components SDK“ from OPC-Foundation (http://www.opcfoundation.org/) for free.
OPC Example in c#:
Forum:
Forum
Codeproject
Back to FAQ overview
[b]How to avoid the problem of failed OPC connections by changed plc ID's?[b]
The best way ist to use IP address or name of plc.
a) IpAddress ( Tcp/Ip blockdriver:
Or within the OPCServer.ini file:
[PLC:PLC1]
interfacetype=GATEWAY3
reconnecttime=15
waittime=10
active=1
logevents=1
logfilter=15
gateway=Tcp/Ip
gatewayaddress=localhost
gatewayport=1217
parameters=1
parameter0=IpAddress
value0=192.168.101.127
b) By name:
Back to FAQ overview
Can I use GSM Modem?
It is possible, but the connection time can be very long. For this reason the timeouts must should be changed.
Example:
Back to FAQ overview
Write Error 0x80004005
Summary
In redundant mode, the error 0x80004005 occurs while writing
More information
E_FAIL and is a generic error, and is thrown by many causes.
In particular, the OPC Redundancy mode, this error can be delivered to the client, if none of the reports explicitly PLCs "I am master."
Solution:
If at least one of the master PLC variable is set to true,
then writing is possible.
Back to FAQ overview
How to stert OPCEnum?
For some reasons, OPCEnum is not active.
OPC Server Browser
Overview
The OPC Foundation supplied Server Browser OPCENUM.EXE can reside on any machine, will access the local Component Categories Manger and provides a new interface IOPCServerList which can be marshaled and used by remote clients. This server has a published classid (see below) and can be installed once on any machine which hosts OPC servers. The client still needs to know the nodename of the target machine however he can now create this object remotely and use it's IOPCServerList interface to determine what types and brands of servers are available on that machine.
Information for Users
The OPC Server Browser (OPCENUM.EXE) and the required proxy/stub (OPCCOMN_PS.DLL) can be obtained from the OPC Foundation Web Site. The EXE and DLL should be copied to the main WINDOWS directory (see the section “Installing OPC Binaries”, above).
The EXE is installed by running
or
```
OPCENUM /Service
to install the server as a service on Windows NT. The DLL is installed by running
REGSVR32 OPCComn_ps.dll
```
No further user action is required. Doing the steps above will allow Client programs you have purchased which support this server browser capability to function properly. Note that the OPC Server Browser is designed to allow access by any user regardless of the DCOM security setup.
Information for Server Programmers
Note that the OPC Foundation provides the OPC Browser Object. OPC Servers should NOT implement this interface. OPC Servers should simply register themselves with the appropriate component category as described on the appropriate OPC Specification.
Information for Client Programmers
Client programmers should create the OPC Server Browser Object on the target machine by passing its class id (CLSID_OPCServerList as defined in opc_cats.c) to CoCreateInstanceEx. They should obtain the OPCServerList interface (IID_IOPCServerList as defined in opccomn_i.c). They can then use this interface to obtain lists of the available servers for particular component categories. The OPC Component categories for the various OPC Server types are defined in opc_cats.c. The marshalling for this interface is included in the OPCComn_ps.dll.
Back to FAQ overview
Why is my OPC connection slowly if not logged in as admin?
The configuraiton is stored at local user:
You can change this:
Delete OPC-configuration in the registry at current user:
[HKEY_CURRENT_USER\Software\3S-Smart Software Solutions GmbH\CoDeSys OPC]
Set this new key:
[HKEY_LOCAL_MACHINE\SOFTWARE\3S-Smart Software Solutions GmbH\CoDeSys OPC\Config]
"StoreConfigInCurrentUser"=dword:00000000
Store the new configuration with admin rights
Result: there is only one configuration, and no local copy. Therefore only the adminstrator is able to store a new configuration.
Back to FAQ overview
OPC with Win2008 or Win2012 Server
Windows Server 2008
Windows Server 2012
Windows Server 2008 & 2012 is not officially supported by 3S.
The reason is because we do not test the combination.
But several use this new OS without a known problem.
see also:
OPC configuration without effect?
Just add a Symbol configuration and downlod the project to the plc
No additional OPCUA Server configuration is needed.
(sure the OPCUA Server component must be embedded in the runtime - all CODESYS SL products have the UA Server)