Hello Thomaz,
Please also see Preston's comments. I talked with him about your application and the order analysis toolkit may be very helpful for you in your application as you move forward.
Looking at your code, the main problem lies with the data acquisition. In your code you use the single point acquisition function AI Sample Channel which includes no timing control. You repeat this function 368 times in the For Loop, but you don't know how fast the loop is running and therefore how fast the samples are being acquired. The 1 ms delay outside the For Loop has no effect on the timing of the For Loop and the timing of your data acquisition.
Instead of the single point functions, you should use the AI Acquir
e Waveforms VI to acquire a set number of samples (368) at a set rate (1000 Hz) from both channels. In this case the timing will be handled by the data acquisition card so that you know that interval between samples is 1 ms. This function will return an array containing all the data points which you can then process using the array manipulation and arithmetic functions. If you plot the raw data from each of the channels on a waveform graph you will likely see a somewhat sinusoidal pattern like the plots on the graphic that Preston showed.
I tried making the changes in LV 7.0 and then saving the VI back to 6.1. Please see attached. The DAQ VI will likely not load/show in 6.1 and you will need to replace it after opening the attached VI.
If you make this change, you will still have a limitation that you don't know where in a revolution of the rotor you start sampling the data. So repeated acquisition sequences will not match each other in regards to this phase offset. Eventually yo
u will want to use a continuous data acquisition operation where the data is acquired without breaks and processed and plotted at the same time.
Christian
authored byChristian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX

