Problem writing array elements to PLC using OPC UA

Hello,

I'm using an Omron NJ-502 processor with Ignition Edge, using the OPC-UA connection. I'm reading an array (2 dimensional) with a Polled group. The tags read from the PLC correctly, but when I link one of the elements to an Input block and try to enter a value, it either just accepts the value in the Ignition and does NOT change it in the PLC, or it throws an error Error writing "hg" to tag. Bad_Failure.

I had read that some PLC's want you to write the WHOLE array at one time, but I'm not sure if that's the issue, or if it is, how to correct it. I'm already having to create a fake array because the OPC driver will not pick up 3 dimensional arrays...it only reads single or two dimensional arrays.

Again, all of the elements in the array when changed in the PLC display correctly on the Ignition display or data entry items. The data just doesn't go back down to the PLC. I do have it set for bi-directional communications, both on the top of the developer AND in the tag binding window.

Thank you!

Ignition doesn't support multi-dimensional array tags, so this must be multiple tags in Ignition. Does each tag point at a one-dimensional row/column, or does each Ignition tag point at one primitive element of the array?

Can you edit values in the array from the designer tag browser?

1 Like

Hello!

The tags are displayed in the tag browser, with the values from the PLC, but you cannot type in a value there...you get the same error. The two dimensional array comes in "stacked", so you just have to count out the elements to find the correct two dimensional part of the array.

So, for instance, in an array (2,2), the (0,0) is element 0 in ignition. (0,1) is element 1, (0,2) is element 2, (1,0) is element 3, and so on and so forth...

Show a screen shot of this. (If each Ignition tag has multiple array elements, then no, you cannot write to the individual elements.)

Hello,
Sorry for the delay. I did some testing and I've found the problem. Apparently you cannot write directly to an element in an array, as suggested in the Ignition manual. So I had to create an Ignition Single DImension Array memory tag, populate that will the data from the PLC, modify the memory tag, and the write the ENTIRE ARRAY to the PLC in order to change the values in the PLC.

This is the script I used to write a DINT[0..1,0..5] array to the PLC:

tagValue = system.tag.readBlocking('[edge]TestMemoryTag')[0].value
value = list(tagValue)
system.tag.writeBlocking('[edge]GlobalVars/AATestArray', [value])

The same code worked for both 1 dimensional arrays in the PLC and 2 dimensional arrays. 3 Dimensional arrays aren't even recognized by the OPC-UA driver, so I couldn't even test that.

Thank you!