From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I make waveform graph and/or excel file with two different dynamic DBL values?

Solved!
Go to solution

As the question describes, I have two dbl sources from a load cell and linear actuator (from firgelli). I want to make a load/displacement curve from the force readings from the load cell and the displacement readings from the linear actuator. The load cell outputs an analog signal that can be acquired by a DAQ and the actuator comes in with a board and VI program to control the speed and measure the displacement of the actuator to a sample rate of my choosing. Is there a way that I can make a VI where it continues to collect data and construct the graph I'm looking for?

0 Kudos
Message 1 of 11
(4,877 Views)

Hello,

 

There are many examples regarding graphing and writing data to files in LabVIEW. Two that may be specifically help full are “Waveform – Write Waveforms to File.vi” and “Waveform – XY Pairs.VI”. These are both found in the NI Example Finder, under Fundamentals>>Waveforms. Also, here is a link to writing data and Excel File using an Invoke Node:

 

Moving Data From LabVIEW Into Excel

http://www.ni.com/newsletter/51339/en/

0 Kudos
Message 2 of 11
(4,840 Views)

So I try to export data with a waveform chart (right click method). Can this function only be done with a waveform graph? Also, how do I combine the two dbl values? For instance, I am trying to make a stress/strain curve with one set of data as the displacement and another as the force. But everytime I try to build an array of the two DBL wires it only gives one set of data points.

0 Kudos
Message 3 of 11
(4,815 Views)

A couple points about your application:

 

1.  Synchronization.  Since you're ultimate goal is a stress/strain curve, it is vital that your force and displacement data be synchronized appropriately.  If your sampling is beyond a few times a second, this is not really possible without some form of hardware synchronization via either a trigger and/or sample clock.  Two NI DAQ boards can be synchronized this way easily, but it seems you're using 3rd party hardware for one of these processes.  Would need to know more about that board to know what options you have.  You could specify what your resolution is in distance, and how fast the article will be moving, to get an idea of how fast to acquire, and how well you'll need to synchronize the data.  Another option, since it appears each data stream will be sampled on a hardware-timed sample clock, they will be offset in time, but not skewed during the acquisition.  You may be able to identify a feature in the data set common to each and use that to remove the timing offset after the process is completed.

 

2.  Display.  To display data during the acquisition process, I usually recommend at least one display that plots vs. time.  Much easier to spot irregularities with the acquisition process that way.  However, if you'd like to also plot force vs. displacement, you can use an XY Graph to plot parametrically. For Example, in your case you would use the Displacement data as the X coordinates, and the Force data as the Y coordinates.

 

3.  Saving data to file.  I would recommend using the Save to Spreadsheet File.vi (File IO pallette) to save your data.  If you use a comma as the delimiter, and save the file with a *.csv extension, you will have a file that is easily read into excel.  The standard tab-delimited spreadsheet file is also fine, it will just require an extra step to read it into excel to specify to excel what the delimiter is.

 

4.  Batch vs. Real-Time Recording (Data File).  If your process is short (< 30 sec) you may be better off acquiring the data, Storing it locally to the VI (Array - usually maintained in a shift register), and then writing the file with a header (acquisition parameters, test article information, data column headers) and the data all at once in batch mode to the file after the process is finished.  If, however, it is longer than that you would be better off starting a data file with a header and appending the data to the file as you go, so that if something happens during your test, you at least have data up to that point.

 

Hope this Helps,

 

Kurt

Message 4 of 11
(4,800 Views)

So right now I'm using an arduino UNO and a board provided by the linear actuator company. The company also provides a VI to control the actuator with a sample rate, speed, displacement graph etc. The VI itself also provides a waveform chart to show displacement overtime which is useful. So it seems like what you're saying is even though I specify a specific sample rate (say 1 sample per 100 ms) the data acquired may not be every 100ms since there's a hardware offset?

 

As for saving the data, could I somehow take the data gathered from the shift register and write it to a spreadsheet file?

 

With the arduino, I'm using a 3rd party software in LINX (LVH) to control the microcontroller. Couldn't I put a wait counter in a while loop to help ensure synchronization from the two sets of data?

0 Kudos
Message 5 of 11
(4,752 Views)
Solution
Accepted by topic author jwl287

I think I see where the confusion is.  It looks like your displacement data is not be coming directly from a sensor (LVDT, etc.), but from the control software.  If that's the case, you're sort of stuck with software timing, which will not be well synchronized at all.  Still not really sure what the entire setup is - but if you don't have access to any displacement data other than from the control VI that drives the actuator, you have limited options.  It depends on where that data comes from and how it's processed.  My original comment assumed displacement data coming from a sensor into another (Non-NI) board.

 

You can absolutely use the data in a shift register (or the History Data Property Node from the Waveform Chart - as someone else suggested) to save data to file.  Use the Write to Spreadsheet File.vi.  There are examples that show how to do this. 

 

I would begin by trying to start the processes (motion and data acquisition) as close to at the same time as possible, let them run independently but in parallel, then after you have some data you can see if they're synchornized well enough for your purposes.  If you put them both in the same while loop with software timing (wait ms) you're going to get inconsistently timed data from both data sets.  Better to use hardware sample clocks when you can.  If your test article is moving very slowly, it may not matter how you do it.  If it's moving fast, it will matter that your force data points line up with your displacement data points more closely in time.

 

Good Luck!

 

Kurt

0 Kudos
Message 6 of 11
(4,740 Views)

Okay that's what I was planning on doing. Yeah unfortunately due to costs I had to really budget down and use 3rd party units to do my project.

 

Thank you so much for your help.

0 Kudos
Message 7 of 11
(4,684 Views)

Dear Friend,

                      I want to draw a voltage(on x-axis) verses current(on y-axis) plot from text file.my text file and vi is attached.Can sombody help me how i can do it????????????I am reading from two text files current.txt and voltage.txt its ploting fine.I need to combined these both on one graph voltage on x-axis and corrosponding current on y-axis.

                                          Thanks

Download All
0 Kudos
Message 8 of 11
(4,663 Views)

Use the XY Graph to plot two sets of data parametrically.  See attached.  Your X data (Voltage) is not increasing (or decreasing) contiguously, so your plot is not a function as-is.  I added a "Sort" option to order both sets of data with increasing voltage.  Check it out both ways (sorted vs. not sorted) to see which makes the most sense for you.  Not sure if your voltage data is being retrieved properly.  Seems odd to have such low resolution for Voltage but such high resolution for current.  Just a thought.

 

Kurt

0 Kudos
Message 9 of 11
(4,617 Views)

Dear Friend,

                       Thanks for replay.please save this VI for previous version because i have labview 9.0.

 

Dear friend i am applying different voltages high and low for having some delay of 10s as my application requirement. I am in designing phase.i actually want a voltage on x axis increasing from 10v t0 350v with

5v step and 10seconed delay and plot their correponding current on y axis.

 

                                                                Thanks

0 Kudos
Message 10 of 11
(4,557 Views)