---
url: /dyad/stable/stdlib/BlockComponents/components/Nonlinear.DeadZone.md
description: Dyad Nonlinear.DeadZone docs.  Provide a region of zero output.
---

# `Nonlinear.DeadZone` {#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.

$$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 {#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`](../types/Interfaces.SISO.md)

## Usage {#Usage}

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

## Parameters: {#Parameters:}

|   Name |              Description | Units | Default value |
| ------:| ------------------------:| -----:| -------------:|
| `uMax` | Upper limit of dead zone |     – |             1 |
| `uMin` | Lower limit of dead zone |     – |         -uMax |

## Connectors {#Connectors}

* `u` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

* `y` - This connector represents a real signal as an output from a component ([`RealOutput`](/stdlib/Dyad/connectors/RealOutput#RealOutput))

## Behavior {#Behavior}

$$ \begin{align}
y\left( t \right) &= ifelse\left( \mathtt{uMax} < u\left( t \right), u\left( t \right) - \mathtt{uMax}, ifelse\left( u\left( t \right) < \mathtt{uMin}, u\left( t \right) - \mathtt{uMin}, 0 \right) \right)
\end{align}
$$

## Source {#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
````

````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 {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`DeadZone`](Nonlinear.DeadZone.md)

  * [`DeadZone`](Nonlinear.DeadZone.md)

  * [`Sine`](Nonlinear.DeadZone.md)
