Communication Between Robot and B&R PLC

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?

Hi Tobias, welcome into our community!

In order to communicate an array element, first of all you must enable “show array elements” for this variable in server OpcUa mapping configuration.

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]

image

And at this point you can test it. And it works :slight_smile:

Hope this solves your problem!

1 Like

Hi again.

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.

2 Likes

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!

PROGRAM _INIT
VarA;
EasyUaWrite_0.ServerEndpointUrl := ‘opc.tcp://localhost:4840’;
EasyUaWrite_0.NodeID.NamespaceIndex := 6;
EasyUaWrite_0.NodeID.Identifier := ‘::Write:TEST_WRITE’;
EasyUaWrite_0.NodeID.IdentifierType := UAIdentifierType_String;
EasyUaWrite_0.pNodeAddInfo := ADR(NodeAddInfo);
EasyUaWrite_0.Variable := ‘::Write:VarA’;

NodeAddInfo.AttributeId := UAAI_Value;
NodeAddInfo.IndexRangeCount := 0;
NodeAddInfo.IndexRange[0].StartIndex := 0;
NodeAddInfo.IndexRange[0].EndIndex := 10;

END_PROGRAM

PROGRAM _CYCLIC
EasyUaWrite_0();
END_PROGRAM

PROGRAM _EXIT
END_PROGRAM

This is not working for me. It is writing whole array, regardless Start and End Indexes. Maybe I am doing something wrong.

Hello @c587561 ,

I’m going to analyze your use case! Thank you very much for your feedback! I will be back to you as soon as possible!

Regards,

Javier

This number must be number of dimensions of array, for one dimensional array:
NodeAddInfo.IndexRangeCount := 1;

1 Like

@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.

Hello Tobias,

Thanks for the confirmation. It happens with AsOpcUac and with EasyUaClnt. We will be back to you with more information as soon as possible.

Thanks for you feedback,

Regards,

Hello Tobias,

The StartIndex and EndIndex are from the node on the server side. Let me put a screenshot to show it to you:

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.

2 Likes