LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

3 conditions

Solved!
Go to solution

You have a potential race condition where you are reading a local variable containing the value for average and also setting it to a random number without enforcing dataflow.  If your previous run had an average value lower than .161, the compare on the following (incorrect) run could execute prior to updating of the average value indicator and thus cause the problem you're seeing.

Message 11 of 14
(1,007 Views)
Solution
Accepted by topic author jmejiagusmer

jmejiagusmer wrote:  In this particular case, I am getting a boolean true when my exit temp 1 is 0.161412 and my average is 0.173414. I have no idea why this would give me a true when it's clearly false?? Since I know that the boolean is returning true when it should be returning false, this doesn't even have anything to do with the select functions. This appears like it would be a problem with either the greater than function or the boolean array? I am very confused with this result.

That is the classic race condition issue with local variables.  Your comparisons are likely being done with the data from the previous iteration.  USE DATA FLOW!  Use wires instead of local variables.

 

I took the liberty of cleaning up your VI and got rid of the loop (not needed here anyways).  You should aim for something along these lines.


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
Message 12 of 14
(990 Views)

just an example to show the 3 conditions....

 

3 conditions.png

0 Kudos
Message 13 of 14
(980 Views)

@crossrulz wrote:

jmejiagusmer wrote:  In this particular case, I am getting a boolean true when my exit temp 1 is 0.161412 and my average is 0.173414. I have no idea why this would give me a true when it's clearly false?? Since I know that the boolean is returning true when it should be returning false, this doesn't even have anything to do with the select functions. This appears like it would be a problem with either the greater than function or the boolean array? I am very confused with this result.

That is the classic race condition issue with local variables.  Your comparisons are likely being done with the data from the previous iteration.  USE DATA FLOW!  Use wires instead of local variables.

 

I took the liberty of cleaning up your VI and got rid of the loop (not needed here anyways).  You should aim for something along these lines.


Thank you! I just did the same thing to my VI and it works perfectly now! 

0 Kudos
Message 14 of 14
(956 Views)