LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

data socket slower than shared variable nodes?

I had a Sub VI running very clean and quick while reading around 40 shared variables.  Recently I switched to DataSocket Reads, and now my Sub VI takes around 10-15 seconds to open and close programmatically.  It used to be almost instantaneous.  What's my problem?
0 Kudos
Message 1 of 9
(3,280 Views)

Hi,

 

I saw no one had posted, so hopefully this will help start some activity. Please see the KnowledgeBase article "Why Are My LabVIEW DataSocket Connections Updating So Slowly?"

Regards,
Claire Reid
National Instruments
0 Kudos
Message 2 of 9
(3,249 Views)
Thank you for the reply.  But while that KB article was good to know, and I was not wiring the terminal to a false constant, it did not help me.  My previous setup was Shared Variable Nodes wired to indicators, but I needed to be able to "point" to different URLs so I changed my VI to a case structure with two cases, one for each library that contains my shared variables.  Then out of the case structure to a data socket read to an indicator.  I was just wondering if Data Socket is slower, it is definitely running 100 times slower.
0 Kudos
Message 3 of 9
(3,243 Views)

Here is how I am communicating with my OPC tags.  The Menu Ring on the left is for whoever is using the VI to be able to select 1 of 2 identical machines with hundreds of data points.  The Ring is fed to a case structure with a shared variable constant.  Each case contains the same list of constants with the exception of the library name is either 1 or 2.  Those values are fed to Data Socket Read VIs and then converted into usable data which is then displayed on my indicators.  Some questions: Will that data be read every iteration of the while loop or only the first?  Is there a faster way to read from these Shared Variables?  This VI is just one of many, which are all called dynamically from a "Main" VI.  I need some help here.  Before I made the leap from Static Shared Variables to this dynamic Data Socket stuff, sub VIs were nearly instantaneous.  I must be doing something wrong, but what?

 

0 Kudos
Message 4 of 9
(3,232 Views)
I believe the data will only be read the first iteration. Have you tried taking the indicator out of thewhile loop?
Regards,
Claire Reid
National Instruments
0 Kudos
Message 5 of 9
(3,215 Views)
Ok, I figured out that I needed to wire up the timeouts, as they default to 10 seconds.  So things are running back to normal now, except I haven't tested whether they will read every iteration or just the first.  I will report back when I find more.
0 Kudos
Message 6 of 9
(3,213 Views)
sounds good! keep me posted.
Regards,
Claire Reid
National Instruments
0 Kudos
Message 7 of 9
(3,211 Views)
Good news!  I have my URLs outside the main while loop, and it doesn't matter.  Once the URL is fed to the data socket, it continues to retrieve the data from that URL.  My program is working cleanly now and I have learned a lot along the way.
0 Kudos
Message 8 of 9
(3,163 Views)
That is great news! thanks for updating the post.
Regards,
Claire Reid
National Instruments
0 Kudos
Message 9 of 9
(3,141 Views)