LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Override On/Off valve in while loop

Solved!
Go to solution

Hi,

 

I have created a simple VI to switch valves at a specific time constant.

I now want to be able to override the selection in this while loop (while the VI is running) with a perminant On or Off, or disable the override. Im not sure how to go about this though. I have created another while loop linked to each digital output line.

 

Any advice?

 

My setup:

NI cDAQ-9174 Chassis

NI 9472 24V sourcing module.

Download All
0 Kudos
Message 1 of 38
(4,810 Views)

What selection you want  to over ride ? Could you pls explain what you actually want to do and what is your program doing right now ? How many valves you are trying to control ?

0 Kudos
Message 2 of 38
(4,797 Views)

Hi,

 

I have 7 vavles at the moment.

The top while loop in my VI switches those valves at a specific time.

 

The set up i have at the moment is pretty basic and i will have to have a much more complex switching (based on time) of each valve independently.

 

But at the moment i am trying to set up a VI so that the 7 valves switch based on a specific time delay continuously (in the while loop), but i need to have an override switch for each valve so that i can have manual control of each valve independently when the while loop is running.

0 Kudos
Message 3 of 38
(4,786 Views)

The bottom while loop can be used to for direct control since you have user interface switches,  I usually dont use the express VI, but I recommend to use the induvidual DAQ write VI's in a loop with timer.

 

You said complex switching (based on time) is your program waiting on any trigger ? The user interface switches should act as your override switch.

0 Kudos
Message 4 of 38
(4,773 Views)

HI, thanks for your help so far!

 

The VI i have written doesnt work, as i cant run both while loops sending signals to the same module.

 

i get the error:


'Resource requested by this task has already been reserved by a different task.'

 

So both while loops work if they are in separate VIs but im looking to have the timed while loop running with manual override controls.

 

I have written a simple DAQ write VI (attached) to manually control a single line but i am not sure how to control all 7 valves with individual switches.

 

 

The program isnt waiting on a trigger, just set time delays.

0 Kudos
Message 5 of 38
(4,767 Views)

Yes having two loops you cannot do control if you are talking to same device same channel, definetely LabVIEW will give resource error, the program you have uploaded will do manual control for one valve, include 6 more in the same while loop to control all 7. You need to initialize for all channels in that case, and remember when you press stop all the relay will hold the previous condition of respective switches (user interface might be on/off)

 

Are you looking for something like this " Press Button --> Wait for x secs---> Turn the relay on ---> Press button --> wait for y seconds ---> Turn the relay off.

0 Kudos
Message 6 of 38
(4,761 Views)

It think what i am trying to do is better describes as follows:

 

Turn on time delay while loop. Ie valves switch indefinitely according to the time delays in the while loop.

 

While this is occuring: press button X, valve x switches immediately (ie override the while loop commands), press button y, valve y switches immediately, etc.

 

0 Kudos
Message 7 of 38
(4,753 Views)

Check this out, If you want continous control then DAQ write has to be in loop which should include wait indifinete while loop.

 

The attached VI turns the relay on and waits until user turns the relay off by pressing Stop button.

0 Kudos
Message 8 of 38
(4,749 Views)

Hi,

 

So i have created a VI 'Timed Valves' similar to your suggestion for 7 valves on time delays. It works ok.

 

But now i want to include an override switch for each valve which is operable while the VI is running. I have done this in the VI 'Timed Valves 2' for "Line 7" to give you an idea of what i am trying to do.

Obviously it wont work though as i can't have 2 DAQmx for the same line.

 

Any ideas?

 

Thanks

Download All
0 Kudos
Message 9 of 38
(4,729 Views)

How many DAQ digital lines you have in your card, assign each digital line for one relay and try having a look here .

 

I'm still wondering why do you need over ride switch when you have stop button in while loop. Click on stop button stops the loop operation and a suggestion use DAQmx STOP before clearing the task.

0 Kudos
Message 10 of 38
(4,715 Views)