# Limiter (`limiter`)

> Keeps the input between a lower limit lo and an upper limit hi.

![limiter](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/img/limiter.svg)

[Component reference](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/) · [繁體中文](https://voltecx-web.nguyenvanqui291.workers.dev/zh/docs/reference/control/limiter/)

**Group:** Control · **Kind:** `{"block":"limiter","kind":"control"}`

## When to use it

Use it to bound a reference, command or duty from a block with no limits. Inside a controller, use the limits of PI Controller.

## Pins

| Pin | Domain | Meaning |
|---|---|---|
| `in` | signal | Signal to limit |
| `out` | signal | Input held between lo and hi |

## Common parameters

- `lo`: Lower limit (Default: -1e30)
- `hi`: Upper limit (Default: 1e30)

## Parameters

| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
| `lo` | — | -1e30 |  | Lower limit |
| `hi` | — | 1e30 |  | Upper limit |

_Parameter descriptions are in English in both languages._

**Use for:** Duty limits · Current reference limits · Voltage commands

**Not for:** Slew-rate limits → [`rateLimiter`](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/control/rateLimiter/) · Limits inside a controller → [`pi`](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/control/pi/)

## Formulas

| Formula | Equation | Source |
|---|---|---|
| Saturation | y = min(max(u, lo), hi) | Åström & Murray, Feedback Systems, 2nd ed. (2021), ch. 11 (actuator saturation and windup) |
| Amount removed | Δ = u - y | Åström & Murray, Feedback Systems, 2nd ed. (2021), ch. 11 |

## Quick check

Inputs:

- `u`: Input value = 1.2 —
- `lo`: Lower limit = 0 —, `lo`
- `hi`: Upper limit = 950m —, `hi`

Outputs:

- `y`: Output = `limit(u, lo, hi)` —
- `cut`: Amount removed = `u - limit(u, lo, hi)` —

## Model logic

- The output is min(max(in, lo), hi) at every step, with no state and direct feedthrough.
- The defaults of -1e30 and 1e30 pass every value; lo equal to hi gives a constant, and lo above hi stops the build.
- The block only limits its own output and tells nothing to the blocks before it, so an Integrator or PI Controller in front keeps winding up.

## Model

out = min(max(in, lo), hi), with direct feedthrough and no state. With the defaults of -1e30 and 1e30 the block passes every value.

## Common mistakes

- A Limiter does not stop an Integrator or PI Controller in front of it from winding up. If they have no limits, set lo and hi on them too.
- A Limiter that sits at one bound for most of the run means the loop is not regulating. Widen the limit or lower the reference.
- lo must not be above hi. Swapped limits stop the build.

Problems rules: `control.saturated`, `compile.error`

## Datasheet and sources

No datasheet applies. The limits come from the hardware you protect, such as the rated device current, the DC-link voltage, or 0 and 1 for a duty.

## Example

Open the example with the command `file.openExample` and the name `demo:limiter`.

---
Generated by `cargo xtask reference` from the usage texts and parameter specs. Do not edit by hand.
