LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Relay control does not stop

Solved!
Go to solution

Hello everyone, 

The attachment is part (modified) of a large control VI. Its role is to turn on a pump when START is pressed (or when a TRUE is send from another part of the control VI, which is too complex and removed), and turn it off after a specified time. I have two while loops with one being included in the other one. The inner loops is to monitor the time and stop the pump when the preset time is reached. The second loop is to keep reading the status of START bottom (in the large control VI, this done by sending a TRUE from another part of the VI). The problem is, once started, the pump and timing runs again and again. Can anyone please provide a solution? 

 

 

0 Kudos
Message 1 of 6
(1,810 Views)

Hi Ab,

 

what's the point of that parallel while loop just to send a Start condition to your main loop using a channel wire?

Why not place the start button directly in your main loop?

Place the stop button inside of your inner while loop and you're done…

 

Btw. you never send a Start=FALSE to your main loop! You only send the TRUE condition…

 

- Cleaning up a VI always makes a good impression when we should investigate your VI.

- Using less local variables by utilizing control/indicator terminals reduces risk of race conditions.

- Hiding labels of control/indicator terminals in the block diagram is pure nonsense!

And last but not least:

WHY don't you implement a (proper) state machine?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO
0 Kudos
Message 2 of 6
(1,801 Views)

Hi,

Thanks for the suggestions. The VI I posted is only the last one third of the complete VI. The first loop that just sends a start condition actually represents the main part in our complete VI, where we acquire T measurements from more 20 thermocouples, split the T measurements into several groups and calculate their mean values and standard errors, and finally send TRUE to the posted relay loop when the temperature conditions are right. This process repeats again and gain. For simplicity I removed the main part and replaced it with that stupid looking parallel loop with START inside. By the way, our aim is to avoid manful control of our process, except for the START only. I started learning LabVIEW two weeks ago, and this is how far I've got. 

-

Ab

 

0 Kudos
Message 3 of 6
(1,762 Views)

I will continue looping forever really. There is absolutely nothing automatically stopping your second loop. So when the time is complete the inner loop stops the VI goes through the rest of the process and starts again. From the VI the only way to stop the second loop is by pressing the stop button. You can create another local variable or use a property node to read the value change when the first loop stops to update the second loop. We don't have the full code so that's what I can see from the section of VI you posted.

0 Kudos
Message 4 of 6
(1,752 Views)

We don't want the second loop to stop unless we want to restart our whole program. The role of the second (outer) loop is supposed to be continues reading of the condition send by another part of our complete VI (another part is simply replaced by the START LOOP in this posted VI), and reactivate the inner loop and turns the pump on  whenever the conditions are right. Our aim is avoid manful operation, except for the initiation only. Please read my reply to the previous answerer.  

-

Thanks. 

0 Kudos
Message 5 of 6
(1,743 Views)
Solution

Thank you everyone. Problem solved. The problem was the type of the Channel Wire used. Previously it was Stream type Channel Wire, which accumulates all the signals in queue while the pump is running and then releases those signals when the pump is available, thus immediately turning it on. Now the Channel Wire is Tag type, which sends the newest or current signal. If it is TRUE, the pumps is turned on. If it is FALSE, the pump remains off.

0 Kudos
Message 6 of 6
(1,712 Views)