Hi all,
I’m trying communication between robot controller and B&R PLC.
By the way, the robot enables OPC UA communication and has several sets of R/W fields, some with 2000 elements, etc.
In order to avoid interval transmission, I am looking for the possibility of transmitting only part of the elements, which is easier to set up - for now only about 10 signals are needed.
Communication with the physical robot from the simulator works, but we have problems with addressing a certain range of the array.
I tried every variant with combinations, but without the help of BR, or the programmers who worked on it, I see no chance of success.
Anyone has any idea what could the browsing path be or is it even possible to get array elements?
Afterwards, if you use Ua Expert software you will see how inside variable (in this case varArray), there are more variables. A variable for each array position.
Then, if you follow the post How to communicate two controllers thought OPC UA , you have just to go “opening folders” and adding the path accordingly with its NamespaceIndex. In this case:
/0:Root/0:Objects/4:PLC/6:Modules/6:&:&:/6:Program1/6:varArray/6:varArray[0]
I’m realizing now the robot OPC-UA server gives the array variable “packed”, as the sub-members don’t have their own node, there is no browsepath to them and you cannot access to them with OpcUa_any component.
So you need to use library AsOpcUac. In that case my recommendation will be to use the library my colleague developed: EasyUaClnt is a simplicity wrapper library based on AsOpcUac.
You should be able to read the array in one go, if you supply the correct information in the NodeAddInfo:
NodeAddInfo.AttributeId := UAAI_Value;
NodeAddInfo.IndexRangeCount := 0;
NodeAddInfo.IndexRange[0].StartIndex := 0;
NodeAddInfo.IndexRange[0].EndIndex := 99;
Thank you for your answer. It helped, but it was working with AsOpcUac even before. With this new library it is working also and less things to worry about - simpler configuration!
@c509054 Thank you for reply.
If I’m correct then this data shows dimensions of array. So if you have there 0 it means there are no arrays, if you have 1 → 1-dimensional array [0], if you have 2 ->2-dimensional array [0,0], etc.
So if I define here 1 dimensional array, start and end indexes the correct range of array then it’s working. If I want to write in this case just the portion of array… so from 0…5, then it’s not working.
To be clear. If we are speaking about reading/writing arrays from specific indexes in array then both of EasyUaClnt and AsOpcUac were not working.
Example:
TestReal99 REAL[0…99] which is array of 100 elements and reading from index 0 to index 99 is working with both methods.
Reading from index 10 to index 20 is not working with neither method.
So if you define in StartIndex a 10 and the EndIndex 20 then the variable used for the writting must be defined exactly with this number of elements. In this case 11 elements.
I hope this clarifies how this functionality works.