Publish and Subscribe
Publisher and Subscriber provide a way to easily exchange information.
- Publishers provide information.
- Subscribers subscribe to information from a referenced Publisher in order to make it available in a specific program section (e.g. template).
Regardless of where Publishers and Subscribers are implemented (e.g. on different PLCs), information is exchanged in a uniform manner.
Sample 1
Application of Publisher and Subscriber to specific functions and objects.
Each function block can be used as Publisher. Function blocks that can subscribe to the desired data types serve as Subscribers. To do this, the unique object name of the Publisher and its AMS NetID must be specified on the Subscriber.
Sample 2
Application of Publisher and Subscriber for any data types.
The FB_BA_RawPublisher can be used to make information of different sizes available to the FB_BA_RawSubscriber. As in the previous sample, the object name and the AMS NetID must be specified on the Subscriber. As indicated in the sample, this configuration takes place once in FB_init of FB_BA_RawSubscriber.
If there are several instances of an object with the same symbol name, it is necessary to specify the complete symbol name of the object in the parameter sSubject.
Sample 3
In the sample, the faults of two heating circuit pumps are to be published and subscribed to separately.
Within the heating circuits, the pumps Pu and the published binary objects of the fault Dst have the same name.
The parameter is therefore published from both templates in the same way.
Subscribing is done separately, you only need to ensure that the symbol path for the event to be subscribed to is specified correctly.