LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

vi priority

Hi to all. I use a timed loop to get data from device. Add it to queue and save array to disk with low frequency (a few seconds data).

Save VI has low priority and different execution system compare with get data VI.

In simple way this view like in added picture.

But 1.vi waits when 2.vi done all saves. The queue has space for new element and I do not understand why VIs not separate to different threads.

 

0 Kudos
Message 1 of 7
(2,096 Views)

Please embed images, saves us a download:

1

0 Kudos
Message 2 of 7
(2,091 Views)

In 20 years, I don't recall changing the priority ever had a desired effect, at least not without unexpected side effects. EDIT: Same for the execution system. I'm sure there are corner cases where it has it's uses, but yours is not one of them.

 

My advice: don't change that at all. No good comes from it.

 

The loop where you read values, doesn't have any timing. It runs free, so everything put on the queue is written to TDMS ASAP, and then it the next iteration.

 

Put a wait in that loop...

 

 

Message 3 of 7
(2,082 Views)

I generally say that a Timed Loop is not something you should be using on a Windows system.  It actually puts the code inside at a higher priority and makes it so that nothing inside can run in parallel.  From just what you have shown, I see no reason to be messing with all of those thread settings.  Those should be reserved for trying to get a possible extra ounce of performance when nothing else is working.  Instead, I would change your Timed Loop into a simple While Loop with some sort of wait inside.  On your consumer side, I would change it to a Dequeue so that it is actually sleeping while waiting for data to come in.  By using the Flush, you are dealing with possibly empty arrays or possibly very large arrays.  This memory difference can cause all kinds of performance issues.


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 4 of 7
(2,043 Views)

Thank you for reply. I will try use ordinary while loop.

 


wiebe@CARYA wrote:

The loop where you read values, doesn't have any timing.

Put a wait in that loop...


In original case the loop has a timing (about 10000 mSec).  Just forgot include it in this example.

0 Kudos
Message 5 of 7
(2,003 Views)

@0Forest0 wrote:

In original case the loop has a timing (about 10000 mSec).  Just forgot include it in this example.


10 seconds!  That is an absolute ETERNITY when it comes to a program.  You really do not need the Timed Loop or worry about the threading.


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
0 Kudos
Message 6 of 7
(1,991 Views)

@0Forest0 wrote:

But 1.vi waits when 2.vi done all saves. The queue has space for new element and I do not understand why VIs not separate to different threads.


Are you sure it's the queue that causes the wait (and not the VISA read)?

 

Do you get continuous data if you just do the read?

Does it work if you replace the VISA read with a constant string?

 

Other then the wait, and the flush (that's better of being a dequeue), I think it should work as you expect. I think your conclusion based on what you're seeing might be wrong. But we can't see what you're seeing. Without being able to run VIs, it's hard to diagnose.

 

If the problem is the queue, the Serial stuff shouldn't be relevant for the problem (I suspect it is in fact the problem). If you remove it, you can post your code here so can evaluate the problem. 

0 Kudos
Message 7 of 7
(1,940 Views)