08-11-2009 02:34 PM
Hello there -
Is there any way to get a measurement of how long each part of the flat sequence takes to execute? Anything like matlab's "tic" and "toc" commands in labview? I have been playing with it for a while now and have yet to discover if Labview has this functionality. Anyone know of anything like this?
I currently have a VI that controls the realtime acquisition of a CCD camera via Firewire and a USB spectrometer. The VI collects data from each of these devices (triggered by an external source at 10Hz), and dumps them into a Matlab script which does analysis on the CCD image and spectrum. The bulk of the VI sits inside a while loop, which continues to run until the user presses the stop button. Inside this main loop is a flat-sequence. The sequence goes: ACQUIRE DATA ---> PROCESSING DATA ----> MATLAB SCRIPT ----> PLOTTING GRAPHS -----> OUTPUT DATA TO FILE.
The problem here is that the VI runs at 5Hz, while we are triggering it at 10Hz. Originally, it was my thought thought that the matlab algorithm was to blame, but I used the matlab commands "tic" and "toc" to determine that the matlab algorithm runs in 15-20ms. I did this by putting a "tic" command at the top of the matlab algorithm and a "toc" command at the bottom. The problem, as I have now discovered is that the rest of the labview code takes ~180ms to execute. (This was discovered by putting the "tic" at the bottom of the program, and the "toc" at the top of the program, thereby measuring the execution time of everything except the matlab algorithm). Each time a trigger signal from the external source comes in, it starts the flat-sequence structure (which takes ~190ms), and then waits for another trigger signal, always missing every second signal. My eventual goal is to reduce the bloat, and get the algorithm down to less than 100ms, so that I can run the VI and acquire data at 10Hz rather than 5Hz. If anyone can offer some help with this, it would be much appreciated!
Eric
P.S. - I have attached a copy of the VI that I am working on, but unfortunately, it most likely will not run on your computer....the VI will not run unless it is connected to a triggered spectrometer and CCD camera....but I have attached it anyways incase anyone who can help might want to take a look.
08-11-2009 05:13 PM
can we divide the program into 2 parts and use background process for acquisition and front end process for analysis?
I mean, create 2 VIs from the present VI and then launch the acquisition program dynamically as a background process and fire events in Main VI from acquisition VI and process it. not sure how much it is going to reduce. lets give a try....