07-31-2013 05:54 PM
Hello,
I've created a .vi that I am trying to use to record multiple channels of data. I've have set it up that the user should be able to record data until the 'STOP' button is pushed, then the data will be saved into a spreadsheet file.
Question 1: How do I allow the user to store an undefined amount of data?
If you run the .vi as is, you will see that you are only able to collect 100 points, and the recording only takes place over a millisecond or so. I would like it to collect +/- 5 minutes worth of data and have a sampling rate of 1kHz. Any suggestions?
Question 2: How do I change the file extension of the spreadsheet? Let's say I would like the file to save as a .csv?
Thanks in advance for any pointers or suggestions!
Solved! Go to Solution.
07-31-2013 06:17 PM
I haven't looked at your code, but based purely on your description I would set up a Producer/Consumer to save your data. You should aquire your data in one loop (the producer) and send it to your logging loop (the consumer) using a queue. Yes, you should save the data while it is being acquired. This way you don't have to worry about storing who knows how much data in RAM. It just goes to the disk whenever it can.
You can save the file with whatever extension you want. If you want it to be a CSV, then make the extension a .csv.
08-01-2013 12:28 PM
I cannot open your VI because I am running LabVIEW 2011. But it seems that you are trying to do something similar to what was discussed in this thread.
Jeff
08-01-2013 12:43 PM
08-19-2013 05:35 PM
I did some research on the producer/consumer loop method and had some sucees! I'll attatch my vi for others to use a point of reference! Thanks again for all the suggestions.
11-15-2013 11:23 AM
Hi Kashi,
I'm new to LV and also trying to record data using a while loop and your vi sounds like it would be very helpful. I'm running LV 2011 and when I tried to look at your vi I got an error that I can't open version 12 files. Any chance you could take a screenshot of your block diagram so I could take a look?
Thanks!
11-18-2013 04:30 PM
11-19-2013 12:51 AM
Hi Kashi,
I went through your code and as others have told if you can put a producer consumer (2 while loops in parallel with some synchronization) should be ok with your requirement.
But what i see is as per the coding standard, flexibility and integrability, i find this kind of 2 while loops in parallel after the start acquisition.vi is a concern.
What idealy would be good is a statemachine (Queue based or Enum / string based) which should keep handling other events and it should loop you to Read acquisition case frequently (based on other events). This Read data should be written to a function global or LV2global (Uninitialized shift register with while loop running only once).
The consumer while loop will keep looking for the function global data. If empty it does nothing. If data is there in function global, the consumer while loop will write the data to a csv file (I would use write to text file vi with file position set ability) and then empty the function global.
Using global variable here will cause race condition easliy.
Hope you are able to get what i say.
11-02-2014 07:27 AM
i can't undestand with your suggestion, maybe you have samo exampel for record data such as i want
11-02-2014 07:54 AM
So you are replying to an old thread that already has a marked solution.
And you have a problem understanding the solution?
You do not give any details about what you have tried and what you have problem with. What is it, that you don't understand?
You have of course gone through all the training material and free online tutorials that NI offer.
The best thing you can do, is to make a new thread with your own question explaining in details your problem, with a minimum of 10 lines. Also include your code that you are working with.