09-04-2012 06:08 AM
Hi All,
My VI looks something like the one I am attaching. I am acquiring pressure data using a while loop.
During data acquisition, I want to run a motorized pressure release valve for a few seconds (1-5 s) and then stop. But I don't want my main program (data acquisition) to stop just yet. That I will stop later through different control/logic.
Is this easy to do? I had found a few programs online that stopped the whole system. But I want an independent loop to run within my main loop for a few seconds.
Cheers,
Saif
09-04-2012 06:37 AM
Can you upload the program in an older version? 2010 or older?
You can also use a flat sequence structure with a wait timer to send a '1' to the valve to run it for a few seconds then stop. Just a guess.
09-04-2012 06:45 AM
Thanks Soham,
The program is attached in 2009 now.
Could you please explain a bit how to do this?
Cheers,
Saif
09-04-2012 06:51 AM
I didn't look your vi .
Have another Parallel loop that has the logic to drive the valve .This parallel loop can have two states. Idle state and Active state.
Idle state will wait for trigger from the main loop.(using notifier)
Once it recieves command, from the main loop , goto the active state execute the required logic(send voltage for predefined time and resets the voltage) and then returns to idle state again.
Additionally this parallel loop has to be stopped when the main program is stopped.
09-04-2012 06:52 AM
Hi
The attached picture shows a logic that might work for you.
try that and let us know.
at this point, i am unable to think of a better logic. there are better ways to do it.
09-04-2012 07:37 AM
Hi Frabto & Freelance,
Thanks so much for your responses!
I tried a bit with the diagram Freelance sent. Please see attachment. I want the 0-5 s command to come from the MAIN loop. In such a case this does not seem to work. Also, I want the bottom loop to stop execution after the FIRST FIVE seconds.
Frabto, as I am new to Labview, if you could please elaborate a bit on your ideas, I would be grateful.
Cheers,
Saif
09-04-2012 08:03 AM
I added a flat sequence structure with a while loop inside it. Now it should run parallel to the main program.
In case you want the 0-5 second signal to come from the main loop, any data in the loop will only come out of the loop once the loop has stopped executing, as far as I know.
Why does it have to be sent from the main loop?
09-04-2012 08:10 AM
Thank you so much Soham!
The data has to come from the main loop because I am monitoring the system pressure in the main loop. Based on the system pressure, I want to adjust the leakage in the system through the motorized valve by operating it for a few seconds (lower loop).
Cheers,
Saif
09-04-2012 10:08 PM
Okay, how about this?
A comparator compares the pressure reading with the threshold. If it is higher, the pressure release loop runs.
See attached.
09-04-2012 11:22 PM
Hi
attached is a crude method. using queues to pass commands and data is a better approach. use two separate loops, one which reads data and decides. the other which writes data as per the command.
these two loops are connected using queues. you said you wanted to send the data for 1 to 5 seconds. so, change the timing inside the for loop and the loop count as per the time you want.
you can make a program for it too.. post back your code in lv2009 or 2010