Bulk tag array writes to Allen Bradley Logix systems

Folks, I have a project working whereby I need to write up to 100 part numbers into a ControlLogix array from a database read for HMI consumption. Yep, I know there are simple ways to use arrays in Windows based HMI’s, but this uses Automation Direct CMore panels.

Ignition, like many powerful software tools, probably has multiple ways to do this. What would be your suggested approach?

Thanks for any suggestions!

Well… hopefully others chime in as well with some real world experience, but there’s two obvious answers:

  1. write a script that queries the DB and then does a bulk system.opc.writeValues call. Easy.
  2. use a DB-to-OPC transaction group. Probably easy, but I’m handwaving here because I’m less familiar with it :slight_smile:

Thanks for the reply, Kevin, I was thinking about using a bulk transaction group. My Python skills with Ignition are growing daily but if you could provide an example of your option 1 I’d much appreciate it!

It’s hard to provide an example without knowing more about how the data is stored, but really you’re just stringing together 2 built-in scripting function calls.

Query the data using something like system.db.runNamedQuery.

Massage that data into an array of values that you write using system.opc.writeValues.

Kevin didn’t mention it, but if the data packs together in the PLC, writes to consecutive addresses within a single .writeValues() call will be optimized into a single message. Very efficient.

Thank you, sir. I’ll look at those built ins. I do appreciate the pointers. SQL is more of my strong suite…but Py is getting stronger all the time.

Anyone else have ideas? I’m interested in learning…

Thank you, Phil. This would ideally write to a CLX UDT and transfer part numbers perhaps other query derived info. I thought I saw somewhere that IA’s driver would write the entire UDT array regardless of specific addressing. Is that true?

No. Combination into single/fewer messages is only of consecutive elements as naturally packed.

1 Like