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.

OPC UA Client: Read directly element of array or bit element

More
06 Oct 2016 13:07 #4436 by support
Then we need the InnerException of that.

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

More
06 Oct 2016 12:14 #4435 by Scattolaro
this is the UAException that UAClient Throw:

An unhandled exception of type 'OpcLabs.EasyOpc.UA.OperationModel.UAException' occurred in OpcLabs.EasyOpcUA.dll

Additional information: An OPC-UA operation failure with error code -1 (0xFFFFFFFF) occurred, originating from ''. The inner exception, of type 'OpcLabs.EasyOpc.UA.UAStatusCodeException', contains details about the problem.

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

More
06 Oct 2016 09:41 #4433 by support
As far as I can tell, you are doing it right, for one element.

Please elaborate on "it doesn't work." What happens?

Best regards

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

More
06 Oct 2016 09:30 #4432 by Scattolaro
Ok, I try to do how you say and this below is the C# code:

UAIndexRangeList idx;
idx = new UAIndexRangeList();
//idx.Add(new UAIndexRange(1, 3));
idx = UAIndexRangeList.OneDimension(0);
//UAIndexRangeList.TryParse("1,2", out idx);

UAReadArguments ra = new UAReadArguments("opc.tcp://192.168.0.128:4870", "nsu=urn:HmiWebLink:VarProvider;s=TABEELLA_ALLARMI",UAAttributeId.Value,idx);

object o = clientUA001.ReadValue(ra);

But with the UAIndexRangeList it doesn't work.
The value of "TABEELLA_ALLARMI" in the OPC UA server is a UInt16 Array[10].
Is it possible read only one element in Value array with the UAIndexRangeList? How?

Thanks

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

More
05 Oct 2016 19:34 #4431 by support
The Node ID refers to the node, or some attribute of the node, as a whole. If the data type of that attribute is an array, then by specifying just the node ID you are referring to the array as a whole, and when reading or subscribing, you will be receiving values that contain the whole array. There is no (server-independent) way to specify an array element or a range of elements inside the node Id.

But that is not the whole story. When reading or subscribing (or writing), you can specify additional parameters besides the Node Id. What you need to use is "index range list". Following is an excerpt from our Concepts doc that covers that:

4.13.5 Index Range Lists

OPC Unified Architecture has support for single- and multidimensional arrays in data values. In addition, it is also possible to work with (read, write, subscribe to) only a subset of an array, so that the whole (potentially large) array does not have to be transferred between the OPC server and OPC client.

QuickOPC-UA uses Index Range Lists (UAIndexRangeList objects) to control which parts of array value should be accessed. An index range list can be used to identify the whole array, a single element of a structure or an array, or a single range of indexes for arrays. Index Range List is basically a list of individual Index Ranges (UAIndexRange objects), each containing a range for a single dimension of an array.

There is an implicit conversion from an integer (Int32) to a UAIndexRange, so if your language (such as C#) supports implicit conversions, an index range containing just a single element can be written simply as the element index, without explicitly constructing the UAIndexRange object.
Besides constructing the UAIndexRangeList from individual UAIndexRange objects, it is also possible to specify the index range list by parsing a string, using static UAIndexRangeList.TryParse method.

Examples of index range strings:

 5:20
 10:11,1:2
 1,4:7,90

Dimensions are separated by commas. A minimum and maximum value, separated by a colon, denotes a range of index. If the colon is missing, only a single for an index is selected. An empty string denotes the whole array.

One-dimensional index range lists can be easily constructed using the UAIndexRangeList.OneDimension static method, passing it either the single index, or minimum and maximum indices.

UAIndexRangeList can be given as IndexRangeList property of the UAAttributeArguments object (and derived objects, such as UAReadArguments, UAWriteArguments, UAWriteValueArguments, EasyUAMonitoredItemArguments, and EasyUADataChangeArguments<>). You can then pass this object to a corresponding method on the main EasyUAClient object.

Best regards

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

More
05 Oct 2016 15:57 #4430 by Scattolaro
With the OPC UA Client:
Is it possible with the node descriptor(es. nsu=urn:HmiWebLink:VarProvider;s=Array) read directly a element of array defined in OPC Server UA?
Is it possible with the node descriptor read a byte of a node?
Or is it necessary to do the data manipulation after I read the array element or variable?

Thanks,
Massimo

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

Moderators: support
Time to create page: 0.050 seconds