From 11:00 PM CST Friday, Feb 14th - 6:30 PM CST Saturday, Feb 15th, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Condition reset after data goes below a certain value

I'm developing a peak detection algorithm. I was wondering is it possible to create a condition such that when one point is detected, the data must  go below a certain value before another point can be detected?

0 Kudos
Message 1 of 8
(3,922 Views)

Yes, it is possible.

 

(Keep the condition in a shift register or feedback node.)

 

Have you tried the built-in peak detector?

0 Kudos
Message 2 of 8
(3,907 Views)

I have attempted the peak detection, but it picks up a larger peak twice which I would like to stop by saying that the value has to drop below a certain point so it moves to the next peak. I have tried other methods which would also benefit from this condition.

I need to develop another form of algorithm to the built-in vi as I would like to compare different methods and their effectiveness to the built-in detector.

 

Thank you

Download All
0 Kudos
Message 3 of 8
(3,890 Views)

Can you comment on the VI you have attached, because it seems extremely convoluted. What is the purpose of showing us this? Is it your attempt at "peak detection"?

 

  • The leftmost FOR loop does not need anything orange. What's the purpose of creating an array when you never use the output?
  • Wiring an array to a Waveform attribute makes no sense unless you are using something undocumented. can you explain.
  • Your small loop with the conditional tunnel removes data from the y-array but not from the x-array. Seems lossy.
  • Your boxcar averager could be simplified dramatically (image).
  • Shouldn't your pbbypt min&max be initialize on the first iteration?
  • It seems unlikely that your (large) boolean array to number ever results in a 1. What's the logic behind that?
  • Your loop to "remove duplicates" will be inefficient for large arrays. The resulting array of amplitudes with probably have a very different size than the x-array created and the positions are unrelated to the x-values. 
  • Why are front panel and diagram maximized to the screen?
  • ...

Again, why do you show us this VI. It seems quite unrelated to the problem and looks completely broken in functionality..

 

CarBox.png

0 Kudos
Message 4 of 8
(3,881 Views)

@swilson8 wrote:

I have attempted the peak detection, but it picks up a larger peak twice which I would like to stop by saying that the value has to drop below a certain point so it moves to the next peak.


It seems to pick exactly 6 peaks. looks fine to me. 😄

 

Peaks.png

Message 5 of 8
(3,874 Views)

Sorry for the slow response and the state of the vi. I've been testing lots of things at a time so the vi is rather experimental as I was trying to see what would solve the problem.

The Boolean section was an attempt to create a condition that would mean that only values where dx/dt = 0 and d(^2)x/dt(^2) < 0 would be detected. It kept throwing out an issue where the source was Boolean and the sink was Boolean but it wouldn't accept it for the case structure, I was trying to (but failing) to overcome this.

Your peak detection does appear to give nice values, but it still uses the vi which I am unable to for the purposes of this. This is why I was trying to create this new condition where a peak is detected and then the data must drop below a value before a new peak is then detected.

 

Thank you

0 Kudos