LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Efficient way to move graph value from SubVi to main vi ?

It depends on how you call your sub VI. If you are calling the sub vi directly in the main VI and if the main VI execution depends on the execution of your sub vi then its better to have the Array data (2d Array) connected to the connector pane and read it in main VI. The queue data transfer comes into picture when you are running your VI in a parallel loop or if you are running the VI somewhere else. Please show how you are calling the sub vi in you main vi

-----

The best solution is the one you find it by yourself
0 Kudos
Message 11 of 15
(1,234 Views)
As explained already, the scenario is simple: The SubVi is inside my main Vi. It is just one of the cases I am running in my simple state machine. I can also decide to replace the SubVi with all its block diagram objects so i don't have to use connector panes or queues or ref controls. I am just asking for the best way to do that. Perhaps the only benefit of having it as a SubVi is a tidy layout (to make the main vi not too dense with a lot of objects) in my main vi (or perhaps for memory management/ performance - I dont know ). So now does placing the queue out to a connector pane as shown in the previous vi amount to the same or worse as placing the 2D array directly to the connector pane in terms of memory management / performance ?
Should I rather replace the subvi with its block diagram objects or continue to use ref control and value property node?

[BADGE NAME]

0 Kudos
Message 12 of 15
(1,208 Views)

I wouldn't suggest a sub vi if it doesn't have large diagram and also your main VI has.If you think having a sub vi makes the main vi clean then you can do that. Passing the 2D array from the sub vi and use it in the main vi instead of a queue. 

-----

The best solution is the one you find it by yourself
0 Kudos
Message 13 of 15
(1,204 Views)

There is another way to approach this challenge that can work...

 

IF

The data updates are not terribly large such that they are a performance issue.

 

If so then...

 

Pass reference of the FP objcts of teh Main VI to the sub-VI and let the sub-VI do the chart updates and fiddle with the properties.

 

This approach will keep the details of the GUI adjustments out of the Top level VI and still acheive the final task.

 

If however...

 

Other porcess running in the application need to KNOW about the value updates....

 

Proceed with the Producer/Consumer approach recomended above.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 14 of 15
(1,200 Views)

As suggested Producer/Consumer design pattern is the best approach for performance and making the application modular.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 15 of 15
(1,193 Views)