12-03-2011 05:17 PM
Hello, just wanted to ask of a simple way to make a timed condition. To be brief, I have a value which I want it to be greater than zero for "x" seconds. If such value is greater than zero for these "x" seconds, then a boolean "true" value would light a LED indicator on. However, if during these "x" seconds the value is equal to or lower than zero, even for a single second, then the LED indicator will have to remain off or in its "false" value.
Is there a simple way to make a timed comparison? In advance thank you very much for reading and for posting your suggestions.
Best,
Nestor
Solved! Go to Solution.
12-03-2011 07:41 PM
Nestor,
Put all the values acquired during the "x" seconds in an array. Use the Array Min Max function. If min < 0, then false.
Lynn
12-04-2011 01:15 AM
An alternative implentation is basically to say that you want a VI which will delay a T value on a boolean wire (B) for N seconds. If you look at the Time Elapsed express VI, it gets you most of the way there. You basically just need to call it with Auto Reset set to F and wire NOT B into the reset terminal, then look at the result. If B is F, reset will be T and the output is F. If B is T, reset will be F and after N seconds the output will be T.
You might also want to give special consideration to the case where N<=0.
12-04-2011 02:17 PM
Excellent. Thank you very much Lynn!!!
Best,
Nestor
12-04-2011 02:23 PM
TST, Thank you very much for your alternative implementation!!! Both solutions I've received work great!!!
Best,
Nestor
12-04-2011 03:42 PM
Nestor,
Be aware that for non-integer representations of data, equality comparisons to zero will not produce a True output unless the value is exactly zero. If you do any calculations on the data you could get values on the order of 1E-16 which looks like zero on most displays but will not show as equal to zero on a comparison. >= or <= comparisons are usually OK. This probably does not matter for what you are doing now, but it is somethign you should be aware of for the future.
Lynn
12-05-2011 04:26 AM
Got it Lynn, thank you very much for your advice!
Best,
Nestor