# Multifunction DAQ

cancel
Showing results for
Did you mean:

## How to plot force vs. distance with XY Chart

Looking for help with a simple ? problem. How do I chart force versus distance with Labview? I have a loadcell and display with +/-5vdc output and an LVDT and display with +/-5vdc output. I want to use these two signals to generate an XY chart with force on the Y axis and distance (LVDT) on the X axis.

I can get close to desired results by doing the following: I combine current voltage of a channel (LVDT)with a shift register (initialized to zero) of the same channel into a 2D array. I do the same with the other channel (force) and then cluster those together as input to the XY Chart. All of this takes place inside a while-loop with a 250ms delay with the exception of initializing the shift registers.

The result is an XY chart that sort of shows a vector diagram instead of a single trace. The "vector" diagram looks like a straight line drawn between the two current x,y coordinates rather than a continuous line from one x,y coordinate to the next (desired). To make matters more interesting, everytime either coordinate changes, a fresh straight line is drawn connecting the new coordinates.

I know there is probably a simple solution to this, but since I'm a beginner it has eluded me so far.

Any ideas or suggestions would be appreciated.
Message 1 of 5
(4,140 Views)

## Re: How to plot force vs. distance with XY Chart

This is either the third or fourth question today about XY graphs. You moght want to go over to the LabVIEW forum to look at those answers and review the shipping example called XY Graph. For a single plot of an XY graph, you build a 1D array of x, a 1D array of y, and bundle them together. There is no 2D array involved at all. You can use two shift registers that each are a 1D array and with each iteration, use the append array function to add a new element to each. You while loop whould have a single bundle function that takes the contents of each shift register.
Message 2 of 5
(4,138 Views)

## Re: How to plot force vs. distance with XY Chart

Thanks for responding so quickly. What you've said helps in that your example is almost a carbon copy of what I've already been trying. The only real difference is your example uses two randomly generated numbers to simulate x and y whereas I'm trying to use two DAQmx tasks. That leads me to believe that maybe there is something wrong with how I'm acquiring my data. I spent all of today on this and most of that time has been spent just trying to find the best way to get two different channels worth of voltage into a vi. My original thought was to use two tasks created in MAX via two DAXmxRead vi's. That is how things appear in the attached vi (Labview 7.0).

The other thing I tried (which was so much easier) was to use the DAQAssistant to pull in both signals at once, then use a seperate SelectSignal Express vi to grab each individual signal. So far so good, but now I have a dynamic data type, and I'm not sure how to break that into the two 1D arrays I'll need for the cluster into the XY Graph. Is there a preferred way to grab signals? In this application, high speed really isn't a huge issue as I am applying a pulling force to a part until it breaks. Still I want to be able to see this on the graph and pick out what the maximum pull was (force) at point of breakage and also know how far the pull had progressed (lvdt).

By the way, you were correct about not needing 2D arrays for the XY Graph, I guess my brain just combined the two 1D arrays for me!

Thanks again,

Doug Rhodes

Message 3 of 5
(4,107 Views)

## Re: How to plot force vs. distance with XY Chart

Just like the DAQ Assistant, you can use DAQmx to read multiple channels with a single read. When you use the DAQmx Create Channels, your physical channels would be something like Dev1/ai0:1 (for continuous channels) or Dev1/ai0,Dev1/ai2 (non-continuous).

There are a couple of ways to use dynamic signals. You can use the Convert From Dynamic Data to get a scalar, array, or waveform. You can also use the Split Signal function. Also, the Express XY Graph (add from front panel) allows you to use dynamic data as inputs so the split signal would work well for that.

Message 4 of 5
(4,102 Views)

## Re: How to plot force vs. distance with XY Chart

Hi.

Did you mange build a force plot. I am a new user and got the same problem that you had that time.

could you help me out.

Regards

Greg

Message 5 of 5
(2,641 Views)