Skip to content
LIBRARY
Nonlinear.DeadZone.md

Nonlinear.DeadZone

Provide a region of zero output.

The DeadZone block defines a region of zero output. If the input is within uMin ... uMax, the output is zero. Outside of this zone, the output is a linear function of the input with a slope of 1.

Misplaced &

Deviations from the Modelica Standard Library

MSL defines the output as y = homotopy(actual = smooth(0, ...), simplified = u), adding two solver aids that this implementation does not reproduce:

  • smooth(0, ...) declares the piecewise expression to be C0-continuous, giving the integrator a continuity guarantee across the uMin/uMax breakpoints.

  • homotopy(..., simplified = u) supplies the linear form y = u as the simplified expression used during homotopy-based initialization.

Here the output is the plain piecewise relation via ifelse; the smooth continuity declaration and the homotopy initialization aid are omitted. The steady-state input/output behavior is identical.

This component extends from BlockComponents.Interfaces.SISO

Usage

BlockComponents.Nonlinear.DeadZone(uMax=1, uMin=-uMax)

Parameters:

NameDescriptionUnitsDefault value
uMaxUpper limit of dead zone1
uMinLower limit of dead zone-uMax

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
"""
Provide a region of zero output.

The DeadZone block defines a region of zero output. If the input is
within `uMin` ... `uMax`, the output is zero. Outside of this zone,
the output is a linear function of the input with a slope of 1.

```math
y = \\begin{cases}
  u - u_{\\text{Max}} & \\text{if } u > u_{\\text{Max}} \\\\
  u - u_{\\text{Min}} & \\text{if } u < u_{\\text{Min}} \\\\
  0                   & \\text{otherwise}
\\end{cases}
```

## Deviations from the Modelica Standard Library

MSL defines the output as
`y = homotopy(actual = smooth(0, ...), simplified = u)`, adding two solver aids
that this implementation does not reproduce:

- `smooth(0, ...)` declares the piecewise expression to be C0-continuous, giving
  the integrator a continuity guarantee across the `uMin`/`uMax` breakpoints.
- `homotopy(..., simplified = u)` supplies the linear form `y = u` as the
  simplified expression used during homotopy-based initialization.

Here the output is the plain piecewise relation via `ifelse`; the `smooth`
continuity declaration and the `homotopy` initialization aid are omitted. The
steady-state input/output behavior is identical.
"""
component DeadZone
  extends BlockComponents.Interfaces.SISO
  "Upper limit of dead zone"
  parameter uMax::Real = 1
  "Lower limit of dead zone"
  parameter uMin::Real = -uMax
relations
  assert(uMax >= uMin, "DeadZone: Limits must be consistent. However, uMax  < uMin")
  y = ifelse(u > uMax, u - uMax, ifelse(u < uMin, u - uMin, 0))
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/DeadZone.svg"}
  }
}
end
Flattened Source
dyad
"""
Provide a region of zero output.

The DeadZone block defines a region of zero output. If the input is
within `uMin` ... `uMax`, the output is zero. Outside of this zone,
the output is a linear function of the input with a slope of 1.

```math
y = \\begin{cases}
  u - u_{\\text{Max}} & \\text{if } u > u_{\\text{Max}} \\\\
  u - u_{\\text{Min}} & \\text{if } u < u_{\\text{Min}} \\\\
  0                   & \\text{otherwise}
\\end{cases}
```

## Deviations from the Modelica Standard Library

MSL defines the output as
`y = homotopy(actual = smooth(0, ...), simplified = u)`, adding two solver aids
that this implementation does not reproduce:

- `smooth(0, ...)` declares the piecewise expression to be C0-continuous, giving
  the integrator a continuity guarantee across the `uMin`/`uMax` breakpoints.
- `homotopy(..., simplified = u)` supplies the linear form `y = u` as the
  simplified expression used during homotopy-based initialization.

Here the output is the plain piecewise relation via `ifelse`; the `smooth`
continuity declaration and the `homotopy` initialization aid are omitted. The
steady-state input/output behavior is identical.
"""
component DeadZone
  "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}
      }
    }
  }
  "Upper limit of dead zone"
  parameter uMax::Real = 1
  "Lower limit of dead zone"
  parameter uMin::Real = -uMax
relations
  assert(uMax >= uMin, "DeadZone: Limits must be consistent. However, uMax  < uMin")
  y = ifelse(u > uMax, u - uMax, ifelse(u < uMin, u - uMin, 0))
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/DeadZone.svg"}
  }
}
end


Test Cases

No test cases defined.