Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Best method for reading dynamically created OPC data

Hi

I am currently using Measurement Studio 7.0 Eval to connect to an OPC server, which has anywhere from 100 up to 8000 tags I need to read (update rate is not critical, up to 5s ok, and some tags don't change or rarely change after initial connection). However, I initially read two tags that I use to discover the names of the tags I will be using. There are also a number of tags that always have a fixed name which I can read fine.

However, after binding the tags of the dynamically created bindings, my pc takes enormous strain. I've tried increasing the update interval above 1 second but it doesn't make a difference. I suspect this problem is related to how I'm obtaining my data or the calls I'm using. I create the dynamic bindings in a loop as follows:

                ....
                ((System.ComponentModel.ISupportInitialize)(this.CSMDataSocketSource)).BeginInit();
           
                for (i=0; i < tMax; i++)
                {
                    if (status[i] == '1')
                    {
                        System.Windows.Forms.TabPage newDevicePage = new TabPage();
                        newDevicePage = BuildDeviceTabPane(i);
                        newDevicePage.Text = "Device "+i;
                        this.deviceTabControl.Controls.Add(newDevicePage);
                        devices.Add(new System.Windows.Forms.TreeNode("Device "+i));
                        deviceCount++;
                    }   
                }

                ((System.ComponentModel.ISupportInitialize)(this.CSMDataSocketSource)).EndInit();
                ....


Currently, I have a bunch of forms containing items such as labels etc, with each element being bound, via a dataSocketSource, to a unique OPC url. Is there a way of doing a group read of this data via some kind of object instead of having to bind and url-specify each element. I currently do this binding as below, for example:

                NationalInstruments.Net.DataSocketBinding networkRunning = new NationalInstruments.Net.DataSocketBinding();
                networkRunning.Name = "networkRunning";
                networkRunning.Url = serverURL+"network_Running"+"?UpdateRate="+OPC_UPDATE_RATE;;
                this.CSMDataSocketSource.Bindings.Add(networkRunning);
                this.networkRunningLED.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.CSMDataSocketSource, "networkRunning"));

I've also looked at using the DataSocket but don't see that as being very useful if I have to specify a dataSocket, and resulting update event handler per tag I want to read. There must be a better way of doing this which has not yet occured to me.

Any ideas/feedback is most appreciated!
0 Kudos
Message 1 of 2
(3,040 Views)
Please see the following example program on how to talk to an OPC server. This program is in Visual Basic.
http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3EB1156A4E034080020E74861&p_node=DZ52133&p_source=External
Also, I wasnt able to figure out whether you are using .NET or Visual Studio 6.0.
Thank you

Nandini NI
0 Kudos
Message 2 of 2
(3,020 Views)