LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issues with passing data between VIs

Solved!
Go to solution

Hello all.

 

I have an issue where my program is slowing down dramatically while running.

 

The program is a producer-consumer, where I have the main consumer loops and producer loops for UUT comms, output power measurement, input power measurement, thermal monitoring, etc.

 

In regards to the issue at hand, the output measurements loop takes the readings and passes the data to a separate VI that remains running (output measurement processor). This VI summarizes and averages the data, and also displays the data for the operator to see details if needed. The operator shows and hides the front panel of this VI with a button on the main program. This VI also passes the summary data back to the main VI, where it is read by my consumer loop.

 

The main VI output measurements loop takes about 200mS to run when the program is first started. Within a minute, it's up to 400mS, and it's all downhill from there.

 

I've isolated the issue to the way I'm passing the data back and forth (I believe). I couldn't figure out a way to pass the queue reference between two VIs not connected by wires. I open a reference to the processor VI and use Ctrl Val.Set and Get to pass the data back and forth. If I eliminate the passing of the data to the subvi, there is no slowdown.

 

My questions are:

1) Why would passing data via invoking a node for the control on the target cause the slowdown?

2) How would I obtain/pass queue information between the two unconnected VIs?

3) Alternately, could I start the processor VI within my main program, keep it running, and pass data into and out of it? I want to keep it running, as it is also part of the user interface.

 

I'm sure I haven't explained this very clearly. I've taken a few screenshots of my code, but didn't see how to upload them here.

 

Thanks you in advance,

Jim

0 Kudos
Message 1 of 22
(3,970 Views)

Hi JIm,

 

"but didn't see how to upload" - well, there is a button labelled "Add attachments" below the tag line input (when writing a message)!

 

"How would I obtain/pass queue information between the two unconnected VIs?"

You can create the queue in the main vi and pass it's reference to both subvis. Using property nodes to move data between vi is not the recommended way!

Usually a slowdown occurs when (big) data arrays are built somewhere in your vis. Did you check that?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 22
(3,956 Views)

phalanx02895 wrote:

...

 

I'm sure I haven't explained this very clearly. I've taken a few screenshots of my code, but didn't see how to upload them here.

 

Thanks you in advance,

Jim


When you post a message there is an option beolow your edit windows called "Add Attachment".

 

Please post jpg or something small.

 

Use mulitple posts to post more or you could zip them (but that reduces reads by other peolpe).

 

Without seeing your code....

 

It sound like you are either repeatedly opening refs to the same VI or a buffer is growing.

 

You could use "named queues" to avoid passig the queue ref. Queues are about as fast as you can get when moving dat from one place to one place.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 22
(3,948 Views)

GerdW wrote:

Hi JIm,

 

"but didn't see how to upload" - well, there is a button labelled "Add attachments" below the tag line input (when writing a message)!

 

"How would I obtain/pass queue information between the two unconnected VIs?"

You can create the queue in the main vi and pass it's reference to both subvis. Using property nodes to move data between vi is not the recommended way!

Usually a slowdown occurs when (big) data arrays are built somewhere in your vis. Did you check that?


 

I see the link now. Thank you. I've attached the pictures.

 

I figured I would have to creat the queue in the main vi, but how do I pass that reference without wires? Maybe with an action engine as an in-between?

 

I've gone through my entire program to make sure I'm not building large arrays anywhere inside a loop. I also got rid of some places I was using property nodes (for local controls).

 

Thank you,

Jim

0 Kudos
Message 4 of 22
(3,947 Views)

 

Without seeing your code....

 

It sound like you are either repeatedly opening refs to the same VI or a buffer is growing.

 

You could use "named queues" to avoid passig the queue ref. Queues are about as fast as you can get when moving dat from one place to one place.

 

Ben


I've checked to ensure I'm opening refs only once.

 

I'll have to look into named queues.

 

Thanks.

0 Kudos
Message 5 of 22
(3,944 Views)

Hi Jim,

 

what is your problem with passing queue reference by wire?

You have to make sure the queue is created before the subvis are started so wires are the natural way to go in LabView...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 22
(3,940 Views)

Thanks for the screen shots.

 

I think I that we can serve you best if we work with you to learn how to use the queues so you can abandon the "set .... method".

 

I suggest you start by creating a VI with two loops that recieve a queue ref that is created prior.

 

Select one of the loops and create a sub-VI from it. That should show you how to pass a queue ref to a sub-VI.

 

If you get stuck post the code and we'll give you another little "push".

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 22
(3,936 Views)

GerdW wrote:

Hi Jim,

 

what is your problem with passing queue reference by wire?

You have to make sure the queue is created before the subvis are started so wires are the natural way to go in LabView...


 

The problem is that there are no wires connecting the main VI (that contains the producer-consumer loops) and my processing VI. I didn't know how to start the processing VI, keep it running (so the operator can open close the front panel at will), and pass data while having it wired.
0 Kudos
Message 8 of 22
(3,933 Views)

Ben wrote:

Thanks for the screen shots.

 

I think I that we can serve you best if we work with you to learn how to use the queues so you can abandon the "set .... method".

 

I suggest you start by creating a VI with two loops that recieve a queue ref that is created prior.

 

Select one of the loops and create a sub-VI from it. That should show you how to pass a queue ref to a sub-VI.

 

If you get stuck post the code and we'll give you another little "push".

 

Ben


Thanks Ben. I haven't done your exercise yet, but see how that will get the queue into the other VI.

 

All I can say for myself is "Duh!".

 

I'm off to make the change. I'll post my results later.

 

Thank you.

0 Kudos
Message 9 of 22
(3,920 Views)

phalanx02895 wrote:
...

Thanks Ben. I haven't done your exercise yet, but see how that will get the queue into the other VI.

 

All I can say for myself is "Duh!".

 

I'm off to make the change. I'll post my results later.

 

Thank you.


Jay Grassel (now with NI and one of my early "G-Daddies") taught me early on that if I did not know how something in LV worked I "should do a ctrl-n* and try it out."

 

Ben

 

* ctrl-n = Open New VI

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 10 of 22
(3,894 Views)