LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

speeding up execution of invoked vi

I have a simple VI:

 

vi.png

 

I compile it to a DLL, and run it without any problems. I get to open a front panel of the invoked VI and present my results. The block panel for that VI is:

 

vi2.png

 

Very simple stuff. Now for my question:

 

I run a simple for loop in C and send each value to my compiled VI. If I were to remove the "Run VI" invoke node and send the values directly to the chart, the program will run super fast, faster even than printing the values to stdout. But in this case where I send the value to the "Numeric" control and the run the VI, execution becomes comparatively slow. Is there any way of speeding up the execution of the invoked VI?

Lars Melander
Uppsala Database Laboratory, Uppsala University
0 Kudos
Message 1 of 5
(3,099 Views)

I don't really understand what you want to do, but in general calling a VI directly is much faster than calling it via the VI server as your code above does.

0 Kudos
Message 2 of 5
(3,077 Views)

I have a C programme that will output data to a VI. When running, the C programme will open a connection to the VI, which will then present the data to the user.

 

The first block diagram is the VI that I have compiled and included in the programme as a DLL. The second diagram represents a simple VI that receives and presents the data.

 

If I try to statically link the VI, the front panel of the presentation VI won't be opened.

 

I suspect that even if the call is a bit slow, it is still faster than using sockets for the call. I have yet to test that though.

Lars Melander
Uppsala Database Laboratory, Uppsala University
0 Kudos
Message 3 of 5
(3,046 Views)

In general I find LabView to be about 40-50% of the speed of well-written C code, which is plenty fast on today's hardware. The approach above has a lot of overhead associated with the VI Server call, so yes, a socket would probably be faster. The code below will handle at least 50,000 points per second, and it could be made a lot faster.

 

You don't need to use TCP to communicate between processes, but if you want to use a DLL you should use a similar producer-consumer design.

 

I don't have much experience calling LabView as a DLL from C; usually I do it the other way around. If all you want out of LabView is the graph controls, you might find it more straightforward to use LabWindows/CVI, which is designed exactly for that purpose.

0 Kudos
Message 4 of 5
(3,038 Views)

Are you really creating a new VI reference every time you send a single point to the chart???

0 Kudos
Message 5 of 5
(3,033 Views)