06-07-2011 09:01 PM
I am taking eight analog input measurements and would like to log the data. Sounds simple but I have tried to log the data using the write to measurement option but the file is huge, and it's also logging way more data than I need. The sample rate is 1K and samples to read is 1K (default settings). The results is one sample logged in the file every 1/10th of a second. I am just interested in logging 1 sample every 60 seconds.
Solved! Go to Solution.
06-08-2011 12:08 AM
Hi,
Can you post your code. You may use the array size function and check for the number of samples, then if the size is a multiple of your required size, write it to the spread sheet by using a case structure. I can explain it better if i see your code.
Regards,
Nitzz
(Give Kudos to good Answers, Mark it as a Solution if your problem is Solved)
06-08-2011 11:50 AM
I have attached a copy of the block diagram. I hope this helps.
06-08-2011 12:36 PM
First, your math is wrong. With 1000 S/sec and 1000 samples, you will have results in the for every .001 sec.
Second, you are wiring an array of 1000 samples to a scalar. Dynamic data allows that but why? It would make more sense to take the mean of each channel and wire that to the indicator.
Third, you can simply use the Elapsed Time function set for a 60 second timeout. Wire the Time Has Elapsed Boolean output to a case statement. Inside the True case, place the write function where you pass the mean of all channels.
06-08-2011 07:30 PM
Third, you can simply use the Elapsed Time function set for a 60 second timeout. Wire the Time Has Elapsed Boolean output to a case statement. Inside the True case, place the write function where you pass the mean of all channels.
I did not change the dynamic data to a mean before displaying, however I have attempted to log minute data following your recommendation. Please have a look at the code and see if this is what it should look like. I may be missing something because the data is not logging every 60 seconds.
06-08-2011 08:18 PM
Do you have the Express VI set to automatically reset the timer?
06-08-2011 08:53 PM
Ravens Fan,
I do not have the vi set to reset the timer. At least I don't think so..That I mean is besides what you see on the block diagram the only question the timer wizard asked ( at least that's what I remember) is the value for the delay. It must be simple to set the reset, right?
06-08-2011 09:06 PM
In the dialog box is a setting to allow the timer to reset itself. Make sure that is checked. Alternately, wire a True boolean constant into the input that says Auto-Reset
06-08-2011 09:20 PM
In cases like this, it's so much better to post the actual VI or a snippet. These Express VIs hide so much code and we have to resort to guessing.
06-09-2011 05:49 PM
Thank You Dennis for the help, in addition thanks to all who contributed to the solution. After converting the data to a mean and then input the signal to the write file (as you suggested). I was able to get one sample to write every one minute. I also wired the Boolean True constant to the Reset which took care of the elapsed timer issue.
Also thanks for correcting me on my math and other mistakes.
Thanks again!
@Dennis Knutson wrote:
First, your math is wrong. With 1000 S/sec and 1000 samples, you will have results in the for every .001 sec.
Second, you are wiring an array of 1000 samples to a scalar. Dynamic data allows that but why? It would make more sense to take the mean of each channel and wire that to the indicator.
Third, you can simply use the Elapsed Time function set for a 60 second timeout. Wire the Time Has Elapsed Boolean output to a case statement. Inside the True case, place the write function where you pass the mean of all channels.