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).
browseButton_Click
starts a target search action. See belowSimitf.cs
> First Steps.A dialog opens and displays all available targets. See below. The second step is to select a target.
btnStartConnection_Click
starts a connection to the selected target. SeePubSubConfigurator.cs
below.PubSubApplication_DataReceived
is called when new subscription data is received.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:
The constructor reads the namespace index of the CODESYS simulation interface.
And the constructor reads all available simulation interface targets from the broker (Targets property).
The
Set Target
public method can be used to select one of the available simulation interface targets.The selected target is searched in detail for all publishers, subscribers, and required data records.
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 fromSimItf.cs
.