LinearTrafo (FB)ΒΆ
FUNCTION_BLOCK LinearTrafo
This function will calculate the linear transformation \(y \in \mathbb{R}\) of \(x \in \mathbb{R}\) according to
\[ \begin{align}\begin{aligned}\frac{y - y_{1}}{y_{2}-y_{1}} = \frac{x-x_{1}}{x_{2}-x_{1}}\\\mathrm{with}\ x_{1}, x_{2}, y_{1}, y_{2} \in \mathbb{R}\ \mathrm{and}\ x_{1} \neq x_{2} \land x_{1} \leq x \leq x_{2}\end{aligned}\end{align} \]
- InOut:
Scope
Name
Type
Comment
Input
lrInputValueLREALValue \(x\) to be transformated
lrInput1LREALCoefficient \(x_{1} \in \mathbb{R}\)
lrInput2LREALCoefficient \(x_{2} \in \mathbb{R}\)
lrOutput1LREALCoefficient \(y_{1} \in \mathbb{R}\)
lrOutput2LREALCoefficient \(y_{2} \in \mathbb{R}\)
Output
lrOutputValueLREALLinear transformation \(y \in \mathbb{R}\) of \(x \in \mathbb{R}\)
xOutOfLimitsBOOLError flagTRUE: If \(x_{1} = x_{2} \lor x < x_{1} \lor x > x_2\)