Configuring the Controller as a Subscriber
This topic contains the following sections:
- How to add a new reader group
- Editing reader group properties
- How to add a reader to a group and map target variables
- Editing reader properties
- How to delete reader groups or readers
Subscribing means reading data sets (values) from a defined network to which these values have been written by accordingly configured publishers.
The network from which data is read is specified by the 'Network address' (Multicast address). You defined this network address when you created the particular connection (see topic "Configuring Connections for Publishing/Subscribing").
For that reason readers have to be defined under a 'Connection' node, i.e., as child elements of the connection.
Readers are organized in so-called reader groups. Each connection may contain one or several reader groups. A group, in turn, can contain one or more readers.
Which data a reader subscribes is defined by uniquely specifying the publishing writer. For that purpose, each reader has to know the Publisher ID, the Writer group ID and the Writer ID it has to listen to.
How to add a new reader group
- Double-click the 'OPC UA' PLANT tree node and open the 'OPC UA PubSub' editor.
- In the tree on the left, open the 'Connection' under which you want to add readers and select the 'Subscribe' node.
- In the editor on the right, click into the 'Name' field of the lowest, empty table row.
A new reader group with a default name is added.Click anywhere into the grid to accept the default name or edit it and press <Enter>.The group is also added to the tree structure.
- Keep the 'Enabled' checked if you want the group to be active for subscribing in the current project.
If you want the group to be idle, deactivate the checkbox.Note
In a deactivated reader group all readers will be inactive, even if they are set to 'Enabled'. In addition, a reader group will be inactive even with the checkbox selected if the corresponding connection is not enabled. - Continue with adding/specifying readers in this group.
Editing reader group properties
The properties of reader groups can be displayed and edited in the 'Reader groups' table (on the 'Subscribe' node) or on the properties page of a reader group selected in the tree.
How to add a reader to a group and map target variables
- In the tree on the left, open the 'Subscribe' folder and then select the required reader group.
- In the 'Readers' table of group editor, click into the 'Name' field of the lowest, empty table row.
A new reader with a default name is added.Click anywhere into the grid to accept the default name or edit it and press <Enter>.The reader is also added to the tree structure.
- Keep the 'Enabled' checked if you want the reader to be active for subscribing in the current project.
If you want it to be idle, deactivate the checkbox.Note
A reader will be inactive even with the checkbox selected if the corresponding reader group or connection is not enabled. - Specify the publisher from which data is to be read.
Using the combination of Writer ID, Writer group ID and Publisher ID, the subscriber identifies the publisher from which to read data.
On insertion, Publisher ID and Writer group ID are set to 0 (the read-only Writer ID is set to 0 by default). Enter the Ids which have been specified for the writer in the publishing controller. - Define a 'Message receive timeout' interval by entering a millisecond value. If this interval is exceeded without receiving data from the specified publisher, a notification is output in the controller Cockpit (category 'Notification').
-
Mapping target variables to read values.The values read from a publisher must be mapped to target variables declared in the current project.Rules for mapping target variables:
- The order of the read variables is specified by the publisher, more precisely, when creating the published data set in the "publisher project".
- The PubSub communication supports IN ports (but no OUT ports) as target ports and resource-globals (no locals or In/Out variables) as target variables.
- The data type of mapped target variables must match the data type of the subscribed values.
- Target variables must already be declared in the current project in order to be selected here as target.
Note
Since the configuration of publishers and the subscribers takes place in different projects, there can be no automatic check for these rules. When configuring the reader, you must ensure that the necessary information on the values contained in the subscribed data set is available and considered.- In the 'Variables' table on the right, click into the 'Source variable' field of the lowest, empty table row.
A new variable is inserted with a default name. If desired, modify the name to the name of the name of the corresponding variable in the received data set. - Click into the 'Target variable' field to open a drop-down list offering all suitable target variables (IN ports and globals) which are defined in the project.
- Repeat these steps for all variables to be subscribed by this reader.
Editing reader properties
The properties of readers can be displayed and edited in the 'Readers' table (on the 'Reader Group' node) or on the properties page of a reader selected in the tree.
How to delete reader groups or readers
The deletion of entries is possible in the 'ReaderGroups' table of the 'Subscribe' tree node and in the 'Readers' table of a 'Readers group' node.
- Left-click into the table row to be deleted.
Multi-selection can be done by pressing the <Ctrl> key or <Shift> key while clicking on the desired table lines. <Ctrl> + <A> selects all table lines. - Press the <Del> key.