In real time application, there might be some Nodes available in OPC address space which contains static data & some holds dynamic/variable data. When subscribe for such variables we should get data in response to subscription.
When we subscribe for dynamic one, we will get data change notification at given interval of time & a monitored item will be created for that. But, when we subscribe for static variable, data change notification will be there & we get initial/default value available in that variable or property & after that there will be no updates in such static variable subscription.
Does this means subscribing a static variable is not a good idea or not required in real time application ?
What is the best or recommended way to read data of static variable or property ?
Thank you Randy for quick response.
The reason behind asking this question was, some people said, we should not subscribe to static variable, as there is no meaning in subscribing a variable whose value will never gonna change. Some people said, we should do this because, when we subscribe to a static variable DataChangeNotification call will get fired for them. If any data change event is created for static variable, may be with the intent to send an initial value of that variable in response, but actually there is no response or data.
Sometimes what happen, plants may be down for long duration, for months, due to some or other reason & when plant supervisor will look at dashboard, s/he won't be able to figure out the time when values of those sensors were modified, instead they find no trend in charts, e.g. when filter is 6 hrs or 1 day. Some people achieve this via polling & draw straight line.
Assume, there are more than 100 sensors in 1 machines, except 1 or 2, are dynamic & subscribed for data change at 1 mins sampling interval, 1 or 2 left from subscription. End user need data for those 1 or 2 sensors & also want to know when value for those sensors initialized or re-initialized after maintenance during downtime. On HMI dashboard, there is no way to display created or modified time of those static sensors data.
In this case, do we should be using polling instead of subscription to get data of those 1 or 2 sensors, may be at higher polling rate ? Or is it ok to subscribe for such variables & let data change notifier send notification whenever there is any change made in static Nodes (may be unknown - with the intent to hack some data or destroy something) ?
Another case is, when a subscription request contains more than one Nodes including static & dynamic, what should be the expected output of that subscription ? Should we look for only dynamic variable value ? Or we will get value for both static & dynamic in 1st notification & subsequent notifications will send only dynamic values ?
If there is no point in subscribing a static variable, we should not get DataChangeNotification for them or end-user should not be allowed to do such, because it is a move in wrong direction.
Your explanation is not that clear, so i will make an attempt at answer what I think you might be asking.
A subscription even for a value that is static is fine. You will get an initial value in the subscription and then if it changes a new value. Take for example a digital value that does not changes for dates. The initial value will represent what the value currently is, it will include a source time stamp that indicates when the value last was updated by the source (when the value changed or was reset) , and if you are looking the server timestamp is when the server last knew the value was current (the two timestamps might not be the same). For example a digital point changed two days ago , the SourceTimestamp would from two days ago, but the server is running and updating value (it knows it is getting all new values) so the ServerTimestamp would be current time.
that said, values that are configuration items, such as engineering units or ranges, need to only be read once, since these item are considered Semantic variable. If they change the status of the correspond value will set a bit that a semantic change has occurred, at which point the engineering unit or range can be re-read.
When creating a subscription, all monitored items are given a handle, the only the changes are return in a publish response (matching to handle).
Paul Hunkar - DSInteroperability
Thank you Paul for explanation.
It means, we can subscribe to a static variable or property & we should get an output in response irrespective of whether it is subscribed together with dynamic variable or independently.
The handle associated with that subscription will be there to take care of all publish events until it's life time.
But, one more doubt I've regarding this, since, we don't know when a value will be reinitialized for a variable e.g., range, should we read a value of such variable via polling or let a user allowed to do it via subscription or let user decide what s/he wants to do based on the use case ?
Please suggest most recommended solution for static variable.