12-05-2014 01:45 PM
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.
12-05-2014 02:18 PM - edited 12-05-2014 02:19 PM
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.
12-05-2014 02:24 PM - edited 12-05-2014 02:50 PM
just an example to show the 3 conditions....
12-05-2014 02:59 PM
@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!