Skip to main content

Information about the C# Source Code

Important

The source code is not included in the example package.

The following information is interesting and important for developers of simulation tools.

The simulation demonstrator uses the open source OPC UA Stack.

For more information, see: OPCFoundation/UA-.NETStandard

The functionality of the individual classes is explained below.

MainWindow.xaml.cs

This class is the top class (top layer class).

  1. browseButton_Click starts a target search action. See below Simitf.cs > First Steps.

  2. A dialog opens and displays all available targets. See below. The second step is to select a target.

  3. btnStartConnection_Click starts a connection to the selected target. See PubSubConfigurator.cs below.

  4. PubSubApplication_DataReceived is called when new subscription data is received.

  5. DispatcherTimer_Tick: Decoding or encoding of the pub/sub data.

SimItf.cs

This class contains code for searching the broker to get information about the existing simulation targets.

Searching is done in two steps:

Procedure. First Steps
  1. The constructor reads the namespace index of the CODESYS simulation interface.

  2. And the constructor reads all available simulation interface targets from the broker (Targets property).

Procedure. Second steps
  1. The Set Target public method can be used to select one of the available simulation interface targets.

  2. The selected target is searched in detail for all publishers, subscribers, and required data records.

  3. The searched information can be read via the properties (see code).

PubSubConfigurator.cs

This class takes over the pub/sub configuration for the selected target.

  • Call the Create method and forward the pub/sub information from SimItf.cs.