Moving Median block

This block calculates a time-weighted moving median of the input variables.

Return to Overview of blocks

Moving Median block

Description

The output of the block is the median of each input variable, respectively, calculated over a moving window. Each field has a configured time span window and quality threshold value. The window moves forward as time progresses with the one end anchored to current execution time.

Conceptually it takes the value of the sample in the middle of the sorted list of values, taking into account the duration of samples. (The median is the number in the middle of a set of numbers; that is, half the numbers have values that are greater than the median, and half have values that are less over the last window period)

Moving median block

Block Type

Statistical block (Moving window)

Input/Output ports

The input port may only contain fields of type double. There is one output field and 3 quality fields for every input field. The 3 quality fields have the following postfixes appended to the configured output field name (by default the configured output field has the same name as the input field):

  • _DurationBad

  • _DurationGood

  • _Windowspan

If a new field is added to the input port an output field will be created. The output field will have the default window span and quality threshold. The default window span and quality threshold is either the last configured window span and quality threshold or, if no new value was specified, it takes on the default block window span and quality threshold values.

In order for this block to run, the input port must be connected to a valid source that contains only double fields. All configured window spans must also be larger than 0 seconds.

There is also a parameter port of type double. During configuration, the parameter ports' fields can be used to substitute the fixed window span and quality thresholds values. During execution, the first value of the parameter field (that was used to substitute fixed values) is then used as the value for the window span and quality threshold

Example:

Input field name = Asset

“Outport1” port’s field name: Asset

“Quality” port’s field names:

  • Asset_DurationBad

  • Asset_DurationGood

  • Asset_Windowspan

Parameter port

The parameter port does not have to be used. The block reads its parameters from the parameter port, if it's configured to do so.

On the first execute, the block will read the value(s) from the parameter field(s) and lock on that value. The parameter value will not change during execution.

Why are parameter ports great?

If you have 10 Moving window blocks and you want to change the configured quality threshold and window span, you only have to change it in one place.  

Functions performed on tags

  • On the values: - The output value is the calculated moving average of the signal over the window.

  • On the timestamp - The output time stamp is always set to the execute time.

  • On the quality - The quality is set based on the quality threshold. The quality level is calculated as the number of seconds that the signal had good quality over the window. This quality level is expressed as a percentage of the window span. If the quality level is less that the quality threshold, the output quality is set to bad, otherwise it is good.

Return to top

Example

  • Sample period = 60s

  • Window span = 300s

  • Quality threshold = 80%

Return to top

 

Example of processing by Moving Median block

Return to top


Related topics:

  

CSense 2023- Last updated: June 24,2025