OPC Historian .NET Server Toolkit Reference
Server Development
Send comments on this topic.

Glossary Item Box

With the HDANSrv Server Toolkit the OPC HDA server development is reduced to the development of a .Net customization assembly with configuration definitions and database access methods.

The customization plug-in is developed with Visual Studio 2010,....2015 for .NET4, using C# and Visual Basic.

The HDANSrv.Net4.exe generic server handles the DCOM interface and is coded with C++.

The C++ libraries used in the compilation are included in the setup subdirectory C++ Libraries. The proper version of the C++ need to be installed on the machine where the server is executed. Newer Windows version usually have the required library versions installed. If not, then run the library setup that is included in the HDANSrv distribution.

The generic server provided is provided for .NET4 in versions for:
- 32bit:  HDANSrv.Net4.exe in the product installation subdirectory Generic Serrver\X86
- 64bit:  HDANSrv.Net4.exe in the product installation subdirectory Generic Serrver\X64

The proper file needs to be copied into the output directory of the customization plug-in project.
The sample plug-in assemblies are compiled for 'Any CPU' and work in 32-bit and 64-bit mode.
 

Base for Customization projects
A new server development project is based on one of the provided sample server, which has a text file based database with one file for each item.
The provided sample servers are tested for OPC HDA V1.2 compliancy. Simple server implementation may require only changes in the database access methods in the HDAPluginDBANet4.dll assembly. Server implementations for complex databases and performance optimization requirement may require changes in the data handling methods. Such changes need to be implemented carefully to maintain the OPC HDA compliancy.

Structure of the customization plug-in DLL
Base layer:   HDAPluginNet4.dll
The generic server (HDANSrv.Net4.exe) does only handle the COM interface, .NET wrapping and basic error checking.
The HDAPluginNet4.dll does OPC HDA compliant data processing that may not have to be application adapted.
The implementations is structured to minimize required changes:
    - The source files in the folder Common implement basic features that rarely should require project adaptations
    - The file ServerAdapt.cs/vb contains the basic server handling and configuration definitions.
    - A source file for each HDA server feature, such as RawData, ProcessedData, Attributes, Annotations etc.
Classes and methods that are used in the generic server interface must not be changed without adapting and recompiling the generic server HDANSrv.Net4.exe.

Database access layer:    HDAPluginDBANet4.dll
There is a source file for the handling of each HDA feature group.

 

Plug-in DLL Version Numbers
The plug-in DLLs are strong-name signed and the version numbers may not be increased without either recompiling the calling assembly or declaring interface compatibility.
- HDANSrv.Net4.exe V6.0 is compiled with a reference to HDAPluginNet4.dll V6.0
- HDAPluginNet4.dll N6.0 is compiled with a reference to HDAPluginDBA.dll V2.0

Only users with the Professional Edition Company Site license have the generic server source code4.1.0.0 and can compile it with updated DLLs.

Other users need to make an AssemblyBinding definition in the application configuration file.
The assembly binding can be redirected to a newer version as long as long as nothing is changed in the assembly interface.

Assembly binding redirection is done with the following definition section in the application configuration file HDANSrv.Net4.exe.config

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

    <dependentAssembly>
      <assemblyIdentity name="HDAPluginNet4" publicKeyToken="9e4d4836f3da8b2d" />
      <bindingRedirect oldVersion="6.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="HDAPluginDBANet4" publicKeyToken="43f57eba0dcf329a" />
      <bindingRedirect oldVersion="2.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
    </dependentAssembly>

  </assemblyBinding>
</runtime>


 

 

 

Timestamps
The generic server converts all call arguments to/from .NET types. The time arguments ( UTC FileTime) from client calls are converted to DateTime or TimeSpan types.
Timestamps returned to the client are converted in the generic server from DateTime to UTC FileTime.


Copyright ©2004-2019 Advosol Inc. All Rights Reserved.