07-26-2016 10:27 AM
Please use the below snippet and modify code according to your requirements.
07-26-2016 10:29 AM
Move your lost terminals closer to your actual code. You have miles of white space making that image much larger than it needs to be.
Did you read my message earlier about why your code is running twice with relation to how your stop button is being read in the loop?
You are probably queuing up mulitple operations in your queue when the number hits a value rather than just a single time because your producer loop runs infinitely fast.
07-26-2016 10:41 AM
Dear Ravens,
I read your message and the programe is stopping now with the conditions that I added.
But the problem is that if I run again the problem inside the for loop is going to be equal to the number of value set so he is going to stop and doesnt make the measurement again..
I'll join you the program because I used control+U and I couldn't find the terminals 😛
07-26-2016 11:04 AM
The VI you attached isn't doing anything with the queue. You never enqueue anything in it.
Your producer loop has nothing in the False case, not even the queue wires. Which means you are going to lose the reference to your queue as soon as one of those conditions becomes false.
When you start your VI, isn't that diresist value going to be something besides 26, 36, or 16? Be different than it was when you VI last ran?
You can keep an array that tracks which values you have been run. Anytime you get a new value check to see if it exists in the array. If it doesn't, then queue it up. If it does, you won't. If you detect that all 3 values have happened, then you can queue up a stop command to tell the consumer loop to stop when it is done. When your VI starts, you queue up an empty array to the shift register so that when it restarts, it starts from scratch and will forget that it is still sitting at the last value it was at when it last ran.
07-27-2016 04:33 AM - edited 07-27-2016 04:37 AM
Dear RavensFan,
The starting of the program is working weel. Everytime I am getting 36, 26 or 16, the program is queuing. But as you said, as soon as one of the stopping condition become true the program is not running anymore. (Even if I run from new the whole program)
So how can I initialize my second loop everytime?
"When your VI starts, you queue up an empty array to the shift register so that when it restarts, it starts from scratch and will forget that it is still sitting at the last value it was at when it last ran."
I didnt understand could you please send me the VI or a scrrenshot of what you mean?
What I exactly need is to initialize the " i " of the for loop. It should always start from zero everytime I queue.. any Ideas?
07-27-2016 05:31 AM
Did you check with the snippet i provided?
07-27-2016 05:59 AM
the sniipp is 2015 could you please send as a Vi and convert it to 2014?
07-27-2016 06:05 AM - edited 07-27-2016 06:20 AM
Only stop once you've detected all 3 of those things have happened. Only queue up the event when you detect a particular number has occurred, but has not happened before.
Attached is a VI for an example how to do this.
07-27-2016 06:29 AM - edited 07-27-2016 06:37 AM
Ravens you didnt really understood the problem I think. So I explain you again
I always need to make measurement everytime I got 26 36 16. Once I detect one of those Value, I enqueue and send commands to my instrument to measure values of resistance. The measurement are done via a for loop as in the VI that you received yesterday. Once we achieve the number of measurement written by the operator the VI should stop.
The VI is now doing all this, but he's not initializing, so for exemple, if I runned already the program with a number of measurement = 3. The program run for the first time. I stop the program then and run again, the program will not run.. why?
Because in my for loop i=3 which is one of the stopping conditions so he is not enqueuing. The question now is how can I initialize my second loop ?
I don't need to put it in a table or to wait for the 3 values together to stop.. I need to stop once my measurements are achived so the number of i in my for loop is equal to the number written by the operator..
07-27-2016 07:10 AM