The HDANSrv OPC HDA server toolkit created OPC Historian server consists of the parts:
-
HDANSrv.Net4.exe
The generic OPC HDA V1.2 compliant COM server
This is C++ code compiled into an EXE file. It does the DCOM handling, basic checks on the client call arguments, wraps to .NET types and calls the call handling methods in the HDAPluginNet4.dll base .NET plug-in assembly.
-
I_HDAPluginNet4.dll
Interface definition for HDAPluginNet4.dll
-
HDAPluginNet4.dll
The .NET assembly with the basic HDA compliant data handling.
The provided sample implementation works for many applications. Performance and other application specific requirements may require modifications.
This is C# or VB .NET code compiled into a .Net DLL
-
I_HDAPluginDBANet4.dll
Interface definition for HDAPluginDBA.dll
-
HDAPluginDBANet4.dll
The .NET assembly with the application specific database access handling
This is C# or VB .NET code compiled into a .Net DLL
Often only the database access classes in the HDAPluginDBANet4.dll .Net plug-in need to be changed to implement a HDA server for a specific user application.
The provided sample implementation is tested for OPC HDA 1.2 compliancy. It reads the data from CSV text data files, with a file for each item.
Error Handling
The database access is done in methods in the HDAPluginDBANet4.dll layer (user layer). These methods handle access for a single item, while the HDA client may make calls for data of multiple items. The HDAPluginNet4.dll layer (base layer) makes calls into the user layer in a loop for every requested item.
Errors detected in the database access are reported to the base layer by throwing a HDAException with an OPC HResult error code. The base layer catches the exception and returns the error code to the client in the result data of the appropriate item.
All methods that return an array of data are handled this way.
The base layer doesn't catch exceptions for methods with an error code result.