UADemoPublisher Basics

From OPC Labs Knowledge Base
Revision as of 20:33, 16 July 2019 by User (talk | contribs)
Jump to navigation Jump to search

Introduction

The UADemoPublisher program is a demonstration publisher for OPC UA PubSub.

UADemoPublisher is a console application, running on .NET. It is available for .NET Framework (Windows only), or .NET Core (Windows or Linux). It is available free of charge (does not require a license for QuickOPC or other OPC Labs product).

Note2-icon.png

Note: This page describes a preliminary version (5.55.0.3) of the program; the behavior is subject to change in future versions. This version only support the OPC UA UDP transport protocol mapping (UADP over UDP).

Usage

In order to run the UADemoPublisher, open a command prompt, and switch to the directory that contains the program. You can start the program without any additional parameters. If you are using the .NET Framework version, type UADemoPublisher and press Enter. If you are using the .NET Core version, type dotnet UADemoPublisher.dll and press Enter. In the text that follows, when discussing the command line options, we will be listing the commands simply with the UADemoPublisher at the beginning; remember to use dotnet UADemoPublisher.dll in .NET Core instead.

The published data sets and the way they are published are hard-coded into the program and cannot be changed (for most part).

After the program starts, it prints out a summary of the configuration it uses when publishing the datasets, and then continuously displays a statistics of messages sent on each configured connection.

By default, the UADemoPublisher send messages to IPv4 multicast address 239.0.0.1. This can be changed using the --ConnectionResourceUri (-cru) option (see further below). If you have multiple network interfaces and the messages do not get sent to the one you want, use the --ConnectionNetworkInterface (-cni) command-line option to specify the interface name.

The UADemoPublisher runs until you interrupt it using the Ctrl+Break key combination, or until a given time period elapses. This time period can be configured using the --SleepTimeMilliseconds (-stm) or --SleepTimeSpan (-sts) command-line option.

Command-line Options

Parameters of the UADemoPublisher can be influenced by various options given on its command line. They are:

Usage: UADemoPublisher [options]

Options:
  --ConnectionNetworkInterface|-cni <name>     PubSub connection network interface
  --ConnectionResourceUri|-cru <uri>           PubSub connection resource URI (default opc.udp://239.0.0.1)
  --KeepAliveTime|-kat <double>                Keep-alive time (milliseconds)
  --KeyFrameCount|-kfc <uint32>                Key frame count (>= 1, only where applicable, default 25)
  --SleepTimeMilliseconds|-stm <milliseconds>  Sleep time (-1 for Infinite, default)
  --SleepTimeSpan|-sts <timespan>              Sleep timespan (e.g. hh:mm, or hh:mm:ss)
  --PublishingInterval|-pi <double>            Publishing interval (milliseconds)
  -?|-h|--help                                 Show help information

Sample Output

Below is a sample output from the UADemoPublisher, also showing its configuration with the default values.

OPC Labs UADemoPublisher Utility 5.55.0.1: OPC-UA Demo Publisher.
Copyright © 2019 CODE Consulting and Development, s.r.o., Plzen. All rights reserved.

TransportProfileUri: http://opcfoundation.org/UA-Profile/Transport/pubsub-udp-uadp
Loading configuration...
PublishedDataSets:
  Simple: DataSetClassId=eae79794-1af7-4f96-8401-4096cd1d8908, 4 fields
  AllTypes: DataSetClassId=c51be198-9ade-4a72-8d75-1fbebee173d6, 9 fields
  MassTest: DataSetClassId=96976b7b-0db7-46c3-a715-0979884b55ae, 100 fields
  AllTypes-Dynamic: DataSetClassId=cc7cb5f4-4272-45c2-9a4d-f85a8b331f6a, 16 fields
Connections:
  FixedLayoutConnection: {opc.udp://239.0.0.1 | } PublisherId=[UInt16]30
    FixedLayoutGroup: WriterGroupId=101, PublishingInterval=500, KeepAliveTime=2000, GroupVersion=615377160
      SimpleWriter: DataSetWriterId=1, DataSetName=Simple, KeyFrameCount=1
      AllTypesWriter: DataSetWriterId=2, DataSetName=AllTypes, KeyFrameCount=1
      MassTestWriter: DataSetWriterId=3, DataSetName=MassTest, KeyFrameCount=1
  DynamicLayoutConnection: {opc.udp://239.0.0.1 | } PublisherId=[UInt64]31
    DynamicLayoutGroup: WriterGroupId=102, PublishingInterval=500, KeepAliveTime=2000, GroupVersion=615377160
      SimpleWriter: DataSetWriterId=1, DataSetName=Simple, KeyFrameCount=25
      MassTestWriter: DataSetWriterId=3, DataSetName=MassTest, KeyFrameCount=25
      AllTypes-DynamicWriter: DataSetWriterId=4, DataSetName=AllTypes-Dynamic, KeyFrameCount=25
      EventSimpleWriter: DataSetWriterId=51, DataSetName=Simple, KeyFrameCount=0
  FlexibleLayoutConnection: {opc.udp://239.0.0.1 | } PublisherId=[String]32
    FlexibleLayoutGroup: WriterGroupId=103, PublishingInterval=500, KeepAliveTime=2000, GroupVersion=615377160
      SimpleWriter: DataSetWriterId=1, DataSetName=Simple, KeyFrameCount=1
      MassTestWriter: DataSetWriterId=3, DataSetName=MassTest, KeyFrameCount=1
      AllTypes-DynamicWriter: DataSetWriterId=4, DataSetName=AllTypes-Dynamic, KeyFrameCount=1

Starting to publish...
Sleeping for Infinite (press Ctrl+Break to abort)...
Messages sent: DynamicLayoutConnection 20, FixedLayoutConnection 19, FlexibleLayoutConnection 60