Time Weighted Average (Time Resetable) block
This block calculates a time-weighted average that is defined by two consecutive events.
Time Weighted Average (Time Resetable) block
Description
The Time Weighted Average block builds a history window of the input tags. The output of the block is the average of each input variable between two consecutive events. The output fields are reset to the current input value when a reset event occurs. This action is referred to as sampling. The normal execution of the block calculates the average of all values in the history buffer from the time of the last reset, i.e. each execute will produce a new output value. A reset event is triggered by the Reset on Input Change block.
If X1, X2, … XN, represent the samples in the history buffer, the average is calculated as (åi Xi)/N, where N = n + 1 until the next reset event and n is set to 0.
Diagram of the Time weighted average (Time resetable block)
Block Type
Time based block
Input/Output ports
Information parsed to the input port (list input fields/ tags in a Normal list)
The block can accept any number of fields of type double only. There is an output field for every input field. Output fields are created automatically to match the input fields. New output field names can have a post-fix applied, the post-fix is configurable by the user or the user can assign a new output tag name by editing the output field.
Functions performed on tags
-
On the values – A history buffer is built-up as the blueprint execute. The average is then incrementally calculated as it executes further until a reset event occurs, and the average is reset to the current input field. The average can only be calculated as long as the duration is less than the history buffer. The reset event is generated by the Reset on input change block.
-
On the time stamp - The time stamp of the output field is the corresponding execute time stamp that is assigned to the output field.
-
On the quality - The output field quality is determined by the quality of the input, if one input in the time window between two consecutive events is bad, the calculated average value will be bad until the next reset event occurs. The quality will also change to bad when the duration between two consecutive events is larger than the specified history buffer.
Example
The table below shows the input to the time weighted average block, the input to the reset on input change block, as well as the output value from the time weighted average block. The reset on input change block is configured to sample on the rising edge and to generate an event for the time weighted average block. Thus the output resets to the current input on the event and then starts to incrementally calculate the average until the next event occurs.
Related topics: