03-26-2013 09:11 AM
Hi,
So, I have an array comprising of 16 values, and I would like to compare the first 14 values (using the Array Subset vi) of the array, and when they are all within a specific distance of each other, start a timer.
Since we are measuring temperature with each one of these inputs in this array, once, and only once, they elevate past about 100 degrees Celsius, I would like to start comparing them amonst each other. Once they all are within 20 degrees celsius of each other, this timer should start. I already have the timer set-up, but I'm missing this comparison.
I'm really new to Labview, so the only way I can think of right now, would be extracting every single value, and comparing them with each other inside a while loop, but there has to be a better way, right?
Thanks in advance!
Solved! Go to Solution.
03-26-2013 09:21 AM
If you were only working with three temperatures, say 10, 25 and 40 degrees then I am assuming this does not meet the criteria?
10 is within 20 degrees of 25
25 is within 20 degrees of 40
10 is not within 20 degrees of 40 (so no go).
If I understood the above correctly you should be able to take the min and max of the array subset and if these are within 20 degrees of each other all the others have to be also...
03-26-2013 09:26 AM
I thnk you're on to something!
Sound so simple that I'm actually a bit skeptical, hahah.
I'm going to try it out later, and I'll let you know how it goes.
Thanks!
03-26-2013 09:27 AM
03-27-2013 03:02 AM
Hi Gerd,
So, I actually did almost the same thing as you suggested, but I still have some questions.
- Since this is just a small part of my vi, I still have several other things going on, in the same part of the flat sequence structure that's encompassing the rest of the program. Should I have this entire part I just added, timer and the trigger for it (or just the trigger), inside of a new while loop, or is there something better/simpler?
- The temperatures, the values that are coming from the array, are going to be constantly changing, and it's crucial that the timer stay running, even if the condition of them not being more than 20 degrees from each other is not true anymore. How can I tip off a trigger like that, so that I just have to have these initial conditions be true once for the timer to start running? Should I put the timer in an event structure?
Again, thanks for the help, guys!
03-27-2013 03:11 AM - edited 03-27-2013 03:13 AM
Hi Eduardo,
it's crucial that the timer stay running
I think the ElapsedTime is still running! The point is: your indicators for time and progress are inside the same case and so will only update, when the case is selected...
Should I put the timer in an event structure?
That depends on your overall programming scheme. As you talked about (flat) sequence structures I guess there's a lot to improve...
03-27-2013 05:22 AM
So I tried creating a separate VI, with just this timer and the two conditions. It will initially execute as it should, when the temperatures pass 100, and when they are within 20 degrees of each other. But, when I manually change one of those conditions to false, the case is no longer true, and the timer stops running, which it shouldn't.
Not sure I'm making myself clear, but like, the timer is not suppposed to run before those two conditions are true, and it should not stop running once they aren't true again. Not familiar with event structures though, so that's why I'm not sure I should be using that instead of a case structure.
03-27-2013 05:49 AM - edited 03-27-2013 05:50 AM
Hi Eduardo,
the timer is not suppposed to run before those two conditions are true, and it should not stop running once they aren't true again
You have to define your logic carefully! What happens the second time the conditions become true?
Get rid of the case structure:
The timer gets resetted when both conditions become TRUE (by help of rising edge detection), else the timer just runs up...
If you really insist on "timer is not suppposed to run before those two conditions are true" you have to include some more boolean functions like here:
03-27-2013 09:58 AM
Minor note on word usage: You have misused the word "comprising". Any of the following would be correct:
... 16 values comprising an array ...
... an array composed of 16 values ...
... an array consisting of 16 values ...
03-27-2013 10:29 AM
(by the way, this is just a separate simulation I'm running from the actual program, so that's why the array and some other stuff is different)
There we go!
Just made it pick up from where it left off from in the False Case, and told it to not start (or just reset) if the present time was 0, which it would have been if the True Case had never been set off before.
Only real problem now is that the Present (s) doesn't reset to its default value of 0 after I press stop, but since this would only be fired up once, and then the program would be shut down, and restarted a different day, it won't be a problem. And a friendly warning to remember to write 0 on the control if they were to start it again would also go a long ways. All in all, I'm satisfied.
Thanks for the help!