Integral (FB)

FUNCTION_BLOCK Integral

This function block will approximate the integral function of the fuction \(f = f(t)\) over the time interval between the first function call \(t_{0}\) and the actual time \(t_{n}\): \(\int_{t_{0}}^{t_{n}}f(t)\mbox{d}t\). The size of the time intervals \([t_{i+1}, t_{i}]\) are integers and measured in micro seconds. The approximation is carried out by use of the explicit (\(x = f(t_{n-1})\)) resp. implicit (\(x = f(t_{n})\)) Euler method:

\[\int_{t_{0}}^{t_{n}}f(t)\mbox{d}t \doteq \int_{t_{0}}^{t_{n-1}}f(t)\mbox{d}t + (t_{n} - t_{n-1}) \cdot x\]
InOut:

Scope

Name

Type

Initial

Comment

Input

xEnable

BOOL

reset

lrInputValue

LREAL

function value (corresponds to :math`x`)

udiTM

UDINT

size of time interval \([t_{n-1}, t_{n}]\) (equals time passed since last call to function)

Output

lrIntegral

LREAL

approximated value of integral

xOverflow

BOOL

FALSE

error flag
TRUE: If an overflow has occured