LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XY graph data type problems

Hi, this is my first post on NI so I'll try to be as complete as possible.  I have been playing around with LV student version 8.5 for a few days, it came bundled with the USB 6009 DAQ (great cheap system by the way).  I have used previous versions a labview, but not enough to troubleshoot problems.  The code i am trying to write is also attached.  The goal is to take a voltage vs current curve of any device, mainly a solar cell, LED (diode), resistor, or whatever you may want an IV curve for.  The main code is based inside a for loop with an analog output, and two analog imputs.  After some math and what not i would like to graph the voltage drop across the component vs the current in the circuit (found by taking that voltage across a known resistor).  When i try to come outside of the loop with the data i can never seem to get it to match up right to make a xy graph.  I've looked at previous posts and tried using bundles, as well as clusters, but i still can't get it to work.  I would also like to do a curve fit on the data, and write it to a file eventually.  Any advice would be appreciated! if you have any more questions just let me know.
 
Thanks again!
Kyle B
0 Kudos
Message 1 of 7
(3,391 Views)
There's a couple of things that you should fix. The first thing would be to use a single DAQ Assistant for acquiring both channels. Open the first and when you get the properties page, just click on the Add Channel. You can also select multiple channels when you first use the DAQ Assistant. The other thing involves the dynamic data type out of the DAQ Assistant. You can't wire it out of a for loop and then to an XY Graph. You could put the Build XY Graph inside the loop and wire a False constant to the reset input. The problem with that is that you are acquiring 1000 points with each scan and your graph is going is not going to look right. I'm not sure why you are acquiring 1000 points and then wiring the result to scalar indicators. That is discarding 999 of the points you've acquired. Instead, you could acquire a single point or take the mean of each 1000 points you acquire. If you stick with dynamic data type and use the single DAQ Assistant, you would use the Split Signal function to get the separate channels.
0 Kudos
Message 2 of 7
(3,373 Views)
I tried using one DAQ assistant, but i was unable to figure out how to split the signal, when i used the split function there was still only one output however, when i tried to reuse my cose i had written, i did what you suggested and wired a false boolean constant to the xy graph and let it run that way just to see what it would do, it seems like it was graphing a "cluster" of points for each real data point that i wanted, as if it ran at that value for the number samples i set initially.  Not sure if that description made sense.  By the way, those indicators were placed there just so i could see that values spit out as the loop ran from the initial to the final voltage.  It works when i watch that.  any more advice would be appreciated, thanks!
0 Kudos
Message 3 of 7
(3,369 Views)

The Split Signal function can be dragged to have multiple outputs.

As you have the DAQ Assistant now, with 1000 samples to acquire, for each analog output, you will have 1000 points graphed. That is why I said to change the number of samples to 1 or take the mean of each scan. What you want (I believe) is a single x and y value for each analog output. Because dynamic data can be just about anything and it really hides information, I really dislike it and never use it. You could also convert the dynamic data to something more meaningful with the Convert From Dynamic Data function.

0 Kudos
Message 4 of 7
(3,360 Views)

Hello Kyle,

Just to toss out a plug for our Example Finder, I'd like to make you aware of the XY Graph.vi shipping example.  You can find this example, which demonstrates four different ways to use the XY Graph, in the NI Example Finder (Help>>Find Examples) under Fundamentals>>Graphs and Charts

Best Regards,
T. McCarty

0 Kudos
Message 5 of 7
(3,337 Views)

Not to keep beating a dead horse, but i think i have fixed the problem, sort of.  Instead of using the express VI to take samples I used the DAQmx, which seems to work better. I can graph like i wanted, and write to files, and all the good stuff now, however, i am still having 3 problems with my program.  I have tried to use the daq mx write function instead of the daq assistant express VI to output a voltage, but i am not sure how to do this.  Another problem is that while switching to the daq mx i seemed to have lost the ability to control my sample rate, (a very large issue in large data collection). The last problem i am having is that while running this program, i am using almost half a gig of ram extra! i know that there must be something very inneficient about my program and i suspect it has something to do with mixing the daq mx with the express vi.  I have attached a revision of my code.. well a complete new code pretty much.  Hope you guys can help, thanks!

ps.  I'm not sure if my hardware supports multiple channels per task, i could be wrong though.

 

Kyle B

0 Kudos
Message 6 of 7
(3,317 Views)
Hello Kyle,

As a general rule of thumb, you should minimize the amount of code that is handled inside a loop structure to maximize program efficiency.  In your program, you use an Express VI inside a For Loop and you create your DAQmx channels inside the For Loop.  If you choose to use a loop structure, I recommend you create your channels outside the loop and just write values inside the loop to improve your program's efficiency.

I recommend you follow the structure of the examples located in the NI Example Finder.  You might begin by looking at the Acq&Graph Voltage - Int Clk.vi, which can be found the the Hardware Input and Output>>DAQmx>>Analog Measurements>>Voltage folder. 

As a general style guideline, you should also strive to include all inputs on the left border of your loop and all outputs on the right border of the loop.

Best Regards,
T. McCarty
0 Kudos
Message 7 of 7
(3,289 Views)