From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

Who has an example? duration of a waveform above threshold

Excuse me,

does anyone know how to find the duration? like this picture.


F2.png


Please help me.
Thank you

0 Kudos
Message 1 of 7
(956 Views)

Hi Danny,

 


@Danny29434 wrote:

does anyone know how to find the duration? like this picture.


You need two steps:

  1. Find the first time the signal rises above your threshold value.
  2. Find the last time the signal falls below the threshold…

Subtract both times…

 

What have you tried?

(In the end it boils down to comparisons and search array functions.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(950 Views)

To make things simple, square each point and then take a square root, now, the signal is single-sided, now, you can do all sorts of comparisons to find the duration above a threshold.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 3 of 7
(930 Views)

Hi gerdW,

Thank you for the advice
I try this but it's not work

I don't have idea about finding the first time and last time (What function should I use?)
My English's not good and I don't understand some function ---> that's my problem

1643256111506.jpg

 

Thank you Very much.

0 Kudos
Message 4 of 7
(901 Views)

Hi Danny,

 

like this:

(There's a small bug: you need to search for TRUE both times.)

 

Hint: time duration is the number of sample (aka difference of indices) multiplied by dt (aka time interval between samples)…

Recommendation: cleaning up the block diagram helps to improve readability of your code!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 7
(877 Views)

Hi GerdW,

I tried following your advice. But it still doesn't work. 
Maybe I misunderstood something. Can you help me check my code? (Thank you very much)
I tried this (picture 1) and the result (picture 2)

1643464615094.jpg

                                                                                              picture 1

 

1643464588434.jpg

                                                                                                           picture 2

index of rising is correct but the index of falling is not
then I tried this (picture 3)  and the result (picture 4)

1643464905806.jpg

                                                                                           picture 3

1643464885063.jpg

                                                                                           picture 4

index of rising is still correct (2179) but the index of falling should be 8297 (In picture 4).
about 2382 is the next index that is above the threshold
and then I tried this (picture 5) It' still doesn't work

1643464917505.jpg
                                                                                            picture 5

Best regards,
Danny
0 Kudos
Message 6 of 7
(845 Views)

Hint.

 

Threshold array x2,  array size, reverse array and subtractx2 (or a compound math.)  You don't need any of the silly comparisons. 

 

You'll get there.

 

 

If you search my old posts for "Trim.vim" you might find an example that I believe even has a waveform datatype case.

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 7
(831 Views)