Reading string values from 3rd Party OPC

Hi,

We are trying to read a STRING into Ignition. We are using a Unity PLC connected to OFS.
Currently it is reading an array of ASCII characters instead of the proper string.
If we add ;C to the tagpath in the OPC client, than we can correctly read the string value. But doing the same in the Ignition tag definition just results in a config error.

Does anyone know what Ignition might need in the tag definition to force reading a String instead of an array of chars?

Regards

Richard

1 Like

What have you set the data type of the tag to?

Tried a combination of things. But STRING is what we are using, and trying to get working. Because thats what we are after.
The tag in the PLC is a STRING type too.

I’m not even up to noob status on OFS, but a browse through the manual points at using ;S for a string.

So, and you might have to correct me here, would a valid address then be something like 400001:10;S to get the length of a ten word string?

Hi Jordan,
Thanks, yea we tried ;S as well, still get a config error. This is trying to use Tag Name addressing though, not Memory addressing. So its something like “testString” in the PLC, and we’ve tried various configurations in Ignition like “testString;C” “testString;S” etc…

We’ve used a modbus driver to read a String using that method, where 40001 is represented as HRS2:32 in the Ignition OPC Tag Address for a 32 character string. And that works fine.

But we’d like to get Strings working properly with the OFS method, not Modbus if possible.

Hi @richardNZ15, did you ever get this working by doing something clever in OFS? It stumped me so I've worked around it in Ignition.

As of 2024 the OPC UA version of OFS has better string behaviour*, but I'm stuck with plain old OFS on one site.

I have worked around it by creating a function in my Gateway script library:

def arToString(charArr):
return ("".join([str(y) for x,y in enumerate(charArr) if x%3 == 1]).rstrip())

and then a derived tag with:

runScript("Global.arToString",1000, {[default]Module7/MainRecipe/RecipeName})

as the read expression, with {source} as the write expression, where [default]Module7/MainRecipe/RecipeName is the path of the string from OFS.

Hope this helps someone else at some point.

*(at the cost of not supporting bool arrays, and bringing in times as strings, and a few other things)

Can't even remember what project this was for to be honest, so not sure what ended up happening. But thanks for the update, hopefully it helps someone else on their journey!