LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"Timed event" for peak detection input

I have a program that takes some data and looks for peaks in the data it collects. What I need to do is make a timed event such that the "peak width" parameter will change from one control variable that I can change manually to a second one after a certain time. Do I need a second loop and some boolean logic for this, or is there a much simpler way?
I don't have access to the entire program right now, but the attached screenshot should contain all the relevant stucture.

0 Kudos
Message 1 of 13
(3,988 Views)

How about putting your parameter in a shift register of a while loop?  When the control parameter changes, just update the shift register.

 

BTW, I would get rid of any and all sequence structures. 

 

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
0 Kudos
Message 2 of 13
(3,978 Views)

I agree with vt92.  Use shift registers to pass the value between iterations.  And then change the value based on your desired criteria.

 

And definetly do something about those sequence locals! 

http://www.medicollector.com
0 Kudos
Message 3 of 13
(3,959 Views)

So it would be something like this?

0 Kudos
Message 4 of 13
(3,941 Views)

Yes

 

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
0 Kudos
Message 5 of 13
(3,925 Views)

When I use that code (or, rather, the newly attached code, which is a better version of it), it doesn't return a value at all until the while loop is complete, at which point it returns the "second peak width" value. How can I make it return the "first peak width" value to "current peak width" before the loop finishes? It has to be using that for the time the loop is executing.

0 Kudos
Message 6 of 13
(3,897 Views)

Try putting the indicator inside the loop while keeping the shift register in place. In other words make a wire branch that goes to the indicator inside the loop.

0 Kudos
Message 7 of 13
(3,871 Views)

Also, keep in mind that the code in the most recent VI attachment is not using the input shift register. 

0 Kudos
Message 8 of 13
(3,856 Views)

Sorry for the multiple posts.

Upon closer inspection of the first VI image attached, I think I should clarify a bit more. In this attachment, a subVI called "peak detector" is being used to locate the magnitude and position of maximum values of the data array. I think this is the similar VI as the one shown here. This VI is being passed the following input parameters: 

Peak Detector VI_LabVEIWHelp.PNG

So it looks like the goal is to change the value of the "width" input manually after a certain period of time has elapsed. There was some ambiguity in my mind of exactly what this meant.

 

If we just want to change the value of the "width" input during future iteration(s) in the stacked sequence structure, one way would be to place a different control inside each stacked sequence structure. You could add Wait (ms) VI's inside each stacked sequence to delay the progression from sequence to sequence.

 

By contrast, if the goal is to change the value of the "width" input in the middle of the "X" array, then we could alter Detect Peak VI's default behavior by going into the block diagram of this VI. You might need to press "Ctrl+m" on its front panel to get an editable VI in this case. There, switch the threshold value to another added input parameter after a certain number of iterations into the array.

 

What is the behavior that you want to see?

 

Just some thoughts if you haven't solved the issue yet. Hope this helped, let me know if you have any questions or comments, and best of luck.

0 Kudos
Message 9 of 13
(3,817 Views)

Hi - 

The behavior I want is definitely to change the width during the middle of "X," so the manual fix probably wouldn't work. 
I got into the block diagram of the peak detection VI and found the attached diagram. I'm not exactly sure where to begin to change it, but your suggestion about altering the value of the width input after a certain number of iterations sounds like exactly what I want to do.

0 Kudos
Message 10 of 13
(3,791 Views)