07-05-2012 02:59 PM
I am wondering if there is any way to add a function in Labview that simulates a "Tare" (zeroing) function based on the first value of a reading. I assume this is a fairly often asked question and there is a simple answer to this (I understand that assuming can end badly thought =)). The only way I have been able to find on how to tare is doing a hard tare or manually inputting an intial value into the VI (reference: http://forums.ni.com/t5/LabVIEW/Adjustable-Calibration/m-p/924068#M415322). Is this still the only way to Tare data from a DAQ? If there is a standard link for this question please post it since apparently I am inept of finding it. Thanks!
07-05-2012 03:05 PM
Are you reading single points or arrays?
Assuming you acquisition occurs in a loop, you can do [i]=0 or the "first run?" primitive the get the reference value. Then keep it in a shift register or feedback node and keep subtracting it from the new data.
07-05-2012 03:27 PM
Altenbach,
Here is the VI I am currently using. I am bringing in 6 data readings from a USB 6210. I don't know how to do the [i]=0 or to keep it in the shift register so I will look into that. Thanks!
Coulton
07-05-2012 03:39 PM
This VI makes very little sense. Why are you appending one point at a time, followed by smoothing the entire accumulated data. This means that after N iterations, the oldest point has been smoothed N times! Can't you use a ptbypt filter instead?
Why can't you use a single shift register with a 2D array, and append an entire row per iteration? It would simplify the code at least 6 fold!
Sorry I don't quite understand where you want to tare? At the start of the program? The first time the "start" boolean turns TRUE? Every time the "Start" boolean turns TRUE?
07-05-2012 03:57 PM
Altenbach,
I apologize for the sloppy code, this is one of about 6 total LabView codes I have ever written. Essentially, I am aquiring 6 voltage inputs, but the voltage noise in the system is relatively high compared to the voltage difference I am trying to document. This filter was the only one I could get to work. I will try the ptbypt filter.
By using a single shift register and use a 2D array I would essentially attach a 2D array and replace the rest of my arrays with array?
Lastly, my goal is to have the program tare everytime the Start boolean is True.
Thanks for the help!
Coulton
07-05-2012 04:45 PM
I don't have DAQ, so here's a simple version that uses simulated data. I removed the filter, but you can add it again before the graphs. Simply define that columns are channels when converting to dynamic data and it will filter all channels with one instance of the express VI.
Of course you will be running out of memory at one point, accumulating data without limits, but I assume that you acquisitions are short.
07-05-2012 05:38 PM
Yes my acquisitions are relatively short.
Stupid question, how do you define columns as channels? I placed the filter after the array, but before the end of the if structure.
07-05-2012 06:34 PM
This VI is what I came up with when I defined columns as channels. I am still getting the same graph for all 6 graphs. Perhaps I missed something?
07-05-2012 07:49 PM - edited 07-05-2012 07:49 PM
I think it needs to be "rows are channels". I never use dynamic data, so whatever. 😄
It really makes no sense to filter the existing data over and over again, so the filter should be between the 2D array and the graphs. See if this works better.
(Sorry, I changed the filter to 10, please change it back.)
07-06-2012 01:10 PM
Alright,
I was able to get my sloppy version of what you built to run correctly, but for some reason the simpler VI that you built still reads the same data on all 6 graphs. Perhaps I am doing something wrong on my end?