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
![Publish and Subscribe 1:](Images/png/15130787211__Web.png)
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
![Publish and Subscribe 2:](Images/png/15130784779__Web.png)
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.
![Publish and Subscribe 3:](Images/png/15130792075__Web.png)
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.
![Publish and Subscribe 4:](Images/png/15130794507__Web.png)
![Publish and Subscribe 5:](Images/png/15130850571__Web.png)
Subscribing is done separately, you only need to ensure that the symbol path for the event to be subscribed to is specified correctly.
![Publish and Subscribe 6:](Images/png/15130848139__Web.png)
![Publish and Subscribe 7:](Images/png/15130789643__Web.png)