LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to compare values, wait if it different and adjust

Hello!

There is a range of X values that is equivalent for certain Y levels, for example from 500 to 1000 (X) equals 5 (Y), from 1001 to 1500 equals 4, 1501 to 2000 equals 3, 2001 to 2500 equals 2, 2501 to 3000 equals 1. If my X at 1400, level 4, changes to 1600. How do I get LabView to wait 10 seconds to see if X returns to the range 1001 to 1500, if it doens't go back to this range, change level Y to 3, and keep checking, always plotting that Y value.

Thanks!

 

.labview.jpg

0 Kudos
Message 1 of 12
(4,116 Views)

Please attach your VI. All we can tell from the picture is the presence of many coercion dots an duplicate scalar operations where arrays would simplify the code N times.

Where is your top-level loop? What is your architecture? In a state machine, a wait is just one of the states, right?

You have 11 terminals, but only two labels (x or y) shared by all. Very confusing! Why is the orange wire under the case structure?

0 Kudos
Message 2 of 12
(4,094 Views)

Throwing out a wild guess...

 

"Threshold 1-D array" and "Interpolate 1-D Array" with the output of the "interpolate..." wired to "Round toward - infinity" may be useful...

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 12
(4,078 Views)

@Ben wrote:

Throwing out a wild guess...

 

"Threshold 1-D array" and "Interpolate 1-D Array" with the output of the "interpolate..." wired to "Round toward - infinity" may be useful...


Interpolate 1-D Array is not actually needed.

Though, if the ranges are evenly spaced, Quotient & Remainder would be a lot cleaner.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 12
(4,052 Views)

You'll need to define your conditions a bit more.  Is this simply take a measurement, wait 10 seconds, take another measurement and compare to previous?  Only wait if there was a level change?  This would be pretty straight forward, but not particularly useful if your data can change relatively quickly. What happens if the level changes during the wait?  Does this reset the counter?

0 Kudos
Message 5 of 12
(4,043 Views)

@Ben wrote:

Throwing out a wild guess...


Except he also wants to light a consecutive subset of LEDs. A simpler solution would create code that does both at once. 😉

Message 6 of 12
(4,037 Views)

@altenbach wrote:

@Ben wrote:

Throwing out a wild guess...


Except he also wants to light a consecutive subset of LEDs. A simpler solution would create code that does both at once. 😉


I saw those LEDs as a quick test of his logic that will be tossed after debugging.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 12
(4,031 Views)

Never mind. These are of course equal comparisons. I thought they were > comparison acting similar to a VU meter. Now I need to get some coffee. 😄

0 Kudos
Message 8 of 12
(4,028 Views)

@altenbach wrote:

Never mind. These are of course equal comparisons. I thought they were > comparison acting similar to a VU meter. Now I need to get some coffee. 😄


Make the VU meter an integer?

 

Ben

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 12
(4,015 Views)

Hi.

 

Thank you for your help. My program procedure has changed, so it is not necessary to identify the range of values because I can receive this information directly. Here is my old VI.

0 Kudos
Message 10 of 12
(3,948 Views)