LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reusing charts in a case structure

I have a chart on the front panel.

 

I need to output tuples to it in two different cases (in the same case structure). How does one do it without creating copies or running into naming conflicts ? 

0 Kudos
Message 1 of 7
(3,679 Views)

hi

well, maybe I shouldn't say it, I am doing this with a local variable ...

N

0 Kudos
Message 2 of 7
(3,674 Views)

You don't give enough information to solve the problem, but if your case structure has only two cases, you would place the chart terminal after it.

 

If you have more than two cases and not all cases update the chart, make one case handle all the cases that update the chart, and inside that case place a second case structure before the chart terminal that further distiguishes the various cases.

 

All clear? 🙂 

0 Kudos
Message 3 of 7
(3,650 Views)

I am sorry I did not provide enough information earlier. Here is the situation:

 

I have 3 cases.

 

The front panel has two waveform charts (2D - call them a and b) and three intensity charts (3D - call them c, d and e).

 

Case 1 updates a.

Case 2 updates b.

Case 3 updates c, d and e. In addition, I want each y raster of case 3 (assuming x and y are the variables and loop on y is nested in loop on x) to update a, and each x raster (slower than the y raster) to update b.

 

As you can see, your suggested solution would make it immensely difficult to carry this out and lead to loss of program clarity (which I do not want). 

Message Edited by m-s on 02-13-2010 03:26 PM
0 Kudos
Message 4 of 7
(3,640 Views)

Your description is not all that clear. A simplified VI would probably help.

 

A local is not necessarily bad. Just be aware that they might force additional data copies in memory, so keep your chart histories and update rates reasonable. 

0 Kudos
Message 5 of 7
(3,624 Views)

Most of the time I also solve this using local variables. But I only use it for display/to update the graphs, not to transport the data (this goes via wire/shift register).

An alternative would be a (queued) message handler. The slave would have the cases 'update a', 'update b', ... and the main loop would send the update messages. But how to get the data aquired in the main loop to the slave loop. You can add it as data value in the queue, but this also involves a extra data copy, or some kind of local variable (LV2StyleGlobal, by-ref OOP).

 

Some more ideas:

* usa a SubVi to display the graph and load it into a SubPanel. Then you call the subVi in any of the cases.

* Bad idea: use a reference to the graph and the 'Value' property, this will be very slow.

 

For good performance you could update a via terminal in case 3 and via local in case 1. For clarity, you could just place a text inside which cases there are writes to terminal/local variables (basically what you posted here).

 

Felix

0 Kudos
Message 6 of 7
(3,606 Views)
You could also place each chart terminal inside a small case structure after the main case structure. All you need to to is generate a TRUE output from the big multicase structure for any charts that needs to update. Make the output tunnels to use default if unwired, so only a few TRUE diagram constants are needed in the entire stack.
0 Kudos
Message 7 of 7
(3,597 Views)