LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying a sub vi XY graph on main vi

Solved!
Go to solution

Hi all,

 

After trying to figure this out from the examples and other peoples questions, I believe I need some assistance. In my code, I have an XY Graph in a subvi. I am trying to reference that graph from the sub vi to the main vi so I can get  data in real time......or close to it.

 

Though this is probably pretty simple to do, I cannot figure it out. This is my first time doing this reference function. Instead of including my actual code, I created a sub vi and main vi example of basically what I am trying to do. I follow the steps from online NI instructions for setting up the sub vi but I get confused as to what should be done on the main. I just would like to mimic the XY graph from the sub to the main. 

 

Part of my question is should I just reference the X-Y coordinates and create the actual graph on the main or can I just reference the entire graph?

 

It would help me tremendously if someone could explain what I need to do for my particular example. I have spent a lot of time on this and have gotten nowhere. Attached are my example vi's of exactly what I am trying to do....not my actual code.

 

Thank You,

Ryan

 

Download All
0 Kudos
Message 1 of 10
(3,918 Views)

Hi Korpz,

 

wouldn't it be much (much) easier to use a queue to transfer data from subVI to mainVI (aka producer-consumer scheme) and have the XY graph in the mainVI?

 

A XY graph is just an indicator, the data is already available in the wire before the graph! ("THINK DATAFLOW!")

So transfer the data instead of trying to access an indicator…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(3,888 Views)

Hi GerdW,

 

Thanks for the tip. I will take you recommendation as that is why I asked. I do not have a lot of experience with these functions. I searched on the forums about producer/consumer and do understand the concept. The problem for me is that all the examples are within one vi. I am having a hard time grasping of sending information from a sub vi to a main vi while the sub vi is executing. I believe, and correct me if I am wrong, either way I need to use references....or maybe I am totally off. I am looking for a simple example I can use for my code and is why I attached the vi's.

 

Thanks

0 Kudos
Message 3 of 10
(3,877 Views)

Sorry, don't have LabVIEW 2017.  The simplest (and, to me, the optimal) way to display the sub-VI's graph is to put the sub-VI in a sub-Panel of the Main VI.  A sub-panel is a "window" through which you can view (and interact with) the Front Panel of a sub-VI.  You can "multi-task" the sub-Panel -- if you have several sub-VIs with similarly-shaped FPs you wish to view selectively, you can place the one you want to see in your sub-Panel, removing it and putting another one in when you want to see something else.  

 

In the "old days", there were Tab Controls.  I remember learning at one of my first NIWeeks that sub-Panels were much better ways of handling "seeing different sets of data on command) than Tabs, and I heartily agree (having done it both ways).

 

Bob Schor

0 Kudos
Message 4 of 10
(3,876 Views)

I attached a version in Labview 2013.

 

I am not sure using panels would work. This VI is open during the entire process of the main execution. I believe with panels, the sub vi window would pop up? I don't think doing that would be the best way in my application. I need a little clarification on how to bring the X-Y coordinate values to the main vi from the sub vi in real time. This is where I am stuck.

Download All
0 Kudos
Message 5 of 10
(3,867 Views)
Solution
Accepted by topic author Korpz

You don't (quite) understand sub-Panels.  Think of it as an area on your Main VI's Front Panel to show, whenever you choose, the Front Panel of a sub-VI.  You start your sub-VI running, and at some point, you want to "see" (and interact with) its Front Panel.  So you use the Insert VI Method, passing in a Static VI Reference to your Sub-VI (be sure to make the sub-VI's Front Panel "fit" what you want to see -- you can move Error In and Error Out "off screen", for example, and also make sure that the sub-Panel space on Main is the same size).  Now you see the Front Panel of your Running sub-VI.  When you don't want to see it (but want to keep it running), use the Remove VI method.  Finally, if you want to use the "space" for something else, you can set the Sub Panel's Visible property to False, and it will become "invisible".

 

I should note that I really didn't know if it was possible to "hide" the entire Sub-Panel, so I tested it with the code you sent, and it work fine.

 

Bob Schor

0 Kudos
Message 6 of 10
(3,855 Views)

Hi Bob,

 

Actually I was thinking about it more and thought it may be a good idea. If I used a reference then I assume I would have to loop it for an update....with the sub-panels it would just show the sub vi running which may work out.

 

Do you have the modified VI's that you tested it with? I would like to see the example.

 

I appreciate all the help that I get on these discussion forums. I have learned quite a lot through them over the years.

 

Ryan

 

0 Kudos
Message 7 of 10
(3,852 Views)

Bob,

 

No need regarding example. It was pretty simple to do. I just need to work on formatting now. It is a matter of getting rid of the scroll bars and having it always open up in the proper location of the graph on the VI. 

 

Thanks,

Ryan

 

0 Kudos
Message 8 of 10
(3,846 Views)

Ryan,

 

     I often try to "talk through" the example to encourage you to "experiment".  Half of the things I learn in LabVIEW is because I tried something out ...

 

Bob Schor

0 Kudos
Message 9 of 10
(3,839 Views)

Bob,

I got the sub panel working and it works great....just the way I wanted. I actually had no idea this functionality existed. Thank you very much. One question though, any caveats you know of when using a sub panel and creating an installer package that I should know about?

 

 

0 Kudos
Message 10 of 10
(3,831 Views)