I have a project where we are using Ignition 8.1.45.
I have about 100 Siemens PLCs that I am reading data from on an Edge device via OPC UA, which pushes the data to my server via MQTT.
I am supposed to map boolean data from nested structs in the Siemens PLC via an UDT, as I have understood is a common way of dealing with the Siemens OPC UA data. The issue is that in the PLC, all data structs which I am reading consists of both period (.) and slashes (/) (yes, I agree this is stupid to do). I have no way, what so ever, of changing the naming in the PLCs.
I have been in contact with my local dealer and they assume I can do some more tricks with the UDT and use a python script to replace all the special characters, but I have not been able to get anywhere with this. Can someone please help me or point me in the right direction?
I have tried inserting python scripts on tag event change where i use the replace() method, but still without any luck. This is starting to get time-critical as I have used weeks on this now...
I have tried to use the jsonGet to extract the individual values into separate tags. In general, I can do that successfully. The issue is that the individual values are nested in sturcts in the Siemens PLC, where the top struct have special characters in the name. As can be seen in the image, I am trying to extract a value within a struct that is called "AC.08.2.01/AHU". As periods are used to navigate further down the structs (or key/value pairs of you want), I am not able to correctly navigate as the periods in the struct name are interpreted as going one level deeper.
I was therefore hoping that it could be possible to import the json as a document tag, do some python-magic and end up with a struct name without special characters. I can quite easily solve this in python with the repalce(".", "") function, but I am not sure how to implement this in Ignition. What kind of setup should I have to make such an UDT, which kind of tags to do the replace() function etc.
I was hoping that some of you guys with more experience with Ignition had some good advices!
In this image you can see where the problems starts:
Ah, this was exactly what I was looking for. Thank you both for quick replies!
I needed to alter the code a little bit, it seems like Ignition would not let me use the brackets only for parts of it. For anyone who might wonder, it ended up like this: