LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically change number of digital displays

Solved!
Go to solution

What I'm trying to do is control the number of digital display for a waveform graph. I have a control that changes the number of plots for the graph, but when I add an element a new digital display for it doesn't appear. If I lower the number of inputs the digital displays disappear, but they never add any extras.

 

So for example in the picture below I started with 3 inputs. I then changed it to 5 and the legend updated automatically like it should, but there are still only 3 digital displays instead of 5. I currently have a property node that has a true constant linked to Digital Display(s) Visible. I've tried changing the number of inputs before I start running and while I'm running, but neither works. I'm currently using LabVIEW 2013. Thanks for any help or ideas, I really appreciate it.

 

Temperature Graph.PNG

0 Kudos
Message 1 of 6
(3,757 Views)

You don't have a graph, you have a chart (big difference!). Changing the size of the legend does not define the number of plots. Wire e.g. a cluster with 5 elements to the chart terminal and your digital display will probably appear.

 

Charts accept a variety of datatypes. What datatype are you currently wiring to the terminal?

 

(It always helps of you would attach a simplified version of your VI so we have more specific information)

 

Of course you can always use a plain array indicator for the digital display and change the number of visible elements programmatically.

0 Kudos
Message 2 of 6
(3,753 Views)

I'm using an indicator to control both the size of the legend as well as an index to show the correct amount of plots. I'm using a DAQ assistant to output every channel available, and index out the ones I don't need. Using a cluster might work, but I need to be able to dynamically change the number of inputs between runs.

 

The dynamic data from the DAQ assistant is converted to a 1D array of waveform, which is stored in an array with a shift register. That array is then wired to the chart to plot. I'm attaching the portion of the VI that graphs, the top part of the while loop is the part that controls the temperature graph. Once I get that working I can fix the bottom part the same way.

0 Kudos
Message 3 of 6
(3,720 Views)

You are constantly resizing array with a bewildering amount of code and datatype (array, waveforms, dynamic) and the compiler cannot determine the number of plots at compile time. If you want to go that route, create your own legend and digital display (e.g. as a 1D array of clusters).

 

There are plenty of things wrong with this code:

  • Why are you reading from the pink local variables instead of the terminal?
  • What is the point of the outer case structure?
  • Your "temperature" local variable causes a race condition because it might get read before the indicator gets updated. Use a wire to define execution order!
  • You only need to rewrite properties if they change, and not hammer them with every iteration of the loop.
  • Properties that never change (e.g. visibility checkbox) can be set at edit time and never need to be touched again.
  • Property nodes execute top to bottom, so you need to first select "active plot" before setting the name or you get a mess. (small FOR loops)

(These are just general comments. I have not analyzed the sanity of all these crazy array operations.)

 

Message 4 of 6
(3,711 Views)
Solution
Accepted by topic author mttmndl

I highly recommend you go through all Altenbach comments and implement them. Attached is a way to change the number of digital displays dynamically.

 

Ben64

Message 5 of 6
(3,646 Views)

Thanks to both of you for the assistance. I'm pretty new to LabVIEW and I realize my code is very messy, most of this was experimenting until I found something that worked. The vi I posted was only a portion of what I'm using, the local variables and outer case structure have nothing to do with the chart but make a lot more sense in the other loops I didn't include. I'll make sure to implement the rest of your suggestions, thanks again for the advice.

0 Kudos
Message 6 of 6
(3,637 Views)