07-21-2010 11:27 AM
Hi All,
First post here, so play nice =). I am trying to update a graph on the front panel from within one of my subvis, however it does not update it in real-time. It will only show the completed graph after the subvi finishes running. I have tried to use references/property nodes and I have also tried using my chart as a global variable, but neither of those methods have worked (I am probably doing it wrong). Can anyone provide a detailed walk-through of how to do this using either one of those methods? Or perhaps even a different method?
07-21-2010 11:48 AM
07-21-2010 11:56 AM - edited 07-21-2010 12:00 PM
Unfortunately, and I know this makes things far more difficult, I cannot provide any code. I can outline it for you, but I can't upload the code itself here. To start off, I will outline what I did with the global variable method:
1. I created a global variable and placed the graph I wanted on it.
2. Then I right-clicked on the global variable and did Select Item -> Graph.
3. I replaced the graph indicator in my subvi's block diagram with the global variable I had just created.
4. I placed the global variable on my main vi's block diagram, and right-clicked it to create an indicator.
If I have the global variable front panel open, I can see the graph being updated just fine. However, it does not update itself on my front panel. There is probably something minor that I am doing wrong.
If at all possible, I would prefer using global variables to accomplish this task, as it makes the diagram simpler. I don't think I would have to worry about race conditions, because only one portion of code can write to the graph at any given time anyways. At this point, however, I will pretty much do anything so long as it works.
07-21-2010 12:04 PM
07-21-2010 12:07 PM
Since you are creating an indicator of the global variable, why wouldn't it just automatically update whenever the state of the graph on the global variables front panel changes? Ah well..
What is an action engine and how would I use it?
07-21-2010 12:08 PM
07-21-2010 12:14 PM
Also, I had tried the reference method, but it did not work. This is how you do it, right?:
1. Create a refnum control in the subvi that links to the graph in the main vi.
2. I created a property node and wired the refnum control to it, selecting value in the property node.
3. I created an input terminal on the subvi's connector pane (to wire the reference in).
4. I created a reference and wired it to the newly created terminal on the subvi.
07-21-2010 12:50 PM - edited 07-21-2010 12:52 PM
@ModusPwnens wrote:
This is how you do it, right?:
Try this for a quick demo of the reference method:
07-21-2010 01:19 PM - edited 07-21-2010 01:27 PM
I just tried the equivalent of that in my project, and it did not work. However, I did not create a subVI out of it like in that example. I tried, and I actually just ended up with a giant clump of references and wires for some reason. In any case though, I did the equivalent. I wired a reference to the graph into the subVI, I linked that to a refnum control, and then I wrote the values to a property node. That should do the trick right? I mean, if it helps, I suppose I could provide a screenshot of the section of code in question...
EDIT: It turns out that for some reason the graph does not get updated at all anymore, even when the subVI finishes running. Maybe there is something else going on..
07-21-2010 01:34 PM
@ModusPwnens wrote:
I tried, and I actually just ended up with a giant clump of references and wires for some reason.
What else was in the selection (direct property nodes, local variables, etc)?
@ModusPwnens wrote:
EDIT: It turns out that for some reason the graph does not get updated at all anymore, even when the subVI finishes running. Maybe there is something else going on..
If you update it from within the subVI, and the subVI stops running, I would expect it to no longer update. 😉
@ModusPwnens wrote:
I mean, if it helps, I suppose I could provide a screenshot of the section of code in question...
Yes, please do.