Abs Abs Icon

Mathematical.Abs

Abs

Computes the absolute value of the input signal.

Description

Extends BlockComponents.SISO and outputs the absolute value of its input signal u. The output y = abs(u) removes the sign of the input, returning only the magnitude.

Variables

  • u: Input signal
  • y: Output signal (absolute value of input)

Examples

  • u = -5.0 → y = 5.0
  • u = 3.2 → y = 3.2
  • u = 0.0 → y = 0.0

This component extends from BlockComponents.SISO

Usage

PrimitiveComponents.Mathematical.Abs()

Connectors

  • u - This connector represents a real signal as an input to a component (RealInput)
  • y - This connector represents a real signal as an output from a component (RealOutput)

Behavior

\[ \begin{align} y\left( t \right) &= \left|u\left( t \right)\right| \end{align} \]

Source

"""
    Abs

Computes the absolute value of the input signal.

# Description
Extends BlockComponents.SISO and outputs the absolute value of its input signal u.
The output y = abs(u) removes the sign of the input, returning only the magnitude.

# Variables
- `u`: Input signal
- `y`: Output signal (absolute value of input)

# Examples
- u = -5.0  → y = 5.0
- u = 3.2   → y = 3.2
- u = 0.0   → y = 0.0
"""
component Abs
  extends BlockComponents.SISO
relations
  y = abs(u)
metadata {
  "Dyad": {
    "icons": {"default": "dyad://PrimitiveComponents/Abs.svg"},
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100}]
  }
}
end
Flattened Source
"""
    Abs

Computes the absolute value of the input signal.

# Description
Extends BlockComponents.SISO and outputs the absolute value of its input signal u.
The output y = abs(u) removes the sign of the input, returning only the magnitude.

# Variables
- `u`: Input signal
- `y`: Output signal (absolute value of input)

# Examples
- u = -5.0  → y = 5.0
- u = 3.2   → y = 3.2
- u = 0.0   → y = 0.0
"""
component Abs
  "Input signal port"
  u = RealInput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "input", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0},
        "diagram": {"iconName": "input", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0}
      }
    }
  }
  "Output signal port"
  y = RealOutput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "output", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0},
        "diagram": {"iconName": "output", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      }
    }
  }
relations
  y = abs(u)
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://PrimitiveComponents/Abs.svg"}
  }
}
end


Test Cases

No test cases defined.

  • Examples
  • Experiments
  • Analyses