03-14-2007 08:54 AM
Two Timed Loops: One loop is deterministic and contains the DAQmx read portion of the program. I will have two different DAQmx tasks, one for the 6132 high speed task and one for the slower speed 6259 task. The other loop is non-deterministic. It contains the code for data analysis and data storage. With these things in mind, are my target adquisition rates possible to achieve? Furthermore, what should my loop timings and buffer sizes be? Should the non-deterministic loop run at the same speed, or faster? I am timing the loop such that the ADQ will fill the entire buffer during the loop cycle. I assume this is proper.Screenshot of the guts of the program (using shared variables) is attached. Thanks!
Data Buffers Between Loops: As far as I can tell I have two options for buffering the data between the loops. 1) Use RT FIFOs for each channel (1D arrays). I can't seem to get an RT FIFO to pass a 2D array properly (3 channels x length of ADQ buffer). If there is code that shows how to do this, let me know. Total of 9 RT FIFOs. 2) Use shared variables to pass the data. This uses less space on my block diagram, but I'm not sure it's better. Furthermore, I have to change the size of the FIFO manually in the Project Explorer, which is kind of a pain. Also, I've read that shared variables are somewhat slower than RT FIFOs when passing large arrays. Finally, there is no way to pass 2D arrays using shared variables as far as I can tell (correct me if I'm wrong). What is the best method for speed and without losing any data? Any recommendations on FIFO buffer sizes? I was using the same size buffer for ACQ as FIFO (something like 10,000).
Writing to Disk: I would like to write the files in text format as a tab delimitted spreadsheet so they are easy to handle for post-processing (MATLAB). I know that binary files are faster and can be opened in MATLAB, but I prefre text files. I'm writing them in blocks as they come in from the buffer. Any tips on this portion are appreciated.
03-14-2007 09:01 AM
03-14-2007 10:18 AM
03-14-2007 10:20 AM
03-16-2007 07:07 AM
03-20-2007 05:13 AM
Hi there!
Brief notes:
As far as I know, RT FIFO`s performance is better than shared variables’.
If you do not need to perform the analysis and data storage in a deterministic way, I think the non-deterministic part should have a larger period, even you could use a plain while loop (which leads to a lower overhead than timed loops) and use to time it Wait until next millisecond with a larger time (depending on what you want). Is it possible for you to use a VI architecture based on state machine template; maybe you already know it: it means using a state machine as normal priority vi and calling from one of this states ("running" state) the time critical loop. Maybe is too simple for your requirements? I'm not experience in http server.
Is it possible for you to write the files in binary format in the real time target and convert them to .mat files or to spreadsheet by means of a postprocessing VI?
Hope something provides you an idea!
03-22-2007 07:44 AM
03-22-2007 11:26 AM
Hi,
You can find the information about binary, ascii and so on in http://zone.ni.com/devzone/cda/tut/p/id/3746.
I’ve had a look at LabView 8.0 examples and I think that you could fit the project example Command Based Architecture.lvproj. This is not based on state machine but I think it can be as well a good option for your needs (state machine is one of the design patterns provided in LabView but are less developed than Command Based Architecture.lvproj). The RT VI of this example uses three loops: one for sending data to the host, one for receiving data from the host and one timed loop for the deterministic operations.
Hope it helps!