I try to read a Siemens word where each bit represents an alarm into a boolean array.
I set the OPC Item path to [HD200_TAKEUP]DB3201,W5136.0 and expect to get an array with 16 elements. But instead I get 32?
I tried to read a byte instead using [HD200_TAKEUP]DB3201,B5136.0, then I got 16 elements in the array.
What am I missing here?
Why do I get the double size than what I expect in the array?
This syntax is incorrect. You’re asking for bit 0 of that word, then letting Ignition turn that bool into an int, then casting that int into a bool array.
The word is just
That said, I think you’re better off creating 16 separate tags, because I’m not sure Ignition’s array tag will let you alarm per element…
Syntax would be
.7 and then
Thanks, I removed the .0 from the address. And get the same result as before.
A Siemens Word is unsigned. Ignition’s tag system doesn’t have unsigned values, so it’s delivered to the tag system as a value the next size up - a signed integer. You’re then telling Ignition to treat it as a bool array.
Try addressing it as Signed Int instead:
Or just ignore the last 16 bools.
Aha, ok, thanks for the explanation
That would cost your 7 power tags license cost, tags gets expensive in siemens very fast, and tossing 7 uneccecary bools instead of a DWord is just like burning money in your bbq.
Hi @Kevin.Herron ,
Would that be the recommended way to read alarms?
What if you have over 1000 alarms, all stored in 125 following words in the PLC?
Would making 1000 seperate tags with 1 alarm be a good practise?
Which one of the two options would you prefer?
Option 1 would be my preferred solution, but we are wondering if this is less performant for the OPC polling, or is this the same load for the OPC server?
btw, it is not Siemens at our side, but KepWare.
If it’s Kepware you may have a 3rd option of actually reading a Boolean Array, I think their driver supports it.
Either way… #2 would be less load on the OPC Server, but I think the difference does not matter. I’d imagine all 3 place the same polling load on the PLC but I can’t tell you for sure because you’re using Kepware.