11-19-2018 04:00 PM
I'm trying to find the first occurrence of a passing a threshold using the Threshold 1D Array function. My labview program is continuously sampling the output of a variable DC power supply. The supply will start at 0V and I will increase and eventually pass the set threshold. I'm using a DC power supply to simulate a transducer that will essentially output a step function with a rise time of 50ms and amplitude of 5V. I don’t have the transducer yet. What I want to accomplish in labview is to display only the first occurrence of the threshold being passed. In my attached BD, the threshold function refreshes with every while loop iteration. The while loop reads 100 samples of data sampled at 1kHz with each iteration. Because this is much faster than I can turn the knob, the reported index is either 0 or 99 depending if I'm increasing above the threshold or decreasing below the threshold. If I turn my knob quickly about the threshold point, I can see the index indicator very briefly display an index between 0 and 99. I'm not sure how to only capture the first occurrence and could use some guidance.
Another idea I’ve been toying with is to eliminate the continuous sampling and do a measurement analogous to a single sweep on an oscilloscope. I could tell labview to capture a finite amount of samples that would capture the whole step function from the transducer. Then have a for loop function that would store the results into an array. The entire array would then go into a threshold function. I’m still new with labview and I’m not sure how to implement that in a BD.
11-19-2018 04:08 PM
You would put it inside a case structure and have a boolean in an initialized shift register that toggles when the first instance is found. Don't forget to add "i" x 1000 to the fractional index. Also include a mechanism to reset.
(If you would attach a VI instead of a picture, somebody might actually show you directly.)
11-19-2018 04:14 PM
Would you mind?
11-19-2018 05:39 PM
Maybe this can give you some ideas ....
(Of course you don't want to build an ever-growing array or stop once the threshold is found, so modify as needed)
11-27-2018 10:49 AM
Thanks for your help! I've been looking at your example and trying to figure out how it works. I get that when the size of the simulated data array is equal to the output of the threshold 1D function this will trigger boolean to display the fractional index. What I don't understand is the additional arithmetic performed on the output of the threshold 1D fuction (OUTPUT + I * 1000). Also, is there a reason you chose the for loop iteration count to be 1000?
12-03-2018 11:48 AM