08-02-2012 09:00 AM
I don't think that structure is doing anything except outputting zero.
First, you have the thin orange wire, which holds a single double data value.
That value gets converted to dynamic data (required for the sample compression and the collectors).
The value goes through the sample compression. There is only a single data value, and it expects an array. It outputs zero.
The value goes through the collector. There is only a single data value, so it does nothing and returns the same thing.
The value is converted back to the thin orange wire and is still zero.
You could use a numeric constant of 0, but subtracting that from your original signal will do nothing, so I'm very confused what the structure is trying to accomplish. I attached that snippet which shows the path of data through the operations.
08-02-2012 10:14 AM
Actually that piece of code works fine, but I don't think it is efficient. What it does is create a buffer that is collected, then subtracts from itself to zero the input. I have tried to duplicate this without the sample compression and collector but it does not remain at the new "zero" value. It zero's it momentarily, but reverts to the original number. For example, I set up a test with the LVDT, which is reading lets say .005", I want to zero that input so that I start at .000" so if my specimen wears .002" that's what I'll be reading, not .003". There's got to be an easier way but I am having trouble figuring out the code.
08-03-2012 09:53 AM
Alright, I've looked more into what that code does and my initial assessment was wrong. I don't think it's quite doing what you want either though.
As far as I can tell the collector does nothing. The sample compression does this:
Loop Iterations (assumed inputs):
1-Collects 1 point of value 1, outputs 0
2-Collects 1 point of value 2, outputs 1.5
3-Collects 1 point of value 3, outputs 1.5
4-Collects 1 point of value 4, outputs 3.5
5-Collects 1 point of value 5, outputs 3.5
6-Collects 1 point of value 6, outputs 5.5
The vi waits for two values, averages them once it has them, and ouputs that average till it has two additional data points.
By subtracting your signal with this output it seems like you would be adding a consistent incorrect skew to your data.
It looks like you are more interested in having the initial readings show zero so that you can see the change in the system. Is this correct?
08-03-2012 10:32 AM
Correct, I need to offset the initial value so that I'm starting at a zero point. The torque also needs to do this because it is an oscillating test, so when I am at dead center of the stroke, I need to zero the torque so that I get an equal torque reading +/- about center. Any snippet of code that you can show me to point me in the right direction? I've tried to simple subtract the value from itself after doing a mean and then into a shift register, but the initial value returns after it does zero, I'm sure its simple and I'm in the right direction, but I'm having trouble with it.
08-06-2012 06:46 PM
You can try using the Statistics Express VI (Express->Signal Analysis palette). You will want to keep your data as the dynamic type however. There are some examples of this in the example finder under Analyzing and Processing Signals.
Why are you converting an array of dynamic data to a single value?
09-17-2012 12:34 PM
Ok so I am revisiting this problem VI, which I made corrections to, but still has that memory issue. The VI will run fine do what it's supposed to and the memory usage stays even and sometimes goes down a bit, but all of a sudden, and I cannot pinpoint what it is, the memory jumps almost exponentially to where it crashes my computer. I have attached the latest version which does work better than the original, but the memory problem persists.
04-02-2013 07:37 AM
After all the memory issues with the program in question, I went back to the original program which I think is a mess, and had no trouble at all. This program was done in LV 2009. I attempted to make another program eliminating some of the questionable issues and adding some others. I know my code isn't perfect, but I have been using this type of architecture in the past and had no memory issues at all. And our test have to run for 1500 hours or more, so running into a memory issue after a couple days isn't helping. I am posting my new code, which is messy and not perfect, but can someone point out what is causing my memory to instantly jump from 100k to 3GB almost instantaneously, without telling me how much of a mess and poorly coded it is. Thanks so much in advance.