[DIFFCALC] Differential function

Function block DIFFCALC differentiates an input value.

DIFFCALC differentiates an input value.

Functioning

DIFFCALC takes the current value at input [In], compares it with the previous value at the input and provides as a result the rate of the value change in respect to the time.

Acquiring input value

DIFFCALC takes the values from input [In] at regular interval. The duration of this interval is configured at input [SmplRate].

Output limitation

The output value can be limited via configuration at input [VMax]. The result is limited to a range of -1.2*[VMax] and 1.2*[VMax].

Conversion

When calculating the rate of the input change, DIFFCALC uses seconds as time unit. Therefore, the units of the result must be considered as value per second. Input [CnvFac] provides an option to change the unit of the output value. DIFFCALC multiplies the calculated rate of the input change (in seconds) by the value at input [CnvFac] before providing it at output [Out]. The conversion is done after performing the limitation via [VMax].

Filtering

DIFFCALC can perform filtering for the output value by evaluating multiple sampled input values (most recent values). Inputs [RngMin] and [RngMax] can be used to configure the number of evaluated values. For filtering with a fixed number of sampled input values, [RngMin] and [RngMax] must be equal.

Filtering adjustment

For some of the cases where filtering is used, fast changing values might be wished to have a weaker filtering compared to slow changing values. For such cases, DIFFCALC can automatically adjust the number of evaluated input values according to the rate of the value change.

To enable this function, the values of [RngMin] and [RngMax] must be different. DIFFCALC calculates the number of evaluated samples within the range defined by [RngMin] and [RngMax]. The algorithm is based on the difference between two internally calculated filtered values: one by evaluating [RngMin] input samples (weak filtering) and a second by evaluating [RngMax] input samples (strong filtering). The bigger their difference, the closer the actual number of evaluated values for the function block output is to [RngMin], thus achieving weaker filtering for faster changing values and vice versa.

The value at input [RngAdj] can be used to influence the impact of the difference between weak and strong filtering when calculating the actual result. The value at [RngAdj] input is used as a gain factor for this difference, therefore the bigger the value at [RngAdj], the closer the actual number of evaluated values is to [RngMin] for faster changing input values.

The value at input [VMax] affects also the calculation of the actual number of evaluated values. It is used as divisor for the difference between weak and strong filtering, therefore the bigger the value of [VMax], the closer the actual number of evaluated values is to [RngMax].

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

Real

0.0

Reset

Reset

Boolean

0

0 - Do not reset
1 - Reset

CnvFac

Conversion factor

Conversion factor to modify the unit for the output value.

Real

1.0

0.0...3.402822E38

SmplRate

Sampling rate

Time period for acquiring the value from input [In]

Time

1s

1s...18h

RngMax

Range maximum

Maximum evaluation range

Integer

1

1...30

RngMin

Range minimum

Minimum evaluation range

Integer

1

1...30

RngAdj

Range adjust

Real

10.0

0.0...3.402822E38

VMax

Maximum velocity

Real

3.402822E38

0.0...3.402822E38

 

Output

Description

Data type

Default value
Value range

Out

Output

Real

0.0

Application

DIFFCALC can be used in combination with accumulator inputs which provide accumulated values like: m3 or kWh. Values from such inputs can be provided to DIFFCALC to get the corresponding m3/h or kW. The resulting value can be used in the following control logic: equipment protection, indication, detecting opened window by monitoring rate of change for room temperature or other purposes.