C++ Based OPC UA Client/Server/PubSub SDK
1.7.1.476
|
The getting started describes the creation of a PubSub configuration for initial PubSub testing using the C++ SDK Demo Server and the PubSubImporter demo application.
The C++ SDK Demo Server has the PubSub capabilities included and can be configured to publish data from the variables in the demo server address space. The sample configuration explained in the getting started will use variables with simulated data out of the demo address space (Demo/001_Dynamic and Demo/007_Massfolder_Dynamic)
The demo server can also be configured to subscribe for PubSub messages. The received data can be written to variables in the demo server address space. The address space contains variables for this purpose in the folder PubSubTargetVariables.
The PubSub configuration is stored by the C++ SDK Demo Server in the file bin/pubsubconfig.bin.
The PubSub configuration can be created off-line with the PubSubImporter. One option is to copy the resulting file into the demo server location and to restart the server with the new configuration. Another option is the download of the configuration to the demo server by the PubSubImporter using a FileType object in the demo server.
The PubSubImporter provides an example for the use of the UA PubSub Base Library for the off-line creation of a PubSub configuration but it can also be used as simple configuration tool.
The PubSubImporter creates the standardized OPC UA binary encoded PubSub configuration files from an INI text file and is able to download the file to the C++ SDK Demo Server using OPC UA client/server.
The tool is working with the following input files in the working directory of the tool
Sample files can be found in the SDK setup directory in examples/config. The files must be copied to the working directory of the PubSubImporter (e.g. sdk/bin)
The following actions are possible with the PubSubImporter console application
This option reads the configuration from the file PubSubConfigImport.ini and prints the read configuration objects to the console output. The file must be located in the working directory of the PubSubImporter.
This option creates an OPC UA binary encoded PubSub configuration file from the imported configuration.
The output file name is pubsubconfig_out.bin. The file is stored in the working directory of the PubSubImporter.
The file can be used to replace the demo server configuration. This requires to stop the demo server, to replace the file and to start the server with the new file.
The configuration of a subscriber requires knowledge about the configuration of the WriterGroups and DataSetWriters of interest. This option allows the import of a Publisher configuration that contains the WriterGroups and DataSetWriters referenced in the Subscriber configuration.
The import file name is pubsubconfig_in.bin. The file is stored in the working directory of the PubSubImporter.
If a Publisher configuration is necessary, this option must be used before the Subscriber configuration is imported with the INI file.
The option allows the transfer of the imported configuration to the server.
It is necessary to create a connection to the server using the option "Connect to server".
Changes to the configuration require a user with the role ConfigureAdmin.
The import file PubSubConfigImport.ini provided with the SDK contains a Publisher and Subscriber configuration. If this configuration is imported and loaded to the demo server, the Subscriber receives the messages produced by its own Publisher.
The following steps describe how a configuration can be created with two demo servers on different network nodes.
Example:
In this example, we use two Demo servers and two PCs.
The first Demo server, which is running on PC1 consider it as a Publisher
The second Demo server, which is running on PC2 consider it as a Subscriber
The following configuration options must be provided in the file PubSubConfigImport.ini for the publisher configuration. The file contained in the SDK setup can be used as example.
PubSubConnection
WriterGroups
DataSetWriters
PublishedDataSets
As first step, the Publisher binary configuration file must be imported.
The following configuration options must be provided in the file PubSubConfigImport.ini for the subscriber configuration. The file contained in the SDK setup can be used as example.
PubSubConnection
ReaderGroups
DataSetReaders
SubscribedDataSets