I have setup connection with several modbus devices in my gateway. I monitor two modbus addresses from each device. I need to create a Data array of integers where I input the values of the modbus registers into the boolean bits of the integers. Each integer in the array represents a modbus device and I would like to input the values of the two registers in bit 0 and bit 1. I can easily do this on a PLC but hoping I can get some guidance on how to do this in ignition.
There is no way to create an array via an expression. You would have to configure a gateway timer script to read all of the different device registers and assemble them into Ints, and assemble all those into an array and write it to the expected tag. Something like a 1s rate on this timer event should work for most applications.
Arrays expect a jarray.array
type to be written to them.
Hmmm. I should add toArray()
to my toolkit.
Please do, I tried to use asList()
once hoping it would coerce, but no dice.
Tricky across primitives and generics at the same time, no? Although I'm not well versed enough in the tag system layer to know whether it'll coerce a boxed array as you'd expect it to.
I would have it take two arguments, a type as is used for dataset column types, and the list to convert to an array of that type. The error when I tested with asList()
suggests it is expecting boxed Integer
, not int
.