LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying a custom graph

I'm having a problem graphing signals that I am reading from my PCI-6013 device. Basically, what I want to do is graph one of three signals being read by the device. The signal graphed should be the largest of the three values. If Signal value A is larger than value B and C, then I want A to appear on a graph. If B were to change and become the largest, then I want B to be graphed. Any suggestions?
0 Kudos
Message 1 of 20
(3,841 Views)
Hello,

What you will want to do is the following:

1) First, place a waveform chart on the front panel by right-clicking on the panel and selecting a Waveform Graph under the [Graph Inds] panel

2) Press [Ctrl]+[E] to go to the block diagram

3) [Right-click] on the diagram and choose [Signal Manipulation] >> [Split Signal]

4) You will want to wire the signal split icon to the output of your PCI device.

5) Now, you can compare the signals to determine the instantaneous maximum and plot the resultant signal. To do this, place a "waveform min and max.vi" SubVI on your block diagram. You can find this subVI by [right-clicking] on the block-diagram, selecting [All Functions]>>[Waveform]>>[Analog Waveform]>>[Waveform min and max.vi] Finally, you ca
n use the "max" output of the subVI to plot the instantaneous max value of all incoming waveforms.

I hope this helps. You may want to refer to the following discussion thread for example programs that perform similar actions:

http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RNAME=ViewQuestion&HOID=506500000008000000B99A0000&ECategory=LabVIEW.LabVIEW+General

Please let me know if you need further assistance. Have a great day!

Kind Regards,

Joe Des Rosier
National Instruments
Message 2 of 20
(3,841 Views)
Thanks Joe,
Your response was very helpful. I did not know about the "waveform min and max" VI. Another question...How would I wire all three signals into the "waveform min and max" VI? Would I merge the three signals together? I attatched my VI so you could get an idea of what I am talking about. Direct your attention to the upper right of the while loop. My three signals come out of a multiplication signs. Ultimately I would like the largest of these values to be displayed on the graph labeled power.

Matt
0 Kudos
Message 3 of 20
(3,841 Views)
There's a couple methods that immediately come to mind. You would use waveform min and max on each of the three and then have to compare the different max y values. You can do it with some Greater? functions and a nested case statement or build an array out of the Y values and use the array min max function. I've attached a sample VI that shows both methods.
0 Kudos
Message 4 of 20
(3,841 Views)
Matt-

Thanks for sending your code.

Ok, I made the assumption that your data is being taken at the same time intervals. I updated your code in the attached VI. The data from each dynamic data type signal is compared for maximal values at each position in the array (the auto-indexing feature of the FOR loop handles this), and the instantaneous data points are compared for a maximal value. Afterwards, the array of maximum values is displayed on a waveform.

I hope this helps. Please let me know if I can further assist you.

Best Regards,

Joe Des Rosier
National Instruments
0 Kudos
Message 5 of 20
(3,841 Views)
Thank you Joe and Dennis,
I think with your suggestions I will now be able to satisfy the requirements of my program. Because of some hardware difficulties at the office, I will be unable to test the program for a short time. However, once I am able to test I will let you know if I have any further troubles.

Matt
0 Kudos
Message 6 of 20
(3,841 Views)
Joe,
I tested the update VI that you provided. It seems to be working great. The only question that I have at this point...is there some way to indicate which one of the three signals is being displayed on the graph.

Matt
0 Kudos
Message 7 of 20
(3,841 Views)
Matt-

Visually representing which of the three signals is responsible for each data point is most easily accomplished by plotting the power waveform in regular format and overlaying the three raw signals on the graph as discrete-point plots.

If you plot the power waveform as a white line, you can plot the other three signals as overlayed bright-colored points. I made an example VI for you and attached it.

Once you've added the three extra raw signals to your output plot, you can modify the graph properties for each of the points. To do so, simply go to the front panel, [right-click] on the graph, select the "Plot" tab, and change the representation of the three raw signal plots to discrete points of contrasting
colors. You can reference my example VI to see how I adjusted the propertied. Note: I changed the color of the power plot to 'white' for the sake of nice contrast.

Your result will be a plot with all four waveforms, and it will be easy to see which raw signal is responsible for each maximum power point on the resultant waveform, since the colored data point will overlap the final (solid-line represented) signal.

I hope this helps. Please don't hesitate to ask for more help/clarification if necessary.

Good luck,

Joe Des Rosier
National Instruments
0 Kudos
Message 8 of 20
(3,841 Views)
Joe,

I liked your suggestion. The discrete-point plots nicely indicated which signal was reponsible for the high power output. Unfortunately we are again have some hardware trouble and I wasnt able to test it with the actual signals. I will get back to you with any further questions if neccessary.

Matt
0 Kudos
Message 9 of 20
(3,841 Views)
Joe,
I noticed a couple of problems with my VI the way it is set up. The graph looks great but for some reason the white power line isnt always the highest value on the graph. I included a screen shot to show you what I mean. Also, how do I rearrange my plot legend? Right now it is not in the order I would like. Finally, we have been having some problems with the VI freezing if it runs too long. I suspect its a problem with it recording too much data. Can I program a better format to avoid this problem? Would reducing the sampling rate help? If so, how do I do that? I will be on vacation for the next week so you will not hear from me. I look forward to solving this problem once and for all when I ret
urn.

Matt
Download All
0 Kudos
Message 10 of 20
(3,841 Views)