02-13-2010 04:48 AM
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 ?
02-13-2010 05:02 AM
hi
well, maybe I shouldn't say it, I am doing this with a local variable ...
N
02-13-2010 12:45 PM
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? 🙂
02-13-2010 03:23 PM - edited 02-13-2010 03:26 PM
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).
02-13-2010 05:14 PM
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.
02-14-2010 04:50 AM
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
02-14-2010 11:56 AM