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.

BadFilterNotAllowed with reactive subscription to a boolean

More
30 Jul 2014 17:01 - 30 Jul 2014 17:02 #2109 by support
The various argument overrides are different between EasyDAClient.SubscribeMonitoredItem and UAMonitoredItemChangedObservable<TValue> Create<TValue>.

It looks like that the problem comes form using an absolute deadband, which may not be supported by the server. That's what you get when using the second (listed below) form of SubscribeMonitoredItem, and, that's what you get when you call UAMonitoredItemChangedObservable<TValue> Create<TValue> as in your call. It ends up using this override:
        /// <summary>
        /// Creates a new item change observable for OPC item, specifying machine name, server class, item ID, requested update 
        /// rate, and percent deadband.
        /// </summary>
        /// <param name="endpointDescriptor">Endpoint descriptor. Identifies the OPC-UA server.</param>
        /// <param name="nodeDescriptor">Node descriptor. Identifies the node in OPC server's address space.</param>
        /// <param name="samplingInterval">The sampling interval (in milliseconds) indicates the fastest rate at which the 
        /// Server should sample its underlying source for data changes.</param>
        /// <param name="absoluteDeadbandValue">The value of absolute deadband.</param>
        /// <returns>Returns an observable for changes in the given OPC item.</returns>
        /// <remarks>
        /// The <see cref="UAReactive.DefaultClientSelector"/> selector will be used for OPC Unified Architecture operations.
        /// </remarks>
        [NotNull]
        [SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]    // intentional (advanced usage type)
        static public UAMonitoredItemChangedObservable<TValue> Create<TValue>(
            [NotNull] UAEndpointDescriptor endpointDescriptor,
            [NotNull] UANodeDescriptor nodeDescriptor, 
            int samplingInterval, 
            double absoluteDeadbandValue= 0.0F)

You can see that it is using an absolute deadband of 0.0F.

You should rather use this one:
/// <summary>
        /// Creates a new item change observable for OPC item given by OPC server and item descriptors, and OPC group parameters
        /// object.
        /// </summary>
        /// <param name="endpointDescriptor">Endpoint descriptor. Identifies the OPC-UA server.</param>
        /// <param name="nodeDescriptor">Node descriptor. Identifies the node in OPC server's address space.</param>
        /// <param name="monitoringParameters">Contains monitoring parameters (such as the sampling interval, and optional 
        /// 	data change filter).</param>
        /// <param name="subscriptionParameters">Contains subscription parameters (such as the publishing interval).</param>
        /// <param name="state">The state object (can be any object supplied by your code); available in notifications. </param>
        /// <returns>Returns an observable for changes in the given OPC item.</returns>
        /// <remarks>
        /// The <see cref="UAReactive.DefaultClientSelector"/> selector will be used for OPC Unified Architecture operations.
        /// </remarks>
        [NotNull]
        [SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]    // intentional (advanced usage type)
        static public UAMonitoredItemChangedObservable<TValue> Create<TValue>(
            [NotNull] UAEndpointDescriptor endpointDescriptor,
            [NotNull] UANodeDescriptor nodeDescriptor, 
            [NotNull] UAMonitoringParameters monitoringParameters,
            [NotNull] UASubscriptionParameters subscriptionParameters,
            [CanBeNull] object state = null)
 

Instead of UAMonitoringParameters, you can pass in just the sampling interval, as there is an implicit conversion from Int32 to UAMonitoringParameters, and it will create the parameters without a deadband. Similarly with UASubscriptionParameters and the publishing interval, or use UASubscriptionParaneters.Default.

Alternatively, call the following override instead:
 
        /// <summary>
        /// Creates a new item change observable for OPC item given by <see cref="UAMonitoredItemArguments"/> object.
        /// </summary>
        /// <param name="args">Contains an OPC server and item descriptors, and OPC group parameters.</param>
        /// <returns>Returns an observable for changes in the given OPC item.</returns>
        /// <remarks>
        /// The <see cref="UAReactive.DefaultClientSelector"/> selector will be used for OPC Unified Architecture operations.
        /// </remarks>
        [NotNull]
        static public UAMonitoredItemChangedObservable<TValue> Create<TValue>([NotNull] UAMonitoredItemArguments args)

Best regards
Last edit: 30 Jul 2014 17:02 by support.
The following user(s) said Thank You: giles

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

More
30 Jul 2014 14:19 #2106 by giles
btw I have paid for a license

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

More
30 Jul 2014 14:10 #2105 by giles
Hi I am using the Ignition UA server to subscribe to a boolean value - this code :
public static void Main()
            {
                Console.WriteLine("Creating observable...");
                UAMonitoredItemChangedObservable<Boolean> dynamic =
                    UAMonitoredItemChangedObservable.Create<Boolean>(
						"opc.tcp://192.168.1.95:4096/UA/Ignition OPC-UA Server", "ns=1;s=[Z9PLC]B145/1", 1000);
 
                Console.WriteLine("Subscribing...");
                using (dynamic.Subscribe(e => Console.WriteLine(
                    e.Exception == null ? e.AttributeData.ToString() : e.Exception.GetBaseException().ToString())))
                {
                    Console.WriteLine("Waiting for 10 seconds...");
                    Thread.Sleep(10*1000);
 
                    Console.WriteLine("Unsubscribing...");
                }
            }

gives me the following error:

OPC-UA service result - An error specific to OPC-UA service occurred.
---- SERVICE RESULT ----
StatusCode: {BadFilterNotAllowed} = 0x80450000 (2152005632)
at OpcLabs.EasyOpc.UA.Toolkit.UAClientMonitoredItemBase.UpdateException()
at OpcLabs.EasyOpc.UA.Toolkit.UAClientSubscriptionBase.UpdateMonitoredItemsException(IEnumerable`1 monitoredItems)
at OpcLabs.EasyOpc.UA.Toolkit.UAClientSubscriptionBase.InternalPerformSdkSubscriptionChanges(IEnumerable`1 itemsToRemove, IEnumerable`1 itemsToModify, IEnumerable`1 itemsToAdd)
at OpcLabs.EasyOpc.UA.Toolkit.UAClientSubscriptionBase.PerformSdkSubscriptionChanges(IEnumerable`1 itemsToRemove, IEnumerable`1 itemsToModify, IEnumerable`1 itemsToAdd)
at OpcLabs.EasyOpc.UA.Toolkit.UAClientSubscriptionBase.InternalConnect()
at OpcLabs.EasyOpc.UA.Toolkit.UAClientSubscriptionBase.Connect()
at OpcLabs.EasyOpc.UA.Toolkit.UAClientSessionBase.ConnectSubscriptions(IEnumerable`1 clientSubscriptions)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()


The problem is with the dead band...

If I do this (not with RX):
easyUAClient.SubscribeMonitoredItem(
                    "opc.tcp://192.168.1.95:4096/UA/Ignition OPC-UA Server", "ns=1;s=[Z9PLC]B145/1",
                    1000);

It's all good, however if I do this...
easyUAClient.SubscribeMonitoredItem(
                    "opc.tcp://192.168.1.95:4096/UA/Ignition OPC-UA Server", "ns=1;s=[Z9PLC]B145/1",
                    1000,0);

I get the same error.

So leaving the deadband variable out with RX is clearly working differently to leaving it out with the normal method (I have tried setting it null but that doesn't work either.

I'm hoping we can get this sorted as as it is the RX version will not work for me.

Many thanks g

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

Moderators: support
Time to create page: 0.064 seconds