LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Selecting plots to isolate/show on a graph is not working

Hello,

 

I am trying to isolate one signal at a time to show on the graph when inputting 3 signals using 3 Simulate Signal VIs.  I have attached my code below.  This would be great if it weren't for these problems:

 

  1. Signal 3 that shows up whether its "show plot" button is pressed or not. 
  2. Signal 1 shows up  when Signal 3 is on.
  3. The only one that "acts right" is Signal 2.

Can someone please help me to troubleshoot this?  I originally had them all with their own Property Nodes but I saw no differences when I combined them to the same node and clustered the booleans. 

 

The inputs with their corresponding booleans are:

 

Signal 1 = Sine 1 = 10.1 Hz,1V, Boolean 2
Signal 2 = Sine 2 = 100Hz, 3V, Boolean 3
Signal 3 = Sine 3 = 100Hz, 2V, Boolean 4

0 Kudos
Message 1 of 5
(2,432 Views)

Hi GradStudent,

 

I was able to open your VI and edit it to make it work for you.  For some reason, when you tried to index the array after you merged the signals together, it was not correlating the indexed numbers to the corresponding simulated signal.  The first think that I did was to reverse the order of your active plot and plot visibility for each signal in the property node. Next, I deleted your index array function and simply wired constants to each of the Active Plot nodes.  

 

I have attached a picture of the block diagram here as well since I am not sure which version of LabVIEW you have.  The attached fixed VI is in LabVIEW 2010. 

 

Block Diagram.png

 

I hope this helps!

 

Kim W.

Applications Engineer
National Instruments
Message 2 of 5
(2,420 Views)

You don't really want to hammer these property nodes with every iteration of the loop. It is sufficient to run them once at the beginning and then only when the control changes. I would use a parallel event loop instead.

 

You should also make the code more scalable. If you iterate over the plots, very litte code changes are needed when you want fewer or more plots later.

 

Here's a quick draft. Also, unless you simulate acquisition timing, place a small wait inside the loop.

 

Download All
Message 3 of 5
(2,414 Views)

Thanks for the response guys!  I found someone's example yesterday that seems to solve the problem.  It pretty much looks like Altenbach's top half without the Event Loop. 

 

Kim: You made an interesting point in switching the Plot Visible and Active Plot around on the property node.  I tried to implement this on the new version but the Boolean buttons were off by 1 channel on the DAQ board so, I left it alone. 

 

Altenbach:  I'm not sure about adding Time Wait as this code will be inside a While Loop that contains code to write data (which it must do within a certain time frame while data is being acquired).  Also, what do you mean by making it more scalable? 

 

I've attached a screen shot below.

0 Kudos
Message 4 of 5
(2,405 Views)

 


@GradStudent wrote:

Also, what do you mean by making it more scalable? 


 

Using a FOR loop that automatically itereates over the existing number of plots is scalable, because the code does not need to change if you make changes in the future. For example you can use it equally well on a graph with 50 plots, the only thing you need to do is change the number of plots and the number of elements in the cluster. Even better would be to use a boolean array instead of a cluster, because it can be resized and adapted much more easily.

 


GradStudent wrote:

Altenbach:  I'm not sure about adding Time Wait as this code will be inside a While Loop that contains code to write data (which it must do within a certain time frame while data is being acquired).  Also, what do you mean by making it more scalable? 


Nothing needs to run at infinite speed. Without the wait, the execution speed will heavily depend on the computer hardware and is thus unpredictable. the program will also use 100% of at least one CPU core. The speed should depend on the given problem, and not on the compting hardware. If you run it on a new computer 10 years from now, does it really need to run 1000x faster than today? 😮 Think about it!!

 

0 Kudos
Message 5 of 5
(2,402 Views)