×
Siemens Industry Online Support
Siemens AG
Entry type: Application example Entry ID: 21043779, Entry date: 09/04/2014
(8)
Rate

Programming of OPC DA .NET Clients with C# for the SIMATIC NET OPC Server (COM/DCOM)

  • Entry
  • Associated product(s)
Exchanging process data between programmable logic controllers and computers via OPC is a core element of automation technology. Due to the .NET technology introduced by Microsoft, the question arises how COM interfaces specified in OPC, such as C# can be used in .NET languages.

Description
The main requirement in this application is to show the C# programmer how process variables delivered via OPC can be visualized with a simple client.

The example at hand shows two options to create individual OPC clients under .NET with the programming language C#.

Application 1
The first application describes an universal OPC client that communicates with the SIMATIC NET OPC DA Server via RCW (Runtime Callable Wrapper). For the user of this application the complex RCW methods were encapsulated in a simplified, reusable and easily expandable API-DLL. This  DLL contains the most important methods to communicate with the SIMATIC NET OPC server.

User interface of application 1:


Figure 01

The following details are dealt with in this example:

  • Connection to the process data via Industrial Ethernet as well as the SIMATIC NET OPC Server V8.x.
  • Use of OPC DataAccess Custom interfaces RCW.
  • Symbolic and absolute addressing of process data.
  • Asynchronous/synchronous reading and writing of individual process data.
  • Writing and reading of large data volumes via block services.
  • Implemention of a structure for error handling.

Application 2
The second application shows how to handle the OPC DataControl for .NET. The Data Control was designed especially for the easiest access to the SIMATIC NET OPC Server. The user does not have to program anything in his development environment but can interconnect the OPC variables with his standard Windows controls. This method is suitable for very easy clients.

User interface of application 2:


Figure 02

Hardware configuration


Figure 03

Downloads
Programming an OPC DA .NET Client with C# and RCW for the SIMATIC NET OPC Server (COM/DCOM) and a simple OPC DA .NET Client with SIMATIC NET OPC Data Control
  Documentation for application 1 (2,5 MB)
  Documentation for application 2 (3,0 MB)
 Registrierung notwendig  STEP 7 (TIA Portal) V15.1 project (732,4 KB)

Archives
OPC Client (RCW) V1.0
The version  1.0 of the example deals with the .NET programming in even more detail:
 Registrierung notwendig  OPC-Client (RCW) V1.0 (4,5 MB)

Last change
Update with STEP 7 (TIA Portal) V15.1