LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Two while loops in parallel

Hi all...
If there are two while loops in parallel, which do different operations...
which the be synchronous...?
i.e they will start a new ietration only after both of themhave finished the executing the
previous iteration...?
0 Kudos
Message 1 of 26
(44,044 Views)

You may use rendezvous. See the example that ships with LabVIEW.

 

C:\Program Files\National Instruments\LabVIEW 8.5\examples\general\rendezvous.llb\Rendezvous with SubVIs.vi 

 

In stead of subVIs you can use your parallel while loops.

BR
Message 2 of 26
(44,038 Views)

Hi lordsathi...,

they will not run synchronous. If you place a 30min wait in one loop and only 10ms in the other, then there is a difference. Smiley Wink Each loop will start a new iteration if the iteration before is executed.

 

Mike

Message 3 of 26
(44,035 Views)

Thanks Mike that cleared my doubts...

Smiley Happy 

0 Kudos
Message 4 of 26
(44,033 Views)

Multiple loops run asynchronously. They are usually opened in different threads, that the operating system usually decides on. So the time that the loop takes to run is dependant on how much priority it is given

 

 

Message Edited by yenknip on 08-21-2008 11:10 AM
_____________________________
- Cheers, Ed
Message 5 of 26
(44,028 Views)

Hi,

 

I have a question concerning running two parallel loops when DAQ device is involved.

I have a few input channels, which are configured for sampling at fixed rate (it can be done before entering the while loops, since it's done for all channels).

Also, there are two counters, which I would like to output at DIFFERENT pulse rate. Right now, there is a while loop that includes one counter going high and low, sequentially, with the Start VI in the loop.

If I add another loop in parallel, calling to the second counter at a different rate (different points in time), can it work? Or will the fact that they address the same DAQ device cause failure?

 

Thanks a lot,

 

Michal

0 Kudos
Message 6 of 26
(42,049 Views)

Hi mike,

I'm facing this exact situation right now, i'm doing daq for one second and insert those data into sql db only 5 mins once.

Current problem in my program is  when i start running the program, daq takes place only once after that, daq paused next acquisition, and last data acquired is inserted into database at random speed.

Can you help me get out of this problem.

Thanks in advance

0 Kudos
Message 7 of 26
(16,640 Views)

@praveenrajk wrote:

I'm facing this exact situation right now,


You don't have parallel loops.  Everything inside of that WHILE loop must complete before you can iterate again.  So if you run into data base communication issues, everything will get slowed down.  Look into using a Producer/Consumer.  The idea is that you have one loop doing your acquisition and then another loop doing the processing on the data.  This way the logging will not affect the acquisition.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 26
(16,634 Views)

EDIT: sorry, I responded to the ancient post. did not see the date on it. It is usually better to start a new thread after such a long time...

 

 


@lordsathish wrote:
If there are two while loops in parallel, which do different operations...
...
i.e they will start a new ietration only after both of themhave finished the executing the
previous iteration...?

So why do you have two while loops then??? You get exactly the desired result if you combine the code from both loops into one single while loop, right? As soon as all code has finished, it will go to the next iteration... 😄 Nothing else needed.

0 Kudos
Message 9 of 26
(16,609 Views)

I tired this technique but it quite hard to me, i'm missing something on code, can you help to get out of this problem.

My aim is to acquire data for time interval of 1 second once and insert those data into db for 5 sec once. I need only last sample of data to be inserted into db at period of 5 sec once.

Based on my knowledge i build producer consumer concept but it's not working.

Thanks in advance

 

0 Kudos
Message 10 of 26
(16,579 Views)