cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

ThingWorx Navigate is now Windchill Navigate Learn More

Translate the entire conversation x

Siemens 1500 datatype wstring

NB_13466175
2-Explorer

Siemens 1500 datatype wstring

Our Kepware server (v6.16.203.0) is connected with a Siemens PLC 1500 with the Siemens Plus Suite - (KWP-SIEMP0-PRD KWM-SIEMP0-ATT) driver. The PLC has defined a datatype WString of 10 characters long (24 bytes). Which datatype should we define in the Kepware server as the datatype wstring does not exist (only string). When we define the tag as DB1101.STRING0034.24 we receive no error but when reading the value from the plc we get a blank result. If we define as bytearay or hexstring e.g. DB1101.HEXSTRING0034.24 then we get the value of the PLC returned as 000A0000300068000... which seems as the correct hex representation of the PLC value. However it is not clear how to write a value to the wstring. We tried several notations with the Quick client, but always get errors like: Failed on item <tagname> synchronous write.
Changing the PLC program or address types is not an option - we can adjust or IT application (=opclient) but need to know how to write to this datatype wstring

ACCEPTED SOLUTION

Accepted Solutions

Hi @NB_13466175 ,

 

The Siemens WString (wide string) type isn’t natively supported as a direct data type in Kepware’s Siemens Plus Suite driver. Kepware can read or write standard STRING types, but WString uses UTF-16 encoding (2 bytes per character), which makes it appear as a byte or hex array to Kepware.

Here’s how you can handle it:

  1. Reading the WString:

    • Define the tag in Kepware as Byte Array (for example: DB1101.ByteArray0034.24).

    • This will return the raw 24 bytes (UTF-16 encoded). You can then decode them on the client side as UTF-16 text.

  2. Writing to the WString:

    • Kepware can’t write UTF-16 directly through the standard STRING tag.

    • Instead, convert your intended text to UTF-16 bytes and write those as a Byte Array (or HEXSTRING) from your OPC client or script.

    • Example: Writing “HELLO” → 480045004C004C004F00 (UTF-16 LE) to the same address range.

  3. Alternative Option:

    • If you have control over the interface on the receiving side, the simplest path is to create a shadow STRING tag in the PLC and mirror it to the WString using PLC logic (STRING_TO_WSTRING or WSTRING_TO_STRING).

    • This allows Kepware to interact normally with the STRING while the PLC handles conversion internally.

Kepware’s Siemens Plus Suite doesn’t yet expose WString as a standalone data type, so handling it as a byte array and decoding externally is currently the most reliable approach.

 

Thanks,

Shashi Preetham,
+91 8099838001 | shashi@psptechhub.com,
PSPTechHub  ||  World of PTC Thingworx  ||  LinkedIn

View solution in original post

2 REPLIES 2

Hi @NB_13466175 ,

 

The Siemens WString (wide string) type isn’t natively supported as a direct data type in Kepware’s Siemens Plus Suite driver. Kepware can read or write standard STRING types, but WString uses UTF-16 encoding (2 bytes per character), which makes it appear as a byte or hex array to Kepware.

Here’s how you can handle it:

  1. Reading the WString:

    • Define the tag in Kepware as Byte Array (for example: DB1101.ByteArray0034.24).

    • This will return the raw 24 bytes (UTF-16 encoded). You can then decode them on the client side as UTF-16 text.

  2. Writing to the WString:

    • Kepware can’t write UTF-16 directly through the standard STRING tag.

    • Instead, convert your intended text to UTF-16 bytes and write those as a Byte Array (or HEXSTRING) from your OPC client or script.

    • Example: Writing “HELLO” → 480045004C004C004F00 (UTF-16 LE) to the same address range.

  3. Alternative Option:

    • If you have control over the interface on the receiving side, the simplest path is to create a shadow STRING tag in the PLC and mirror it to the WString using PLC logic (STRING_TO_WSTRING or WSTRING_TO_STRING).

    • This allows Kepware to interact normally with the STRING while the PLC handles conversion internally.

Kepware’s Siemens Plus Suite doesn’t yet expose WString as a standalone data type, so handling it as a byte array and decoding externally is currently the most reliable approach.

 

Thanks,

Shashi Preetham,
+91 8099838001 | shashi@psptechhub.com,
PSPTechHub  ||  World of PTC Thingworx  ||  LinkedIn

Hi Shashi,

 

Thanks for the detailed feedback. We will handle the wstring as you suggest

 

cheers Nick

Announcements


Top Tags