analytical functions ¶ CalcRootLin (FunctionBlock) CalcRootParable (FunctionBlock) Derivative (FunctionBlock) Integral (FunctionBlock) PolynomialValue (Function)
CalcRootLin (FB) ¶ FUNCTION_BLOCK CalcRootLin By use of this function block the root of a linear function \(y = a \cdot x + b\) with \(a\mbox{, }b\mbox{, }x \in \mathbb{R}\) , if there is one, will be calculated. InOut: Scope Name Type Comment Input lrParam1 LREAL gradient of straight line (corresponds to \(a\) ) lrParam0 LREAL height at which line cuts the vertical y-axis (corresponds to \(b\) ) Output byRoots BYTE number of roots 0: If line is parallel, but not identical to horizontal x-axis | 255: If line is identical to x-axis 1: Else lrRoot LREAL root
CalcRootParable (FB) ¶ FUNCTION_BLOCK CalcRootParable By use of this function block the root of a linear function \(y = a \cdot x^{2} + b \cdot x + c\) with \(a\mbox{, }b\mbox{, }c\mbox{, }x \in \mathbb{R}\) , if there are some, are calculated. InOut: Scope Name Type Comment Input lrParam2 LREAL multiplier of \(x^{2}\) (corresponds to \(a\) ) lrParam1 LREAL multiplier of \(x\) (corresponds to \(b\) ) lrParam0 LREAL multiplier of \(1\) (corresponds to \(c\) ) Output byRoots BYTE number of roots (0, 1, 2 or 255 in case of infinite roots) lrRoot0 LREAL first root lrRoot1 LREAL second root
Derivative (FB) ¶ FUNCTION_BLOCK Derivative This function block will approximate the first derivative \(f\prime\) of a function \(f = f(t)\) at the actual time \(t_{n}\) with the respect to the values of the last three function calls according to the BDF method: \[f\prime (t_{n}) \doteq \frac{3 (f(t_{n}) - f(t_{n-3})) + f(t_{n-1}) - f(t_{n-2})}{3(t_{n-2}-t_{n-3})+4(t_{n-1}-t_{n-2})+3(t_{n}-t_{n-1})}\] InOut: Scope Name Type Comment Input xEnable BOOL reset lrInputValue LREAL actual function value udiTM UDINT length of time interval \([t_{n-1}, t_{n}]\) (equals time passed since last call to function) Output lrDerivative LREAL approxmated value of first derivative xValid BOOL Validity of result FALSE : If the number of calls neccessary for approximating has not been executed yet.
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
PolynomialValue (FUN) ¶ FUNCTION PolynomialValue : LREAL This function block evaluates a given polynomial of arbitrary degree, \(p(x) = c_{n}x^{n} + c_{n-1}x^{n-1} + \dots + c_{1}x + c_{0}\) with \(c_{i} \in \mathbb{R}, n \in \mathbb{N_{0}}\) at a point \(x \in \mathbb{R}\) by use of the Horner scheme. InOut: Scope Name Type Comment Return PolynomialValue LREAL Input siDegree SINT degree of polynomial plr POINTER TO LREAL pointer to Array of polynomial coefficients; at first there is the coefficient of the monomial of highest degree (corresponds to \(c_{n}\) in the formula) lrValue LREAL point \(x\) , where polynomial has to be evaluated
function manipulators ¶ CharCurve_DINT (FunctionBlock) CharCurve_LREAL (FunctionBlock)
CharCurve_DINT (FB) ¶ FUNCTION_BLOCK CharCurve_DINT This function block will evaluate a piecewise linear function (the characteristic curve) at an integral point \(x \in \mathbb{Z}\) . The characteristic curve is specified by a defined number of integral sampling points \((x_{1}, y_{1}), \dots , (x_{n}, y_{n}) \in \mathbb{Z^{2}}\) InOut: Scope Name Type Comment Input diInputValue DINT interpolation point \(x \in \mathbb{Z}\) usiNoPoints USINT number \(N\) of sampling points defining the characteristic curve ( \(2 \leq N \leq 11\) ) Inout ap2diPoints ARRAY [0..10] OF POINT2_DINT array of \(N\) two dimensional sampling points \((x_{i}, y_{i})\) with \(1 \leq i \leq N\) Output diOutputValue DINT interpolated value at point \(x \in \mathbb{Z}\) xError BOOL error flag wErrorID WORD information on error 0: No error 1: error within array of sampling points (i.e. the sampling points aren’t arranged in ascending order) 2: interpolation point diInputValue is outside of area covered by sampling points ( \(x \notin [x_{1}, x_{n}]\) ) 4: invalid number of sampling points
CharCurve_LREAL (FB) ¶ FUNCTION_BLOCK CharCurve_LREAL This function block will evaluate a piecewise linear function (the characteristic curve) at an integral point \(x \in \mathbb{R}\) . The characteristic curve is specified by a defined number of integral sampling points \((x_{1}, y_{1}), \dots , (x_{n}, y_{n}) \in \mathbb{R^{2}}\) InOut: Scope Name Type Comment Input lrInputValue LREAL interpolation point \(x \in \mathbb{R}\) usiNoPoints USINT number \(N\) of sampling points defining the characteristic curve ( \(2 \leq N \leq 11\) ) Inout ap2lrPoints ARRAY [0..10] OF POINT2_LREAL array of \(N\) two dimensional sampling points \((x_{i}, y_{i})\) with \(1 \leq i \leq N\) Output lrOutputValue LREAL interpolated value at point \(x \in \mathbb{R}\) xError BOOL error flag wErrorID WORD information on error 0: No error 1: error within array of sampling points (i.e. the sampling points aren’t arranged in ascending order) 2: interpolation point diInputValue is outside of area covered by sampling points ( \(x \notin [x_{1}, x_{n}]\) ) 4: invalid number of sampling points
geometrical functions ¶ Line Functions ProjectPointOnLine (Function) Plane Functions CalcHesseRepresentation (FunctionBlock) ProjectPointOnPlane (Function) Polar coordinates CartesianToPolar (FunctionBlock) PolarToCartesian (FunctionBlock) Vector Functions AddMultiplicatedVector (Function) CrossProduct (FunctionBlock) CrossProductNormed (FunctionBlock) MakeNormed3D (Function) Norm3D (Function) ScalProd3D (Function) ScalProd3DStand (Function) SubVector (Function)