I’m very new to ignition so I might be doing stuff incorrectly.
I have tried using this: OPC UA struct data type? - #2 by Kevin.Herron and following what people say in the thread but I am unable to get it working correctly.
I have a PLC connected with OPC to my PC and I have verified that data does communicate.
I was not able to find any specific documentation on how the Source tag should be set up but from my understanding I am supposed to just browse for the root UDT tag in the OPC browser as the it should have a JSON structure saved of some sorts but I don’t know if this is correct or not. Whenever I do this I get an error stating “Error_Configuration”
I have gotten the derived tags to work with jsonGet etc. by changing the source tag to memory and manually defining a structure just for tests etc.
If I pull up a tag within the UDT structure via the OPC browser I get real data from the PLC so the connection should be working.
Am I going about this completely wrong? Is there something I’m missing out on?
First of all Happy new year and welcome to the forum.
You need to be sure that every info inside the udt you read/write in ignition is set to accessible and writable in TIA portal
here you can fine a example that i use (Just import the json file in the UDT Definitions of your gateway)
SiemensUDT.json (3.2 KB)
You can find some example of this method in my Siemens Open Library on the exchange platform:
Thanks for the Reply.
I checked out the Json file and tried copying the structure on my UDT but am not able to get it working and I’m not 100% sure why. Readable and Writable was already enabled in the PLC and I have verified that I can read and write to and from the PLC from Ignition while working on 1 tag at a time outside of the UDT.
However I still get “Error_Configuration” on the Source tag whenever I create an Instance. I have an idea of what the issue is but I don’t know how to fix it. Whenever I browse for a tag in the OPC it works but the “OPC Item Path” also ends with i=number depending on which tag I select.
I tried browsing for a tag and replacing the i=number with s= db name . tagname and then I got Error_Configuration on the tag. Is there something I need to setup to be able to adress the source by specifying a path instead of an index? Would it be possible for you to show a screenshot of how your Server Instance is set up in TIA portal?
Can you share some print screen of your udt ?
Here is the structure of the derived Tag which is the same as on that other Forum page
The Error message I’m getting
properties on the instance to get the path
OPC Item Path of the UDT
generated path from the parameters on the instance
The UDT structure and the Source tag
You can’t just make up the OPC Item Path for the source, it has to be the same as if you had dragged the source tag directly into the Tag Browser from the OPC Browser.
The reason why I changed the path here was because I saw that Da_Clerck had done it and he is also using a Siemens PLC in TIA portal because I couldnt get the Browsing path to work when I tried that in the UDT
Here is an Image of the Path I get when I browse for the UDT from the OPC Browser
I still get the “Error_Config” error on the I _Source variable on the Instance. now that I’m using the OPC browser path I am not using any parameters so the source in the Instance is currently hard coded like this as a test.
I think I am doing something wrong but I am not entirely sure what I am doing wrong.
i forgot to mention that i use the PLC on board OPC UA Server
and this is the structure to read a tag in a db
where DB Name is the name gived to the DB in tia and device Name is the name gived to the udt inside the db.
Then the OPC Server of your tag should point to the OPC UA server defined on the gateway
Does it work if you bring that same tag in outside the UDT?
Have you made sure “backwards compatible DataType definitions” option is enabled? https://support.industry.siemens.com/cs/document/109765509/how-do-you-best-configure-an-opc-ua-client-to-communicate-efficiently-with-the-opc-ua-server-of-a-simatic-s7-1500-cpu-and-with-the-best-performance-possible-?dti=0&lc=en-WW
Is this an S7-1500 or S7-1200? All the other posts are 1500, so the NodeIds may be different in the 1200.
If I bring one of the variables that lie within the UDT into the tag explorer I get data and I’m able to write to it, but if I browse the the OPC server and import the UDT it self directly into the tag browser as a “document” tag I get the same error message as with the UDT Instance.
I am using a 1200 PLC atm. but I could switch over to a 1500 via PLCSIM advanced as PLCSIM advanced should be able to communicate OPC to 3rd party devices.
I have not checked out the “Backwards compatible DataType definitions” option, I will do this when I get in the office tomorrow morning.
This is required with the 1500, and if it exists in the 1200 it will be required there as well. I think newer firmware versions default to having this disabled now.
I wasn’t able to find the Backwards Compatible DataType definition on the 1200 PLC so I decided to try out a simulated 1500 PLC instead to have the same basis as the other examples.
I enabled the option on 1500 the PLC and downloaded to PLCsim and have verified that I am able to read and write to specific tags browsed through the OPC browser but if I browse an UDT tag still get an error but the error has changed.
Now I get the error “Bad” instead of “Error_Configuration” on the UDT tag and the quality says:
“Bad(“Bad_DecodingError: Decoding halted because of invalid data in the stream.”)”
I am not entirely sure what could be causing this.
Reading and Writing to specific tags within the UDT on the PLC works.
If there are any hidden members in the UDT, such as part of TON datatypes, you cannot read it.
Try only reading a struct with 2 simple atomic members into a document tag first.
The UDT I’m using at the moment is just 2 boolean values with nothing more to keep it as simple as possible
This thread shows the structure and results of how we use it:
Siemens S7-1500 OPC UA Struct with TON Member - Ignition - Inductive Automation Forum
Never had issues reading a struct, but have never tried reading the whole UDT either (some forbidden members)
For a test now I tried creating a simple struct with two bool values inside of it but I end up with the same result. I can read/write to the tags within the struct but importing the struct it self results in an error.
Are you using the onboard opc ?
can you send us your tia test program maybe we can then verify is something is wrong.
I doubt about is if you can read the udt as document tag
I managed to solve the Issue now.
Your message made me look through the OPC setup of the PLC once more where I saw a check box called “SIMATIC namespace” which doesnt exist in the 1200 PLC.
In the S7-1200 PLC You need to define what tags should be available over OPS through the tab called “OPC UA Communication” where you define a server instance etc. so I had done the same on the S7 1500 because I thought that was the correct way to do it.
Apparently this checkbox makes it so that everything is available as long as the write and read via OPC is checked so the tag was located somewhere else in the PLC structure within the OPC browser.
This also explains why my tags were automatically addressed with an index instead of a source (;i= instead of ;s=)
As I selected the tag via the global namespace via the OPC browser I got the same path structure as you had in your UDT example.
Thanks for the help guys!
Ha that stupid checkbox, i didn't remember of that one.
Typically such things that makes me go crazy on Siemens.
Good that you found it.
To make the Solution concrete in case anyone else comes across this issue:
1200 PLCs have a different OPC structure from 1500 PLCs due to the setup necessary on the PLC side.
On the 1500 PLC the checkbox “Standard server interface (SIMATIC namespace)” has to be enabled.
“Legacy data type definitions” should be enabled on the OPC.
Do not use the “Server Interface” method when communicating datatypes and structures on 1500 PLCs