I'm trying to make templates for a Faults Page. Here is an example of one fault in Ignition:
The faults start off as this:
And have to be extracted using getBit, like so: getBit({[default]_AR_Merchandising_/Program:Saw_1/HMI_ACC_1/Accumulator_Faults/Accumulator_Faults_0_}, 0)
The multilight indicator uses getBit to determine if a fault has occurred, and the labels are strongly typed. Is there a way to use getBit in a UDT so I can use templates instead of copying/pasting hundreds of potential faults?
I looked at the Templates videos and there was nothing about getBit in there. Any suggestions or tips greatly appreciated.
UDTs can contain expression tags, which can use getBit() on other members of the UDT. Just use the {[.]someMember} tag syntax to reference peer members of the UDT (same folder level), or variations thereof.
I am very new to Ignition. Would I drag and drop the entire Accumulator Faults folder... or would I drag and drop each Falt Tag? I've tried with the entire folder and set up these parameters:
No Parameters for the bits. An OPC tag to bring in the integer. An expression tag adjacent to it for each bit you wish to extract. So your UDT would have 33 tags to extract all of the bits of a 32-bit integer.
Side note: Your PLC appears to be Allen-Bradley Logix (or possibly Omron NJ/NX). Direct bit access without using getBit() is supported on such processors simply by editing the item path to include a dot and the bit number. Then you don't need a tag for the integer as a whole. Drivers are smart enough to read the integer to get the bits efficiently. You can also write to individual bits when they are addressed at the driver level.
If you do this in a UDT, you should make a parameter to hold the OPC item path for the integer, then the OPC item paths for the bits would look like {someParameter}.0 and {someParameter}.1 ...
Yes, looks good. Consider using a more unique parameter name than Path. Simple names like that cause trouble when nesting UDTs inside each other, and there's a parameter name in common.
I like to include the UDT's type name in its parameter names so they are sure to be unique. For an example, you might try the JSON that my souped-up new Logix driver produces:
Hi! I have a quick question. The second approach you showed me with making the bits from OPC tags, I really like that approach but I'm unsure on how to make this work for a template since there will be more than one Accumulator eventually. I was curious as if it was possible before I begin digging into a solution.