[DIFFPRDI] Difference of a period for integer values

Function block DIFFPRDI determines the differential value for an integer counter value within a specific time period.

DIFFPRDI determines the differential value for an integer counter value within a specific time period.

Functioning

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 DIFFPRDI, 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.

info

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.

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.

In

Input

Input signal

Double integer

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 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.
1 - The input signal is valid.

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

PrVal

Present value

Double integer

0

RctVal

Recent value

Double integer

0

VldtyDly

Validity with delay

Boolean

0

0 - Not valid
1 - Valid

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

DIFFPRDI 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: