LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Real Time plotting signal time above threshold

I would like to plot, in real time, the peak width of my signal. I am having trouble using my current approach. I have a user defined threshold value, and when the value of my signal goes above this value, I would like to start a timer. Then when the signal goes below the threshold, I would like to stop that timer and plot that value before resetting the timer. I am having trouble with how I can use the various timing functions to do this. I am working on using the select function to output the timestamp if the signal is above the threshold. That might not be the right thing to do though. Possibly plotting the sum of these values while the signal is above threshold and subtracting the sum from itself while it is below will give me peak widths values in real time.

Is this a potential approach for measuring peak width? Do you have any recommendation on how I can utilize timing functions to perform a peak width measurement based on user defined threshold. Are there any better options using the data format I have? Here is my block diagram, and then an image of my signal.

 

 

Block Diagram attemptBlock Diagram attemptSignalSignal

0 Kudos
Message 1 of 4
(2,090 Views)

This is NOT your block diagram, just a truncated picture of part of your block diagram. We cannot run or debug it, so it is useless to us, except for the fact that we can see that there is a lot of questionable code.

 

If you want help, attach the actual VI and also include some typical data that we can play with. Thanks.

 


@Ryansamuel wrote:
 

Do you have any recommendation on how I can utilize timing functions to perform a peak width measurement based on user defined threshold. Are there any better options using the data format I have? 


Assuming that the data comes in at a defined rate, you don't need any timing functions. You can calculate any time interval from the loop time and the number of elapsed iterations. There is even a ptbypt peak detector that might do what you want if used correctly. detector function.

 

0 Kudos
Message 2 of 4
(2,053 Views)

So attached here is the example VI I am building off of. The picture of my block diagram includes some additions I have made where I compare the signal to a user defined threshold but did not complete.

I receive my data from Zurich Instruments HF2IS impedance analyzer and the data rate can be changed but I believe it is 224Sa/s, however I believe the code incorporates a FIFO. I am not sure what kind of sample data I can provide, but the picture included in my previous post atleast shows what my signal looks like. 

 

Much thanks for any help, I had considered a loop function, but did not realize how it could be used for timing. I will see if I can utilize that. I am new to labVIEW so I see many different potential solutions but I don't know exactly how to make things work. 

0 Kudos
Message 3 of 4
(2,042 Views)

The cluster from the "get..." function contains "Timestamp(ticks)" for each point. Once you get the timestamp of the left and right peak boundary, the tick difference will give you the width in time units.

 

We really cannot do much with your code because we still don't have any hardware, drivers, subVIs, or typical data. We don't need most of your code. It would be sufficient to have a typical file output (containing tick, x, y) and a tiny VI to play it back, simulating your acquisition.

 

You also have potential race conditions. For example, you cannot guarantee that FALSE is written to the stop (via local variable) before the stop value is read inside the loop. Since there is no data dependency, both operation occur in parallel, but the outcome critically depends on the fact that the FALSE should be written first. Also, the UI might be confusing because changing "Save" will have no effect once the VI is running. Etc.

 

 

0 Kudos
Message 4 of 4
(2,036 Views)