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