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.

AMapping ( and Reading) objects within arrays using BrowsePaths

More
02 May 2020 08:45 #8451 by support
Hello,

yes, you have made the escaping right (note that there are ways to construct UABrowsePath from its elements, not by parsing, and when done so, names can be passed into the browse path without extra escaping logic).

And yes, although Live Mapping allows the use of Node IDs, its strength is mostly when the Node Id is only used at some "root" of object hierarchy (and possibly even passed into the Live Mapping externally), and the rest is accessed via browse paths. This way, the object/variable types concept in OPC UA can be leveraged.

Regarding the issue, I went into debugging and only when I was into it and related the node tree I saw (also in your picture) to what the browse path actually contains, I realized what should have been obvious to both of us from the start: The correct browse path is

[ObjectsFolder]/PLC1/OpcCommunication/OpcEffectLinear.OpcEffectLinear&[1&].stStatus
Best regards

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

More
01 May 2020 14:51 #8450 by cadomanis
I am experiencing issues when trying to use mapping with object that are contained within an array in the server. In my testing, I found I was having similar issues simply trying to read those same variables. Through the simplified read testing, I believe it may have to do with the [] characters needed for the array index when used in the browse path. I have tried escaping those characters, but end up with the same result. As the read example seems easier to follow, I thought I would post those results and am hoping they would help with the mapping issues as well.

The server setup for these tests is illustrated in the attached ServerConfig.png3. This is the same server reference in the Calling Methods with complex types that you resolved so quickly, and should still have access to if needed. The following is the code I have been testing with:
            UAEndpointDescriptor endpointDescriptor = "opc.tcp://192.168.1.20:4840";
 
 
            // Instantiate the client object
            var client = new EasyUAClient();
 
            var browsePathParser = new UABrowsePathParser {DefaultNamespaceUriString = "urn:BeckhoffAutomation:Ua:PLC1" };
 
            // Prepare arguments
            // Note: Add error handling around the following statement if the browse paths are not guaranteed to be
            // syntactically valid.
            var readArgumentsArray = new[]
            {
                new UAReadArguments(endpointDescriptor, 
                //    browsePathParser.Parse("[ObjectsFolder]/PLC1/OpcCommunication.OpcEffectLinear&[1&].stStatus")),
                "nsu=urn:BeckhoffAutomation:Ua:PLC1;ns=4;s=OpcCommunication.OpcEffectLinear[1].stStatus"),
                new UAReadArguments(endpointDescriptor,
                    browsePathParser.Parse("[ObjectsFolder]/PLC1/OpcCommunication.OpcEffect.stStatus")),
                new UAReadArguments(endpointDescriptor,
                    browsePathParser.Parse("[ObjectsFolder]/PLC1/OpcCommunication.OpcTestData1")),
 
            };
 
            // Obtain attribute data.
            UAAttributeDataResult[] resultArray = client.ReadMultiple(readArgumentsArray);
 
            // Display results
            for (int i = 0; i < resultArray.Length; i++)
            {
                UAAttributeDataResult attributeDataResult = resultArray[i];
                if (attributeDataResult.Succeeded)
                    Console.WriteLine($"results[{i}].AttributeData: {attributeDataResult.AttributeData}");
                else
                    Console.WriteLine($"results[{i}]: *** Failure: {attributeDataResult.ErrorMessageBrief}");
            }
As written, all of the variables will return good results. Note the first ReadArgument is using a string NodeDesciptor as opposed to the BrowsePathParser. If I change the code to use the BrowsePathParser that is commented out ( and comment out the node desciptor string), I get the following exception thrown:
{"OPC-UA service result - An error specific to OPC-UA service occurred (status code: BadNoMatch). Details follow.\r\n---- SERVICE RESULT ----\r\nStatus Code: {BadNoMatch} = 0x806F0000 (2154758144)\r\n\r\n+ The client method called was 'ReadMultiple'."}

What is unclear to me is that the two different methods seem to result is what I understand to be equivalent results when I look in readArgumentsArray and inspect the Node Descriptor
Results when using the BrowsePathParser:
NodeDescriptor	{BrowsePath="[ObjectsFolder]/PLC1/OpcCommunication.OpcEffectLinear[1].stStatus"}
Results when using the NodeDesciptor string:
NodeDescriptor	{NodeId="nsu=urn:BeckhoffAutomation:Ua:PLC1 ;ns=4;s=OpcCommunication.OpcEffectLinear[1].stStatus"}

To try and help confirm this, I made an instance of an identical object not contained in an array. This is the second item in the readArgumentArray. This always works with the BrowsePathParser with good result and a Node Descriptor of:
NodeDescriptor	{BrowsePath="[ObjectsFolder]/PLC1/OpcCommunication.OpcEffect.stStatus"}

As I will eventually be trying to look at these variables through LiveMapping, I believe that I need the BrowsePath approach to make that work? I have been successful in attaching and reading with a Mapper on the object not in the array - [ObjectsFolder]/PLC1/OpcCommunication.OpcEffect.stStatus - but have had similar problems in the mapper as in the read example above with the objects in the array.

Any help or suggestions are greatly appreciated. We are really hoping there is a way to use the array version of the variables.
Attachments:

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

Moderators: support
Time to create page: 0.060 seconds