[AVRG_PRD] Average of a period

Function block AVRG_PRD calculates the average value and integral value for an analog value within a specific time period.

AVRG_PRD calculates the average value and integral value for an analog value within a specific time period.

Functioning

Enable and disable the function

The average value and the integral value for an analog input [In] is determined within a time period if the function is enabled (EnFnct and EnEvl = 1) and the analog input signal is reliable (Vldty = 1).

Calculation

The average value for the present time period is displayed on [PrAvrg].
After the time period has expired, the present average value is saved via a pulse as average value for the recent time period [RctAvrg] and the pending input value is set as new average value. The integral (via time) of the analog input signal is generated as an additional information and displayed via [PrIntg]. At a pulse, the present integral value is saved as integral value of the recent time period and set to value (1/CalcIvl [in seconds]) x valid value at input [In]. The calculation interval [CalcIvl] is 1 hour, which can be set to 0.0167 for 1 minute. The time period, generated outside of AVRG_PRD, is determined via a rising slope on the input [Imp]. If the input signal is invalid (Vldty = 0), the calculation stops. The last valid values from the outputs are frozen until the signal is valid again.

Subperiods within time periods

Input [EnEvl] can be used to evaluate subperiods within the entire time period. When EnEvl = 0, the evaluation is disabled and the last valid values are displayed at the outputs. At a pulse, the present average and integral value are saved as values from the recent time period.

Reset

All present and recent values are set to zero via a rising slope on input [Reset].

Pins

Input

Description

Data type

Default value
Value range

EnFnct

Enable function

Enables the function.

Boolean

1

0 - The function is disabled.
1 - The function is enabled.

EnEvl

Enable evaluation

Boolean

1

0 - Evaluation is disabled and the valid values at the outputs are frozen.
1 - Evaluation is enabled.

In

Input

Input signal

Real

0.0

Imp

Impulse

Pulse input for which the evaluation time period is determined. The rising edge indicates start of new period.

Boolean

0

0 - No
1 - Yes

Vldty

Validity

The average and integral values from the present and recent time periods can only be calculated with a valid input signal.

Boolean

1

0 - The input is not valid.
1 - The input is valid.

CalcIvl

Calculation interval

Converts the results at integral outputs. Possible calculation interval, e.g. 0.0167 for 1 minute

Real

1.0

0.0167...3.70E38

Reset

Reset

All values are reset to zero.

Boolean

0

0 - No
1 - Yes

Pers

Persistent

Boolean

0

0 - No
1 - Yes: the values are stored persistently.

BaObjRef

BA-Object reference
Link between function block and BACnet object.

Structure

---

BaObjRef
> DeviceID

Device identifier
[DeviceID] includes object type and object instance in one ID.
Identifies the device object: local or remote. A local device object can also be identified by value 16#3FFFFF.

Double Word

16#3FFFFF

BaObjRef
> ObjectID

Object identifier
[ObjectID] includes object type and object instance in one ID.
Identifies the object on a device.

Double Word

16#3FFFFF

BaObjRef
> ItemID

Item identifier
[ItemID] represents an index in a view node object that references the BACnet object.
[ObjectID] and [ItemID] together define an indirect reference to the BACnet object.
Value -1 indicates a direct interface.

Integer

-1

 

Output

Description

Data type

Default value
Value range

PrAvrg

Present average

Real

0.0

RctAvrg

Recent average

Real

0.0

PrIntg

Present integral

Real

0.0

RctIntg

Recent integral

Real

0.0

Dstb

Disturbed

[Dstb] indicates whether the referenced BACnet object was accessed.
[Dstb] = 0, if:
BACnet object access = Access successful
[Dstb] = 1, if:
BACnet object access = Error during access

Boolean

0

ErrCode

Error code indication

Integer

0: No error

= 0 - No error
> 0 - Error codes

Application

AVRG_PRD is used to calculate the average and integral values for a time period. By displaying present and recent values from a particular time period, errors such as wrong control parameter, setpoint violations, or manual intervention, can be found earlier and faster.

The following example is based on an evaluation period = 1 day: