LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

starting one while loop after the other

Solved!
Go to solution
Im sorry, I'm new to labview, this is probably an easy question but I didn't really even know what to search for. I have two while loops next to each other, one controlling a temperature (left) and the other controlling pumps (right). I don't want the pumps to start until the temperature gets up to the right value. The <= operator in the while loop on the left is what controls the heater in my system. I want the while loop on the right to start after the <= operator returns false for the very first time, but after that I want them to operate independently of each other, with both while loops running until they are stopped.  
0 Kudos
Message 1 of 9
(6,660 Views)

The easiest way to do this is to connect the output of the temperature (your formula 3) to the second loop.  The second loop won't start until it has that input, even if it doesn't use it.

 

See attached file.

 

 

-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




Message 2 of 9
(6,658 Views)
Solution
Accepted by topic author tompkinhall
Matt's answer is ok if the first loop is intended to stop when it reaches the desired value, but not if it's needed to continue controlling the temperature.  If you need both loops to continue running you can use a Occurrence in the first loop to start the second loop.  Use some test to determine when it's appropriate to start the second loop and execute the True case.  This will set the occurence and the Wait on Occurrence will pass execution to the second loop.
Message Edited by jcarmody on 04-06-2009 07:58 AM
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 3 of 9
(6,609 Views)

thanks jim, the occurrence worked out perfectly. im having another problem now though, i added one more while loop (on the bottom) to the mix and i want it to pass the boolean signal to the loop on the right that controls the pumps. the bottom loop acts as a timer that will switch off the pumps (loop on the right) after a certain amount of time has elapsed. i tried passing the boolean signal, but now the loop on the right doesn't start at all. do you have any ideas as to why this might be and have any solutions?

 

thanks in advance... 

0 Kudos
Message 4 of 9
(6,562 Views)

tompkinhall wrote:

now the loop on the right doesn't start at all. do you have any ideas as to why this might be...?


This is because you've got a data dependancy between the bottom and right loops; the right loop won't start at all until the bottom loop is finished.

 


tompkinhall wrote:

do you have [...] any solutions?


You could use a Notifier between these loops.  Notifiers are useful in the same way an Occurance is, with the addeded function of passing data. 

 

 

A quick way would be to use a Local Variable from your Open/Closed Boolean indicator in the right loop.  This is a quick way, but VERY UGLY.  A good rule-of-thumb is to only use Local variables when you've given up on style! Smiley Very Happy

 

Message Edited by jcarmody on 04-07-2009 09:31 PM
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Download All
Message 5 of 9
(6,547 Views)

The last code capture had a mistake.  This takes into account the possibility that the bottom loop won't send a notification when the right loop is ready.

 

Message Edited by jcarmody on 04-08-2009 07:15 AM
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 6 of 9
(6,517 Views)

Hello Mr. Jim

 

I am trying to apply your scheme on Labview NXG 3.0.2 but it seems some of the function symbols are different. In the left upper, it is "generate occurance", and in the lower part it is "wait on occurance". did I do the same to you? but why the lower loop doesnt start immediately after the iteration becomes 10?

thank you in advance

0 Kudos
Message 7 of 9
(1,641 Views)

Hi nadhira,

 


@nadhira wrote:

I am trying to apply your scheme on Labview NXG 3.0.2 but it seems some of the function symbols are different.


Two problems:

  1. This is a very old thread, long before LabVIEW-NXG even was available. No wonder some items look different…
  2. LabVIEW-NXG3 itself is outdated. Even more NI cancelled LabVIEW-NXG at all, so you better switch over to a recent version of LabVIEW ("classic") to not use an "end-of-life" software…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 9
(1,637 Views)

Thank you Mr. Gerd for your answer

0 Kudos
Message 9 of 9
(1,570 Views)