I am new to Labview and am having some trouble trying to measure the time difference between the two highest peaks coming from two different accelerometer signals/channels. Other posts have mentioned similar problems but I am still confused and would appreciate any help.
So far, the two channels are each using the peak detection VI and then a shift register with a Min/Max array which is supposed to detect the location of the highest peak value from each channel. What I would like to know is:
How to convert of the highest peak locations into units of time. (The conversion I am using is not working)
How to keep this time difference displayed after sampling has finished
Any help is appreciated. Thank you.
Hi Johnny. I recognize a couple things that you should change. The first is that the Locations output of the Peak Detector vi you are using returns the indexes of the peaks, not the time value or amplitude. When you wire the Locations output to the Array Min/Max function, it is spitting out the highest and lowest index, not the highest and lowest amplitude peak. So if it finds 5 peaks, the Array Min/Max function will return the index of the 5th peak, not the highest amplitude peak. I think you probably want to wire the Amplitude output from the Peak Detector to the Min/Max function to find the highest peak. Then you can use use the Search 1D Array to find the index that corresponds to the the highest peak.
Then you need to take care of converting to time correctly. Take the index that you find in the Search 1D array vi and multiply dt value of your waveform. (You can get this from the Get Waveform components vi).
Thanks for your help Craig. I've run into a couple more problems and would very much appreciate any help. As shown in the updated VI (attached), I have changed the input of the MaxMin array to be the amplitudes output of the peakdetection.vi. I have also added a search 1D array which will search for the amplitude of the max value peak and return an its index location. Please correct me if this is wrong.
Finally, to get the time locations, I used the "Get Waveform Components.vi" to get the "dt" and multipled it by the output index location of the ID array. The same process has been done for the 2nd channel, and the two time outputs have been subtracted to get a time difference.
1) My first problem is a fundamental one. (I am pretty new to Labview, so I apologize.) When I start the program, I cannot run the two channels simultaneously. Only channel 0 will run when the start button is pressed even when I have changed the 'physical channels' on the front panel to run both channels 0 and 1.
2) My second problem: After the program has stopped running, I need the time difference between the max peak of the two channels to be displayed 'permanently' on the screen (until the program has been started again)
Any help/solutions would be greatly appreciated. Thank you.
Hi Johnny. I'm in the middle of some other things at the moment, but I have a couple suggestions for you. One is put an indicator on the output of our DAQmx read and look at what is coming out. I think it should be an array of waveforms with your two data channels as elements in the array. If so, you might want to use two index array commands instead of the split signals. I'm uploading a modified example. That split signal command seems to work best with the Express VIs that create dynamic data to start with.
What happens to the time difference after you stop the program? It looks like the last value the loop calculated should still be displayed.
I didn't have a chance to look closely at the implementation of the time difference calculation, but it sounds right.
Thanks for your help Craig and sorry to bother you again, but the latest version I have is Labview 8.0. If you can reattach this compatible version, that'd be great.
For some reason, channel 0 is still the only channel that is able to pass the signal, while channel 1 will not. Is there some way to configure which channels to use in DAQmx? I tried changing the physical channels on the front panel, but that did not work. Any suggestions?
The first thing you should do is wire up the error out of the DAQmx Read and put an indicator there or at least probe it. You may be getting an error and as it is now, you won't know it.
Second thing is to get rid of the split signal function and all of the Convert From/To Dynamic Data functions. I don't think that is the casue of your problem but I don't trust anything about dynamic data. Just use an Index Array function on the output of the DAQmx Read.
Lastly, you keep saying that you have specified two channels. Since that is not evident on the front panel, please provide the exact string you have entered in the Physical Channel input.
The attached VI is the updated one (labview 8.0). After DAQmx Read, I want one index array to correspond to Channel 0, and the other to Channel 1. However now, I believe both arrays are corresponding only to Channel 1.How do I go about specifying the channel for each array?
I see two distinct waveforms on the Voltage Vs. Time and Voltage Vs. Time 3 graphs. The Sampled Data indicator shows two different waveforms and the data and data2 indicators shows two different values.
That appears to be all working (at least on my system). What doesn't work is all of the code you have after. It does not make any sense to me. I don't see where you are getting the time of the peaks. You getting the max voltage of both waveforms seems to guarantee a 0 result.
You can use the code below. It uses the Basic Trigger L:evel Detection.