Skip to content
LIBRARY
Math.WrapAngle.md

Math.WrapAngle

Wrap angle to interval ]-π, π] or [0, 2π[.

When positiveRange is false (default), wraps the input angle u to the interval ]-π, π]. When positiveRange is true, wraps to [0, 2π[.

The input and output are in radians.

This component extends from BlockComponents.Interfaces.SISO

Usage

BlockComponents.Math.WrapAngle(positiveRange=false)

Parameters:

NameDescriptionUnitsDefault value
positiveRangeUse only positive output range [0, 2π[ if truefalse

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

Source

dyad
"""
Wrap angle to interval ]-π, π] or [0, 2π[.

When `positiveRange` is false (default), wraps the input angle `u` to the
interval ]-π, π]. When `positiveRange` is true, wraps to [0, 2π[.

The input and output are in radians.
"""
component WrapAngle
  extends BlockComponents.Interfaces.SISO(u(units = "rad"), y(units = "rad"))
  "Use only positive output range [0, 2π[ if true"
  parameter positiveRange::Boolean = false
relations
  y = BlockComponents.wrap_angle(u, positiveRange)
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/WrapAngle.svg"}
  }
}
end
Flattened Source
dyad
"""
Wrap angle to interval ]-π, π] or [0, 2π[.

When `positiveRange` is false (default), wraps the input angle `u` to the
interval ]-π, π]. When `positiveRange` is true, wraps to [0, 2π[.

The input and output are in radians.
"""
component WrapAngle
  "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}
      }
    }
  }
  "Use only positive output range [0, 2π[ if true"
  parameter positiveRange::Boolean = false
relations
  y = BlockComponents.wrap_angle(u, positiveRange)
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/WrapAngle.svg"}
  }
}
end


Test Cases

No test cases defined.