LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Splitting my Four Channels and Amplitude Control

Am having a problem with the coding of my application to achieve the behavior of an old application which am trying to imitate.  All I really need to achieve is have four channels/signals plot on my waveform graph and which I can chose to  display or not display with the Boolean buttons (channel1, channel2, channel3, channel4) for the different signals respectively.  That is channel1 applies to signal, channel 2 applies to signal 2, and so on.  Also, I want to use the numeric controls button (Numeric, Numeric2, Numeric3, Numeric 4) which acts as "amplitude controls" to be able to increase or decrease the height/magnitude of the respective signal plot that numeric buttons applies to. That is Numeric1 applies to channels1, Numeric2 applies to channel 2 and so on.  Currently, when I run my application, all I see is all four channels blended in one straight line/plot.  I want to be able to have all four channels separated and plot separately on my waveform graph as seen on a screen shot of an plod application that I have also attached here.  I truly need help, or suggestion on how I can troubleshoot this problem.

 

I have attached snapshot of my current code and also the behavior am trying to imitate.

Regards.

Download All
0 Kudos
Message 1 of 16
(3,243 Views)

Hi Tebefia, 

 

I have a couple of documents and an example I would like you to take a look at. 

 

Documents:

What Is the Difference Between Graphs and Charts in LabVIEW?

How Do I View Multiple Waveforms as Separate Plots on the Same Waveform Chart?

 

Example:

Graphing Mutiple Waveforms to a Single Waveform Graph

 

I think these may be helpful in guiding you toward plotting multiple waveforms simultaneously. 

 

As for the numeric inputs for changing the amplitudes of the signals, what behavior are you currently seeing? Do you have these numeric inputs within a loop structure? How is the data being passed as your program runs?

 

Best Regards,

Thomas B.
National Instruments
Applications Engineer
0 Kudos
Message 2 of 16
(3,199 Views)

One option that springs to mind is the mixed signal graph. You don't actually have to have mixed signals, but it's handy to fit multiple plots on a single control and be able to plot them in a stacked manner (or displaying one at a time).

 

Here's an example:

 

mixedg.png

 

I generate four sine waves, each with different frequencies. I send the array of waveforms to a Mixed Graph, having created four plot areas in the control (alas, not programmatically, similarly to cursors). I assign each plot to a different plot area, then set the size so they're nice and equal. Voila:

 

mixedgfp.png

---
CLA
0 Kudos
Message 3 of 16
(3,189 Views)

Extending that, if I want to toggle visibility, I can use the Plot.Visible? property for the Mixed Signal Graph. Similarly to the Plot.YScaleIdx property, you merely wire the active plot to it and a boolean.

---
CLA
0 Kudos
Message 4 of 16
(3,188 Views)

Hi Thomas B:

 

Thanks very much for your kind response to my questions.  Also, am very grateful to you for the Documents and Example you referred me to. No doubt, it would help in guiding me to tackling the problem I have been having concerning the plotting my signals on Waveform chart/Waveform graph.  I am going to review all.

 

In response to your questions to me.  Actually the numerical controls are doing what I want them to do, and that is enable me to increase or decrease the height/amplitude of the plotted signal on my waveform chart.  I found that out when I just applied a sinusoidal signal.  Yes, I have these numeric inputs/controls within a while loop, in which I have the Daqmx Read.vi and my waveform terminal too.  I reated a task of four channels using the DAQmx Create Virtual Channel.vi Function, reading it with the DAQmx Read.vi, separated the task into four 4 channels and also apply some multiplication with four different numerical controls using the "In Place Element Structure" (as shown on my attached snippet earlier).

 

Meanwhile, am having other problem concerning the waveform chart/graph.  For some reasons, I have a particular scale range that I want for my X-axis and Y-axis (say for instance I want X axis to be from 0 - 15000, and my Y axis to be from 0 - 150).  When I try configure my Waveform settings to do that, and I run my application, am not able to see any plot, unless I change both the X axis and Y axis to Auto Scale.  My question now is there any way I can force my desire scale range on both axis and still able to see my plots without necessarily using the auto scale?

 

Thanks for your time and help.

0 Kudos
Message 5 of 16
(3,183 Views)

Hi Thoult:

 

Thanks too for your contribution, and much appreciated.  However, from what you demonstrated, I don't want the four different sine waves plotted in such a way (as in four different windows/plot areas), rather I want the four different sine waves all plotted on one plot area.  How can such be acheived?  My thing is that I have to use the Build Array before inputting it into a waveform chart/graph, and which I could from the example sent earlier by Thomas B.  Although, am yet to try it in my application and see how it turns out.

 

Regards

 

0 Kudos
Message 6 of 16
(3,179 Views)

Hi Tebefia, 

 

Concerning the autoscaling issues you are seeing, it appears that your data is either not in the range that you are trying to specify for the X and Y axes, or it is small enough with respect to the domain and range you have chosen that it does not appear well. Additionally, it could simply be an issue with the X axis. If you are not outputting data to the graph/chart fast enough, given such a large domain, it may just be barely appearing on the left-hand side of the graph.

 

Autoscaling works because it effectively zooms in on whatever part of your data has already been printed to the graph. What data are you printing to the graph? Are the values large with respect to the domain and range you have chosen?   

Best Regards,

Thomas B.
National Instruments
Applications Engineer
0 Kudos
Message 7 of 16
(3,161 Views)

Thomas-B

 

Thanks for your reply since on thursday.  I have been struggling to still get my problem resolved, and no solution yet.  To respond to your question, am printing to the waveform chart raw acquisition data from usb-6218 DAQ device and stored in TDMS format.  I have four channels, sampling at 4096 samples per channel at a rate of 13000 samples/second.  Do you have further adivse, because even my waveform plot does not update or scroll?  What could be wrong?

 

Thanks again for your time.

0 Kudos
Message 8 of 16
(3,143 Views)

Hi Tebefia, 

 

Is there a reason you are printing raw data to your graph? When you acquire raw data, the constants used by the driver from your device to translate the data into the correct range are bypassed. This could be why it is not showing up in the expected range that you are setting on your graph. It would be better to simply read in the data using Nsamples on NChannels. 

 

Also, if you could provide a screen shot of your code and your front panel so I can see what behavior you are seeing, that would be great. 

Best Regards,

Thomas B.
National Instruments
Applications Engineer
0 Kudos
Message 9 of 16
(3,112 Views)

Hi Thomas-B

 

Thanks for your response.  Attached is a copy of the vi.

0 Kudos
Message 10 of 16
(3,099 Views)