[DIFFPRDR] Difference of a period for real values
Function block DIFFPRDR determines the differential value for a real counter value within a specific time period.
DIFFPRDR determines the differential value for a real counter value within a specific time period.
Enable and disable the function
The differential value of a counter value [In] within a time period is determined if the function is enabled (EnFnct = 1 and Imp = 1). The function does not start with [EnFnct] only. A pulse at [Imp] is required to start the function.
Calculation
The differential value for the present time period is displayed on [PrVal]. After the time period has expired, the present differential value is saved as differential value for the recent time period [RctVal] and set to zero via a pulse. The time period, generated outside of DIFFPRDR, 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. If the input value is smaller than the differential value saved at a pulse, the difference becomes invalid. If the signal or the differential value is invalid at pulse time, no valid difference can be generated for the next two time periods. This information is provided at output [VldtyDly].
Reset
All present and recent values are set to zero via a rising slope on input [Reset].
Startup
First time period: After the first pulse, the present value at input [In] is saved as reference for a further differential value generation. After the pulse, [VldtyDly] = 1 after a delay (25 AS cycles). From the first pulse, a difference is generated on output [PrVal] for an increasing counter value at input [In].
Second time period: After the second pulse, the present differential value is saved as differential value on [PrVal] for the recent time period [RctVal] and set to zero.

For a time period of 1 day, a differential value that can be evaluated and provided only after the 2nd pulse (after 2 days).
If a full download is performed, all values are reset and data may be lost as a consequence.
Input | Description | Data type | Default value |
|---|---|---|---|
EnFnct | Enable function Enables the function. | Boolean | 1 |
0 - The function is disabled. | |||
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 | |||
|
Vldty | Validity The differential value from the present and recent time periods can only be calculated with a valid input signal. | Boolean | 1 |
0 - The input signal is not valid. | |||
Reset | Reset All values are reset to zero. | Boolean | 0 |
0 - No | |||
Pers | Persistent | Boolean | 0 |
0 - No | |||
TshVal | Threshold value | Real | 0.1 |
|
BaObjRef | BA-Object reference | Structure | --- |
BaObjRef | Device identifier | Double Word | 16#3FFFFF |
BaObjRef | Object identifier | Double Word | 16#3FFFFF |
BaObjRef | Item identifier | Integer | -1 |
Output | Description | Data type | Default value |
|---|---|---|---|
PrVal | Present value | Real | 0.0 |
RctVal | Recent value | Real | 0.0 |
|
VldtyDly | Validity with delay | Boolean | 0 |
0 - Not valid | |||
Dstb | Disturbed [Dstb] indicates whether the referenced BACnet object was accessed. | Boolean | 0 |
ErrCode | Error code indication | Integer | 0: No error |
= 0 - No error | |||
DIFFPRDR is used to calculate the differential value derived from the counter status within a time period. By displaying present and recent values, daily consumption, for example, can be calculated for a specific time period.
The following example is based on an evaluation period = 1 day:
