blockMovingAverage

Block to output moving average

Information

This block outputs the mean value of its input signal as

      1  t
y =   -  ∫   u(s) ds
      δ  t-δ

where δ is a parameter that determines the time window over which the input is averaged. For t < δ seconds, it outputs

           1      t
y =   --------    ∫   u(s) ds
      t-t0+10-10   t0

where t0 is the initial time.

This block can for example be used to output the moving average of a noisy measurement signal.

See Buildings.Controls.OBC.CDL.Reals.Validation.MovingAverage and Buildings.Controls.OBC.CDL.Reals.Validation.MovingAverage_nonZeroStart for example.

Parameters

TypeNameDefaultDescription
RealdeltaTime horizon over which the input is averaged

Connectors

TypeNameDefaultDescription
Buildings.Controls.OBC.CDL.Interfaces.RealInputuInput to be averaged
Buildings.Controls.OBC.CDL.Interfaces.RealOutputyMoving average of the input

Revisions

  • January 27, 2022, by Jianjun Hu:
    Renamed the block name from MovingMean to MovingAverage.
    This is for Buildings, issue 2865.
  • November 12, 2020, by Michael Wetter:
    Reformulated to remove dependency to Modelica.Units.SI.
    This is for Buildings, issue 2243.
  • March 2, 2020, by Michael Wetter:
    Changed icon to display dynamically the output value.
  • October 24, 2017, by Michael Wetter:
    Set initial condition for mu.
  • October 17, 2017, by Michael Wetter:
    Reformulated implementation to avoid direct feedthrough.
  • October 16, 2017, by Michael Wetter:
    Reformulated implementation to handle division by zero as the previous implementation caused division by zero in the VAV reheat model with the Radau solver.
  • September 27, 2017, by Thierry S. Nouidui:
    Reformulated implementation to handle division by zero. This is for Buildings, issue 978.
  • September 15, 2017, by Thierry S. Nouidui:
    Reformulated implementation to avoid state events.
  • July 5, 2017, by Michael Wetter:
    Revised implementation to allow non-zero start time.
  • June 29, 2017, by Jianjun Hu:
    First implementation. This is for Buildings, issue 825.