08-11-2015 04:50 PM
Hi all. very new to Labview so please excuse me if this is a simple question.
I have an NI-9237 which has a minimal sample rate much higher than I can use for the test I have designed.
I would like to be able to control the sample frequency in the range of 100 samples per second down to 1 sample per 60 seconds. The reason for this is that I need to be able to run the test for several days. I have been using the "Strain - Continuous Input.vi" as the backbone of my program and have had no luck in trying to change the sample rate.
On the forums there have been posts regarding methods of resampling but I can not figure out how to get the task/TDMS file to record a modified signal.
Any help would be greatly appreciated.
08-11-2015 04:57 PM
Downsampling is essentially just combining a whole bunch of points that you have too many of down to a smaller set. So if you want to go from 1Hz to 1/60Hz, you would take 60 data points and average them (or however you want to combine them) down to one point.
With respect to your VI, there is a Sample Rate input. Have you played with this? I think your device can probably only go as low as 0.1Hz, so you would have to do some downsampling to get 1 data point per minute.
Your task won't record a modified signal, the downsampling is done by your code after you read in the values. This might help.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
08-11-2015 05:23 PM
08-11-2015 10:47 PM - edited 08-11-2015 10:57 PM
Thanks for your response.
Unfortunately it seems the NI-9237 is limited to a minimum of 1.613kHz Sample Rate, which I find very frustrating. I have tried forcing it lower with the sample rate input but it will maintain 1.6129kHz. The downsampling example you guided me to works somewhat, which I hope I can make do in a pinch. So far I can't get it to continuously log lower than 10Hz (while a significant improvement I still don't understand why that is the limit), maybe if I put two in sequence?
Adding in a wait function does not seem to work. The recorded array data seems to act erratically; the samples either keep the high frequency sampling rate or don't log at all.
Thank you again for your help!
08-11-2015 11:20 PM
08-12-2015 02:32 AM
Hi Sunkistlist,
Unfortunately it seems the NI-9237 is limited to a minimum of 1.613kHz Sample Rate, which I find very frustrating.
Well, you could have read the manual before using this module, it's all described in there…
To have 100S/s you need to decimate by a factor of 16.
To get from 100S/s to 1/60S/s you need to decimate by a factor of 6000, but I would use two steps (down to 1S/s, then 1S/min) for display reasons…
08-12-2015 09:03 AM - edited 08-12-2015 09:10 AM
Thank you for your reply, I need all the help I can get hah! Obviously something is wrong, I just don't understand why or where. To clarify: I did not design this project, the DAQ was purchased without my input, though I can't say I'd have purchased something different. I would have just assumed LabVIEW would have tools easily available for such a problem. Honestly I'm just trying to do a quick patch job for a co-worker. End of line: "sub-optimal conditions Captain".
To Dennis_Knutson:
I'm including my code which I should have done previously but was too frustrated, I apologize. I have run the program several times with the delay and it turns out to be ~161(+-3) samples/second... Including the DAQmx Read with the delay/while loop will allow me to adjust how many total samples are recorded but the rate remains unchanged regardless of the wait time.
08-12-2015 09:12 AM
Hi Sunkist,
Including the DAQmx Read with the delay/while loop will allow me to adjust how many total samples are recorded but the rate remains unchanged regardless of the wait time
- The delay has NO influence on sample rate…
- Including the DAQmxRead in the second loop is no good idea, even when you force the execution order by DATAFLOW as you do now…
turns out to be ~161(+-3) samples/second...
What6 is the sample rate as shown in your indicator? I don't see any place where you decimate your samples…
08-12-2015 09:51 AM
I don't have LabVIEW on my phone but if you did not change to 1Samp like I said, then of course your code will not work. with 1Samp, your rate is equal to the wait value.
08-12-2015 10:21 AM
Hi GerdW,
Thanks for your input. I don't like having the Read in the second loop either, I was trying to isolate the logging loop from whatever buffer the 100 samples per loop Read maintained. If I switch the Read to 1Samp it will only log one sample even within a while loop with append=T which I don't understand why.
I mistyped on the sample rate. It is still 1613Hz I was just surprised there was some variance (albiet small).
Thanks again!