11-05-2010 09:12 AM - edited 11-05-2010 09:13 AM
I have a simple VI:
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:
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?
11-05-2010 02:23 PM
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.
11-08-2010 09:36 AM
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.
11-08-2010 10:23 AM
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.
11-08-2010 10:29 AM
Are you really creating a new VI reference every time you send a single point to the chart???