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
(2,154 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
(2,108 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, 2021
0 Kudos
Message 3 of 21
(2,106 Views)

Hi Doug,

 

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

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 21
(2,097 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
(2,089 Views)

EDIT: message removed

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

Hi Doug,

 

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

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 21
(2,077 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
(2,042 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 LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 21
(2,039 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
(2,024 Views)