Absolute Value (abs)
Outputs the size of the input, never negative.
Group: Control · Kind: {"block":"abs","kind":"control"}
When to use it
Use it to rectify a signal, for example to take the size of a current for an overcurrent check. Put a Comparator after it for a trip signal.
Pins
| Pin | Domain | Meaning |
|---|---|---|
in |
signal | Signal of any sign |
out |
signal | Size of the input, never negative |
Model
out = abs(in), with direct feedthrough and no state. The result is not negative and keeps the unit of the input. It has a corner at zero.
Common mistakes
- The sign is lost. If a controller needs the direction of the error, take the absolute value only after the sign has been used, not in the loop path.
- An input left open reads 0 and the output stays at 0. If a protection Comparator never trips, look for an open pin.
Problems rules: pin.unconnected
Datasheet and sources
No datasheet applies. The input is a measured value from your circuit, such as a phase current in A.
Example
Open the example with the command file.openExample and the name demo:abs.
Generated by cargo xtask reference from the usage texts and parameter specs. Do not edit by hand.