LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem reading Data live on MainVI from SubVI's SubVI (multiple SubVI's down)

 

Dear LabView-Community,

 

I have a MainVI, where an indicator should show the progress in a for-loop of a SubVI inside a SubVI.

 

As I can find many examples showing a solution to similar problems when there is only a Main and a SubVI, I can't find a suitable solution to my problem

 

On the lowest SubVI-Level (Sub1.VI) I connected a property node to my indicator-value and a Ctl´RefNum.

On the SubVI above I created a Indicator and a reference that goes into Sub1. I can see the value live there.

On the MainVI I did the same, yet I do not get results.

 

I think it gets clearer once you look into the code. The example code is attached.

 

I hope someone can help me on this problem, since it's very important for my thesis.

 

Thanks in Advance,

 

Dennis

Download All
0 Kudos
Message 1 of 4
(2,431 Views)

Dear Community,

 

I immeadiatly saw the mistake the minute I posted it.

 

The solution is a simple, yet crucial wiring change, as shown in the code attached.

 

Sorry for creating a new topic. 

 

Greetings,

Dennis

Download All
0 Kudos
Message 2 of 4
(2,421 Views)

I had a look at your VIs. Yes, it is possible to pass data between VIs using references and property nodes, but this technique is not efficient in many cases. If you just need to change the state of a Boolean control sometimes, using a ref and property node is totally OK. But if you need to pass larger amount of data frequently, it is a no go.

A much better solution to use Queues, Notifiers, Functional Global Variables, or Dynamic User Events to communicate between modules or VIs (the actual requirements often decides what is a preferred method).

 

Here is some further reading: http://digital.ni.com/public.nsf/allkb/74ECB57D3C6DF2CE86256BE30074EC47

 

Edit: and your VI examples are full of possible race conditions.

Edit2: if you have access to the Core1-2 online trainings, you should take them. There you can learn a lot about subVIs, data flow, etc...

0 Kudos
Message 3 of 4
(2,400 Views)

Could you explain more specifically what is your goal? If we get more info, we can give better advice what method/ design pattern would serve you best. It might be for example, that a simple Producer/consumer design what you are seeking...

0 Kudos
Message 4 of 4
(2,393 Views)