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.
- Forum
- Discussions
- Feature Requests & Product Improvement Ideas
- OPC UA Client: Read directly element of array or bit element
OPC UA Client: Read directly element of array or bit element
Please Log in or Create an account to join the conversation.
- Scattolaro
- Topic Author
- Offline
- Platinum Member
- Posts: 35
- Thank you received: 1
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.
Please elaborate on "it doesn't work." What happens?
Best regards
Please Log in or Create an account to join the conversation.
- Scattolaro
- Topic Author
- Offline
- Platinum Member
- Posts: 35
- Thank you received: 1
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.
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:
Best regards4.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.
Please Log in or Create an account to join the conversation.
- Scattolaro
- Topic Author
- Offline
- Platinum Member
- Posts: 35
- Thank you received: 1
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.
- Forum
- Discussions
- Feature Requests & Product Improvement Ideas
- OPC UA Client: Read directly element of array or bit element