Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Reactive Observable UAMonitoredItemChangedObservable.Create<T> Does Not Appear to Use the passed Sample Interval

More
04 Jun 2015 10:01 #3185 by support
I am glad it is resolved. More information, and also others reading this:

There are two sets of parameter that influence the "rate of changes". The first set is called monitoring parameters, and it contains the "logical" parameters, mainly, how often the data should physically be sampled (or otherwise obtained) by the server from the underlying device or system - this is the sampling interval. The second set is called subscription parameters, and it controls *how* (and how often) is the data transferred from the server to the client - here we have the publishing interval. The publishing interval can be shorter or longer than the sampling interval. The client cannot received data faster than the publishing interval is (but, when queuing is enabled, it can still receive all the data, but they will come in "batches").

In order to make things easy for the developer, we allow the publishing rate be set to zero, in which case we determine the actual publishing rate automatically before making a subscription request to the server. The default publishing rate in UAMonitoredItemArguments is, however, set to 1000 milliseconds. You can set it to zero yourself, or you can use EasyUAMonitoredItemArguments, which (among other things) will do it for you.

Other notes to the code you posted:

1. In the first instance you have the sampling rate as fast as 10 milliseconds - in principle there is nothing wrong with that, but be aware of possible performance requirements and consequences.

2. If UAMonitoredItemArgumentsCollection is a class from our assemblies: It is a (yet) undocumented class, with different purpose. It will work; but you'd better not using. All you need is any IEnumerable of UAMonitoredItemArguments: It can be e.g. an array, or a generic Collection<UAMonitoredItemArguments>.

Best regards

Please Log in or Create an account to join the conversation.

More
03 Jun 2015 20:14 #3179 by pmitton
That comment was enough. I hadn't altered the subscription parameter and that did the trick.

That also helped me understand the difference between the two.

Thanks for the quick response!

Please Log in or Create an account to join the conversation.

More
03 Jun 2015 19:36 #3177 by support
Can you please post a piece of code that constructs the arguments for the approach with MonitoredItemChanged event? Thank you.

Note: The likely reason is in the PublishingInterval (in SubscriptionParameters) setting - but I need that code to verify it, and illustrate the difference.

Thank you

Please Log in or Create an account to join the conversation.

More
03 Jun 2015 18:41 #3175 by pmitton
Good afternoon. We recently acquired Quick OPC and have been attempting to use the SDK to link up a simple UI.

While working with the software, we were using the UAMonitoredItemChangedObservable to monitor for changes. We used the collection of multiple arguments to subscribe to multiple items. However, the subscription does not appear to respect the sample rate passed to it. We can compare this to the MonitoredItemChanged event approach and that seems to work fine.

We declare the arguments as follows:
UAMonitoredItemArgumentsCollection analogCollection = new UAMonitoredItemArgumentsCollection
            {
                new UAMonitoredItemArguments(null, endpoint, "ns=6;s=::AsGlobalPV:b_wlcFbk.WT_2612", new UAMonitoringParameters(10)),
                new UAMonitoredItemArguments(null, endpoint, "ns=6;s=::AsGlobalPV:b_wlcFbk.WT_2613", 100)
            };

We then create the subscription as follows:
var observable = UAMonitoredItemChangedObservable.Create<T>( analogCollection );

Finally we have a collection of objects using the observable that has been passed into their constructor and create a subscription to that observable.
private IObservable<UAAttributeData<T>> GetFilteredObservable(string nodeId, UAMonitoredItemChangedObservable<T> itemChangedObservable)
        {
            return itemChangedObservable
                .Where(e => e.Exception == null)
                .Where(i => i.TypedAttributeData != null)
                .Where(i => i.Arguments.NodeDescriptor.NodeId == nodeId)
                .Select(i => i.TypedAttributeData);
        }
 
        private void StartSubscription()
        {
            if (CanMonitor) _subscription = _itemChangedObservable.Repeat().Subscribe(OnNext);
        }

What happens is the behavior seems to work, except the sampling rate is much lower. It seems fixed at 1000ms instead of the desired 100ms that is requested.

How might we correct this issue?

Thanks!

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.051 seconds