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: 

Inconsistent result using build array in loop

Solved!
Go to solution

I have build these snippet which is part of a larger vi to highlight the problem.

 

Basically using Labview 2012, I am trying to measure finite acceleration data over 1s from 3 IEPE accelerometers via National Instrument NI9234/cDAQ-9178 acquisition system (Ch 2 – 4). Ch 1 was excluded as it was connected to a microphone.  I wanted to convert them to rms displacement using SVL Integration.vi

 

Initially I have used the vi as in snippet A. As I will be extending the number of accelerometer to 10 , I wanted a less busy block diagram so I modified it to snippet B. The results were odd.

 

I was testing each channel with a calibrator which provided a 10m/s^2 acceleration at 10 micron displacement. Snippet A gives expected result when the channels were tested individually.  See fig 1.

 

Unfortunately snippet B gives expected result for Ch2 (10 micron) but unexpected ones for Ch3 (7 micron) and Ch4 (6.2 micron) when tested individually. The result were expected when all three channels were mounted on the calibrator.

 

At no time were any of the channels disconnected. It should still measure ambient acceleration. Here again this was not the case with using loop and build array.

 

Using build array and loop is not as simple as it seems. Where did I go wrong?

Download All
0 Kudos
Message 1 of 4
(3,096 Views)
Solution
Accepted by topic author Crawling

There is a Boolean input to the SVL RMS Level VI to restart the averaging.  Set this to TRUE.  That VI keeps a history within itself.  Each call of the VI should have its own memory space (Preallocated Clone Reentrancy).  So you are actually mixing the averages of your three signals.

 

Now to simplify your snippet B even more.  Use Delete From Array to remove the first waveform.  You can then simply use the Autoindexing input tunnel to process your waveforms (no need for the 3 wired to the N or the Index Array inside of the loop).  Also, you do not need the shift register and the Build Array.  Just use an autoindexing output tunnel to build the array.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(3,045 Views)

In case someone is interested with crossrulz last suggestion, here is the snippet. Thanks crossrulz

0 Kudos
Message 3 of 4
(2,989 Views)

Two minor tweeks:

1. You do NOT need the 3 wired to the N on the FOR loop.  The autoindexing tunnel will tell the loop how many iterations to perform.

2. You do not need the 1 wired to the Delete From Array.  It will default to a single item and I think it makes things slightly more efficient if you do not have it.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 4
(2,960 Views)