LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous decimating Array of waveforms with custom aggregat functions

Solved!
Go to solution

Hello,

exists a solution to decimate an Array of waveforms with the aggregat functions MIN, MAX or  Mean?

I found Decimate (continuous) VI, but this can I use only for one waveform.

And it has only the integrated aggregat functions

  • last value (averaging = false)
  • mean value (averaging = true)

"Decimate (continuous) .vi" handle correct the case: Input size of Input Array < as decimation factor.

Than the output array is empty until the decimation factor is reached.

 

Peter

 

 

 

0 Kudos
Message 1 of 9
(3,764 Views)

Hi Peter,

 

exists a solution to decimate an Array of waveforms with the aggregat functions MIN, MAX or  Mean?

When you  know the algorithm you want to implement you can easily implement it…

So the answer is: as soon as you write such a VI!

 

I found Decimate (continuous) VI, but this can I use only for one waveform.

Use an autoindexing loop. Basic LabVIEW stuff…

 

Than the output array is empty until the decimation factor is reached.

What else do you expect for this corner case?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(3,749 Views)

Hi GerdW,

before I reinvent the wheel I ask. Possible there is a libraray.

From your comment I assume, you dont know such library..

 

And try:


@GerdW

 I found Decimate (continuous) VI, but this can I use only for one waveform.

Use an autoindexing loop. Basic LabVIEW stuff…

You will fail, because of the shift register inside Decimate (continuous) .vi. Then you will mix the history of the n channels of the waveforms. Inside of the while loop a for loop is needed similar vi.lib\measure\macond.llb\Implement IIR Cascade Filter for N Chan.vi. But I can not use DecimateContinuous_H in lvanlys.dll. It returns only the mean.

 

But why you write so aggressive?

If I have no answer, I don't write anything.

I have no problem, if the question did no get an answer. Then I build my solution and can post it.

 

Cheers,

Peter

 

 

0 Kudos
Message 3 of 9
(3,737 Views)

Hi Peter,

 

But why you write so aggressive?

Where have I been "aggressive"? I wasn't and I didn't intended to…

 

If I have no answer, I don't write anything.

I had an answer: Because you wanted to implement a very specific behaviour, which is not covered in the generic tools coming with LabVIEW, I suggested to implement your own VI.

 

Then you will mix the history of the n channels of the waveforms.

Using all inputs of the Decimate function you will not mix any waveforms:

check.png

(Just for "proof of concept", the dt of the decimated waveforms is wrong and needs to be corrected.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(3,725 Views)

Hi GerdW,

you can not set the reset control to true. See help:

reset? controls the initialization of the internal states. The default is FALSE. The first time this VI runs or when reset? is TRUE, LabVIEW initializes the internal states to zero. When reset? is FALSE, LabVIEW initializes the internal states to the final states from the previous call to this instance of this VI. To process a large data sequence consisting of smaller blocks, set this control to TRUE for the first block and to FALSE for continuous filtering of all remaining blocks.

 

And that is the reason it can handle correct the case: Input size of Input Array < decimation factor.

 

This vi has only one internal state. You can not use it in a loop for different channels. You will mix the internal states of the channels.

 

Look inside vi.lib\measure\macond.llb\Implement IIR Cascade Filter for N Chan.vi (called by "digital iir filter for n chan") how to keep states for n channels: The shift registers must hold arrays for the n channels.

 

Peter

0 Kudos
Message 5 of 9
(3,707 Views)

Hi Peter,

 

you can not set the reset control to true. … You can not use it in a loop for different channels. You will mix the internal states of the channels..

I can and I did…

In the snippet above those three waveforms in the array are decimated without influencing each other!

Proof:

check.png

But again to summarize this thread: as you want to use some different kind of decimation (like min, max) you need to implement your own VI. As you seem to have an additional requirement to handle arrays of waveforms as well you can implement this too.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(3,691 Views)

Hi GerdW,

Your example is only 'single shot'. Then you can also use "Decimate (single shot) VI".

It will not work correct to decimate waveform arrays in a continuous loop. One exception: The decimation factor is a integer divider of the Y-Array Size. Then no history is needed.

 

Best regards,

Peter

0 Kudos
Message 7 of 9
(3,680 Views)

Hi Peter,

 

now I understand your concern!

 

Conclusion: write your own routine to handle all your decimation requirements…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 9
(3,675 Views)
Solution
Accepted by topic author Peter_S

The solution is:

Sample Compression Express VI
Owning Palette: Signal Manipulation Express VIs
Acquires a large number of data points and compresses the data points into a smaller number of points.

Reduction Methods Contains the following options:
Minimum—Reduces the Signals input by using the lowest value in each segment.
Maximum—Reduces the Signals input by using the highest value in each segment.
Last—Reduces the Signals input by using the last point in each segment.
Mean—Reduces the Signals input by using the mean value of the points in each segment.
Median—Reduces the Signals input by using the median value of the points in each segment.

 

Only the reduction size is no frontpanel control, so the front panel of the Express vi must opened to convert it to a standard vi.

 

It is a little ugly that NI use different terminologies: Decimation and Sample Compression.

Message 9 of 9
(3,669 Views)