We have an OPC-UA server with about 100 tags (NodeID) and are planning to use LabVIEW as a supervisory program.
I created a OPC-UA client subscription and a event structure according to NI OPC-UA example:
But now I don't know how to associate the data change event with the right indicator.
Let me give you an example:
Let's suppose that our OPC-UA server have four variables:
With the "Create Subscription.vi" we can have an <OPC UA Data change event> that will update the values.
The output of the change event is a cluster with "Item URL" and "Value" (data type = variant)
I want to associate each one of these variables with indicators, that will have info, measurements, messages and decisions for the user of the supervisory program (remember that we are have 100+ nodeIDs).
But I don't know how to associate the event output ("Data change") with the corresponding variable, because the variables change its value in different times. For example: the 1st iteration change the value for the 2nd variable, the 2nd iteration change the value for the 4th variable, the 3rd iteration change the value for the 2nd variable again and etc.
The OPC-UA Client Example from NI have only one NodeID, so it isn't clear to me how do I do the "data distribution" to my indicators
The image below is my current OPC-DAQ
Solved! Go to Solution.
You could do it with a simple case structure as suggested by Artem.SPb, with a case for each variable:
Or you could use a more generic way, so you just have to created the control with the right name, and the value is automatically updated without additional code. Here it detects the name of the control to update by taking the end of the Item URL, for example you just need to name your controls Variable1, Variable2, Variable3, ... to automatically update from OPC variables "ServerInterfaces.OPC.Variable1", "ServerInterfaces.OPC.Variable2", "ServerInterfaces.OPC.Variable3", ...
For the 2nd solution, you can also use "Set Control Values by Index", which is more effective in case you have lots of controls and need a high refresh rate. However it requires to know the index of the controls in the front panel.
I have to question the sanity of designing a UI with 100s of controls/indicators. Yes, your system may actually have that many items but from a UI perspective, more than a handful of items displayed at any one point in time is very difficult for a user to comprehend. Surely the UI design can be broken down to display fewer related items at one time. You may have groups of related items which are displayed as well as apply to different groups of node IDs. The user makes some sort of selection of what to display. Behind the scenes youyr application could have a data repository which has the latest values for all your nodes and get updated via the URL. You could think or maps or sets for storing the data. Based on a user selection you would display the desired elements on the UI in a concise display.