Bad_Decoding Error when reading Siemens Array of Date_And_Time from inside a PLC UDT via OPC

I seem to be having an issue reading an object of type "Array[0..1] of Date_And_Time" from a Siemens PLC when it exists inside a Siemens UDT. In Ignition I am using the entire UDT as an OPC tag, and then using derived tags to reference the individual internal tags (which aren't shown below).

I've done some testing and Ignition can happily read an array of Date_And_Time when its on its own, however, when the array exists inside a UDT, it fails with the error:
Bad("Bad_DecodingError: Decoding halted because of invalid data in the stream.")

Other array types work fine when inside a UDT, it just seems to be when its of type Date_And_Time.
I am using a Siemens 1500 PLC and connecting to the OPC Server on the PLC

I just left a note on your support ticket so I suspect you'll be hearing from them soon, but the problem here is:

  • Siemens OPC UA server models Date_And_Time as an unsigned byte array. It's not the type they want you to use when accessing over OPC UA.
  • The legacy datatype dictionary mechanism does not support defining structures with multi-dimensional array members.
  • When you define a "Date_And_Time array" what you've really ended up defining at the OPC UA structure definition is a 2-dimensional unsigned byte array.
  • This causes the structure to be omitted from the datatype dictionary and unreadable by Ignition.

You should be using the LDT datatype for datetime values that you will access over OPC UA.

1 Like