LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple timers with different stop conditions

Solved!
Go to solution

Hello,

 

I am working on a simple vi to read the temperature output of a thermocouple, and start 3 timers, counting up, that will stop when the temperature reaches each threshold (80, 85, 90F). I started by creating a vi(attached) that successfully tracks the time to reach 80, but I am struggling to implement all three timers simultaneously.

 

I tried to create separate while loops within the main loop with separate stop conditions tied to the value being read from the thermocouple for each of the timers, but the temperature was only passed into each loop once because the DAQ read function can't be inside multiple loops. 

 

I have a feeling that I'm making this more complicated than it needs to be, but I'm still very new to Labview and it seems there are a lot of different options around timers out there. I appreciate any help you all can give me!

 

-Bryan

0 Kudos
Message 1 of 6
(515 Views)
Solution
Accepted by Bryan7

See if this can give you some ideas....

 

altenbach_0-1720485715202.png

 

altenbach_1-1720485834095.png

 

Message 2 of 6
(474 Views)

Small modification, now with correct x-scale

Message 3 of 6
(452 Views)

Hey Altenbach,

 

Thank you very much! The functionality of this program is exactly what I'm looking to do. I have never seen or used several of the things you have utilized, and I'm working on understanding them. 

 

The top shift register creates the array for the 3 timers as an array and passes it through each loop/to the display. The relative seconds timer is adding the difference between the current value and the previous loop value, yes? Context help shows me that the right facing arrow is a feedback node (seems very useful!), but what is the piece attached to the bottom of it? This seems critical to the operation of the timers themselves and it looks like the value is wired separately into both parts?

 

The second shift register is the simulated "temperature" correct? I think I'm following that this is passed into the comparison with the thresholds to determine whether to multiply the time increment by 1 or 0(This part may have blown my mind). If I may ask, what would you modify to permanently stop the timer once the threshold is reached? 

 

Finally, the wait function is controlling how fast the chart and timers update? 

 

Thanks again for providing this, I will likely reference this for a long time as I continue to learn. 

0 Kudos
Message 4 of 6
(424 Views)

The bottom of the feedback node is the value to get out when it executes for the first time. In this case we want the same as the current time to get a difference of zero. If you leave it unwired, you get the default for the datatype (zero in this case) and the first difference will be a very large random number).

(You can change the direction of the arrow for cosmetic reasons, but the direction does not change functionality)

 

We only need a shift register for the temperature simulation because I add a random number to the old value with each iteration. If you read the temperature from a sensor, you don't need any shift register here.

 

To permanently stop the timer even if the temperature would later fall below, you just need some boolean logic. There are many possibilities, here is one.

 

The wait function determines the loop time. We adjust the x-axis increment to get correctly scaled value.

 

 

altenbach_0-1720543641301.png

 

altenbach_1-1720543655791.png

 

 

 

Message 5 of 6
(410 Views)

Perfect. I was able to get my version of this working just right. Thanks again!

0 Kudos
Message 6 of 6
(400 Views)