LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can i get percentage value from limited signal?

My problem is following, i have signal which is limited between certain values. I would like to have percentage value from the time, when the signal is over or under those limits (Red areas on the picture)
0 Kudos
Message 1 of 6
(2,954 Views)
Hi,

maybe you can sort your array counting all cells which are above and below a certain value and then dividing this number by the max number of cells in the whole array.

Stephan
0 Kudos
Message 2 of 6
(2,954 Views)
It´s not the best way (I hope) because the sample rate is 10000 or more, so the array would be guite large. And the measurement values are in lvm.files.
0 Kudos
Message 3 of 6
(2,954 Views)
You need two shift registers, one who holds the number of points processed and one who holds the number of points out of range. Use the "In Range and Coerce" function to determine if the point is out of limit. Add one to the "processed number" and if it is out of range one to the "out of range number". Divide both and multiply them by 100 to get the percentage.

Waldemar
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
0 Kudos
Message 4 of 6
(2,954 Views)
I tryed to make it with while loop. I made an array that reads the value one by one and then compares it to the upperlimit, and if its out, it decrease counter value by one.

(In the end i divide counter value by the number of scan rate and multibly it by 100. Shouldn´t it give guite right percentage, compared to counting time? Scan rate is big =>10000 so the time in between is guite minimalistic?)

The problem is, that my counter decreases when true as it should, but it drops to zero when false. How can i get it right.

Or could this be made somehow with expressed functions (LV7)

`Ramssted´
0 Kudos
Message 5 of 6
(2,954 Views)
Check out the attached code. I had a look at your example, it won't work and it's not just due to the drop to zero (which can be fixed by wiring the value from the left shift register terminal to the false of the select function, not 0).

From the example it looks like you want to process the first row of a 2D matrix so I made code that will do just that. There's a number of ways to do this. In my example I've shown to different methods; one that works with the row as a whole array (produces very simple code and the fastest one here with the array sizes involved) and one that check element by element.

On my computer doing the test for an array of 10000 elements takes 0,2ms with the whole array method and 0,5ms with the element method.
0 Kudos
Message 6 of 6
(2,954 Views)