03-10-2009 04:39 PM
I'm pretty sure your problem is that all the values and then some are being received. I'm not sure how the FIFO create is interpreting the "elements in array" input for a 2-D array - see if it will accept a 2D array of dimensions instead of a scalar - but my guess is that LabVIEW is expanding your array to fit the size of the FIFO array, padding it with elements containing 0. Unlike a queue, in an RT FIFO that contains arrays as elements, every array must be the same size; this is necessary for the queue to run deterministically and avoid reallocating memory for different-sized elements.
testingHotAir wrote:Ok...now I have a FIFO problem. I've attached screenshots of the block diagram and front panel of the test VI I'm working with. The VI just has three timed loops at different priorities and periods, like my real application, and I'm just trying to pass a 4x8 array of doubles from the top loop to the middle loop using the RT FIFO. The front panel showes the results of running the VI; the "appended array" is the indicator on the RT FIFO write "element" terminal and the "element out" array is the result coming out of the FIFO read. Why aren't all the values being written being recieved?
Thanks.
Message Edited by testingHotAir on 03-10-2009 04:13 PM
03-11-2009 08:50 AM
nathand,
What do you mean by and array of dimensions rather than an array of scalars?
03-11-2009 09:40 AM - edited 03-11-2009 09:41 AM
I didn't intend to say array of scalars, I meant an array containing dimensions versus a single scalar. You're passing a single value for the "elements in array" input. You might be able to wire an array to that input instead, specifying the size of your array in each dimension, similar to the way that "Array Size" returns a scalar for a 1D array but returns an array of sizes for a multi-dimensional array.
03-11-2009 09:54 AM
It won't let me wire an array of sizes to the RT FIFO "elements" terminal.
What I'm trying now is rearranging my data collection subVI so that it generates a 1D array of doubles instead of a 2D array. I had the FP Read VI in a for loop and was feeding it an array of channels. The output of the for loop was thus a 2D array of doubles, which is why I was trying to create and RT FIFO for a 2D array. I now have four seperate FR Read VIs, each one reading one channel (array), the outputs of which I'm inserting into an initialized array. This I know I can send over the FIFO, but I'm not sure if it's the best way to poll the FP modules. Haven't tried it yet, but I'll post the results after I do.
03-12-2009 12:41 PM
Ok, the program now works. I discovered a few interesting things in the process.
The FIFO in the VI I posted stops the two lower priority loops when it times out. I had the error in terminal of the FIFO Write VI in the second loop wired to the error out terminal of a VI that generates error codes if it detects an over limit fault on any of the data channels coming in. When the FIFO Write VI recieved an error code, it would output TRUE on the time out terminal and stop the loop.
I am reading data from the FIFO and writing it to a spreadsheet file on the cFP's on board flash memory using the Write Spreadsheet File VI. If I write a file, then go in through the ftp and delete the file (while the VI is idle), then rerun the program with the same file path, the data in the second file will be identical to the data in the first file regardless of what the Write Spreadsheet File VI recieves. For instance, if I write a file called test1.xls that contains 3 rows of data from 3 iterations, then delete it, then rerun the program at let it iterate 20 times, the test1.xls file will still have the same 3 rows of data. Changing the Apend to File? value did not affect this behavior. Changing to a new file name solved this, but I'm not sure why it happened in the first place.