Statistic Filter

This component takes as input a Global Variable . The output is assigned to a defined Global Variable. The filter averages the input global variable using either a Cumulative Average or Simple Moving Average algorithm.

Property Grid

General

Input Variable

Output Variable

Output Option

Window Length UDF

s | This UDF defines the statistical sampling period when calculating output statistics. The window length is relevant for the sample average, sample standard deviation, and percentage change calculations. This length can be calculated using global variables but cannot change over time.

Download Sample File: Window Length

Legacy Text:

Algorithm Type
  • Cumulative Average

  • Simple Moving Average

History

Used by Simple Moving Average to

Simple Moving Average Mode

Keeps a buffer of the defined length of the History parameter in order to maintain a running/moving average.

Cumulative Average Mode

Computes the cumulative average of the input data. No buffer is required.

Example

Using the standard agitated test case as a starting point, we make the following changes to the model:

  • Add global variable pn
    • Change Data Source to StatsValue

    • Choose Moving body / Moving Body / Rotation / Power Number [-]

  • Add global variable pn_sma

  • Add global variable pn_ca

  • Add Averaging component 1
    • Set Input Variable to pn

    • Set Output variable to pn_sma

    • Set Algorithm Type to Simple Moving Average

    • Set History = 10s

  • Add Averaging component 2
    • Set Input Variable to pn

    • Set Output variable to pn_ca

    • Set Algorithm Type to Cumulative Average

  • Change Simulation Parameters Resolution to 50 (optional, reduced resolution of case to speed up example)

Results

You can see the behavior of these two algorithms in the below image. At 10s, the Simple Moving Average starts to roll of the old data, including the initial peak, which slightly drops the average value. This demonstrates how the Simple Moving Average (pn_sma) tracks more quickly with the current average of the most recent data given. The Cumulative Average algorithm is shown by the pn_ca data.

image of moving average example