LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Executable Slower than VI

I've created a VI to grab data from two spectrum analysers simultaneously over a LAN connection using VISA read/write functions and a simple state machine. I've attempted to grab the data at <1s intervals. When tested in the development environment (LabVIEW 2011) the data grabs work as expected. However, when I build the executable and run it on the same machine, it runs ~50% slower. When I move back to the development environment the VI then runs as slow as the executable and only a restart of the instrument allows the Vi version to run as expected - the executable never runs as fast as the VI regardless of instrument restarts, LabVIEW restarts. PC restarts etc. I've also run the executable on a second PC with the LabVIEW runtime engine and the slower behaviour is the same.  

 

I've tried flushing and clearing VISA buffers when Exiting the state machine and this has had no effect. 

 

Does this behaviour seem normal for a built executable? 

 

The main acquisition loop has two measurement sub VIs running in parallel to grab data from the instruments. I've attached the VI (the most I can attach) - this VI runs in parallel with itself in the main run state of the loop but with different TCP/IP VISA resources at the input. 

 

VISA_Grab_Snippet.png

 

The OPC Query is a piece of legacy code that I cannot change and the implementation is very redundant. 

 

At the end of each grab I write the strings to a spreadsheet using the Write to Spreadhseet File VI but I've also disabled this part and the bahviour didn't change.

 

0 Kudos
Message 1 of 9
(1,457 Views)

To attach an entire folder of VIs (hundreds), right-click the folder, choose Send To, Compressed File, and attach the resulting (single) .ZIP file.

 

Bob Schor

0 Kudos
Message 2 of 9
(1,422 Views)

It's the most I'm allowed to attach.. can't share anything else due to NDA etc. 

 

The slow behaviour occurs when running the state which contains the code I've attached. 

0 Kudos
Message 3 of 9
(1,420 Views)

Since you are communicating over LAN, it could be a firewall permission issue.  LabVIEW, as an IDE likely got permissions your executable did not.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 4 of 9
(1,401 Views)

I tried turning of the virus protection and it made no difference. 

 

I also tried renaming the executable as LabVIEW.exe to see if it bypassed any permission issues. Neither made any difference. 

0 Kudos
Message 5 of 9
(1,398 Views)

Virus protection is not the same thing as a firewall.

0 Kudos
Message 6 of 9
(1,389 Views)

I had the firewall turned off as well as the standard AVG virus protection. 

0 Kudos
Message 7 of 9
(1,361 Views)

How are you measuring the speed and what determines the speed? Is there any kind of pacing or does the code simply run unchecked as fast as the hardware allows?

Is the network communication part of the driver or your own code?


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 8 of 9
(1,353 Views)

The main 'Run' case of the state machine is in the timeout case of an event structure - I've been changing the value of the timeout to see what difference it makes (I plan on using 1000ms). When I run it first in the dev environment after changing the timeout value, the acquisition speed changes. But moving to the executable means the aquisition slows down to about 3-4 seconds. In the run state I'm writing the values I get from the analyser to a table on the front panel with a timestamp (with millisecond resolution) so I can see the difference between each data grab. 

 

For any FOR loops with VISA read/write functions within them I use the Wait Until Next ms Multiple timer to time the loops (rather than letting them free-run) - I've played around with the value of this too but it makes no difference once the exectubale is built.

 

For the network comms I just used the standard VISA read/write functions with the VISA resource name set to the IP address of the instrument (e.g. TCPIP0::172.16.118.100::inst0::INSTR, which I grabbed from MAX). 

 

Do built exectuables share the same VISA drivers as the development environment? It seems strange that the dev code runs as expected but then seems to clog up once the executable is run once. 

 

0 Kudos
Message 9 of 9
(1,348 Views)