OPC Programming with Delphi

Click here to go to our C++Builder page.

Free Source Code

Toolkits and Components

XML and SOAP for Delphi Developers


Free Source Code

'How do I use Delphi for OPC development?'

This is one of the questions that we are most frequently asked. It turns out that Delphi is an ideal language and environment for OPC development, and particularly for client programming.

We have therefore put together a collection of information on OPC programming with Delphi, including Delphi translations of the published custom OPC interfaces, along with source code for a simple console client and some demonstration servers.

In each case, please look at the corresponding README before downloading, and please note the disclaimers in each case.

A number of the downloads on this page are hosted by the opcdelphi project on Google Code.

opcdelphi logo

Delphi Conversions of OPC Custom Interfaces

View the README (also included in the ZIP archive).

Download the ZIP file.

Simple OPC Client

A simple console client which demonstrates the basics of OPC Data Access 1.0 and 2.0.

View the README (also included in the ZIP archive).

Download the ZIP file.

Demo OPC UA Server

If you are developing an OPC UA Client, this is an OPC UA Server to test your OPC Client code with. OPC Universal Connectivity Server

OPC Server Enumerator Sample

A simple console client which shows techniques for listing available OPC servers.

View the README (also included in the ZIP archive).

Download the ZIP file.

Demo OPC Server

This code has very kindly been made available by Mark R. Drake of Everest Software and is updated for Delphi 2007. The server reportedly passes a version of OPC Foundation's Data Access Compliance Test. Good work Mark!

View the README (also included in the ZIP archive).

Download the ZIP file.

Note: the files contained in the Delphi Conversions of OPC Custom Interfaces download should be extracted to an 'OPC_Defines' sub-folder of this project.

LIBOPCD: Lightweight OPC Server Library

LIBOPCD is a Delphi library for creating OPC DA servers, with some restrictions and assumptions - e.g. no support for deadbands or hierarchical address spaces.

LIBOPCD is an open source project, hosted by Google Code. It is administered by Sharon Rosner, author of the excellent SCADA 2.0 blog.

prOpcKit: an OPC Toolkit for Delphi

updated prOpcKit, by Production Robots Engineering Ltd, is primarily intended for OPC server development (for which a Delphi wizard is included). prOpcKit is supplied with excellent documentation.

Delphu 5 thru Delphi 2007 are supported and, since February 2010, prOpcKit is available as a free download.

Note: see our Toolkits page for other OPC server toolkits, some of which provide support for Delphi development.

sOPC: a Prototype OPC Server Toolkit

sOPC was developed by Gerhard Schmid, with the original intention of releasing it as a commercial product. Herr Schmid later decided to put the full source of sOPC into the public domain, for the benefit of the wider Delphi OPC community.

Although the documentation is brief, the code is cleanly structured. The user needs to modify only a few clearly indicated functions of the included demo server to generate his own custom Data Access server.

View the README (also included in the ZIP archive).

Download the ZIP file.

XRTL - eXtended Run-Time Library

XRTL is an open source collection of Delphi packages which includes code for both a Data Access 2.0 server and client - the demo server has passed the full OPC Foundation Compliance Test for DA 2.05a. Other XRTL packages include functions for math, I/O handling, zlib compression and more.

The OPC server is self-contained, with COM interfaces provided for configuring the address space and updating data values from an out-of process source.

XRTL supports Delphi 7.0 and 6.0 and is provided with minimal documentation. Its author is Illya Kysil, who also made significant contributions to the OPC custom interface conversions for Delphi.

XML-DA Client Sample

Kassl, author of the excellent dOPC Client Toolkits, has made available this free XML-DA client sample program, with source code.

The sample does not use dOPC. Request messages are loaded from file, and may optionally be edited before being sent using WinInet. Responses are displayed using Microsoft's WebBrowser ActiveX. This all makes for a surprisingly useful tool, both for learning XML-DA and for testing servers.

The code has been tested with Delphi 5, 6, and 7. See the header of the main.pas file for instructions.

Download the ZIP file.

Toolkits and Components

dOPC Client Toolkits

For Delphi (and C++Builder) developers who don't have the time or inclination to get to grips with the details of the OPC interfaces, we recommend taking a look at Kassl's dOPC.

The dOPC Client Toolkit includes the dOPC DA Component for the implementation of Data Access Clients, and dOPC AE Component for Alarms & Events.

dOPC gives access to almost all the power of OPC, and allows for much more rapid development than using the raw interfaces. For example, dOPC DA allows multiple groups to be easily defined at design time or runtime, reads and writes may be performed either synchronously or asynchronously, and data change events may be set up (these automatically fall back to the OPC version 1 mechanism where the server does not support Data Access 2 or 3).

dOPC DA also includes the dOPCGUI component, allowing OPC item values to be bound directly to properties of visual components, such as labels or edit boxes.

dOPC DA version 3.0 brought support for DA 3.00 and OPC XML-DA 1.01, making it easy to develop clients with support for both COM DA and XML-DA server access. Also included in version 3.0 is is a simulation OPC server.

New version 3.7 provides full support for Delphi 2010. dOPC Client Toolkit may be purchased for 690 USD. Full source code is included, and free trial downloads are available.

dOPC is updated regularly, and is compatible with Delphi 5 upwards (XML-DA support requires Delphi 6 or later). Versions of dOPC are also available for C++Builder and .NET.

For OPC client development, Delphi and dOPC together offer a combination of value, ease of use, performance, and flexibility that may be impossible to beat.

Prosys Sentrol - Component Based Rapid OPC Application Development Framework

Prosys Sentrol is a Delphi/C++Builder component library which provides a "Rapid OPC Application Development Framework". This includes fully compliant OPC DA client and server functionality, as well as database, visualization and other components.

The methodology for connecting components closely follows standard Delphi techniques for visually building database applications. This allows an impressive amount to be achieved with no manual coding.

Prosys Sentrol pricing starts at 695 EUR (995 EUR with source), or 395 EUR for a 'Lite' version - discounts are available for volume purchases. An evaluation download includes a tutorial and reference. Support is provided for Delphi 5 (and C++Builder 5) upwards.

New version 5.1 supports Delphi/C++Builder 2010.

Other Component Libraries

See our Component Libraries page for information on other VCL and ActiveX components which may be useful for OPC client development.

XML and SOAP for Delphi Developers

Delphi provides good support for XML and SOAP, and is not tied to any particular vendor's web server architecture. The ability to implement and consume web services using SOAP is included in all versions of Delphi.

An alternative SOAP implementation for Delphi is IndySoap, part of the Indy project. Versions of this Open Source suite of Internet components (excluding IndySoap) are included with Delphi 6 and later, as well as Kylix (Delphi for Linux).

For an integrated solution, the dOPC Client Toolkits offer XML-DA support for Delphi and C++Builder. Kassl, the author of dOPC, has also provided some sample code for exercising the XML-DA methods.

See also our page on XML and SOAP.