LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Signal out of sensor range

Hi

 

I have a laser distance sensor, which is measuring the distance of a free falling and then rebouncing object. The sensors range is 300mm (from 50 to 350mm). Is there a way how I can set the signal, when the object is outside of the sensors range, to the upper range (350mm) instead of the lower (50mm)?

 

Right now when the object approximates from outside of the sensors range, it jumps up to 350mm as soon as it enters the sensors range, stays there a while and then continues its way down (see attached image). The reason I want to change it that way is, that I can derivate the position signal to the velocity and atm these jumping peaks prevent me from doing that correctly.

 

Thanks in advance!

 

Michael

 

Download All
0 Kudos
Message 1 of 21
(351 Views)

Would code like this work?

 

Replace if Below Threshold.png

 

which results in behavior:

dsbNI_0-1627305730964.png

 

 

Doug
NI Sound and Vibration
Message 2 of 21
(305 Views)

By only watching at the program graph , we can guess that the usable data are those for which  50 < pos < 350.

It's by no means clear why the signal lingers on 350 so long. Whatever the reason, deriving in those regions is useless.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019
0 Kudos
Message 3 of 21
(303 Views)

Hi Doug,

 

what about a simple MinMax function instead of the FOR loop, the Select and the comparison before? 😄

Best regards,
GerdW


using LV2020 on Win8.1+cRIO
0 Kudos
Message 4 of 21
(294 Views)

@GerdW wrote:

what about a simple MinMax function instead of the FOR loop, the Select and the comparison before? 😄


You might have to show us what you mean. I am not getting your hint.

Doug
NI Sound and Vibration
0 Kudos
Message 5 of 21
(286 Views)

EDIT: message removed

Paolo
-------------------
LV 7.1, 2011, 2017, 2019
0 Kudos
Message 6 of 21
(280 Views)

Hi Doug,

 

I'm sorry, after re-reading the problem description I realized my comment was wrong…

Best regards,
GerdW


using LV2020 on Win8.1+cRIO
0 Kudos
Message 7 of 21
(274 Views)

Thank you all for your quick responses!

 

 


dsb@NI wrote:

Would code like this work?

 

Replace if Below Threshold.png

 

which results in behavior:

dsbNI_0-1627305730964.png

 

 


Sounds like a great solution!

 

The only challenge now is, that I get the message "Not enough memory to complete this operation".

Guess that's because of the sampling frequency of 5kHz.

Does the implementation of a producer/consumer loop solve this or do you may have any other suggestions?

 

Michael

0 Kudos
Message 8 of 21
(239 Views)

Hi Michael,

 


@Michael_Jr wrote:

The only challenge now is, that I get the message "Not enough memory to complete this operation".

Guess that's because of the sampling frequency of 5kHz.

Does the implementation of a producer/consumer loop solve this or do you may have any other suggestions?


Suggestion: attach the current state of your VIs…

 

Implementing a producer-consumer scheme will not solve "out of memory" problems magically!

A sample rate of 5kS/s is not that high, many people before you could handle the data without running into memory problems…

Best regards,
GerdW


using LV2020 on Win8.1+cRIO
Message 9 of 21
(236 Views)

~40 s * 5000 S/s is only ~200000 samples. I would not expect this data to bog down a modern computer. As @GerdW suggests, share your code (with acquired data in a constant or saved as default in a control).

Doug
NI Sound and Vibration
0 Kudos
Message 10 of 21
(221 Views)