Subscriptions
Instead of permanently reading information by polling, the OPC UA protocol includes the Subscription function. This function enables the OPC UA high performance stack embedded in the BMENUA0100 module to provide publish/subscribe services, which are used when the module connects to remote devices.
An OPC UA client can subscribe to one or more selected nodes and let the server monitor these items. Upon the occurrence of a change event, for example a change in value, the server notifies the client of the change. This mechanism significantly reduces the quantity of data that is transferred. This reduces bandwidth consumption and is the recommended mechanism for reading information from an OPC UA server.
An OPC UA client can subscribe to the multiple types of information that an OPC UA server provides. The subscription groups together these varying types of data, called Monitored Items, to form a single collection of data called a Notification.
A subscription must:
Consist of at least one Monitored Item.
Be created within the context of a Session, which is created within the context of a Secure Channel.
Subscriptions and Overruns
In some cases, where there exists a large number of subcription requests, the OPC UA server attempts to obtain data from the CPU in an amount greater than the CPU or the BMENUA0100 module can handle in the specified publishing interval. In this case, the execution time for subscription requests will be automatically extended – and the next subscription execution postponed – until all requests can be completed.
When setting a publishing interval, consider the number of clients and client requests the server needs to handle. When determining the number of client requests, confirm that all clients are operating online. In this regard, note that some clients can take 2 minutes or more to come online after startup.
Change Events
A client can subscribe to a data change event, which is triggered by a change to the value attribute of a variable, as a Monitored Item.
The following three settings determine how Monitored Items are added to a subscription:
Sampling Interval: the sampling time interval set for each Monitored Item in the subscription. This is the frequency by which the server checks the data source for changes. For a single Variable item, the Sampling Interval can be smaller (i.e. faster) than the period between notifications to the client. In this case, the OPC UA Server may queue the samples and publish the complete queue. In extreme cases, the server will revise (i.e. slow) the Sampling Interval so that the data source will not experience excessive queuing load that may be caused by the sampling itself.
NOTE: If OPC UA queuing of data samples is supported, the queue size (i.e., the maximum number of values which can be queued) can be configured for each monitored item. When the data is delivered (published) to the client, the queue is emptied. In case of a queue overflow, the oldest data is discarded and replaced by new data.Filter: a collection of several criteria used to identify which data changes or events are reported, and which should are blocked.
Monitoring Mode: used to enable or disable data sampling and reporting.
The following two settings apply to the Subscription itself:
Publishing Interval: The period after which notifications collected in the queues are delivered to the client in a Notification Message (Publish Response). The OPC UA Client must confirm that the OPC UA server has received enough Publish Tokens (Publish Requests), so that whenever the Publish Interval elapsed and a notification is ready to send, the server uses such a token and sends the data within a Publish Response. In case that there is nothing to report (e.g. no values have changed) the server will send a KeepAlive notification to the Client, which is an empty Publish, to indicate that the server is still alive.
Publish Enabled: Enables and disables the sending of the Notification Message.
Embedded DataChange Subscription Server Facet
The Embedded DataChange Subscription Server Facet specifies the minimum level of support for data change notifications within subscriptions. It includes limits which minimize memory and processing overhead required to implement the Facet. This Facet includes functionality to create, modify and delete Subscriptions and to add, modify and remove Monitored Items. As a minimum for each Session, Servers shall support one Subscription with up to two items. In addition, support for two parallel Publish requests is required. This Facet is geared for a platform such as the one provided by the Micro Embedded Device Server Profile in which memory is limited and needs to be managed. For a full description of this facet, refer to http://opcfoundation.org/UA-Profile/Server/EmbeddedDataChangeSubscription.
This facet supports the following services:
Monitored Item Service Set
Subscription Service Set
Monitored Item Service Set
The Monitored Item Service Set supports the following services:
CreateMonitoredItems: An asynchronous call used to create and add one or more MonitoredItems to a subscription.
ModifyMonitoredItems: an asynchronous call to modify monitored items. This service is used to modify MonitoredItems of a subscription. Changes to the MonitoredItem settings shall be applied immediately by the server. They take effect as soon as practical.
DeleteMonitoredItems: an asynchronous call to delete monitored items. This service is used to remove one or more MonitoredItems of a subscription. When a MonitoredItem is deleted, its triggered item links are also deleted.
SetMonitoringMode: an asynchronous call to set the monitoring mode for a list of MonitoredItems. This service is used to set the monitoring mode for one or more MonitoredItems of a subscription. Setting the mode to DISABLED causes all queued notifications to be deleted.
Subscription Service Set
The Subscription Service Set supports the following services:
CreateSubscription: an asynchronous call to create a subscription.
ModifySubscription: an asynchronous call to modify a subscription. The server immediately applies changes to the subscription, and changes take effect as soon as practical.
DeleteSubscription: an asynchronous call to delete one or more subscriptions belonging to the client session. Successful completion of this service deletes all Monitored Items associated with the subscription.
Publish: This Service is used for two purposes: to acknowledge the receipt of NotificationMessages for one or more subscriptions, and to request the server to return a NotificationMessage or a keep-alive message.
Republish: an asynchronous republish call to get lost notifications. This service requests the subscription to republish a NotificationMessage from its retransmission queue. If the server does not have the requested message in its retransmission queue, it returns an error response.
SetPublishingMode: an asynchronous call to enable sending of Notifications on one or more subscriptions.