I'm setting up an OPC UA server in CODESYS. My understanding so far:
Calling methods over OPC UA requires an Information Model β the plain Symbol Set / Symbol Configuration alone doesn't support method calls. Is that correct, or is there a way around it?
With an Information Model, the Node IDs are auto-generated and I can't set them manually. Assuming that's right:
-Are these generated Node IDs stable across builds/downloads, or can they change?
-If they can change, what triggers it β renaming a variable/method, reordering objects in the model, a rebuild, a re-download to the PLC?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Your reading matches what I ran into on a similar setup. The plain Symbol Configuration is handy for reading and writing variables, but it doesn't expose a real OPC UA method, so if the client has to use the Method service, you do need an Information Model and a method node mapped to your FB or program method.
On the NodeIds, I wouldn't hard-code them in the client. In my own projects they stayed put when I only rebuilt and downloaded without touching the model, but I treat that as convenient, not guaranteed. Renaming a method or variable, inserting or deleting a node, or reordering things in the model is exactly the kind of change that can shift the generated IDs, so I plan for it to move.
What worked better for me was to have the client browse for the method by its BrowseName under the parent object at connect time, resolve the NodeId then, and only fall back to a cached value if browsing fails. It adds a little startup logic, but it saved me from chasing a stale ID after a small model edit.
One practical note before you try this on a live controller: test the call in simulation first, and keep any safety interlock in the PLC program itself rather than in the OPC client. A method that writes a value or starts a motion should be harmless to call twice, or guarded, before it ever touches real outputs.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm setting up an OPC UA server in CODESYS. My understanding so far:
Calling methods over OPC UA requires an Information Model β the plain Symbol Set / Symbol Configuration alone doesn't support method calls. Is that correct, or is there a way around it?
With an Information Model, the Node IDs are auto-generated and I can't set them manually. Assuming that's right:
-Are these generated Node IDs stable across builds/downloads, or can they change?
-If they can change, what triggers it β renaming a variable/method, reordering objects in the model, a rebuild, a re-download to the PLC?
Your reading matches what I ran into on a similar setup. The plain Symbol Configuration is handy for reading and writing variables, but it doesn't expose a real OPC UA method, so if the client has to use the Method service, you do need an Information Model and a method node mapped to your FB or program method.
On the NodeIds, I wouldn't hard-code them in the client. In my own projects they stayed put when I only rebuilt and downloaded without touching the model, but I treat that as convenient, not guaranteed. Renaming a method or variable, inserting or deleting a node, or reordering things in the model is exactly the kind of change that can shift the generated IDs, so I plan for it to move.
What worked better for me was to have the client browse for the method by its BrowseName under the parent object at connect time, resolve the NodeId then, and only fall back to a cached value if browsing fails. It adds a little startup logic, but it saved me from chasing a stale ID after a small model edit.
One practical note before you try this on a live controller: test the call in simulation first, and keep any safety interlock in the PLC program itself rather than in the OPC client. A method that writes a value or starts a motion should be harmless to call twice, or guarded, before it ever touches real outputs.