LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

According to an input quantity, generate the corresponding quantity of the waveform chart

Solved!
Go to solution

Hi, I am using the waveform chart of LabVIEW, but I have a problem. Is there a way to generate the corresponding number of waveform charts at run time based on the input value of an input control? Or to put it another way, can you configure the variables displayed in the waveform chart at run time? Thank you very much for providing me with some ideas.

0 Kudos
Message 1 of 16
(1,975 Views)

@SliverAsh wrote:

Hi, I am using the waveform chart of LabVIEW, but I have a problem. Is there a way to generate the corresponding number of waveform charts at run time based on the input value of an input control? Or to put it another way, can you configure the variables displayed in the waveform chart at run time? Thank you very much for providing me with some ideas.


Your description was a bit vague, but you can configure individual plots on the chart.  Do you need each plot in its own chart, or can you have them all in one?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 16
(1,948 Views)

I'm sorry if my description is not clear. A detailed description of the problem is as follows:
I have placed several waveform charts on the interface, and I hope that my users can control the variables displayed in these waveform charts by inputting variable names in the front panel,instead of going to the block diagram interface every time to make the waveform chart show the waveform of corresponding variables by programming. For example, my hardware has obtained six variables A, B, C, D, E and F through sampling. I hope my user can input A in one input control on the front panel, let waveform chart 1 show the waveform of variable A, and input C, E in another input control. Let the waveform chart show the values of two variables C and E (or any number of other variables). I considered using clusters to package all variables and connect them to the waveform chart and then select variables by legend, but this method is too CPU intensive and not convenient for my users. Could you give me some other ideas?

0 Kudos
Message 3 of 16
(1,932 Views)
Solution
Accepted by topic author SliverAsh

If your users were all expert LabVIEW Programmers, you could give them the code and say "OK, make the Plots that you want/need in the style that you would like to see them".  But that is rarely the case!

 

So some decisions need to be made.  Here are some of them:

  • What do you want to show?  Is it a slowly-evolving time series (like the temperature measurement, or perhaps weight), something that is "fast" (a recording of a neural signal lasting milliseconds), an "on-off" indication (contact-closure, generally "slow")?
  • How many signals can a single chart support?  Is there likely to be a problem with "overlap"?
  • How much "screen space" can you devote to the Charts?
  • What is the relative "speed" of the data you are plotting relative to human visual processing?  It gets difficult to see changes that update faster than 20-50 Hz, for example.

Let's say you have 6 signals of moderate frequencies.  Just for the sake of illustration, I'm going to assume you sample at 100 Hz and want to see the most recent 6 seconds of results, meaning you need a chart of 600 points (it might look "nicer" if you make it 601).  You can:

  • Plot all 6 signals on the same Chart.  Color them differently so the User knows which is which.
  • Create 6 Charts, one per signal.  This avoids plot overlap, at the cost of more "vertical" space requirements.

You can also "mix and match".  If you have a 6-signal Chart, you can add a Boolean control to each signal to turn plotting On or Off, so the User can choose to look at only Channel 3, or Channels 1 and 5, or all Channels. 

 

Alternatively, you can write six sub-VIs, one for each Channel, and pass each sub-VI one channel's worth of data.  If you don't actually view the data, this is not a big strain on the processor.  Now what you do is create a sub-Panel on your main VI, and, at Run Time, decide which of the six Channel's "Show Me the Chart" VIs you want to display.

 

More "customization", of course, means more skill required by you, the LabVIEW Developer.  The tools are largely there, you just need to learn how to use them.

 

Bob Schor

0 Kudos
Message 4 of 16
(1,909 Views)
Solution
Accepted by topic author SliverAsh

The number of plots on a waveform chart is determined by the data wired to it. A chart accepts a large variety of datatypes, and most support a variable number of plots that can change at runtime. (The only exception is a cluster, which is of fixed size).

 

charts accept:

  • dynamic data (Whatever is in there will be graphed. too opaque for me!)
  • waveform data (one plot)
  • arrays of waveforms (several plots and array size can change)
  • scalars
  • cluster of N scalars (N plots, fixed number)
  • 1D arrays (a plot getting multiple points per update)
  • 2D arrays (N plots getting M points per update). Make it a single row or column to get eiather one plot with x new points or several plots with one point each. Just play around and transpose if needed.
  • etc. etc.

If this does not get you started, you need to attach your VI so we can see what you have (simplify it to the essentials and substitute simulated data if necessary). Too many possibilities to give a generic solution that fits all scenarios.

 

To let the user choose at runtime what to plot and where, "herding cats" comes to mind. Do all charts update at the same frequency? What should happen to the history data if the users swaps plots between different charts at runtime? etc. etc. If all charts update synchronously, the simplest would be to keep a 2D array of data in a shift register and, for all possible inputs, replace the oldest with the newest with each iteration. create a switch matrix to reassemble the various rows to the various graphs for display (i.e. no longer use a chart because you keep an explicit history!). Whenever the selection changes, you can update all legends and axes using property nodes. The x-axis is shared by all graphs and you should decide what to show.

0 Kudos
Message 5 of 16
(1,897 Views)
Thank you very much for your patient answers. I will make further attempts first~
0 Kudos
Message 6 of 16
(1,824 Views)

Thank you very much for your patience

0 Kudos
Message 7 of 16
(1,870 Views)

Hi,altenbach.

I tried to do an experiment, I have my VI and application screenshots packaged upload share
The general idea of the program is as follows: my lower computer would arrange the collected variable parameters and send them to the upper computer through Ethernet. In the simplified VI I uploaded, I used a for loop and output the number of loops to form an increasing array to replace the collected variable data. I tell the waveform chart which variables I want to observe by typing a comma delimited string before the program runs. Note that I set the cluster size to 5, as it is not common to display more than 5 variables on a single waveform chart. Considering that when the number of variables displayed is less than 5, the curve with a value of 0 will be displayed in the waveform chart, I added a Boolean array to remove the excess curve.
welcome to make some valuable changes to my program~

Download All
0 Kudos
Message 8 of 16
(1,778 Views)

Sorry, I don't have access to LabVIEW 2021 at the moment. Can you "save for previous" and attach it once more. Make sure the string control contains typical default data.

 

(Just looking at your code, it is pure Rube Goldberg. You should not need any downhill sequence structure, and all these local variables. Way too many loops! Way too little autoindexing. You definitely need to spend a little more time on tutorials)

0 Kudos
Message 9 of 16
(1,766 Views)
Solution
Accepted by topic author SliverAsh

Don't use a cluster if the number of plots can change!

 

See if this can give you some ideas. We simulate 10 data traces and pick the ones based on the selection string entered before the run.

 

altenbach_0-1662386512025.png

 

0 Kudos
Message 10 of 16
(1,760 Views)