06-10-2011 05:40 PM
Hi All,
I am attempting to create a VI that will average data over a user defined amount of time (via boolean switch). The attached vi collects data once the "collect Data" switch has been triggered, when the test is over the user triggers the "average collected data" switch to get an averaged value. Please see attached VI.
THis vi works fine for a single signal. However, the ultimate goal is to be able to do this whole process for n-number of sensors throughout my test loop with a final output as an excel file.
I am pretty sure that I can get the data saved for an excel file but I cant figure out how to get all of the signals averaged seperately and placed into an array.
Any help will be much appreciated!
Thanks,
Stefan
06-11-2011 08:03 AM
Stefan,
When you are doing the multiple signal process, will the collection time and averaging be done for all signals simultaneously or will there be separate Collect and Average controls for each channel?
If all channels will be done simultaneously, you can probably just make your arrays 2D with each channel in a different column. Each iteration of the loop will store the data in the next row (if Collect is True).
Notes on your VI: 1. You do not need the sequence structure. Dataflow controls when things happen. Your VI will work the same without it.
2. The two case structures wired to Collect Data could be combined into one.
3. Building an array inside a loop results in frequent memory reallocations. As the array gets large this will cause the program to slow down and will fragment memory. A better approach is to allocate memory outside the loop with Initialize Array and use Replace Array Subset inside the loop where the Build Array primitives are now. You will need to add another shift register to keep track of the next index to replace.
4. Loops should usually have a time delay to prevent them from grabbing all the available CPU cycles. Once you put in a real data acquisition process, that may provide the delay.
Lynn
06-13-2011 12:54 PM
Lynn,
Thanks for your time and tips. I got everything working and integrated as a subvi.
Thanks!
Stefan