LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why can't I use a DVR from a dynamically called VI

Solved!
Go to solution

Hi all

I've created the following two VIs. Place them in the same folder and open testDVR.vi.

Run it once with bCallMode=false and once with =true and see what happens....

Why can I access and use the DVR when using the Call-by-Reference-Node and not when using "Run VI"(resulting in Error 1556)?

As one can see the reference to the DVR is always the same, regardless how the DVR_generator.vi was called.

 

Thanks in advance

Christian

 

 

Download All
0 Kudos
Message 1 of 25
(4,133 Views)

Could you post images so other could play along?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 25
(4,103 Views)

Hi Ben

 

what do you mean? Aren't the two VIs sufficient? Do you need them in LV2009?

Or do you prefer screenshot's so you could build them yourself?

 

EDIT:

here are both VIs as LV2010 snippetstestDVR.pngDVR_generator.png

0 Kudos
Message 3 of 25
(4,101 Views)

The only machine I have that has connection with the outside world only has LV 7.1.

 

To look at code newer that that requires I download to my machine, transfer to a server, transfer same server to PC then look at the code.

 

If I know the answer, 90% of the time I can just look at the diagram (an image of the diagram) to be able to help.

 

And then there is the issue of the fututre...

 

Images will always be as valuable to threads tomorow as they are today. All you have to do is look at the traffic in the "Upgrade" thread to see that actual code goes "stale" quickly.

 

Take care,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 25
(4,093 Views)

Hi Ben

 

thanks for your insight...I will keep that in mind.

I thought I prepare VIs so everybody could play along...without thinking at the developers not having 2010 or the ones not having access to 2010 AND the net at the same time Smiley Wink

0 Kudos
Message 5 of 25
(4,090 Views)

I suspect the LV clean-up is the isuse.

 

All resource created by a VI are cleaned-up when the VI closes. To keep a resource alive the VI that creates them must stay executable. Same thing applies to queues etc. I suspect if you put a "is a valid ref" node on that wire it would show invalid.

 

Not sure if that helps,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 25
(4,089 Views)

Hmmmm, I'm not sure if I can follow you...what do you mean with "is a valid ref"?

 

Just to clarify it for those not having the possiblity of playing along with the VIs:

when using the false state (as shown below) everything works as expected. But when using the true-case as shown in a thread above I get the error 1556. However the DVR-references are are both times the same (when read in testDVR and compared to the one generated in the DVR_generator.vi)

 

testDVR_falseCase.png

 

0 Kudos
Message 7 of 25
(4,084 Views)

Ben is correct about the cleanup operation. When a top-level VI goes idle, it cleans up all its LV references that it created automatically. This is what is happening. You run the VI dynamically with the Run method, which runs it top-level. It runs, but quickly stops and goes idle, and destroys the DVR ref.

 

Is there a reason you want to be calling this VI dynamically? If you want to persist your DVR refs, don't have the top-level VI create it directly. Instead, use an Action Engine (functional global) to create and store the ref on the dynamic VI side, which can also be read from the launcher VI side. Since the action engine VI creates the ref, and won't go idle when the dynamic VI stops (because it is still running in the main VI), the ref won't get cleaned up.

Jarrod S.
National Instruments
Message 8 of 25
(4,065 Views)

Thanks for the follow-up Jarrod!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 25
(4,052 Views)

Hi Jarrod and Ben

 

thanks for your replies so far.

Actually I'm not having problems with the DVR per se but with a GOOP4 class. I just tracked the problem down to that...

I was trying to load a GOOP3 class dynamically which has a GOOP4 class as member but I wasn't able to do so. Maybe the guys at symbio already came up with a solution to my problem.

Also I thought as long as the ref to the VI isn't closed the data-space of that VI is kept alive

0 Kudos
Message 10 of 25
(4,051 Views)