# Read Siemens word into boolean array

**URL:** <https://forum.inductiveautomation.com/t/read-siemens-word-into-boolean-array/52963>\
**Category:** Ignition\
**Created:** [November 11, 2021, 2:43pm UTC](https://forum.inductiveautomation.com/t/read-siemens-word-into-boolean-array/52963 "2021-11-11T14:43:52Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![erik.forsgren](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/erik.forsgren/32/14156_2.png) [@erik.forsgren](https://forum.inductiveautomation.com/u/erik.forsgren)\
**Post date:** [November 11, 2021, 2:43pm UTC](https://forum.inductiveautomation.com/t/read-siemens-word-into-boolean-array/52963/1 "2021-11-11T14:43:52Z")

</div>

Hi,  
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?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/e/0ea8eb708a68dd16eee11b2628e6419afb1088c0.png)

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?

/Erik

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 11, 2021, 2:54pm UTC](https://forum.inductiveautomation.com/t/read-siemens-word-into-boolean-array/52963/2 "2021-11-11T14:54:04Z")

</div>

> [@erik.forsgren](#):
>
> [HD200\_TAKEUP]DB3201,W5136.0

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 `[HD200_TAKEUP]DB3201,W5136`

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 11, 2021, 2:56pm UTC](https://forum.inductiveautomation.com/t/read-siemens-word-into-boolean-array/52963/3 "2021-11-11T14:56:32Z")

</div>

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 `[HD200_TAKEUP]DB3201,X5136.0` through `.7` and then `[HD200_TAKEUP]DB3201,X5137.0` through `.7`.

---

<div class="post-metadata">

**Author:** ![erik.forsgren](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/erik.forsgren/32/14156_2.png) [@erik.forsgren](https://forum.inductiveautomation.com/u/erik.forsgren)\
**Post date:** [November 11, 2021, 2:59pm UTC](https://forum.inductiveautomation.com/t/read-siemens-word-into-boolean-array/52963/4 "2021-11-11T14:59:22Z")

</div>

Thanks, I removed the .0 from the address. And get the same result as before.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/5/7523dba6182f727352a439499280fea801601a55.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 11, 2021, 4:27pm UTC](https://forum.inductiveautomation.com/t/read-siemens-word-into-boolean-array/52963/5 "2021-11-11T16:27:38Z")

</div>

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: `[HD200_TAKEUP]DB3201,I5136`

Or just ignore the last 16 bools.

---

<div class="post-metadata">

**Author:** ![erik.forsgren](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/erik.forsgren/32/14156_2.png) [@erik.forsgren](https://forum.inductiveautomation.com/u/erik.forsgren)\
**Post date:** [November 12, 2021, 6:25am UTC](https://forum.inductiveautomation.com/t/read-siemens-word-into-boolean-array/52963/6 "2021-11-12T06:25:34Z")

</div>

Aha, ok, thanks for the explanation 😃

---

<div class="post-metadata">

**Author:** ![SKA](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ska/32/29528_2.png) [@SKA](https://forum.inductiveautomation.com/u/SKA)\
**Post date:** [November 12, 2021, 6:50am UTC](https://forum.inductiveautomation.com/t/read-siemens-word-into-boolean-array/52963/7 "2021-11-12T06:50:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![louagejasper](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/louagejasper/32/86311_2.png) [@louagejasper](https://forum.inductiveautomation.com/u/louagejasper)\
**Post date:** [February 16, 2022, 4:07pm UTC](https://forum.inductiveautomation.com/t/read-siemens-word-into-boolean-array/52963/8 "2022-02-16T16:07:05Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 16, 2022, 4:10pm UTC](https://forum.inductiveautomation.com/t/read-siemens-word-into-boolean-array/52963/9 "2022-02-16T16:10:19Z")

</div>

You only have 2 options:

1. 1000 separate Boolean tags
2. 125 tags addressed as a Word in the Siemens driver syntax, but use Boolean Array for the Ignition tag type. Ignition tags have limited special handling for this case. I think it will be read only, and you’ll have to look closer at your options for configuring alarms on a Boolean Array tag.

---

<div class="post-metadata">

**Author:** ![louagejasper](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/louagejasper/32/86311_2.png) [@louagejasper](https://forum.inductiveautomation.com/u/louagejasper)\
**Post date:** [February 17, 2022, 7:44am UTC](https://forum.inductiveautomation.com/t/read-siemens-word-into-boolean-array/52963/10 "2022-02-17T07:44:10Z")

</div>

Thanks for the input.

---

<div class="post-metadata">

**Author:** ![louagejasper](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/louagejasper/32/86311_2.png) [@louagejasper](https://forum.inductiveautomation.com/u/louagejasper)\
**Post date:** [February 18, 2022, 9:05am UTC](https://forum.inductiveautomation.com/t/read-siemens-word-into-boolean-array/52963/11 "2022-02-18T09:05:24Z")

</div>

Kevin,

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.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 18, 2022, 1:54pm UTC](https://forum.inductiveautomation.com/t/read-siemens-word-into-boolean-array/52963/12 "2022-02-18T13:54:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![louagejasper](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/louagejasper/32/86311_2.png) [@louagejasper](https://forum.inductiveautomation.com/u/louagejasper)\
**Post date:** [February 18, 2022, 2:06pm UTC](https://forum.inductiveautomation.com/t/read-siemens-word-into-boolean-array/52963/13 "2022-02-18T14:06:41Z")

</div>

Ok great, thanks!
