08-16-2011 10:52 AM
I am running labVIEW version 8.6 and am trying to create a vi that will count cycles of a sine wave from an LVDT and record every nth cycle of this and data from 12 other channels (100 data points per cycle) using a SCC68 labVIEW card and the DAQ assistant.
At the moment I have set it up to count cycles by counting every time the LVDT passes through the zero position in a positive to negative direction, this only works if the acquisition rate times the number of samples is different to the frequency of the LVDT. This is because the dynamic data conversion only works when it is converted to a scalar, which is the last data point of the acquired set of samples.
However, if I set the acquisition rate to 1/100th of the frequency and the number of samples to 100, so that I can record a full cycles worth of data, the cycle counter no longer works as it works off the final point of the hundred samples, which doesn’t change.
Please could somebody suggest a solution or alternative way around this problem?
08-16-2011 01:50 PM
Hi Rob.
Without seeing code I'm not totally clear on how you're implementing your counter. I'm wondering if the issue is that you're converting your dynamic data to a single point scalar and thereby not seeing all your data? Depending on your acquisition settings, you probably receive your data in blocks (an array) rather than 1 point at at time. You might want to make sure your program looks at all the data you are acquiring.
This is just a guess. Try to elaborate or post your code and we'll see if we can find a solution.
Best regards,
Eric
08-17-2011 04:14 AM
Hi Eric,
Thanks for your swift response. I have included a simplified version of the vi I'm using, rather than LVDT + 12 channels, I've included LVDT + 1, but the other 11 behave in an identical manner to the first.
I think you're right about converting my dynamic data to a scalar, however, I've been unsuccessful in using this counting method with an array instead.
Regards,
Rob
08-17-2011 09:13 AM
Hi Rob_P
I am looking into your problems and would like to clarify a few things. I have run you VI on my machine, I don't have your hardware but I have set up the DAQ assistant to run with the hardware I have. I'm inputting a sin wave from a function generator to simulate the input signal. Could you give me the exact numbers you are putting in as the rate and number of samples as well as the frequency of the input signal for the conditions you are talking about. So I can replicate the issue exactly.
Regards
08-17-2011 09:40 AM
Rob,
At first glance it seems like your conversion from dynamic data to a single point scalar would be causing you to lose data. Your acquisition rate is 100 Hz and your samples to read is 10 so every time your loop iterates you bring in 10 samples and convert that to a single point.
You might consider doing this in steps if there is no reason to process the data as it is being acquired. Acquire your data first then analyze it next. You can use a state machine for this. In the first step as you're acquiring data you can convert it to an array instead of a single point. On each iteration of the loop you can append the data you acquire to the data acquired from the previous loop. Store it on a shift register on the main loop of your state machine. Next, after your 10 seconds of data has been acquired, step into the next state where you process the data on that shift register. As a final step within that state machine you can write it to a file.
I remember this post I was involved in a while back where an individual was trying to measure frequency. Scroll to the top of that post and download the code he attached called StrippedVI Folder. Within the main VI there is a subVI called Meas Freq of Visible Waveform. You said you've been unsuccessful performing your counting on an array. Notice how that VI takes an array as an input and counts all the zero crossings. A slight modification of this would probably work for your application.
http://forums.ni.com/t5/LabVIEW/Frequency-measurement-accuracy/m-p/1522998#M567760
Regards,
Eric
08-24-2011 05:18 AM
Hi,
Sorry for slow response.
Matt - The motor can vary but would normally be run at a frequency of 4.5 Hz, I intend to capture a 100 points per cycle and therefore an acquisition rate of 450 Hz would capture said cycle. But in order to use this cycle counter I need a different acquistion rate (a higher rate and a lower number of samples will count cycles but present difficulties in saving complete cycles of data).
Eric - This is a fatigue experiment so the machine could be run for millions of cycles at a time i.e.hundreds of millions of data points for 13 channels, I was hoping to only save a fraction of this data. I've just downloaded the vi you've directed me too and will look through it and see if I can use similar ideas.
Cheers,
Rob