# Rate Limiter (`rateLimiter`)

> Follows its input, but changes no faster than a rising and a falling rate.

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

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

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

## When to use it

Use it for a soft start of a reference, a ramped speed command, or a slew-rate limit on a duty cycle. Use Limiter to limit the value itself.

## Pins

| Pin | Domain | Meaning |
|---|---|---|
| `in` | signal | Signal to follow |
| `out` | signal | Rate-limited signal |

## Common parameters

- `rise`: Fastest rise of the output, in units per second (Default: required)
- `fall`: Fastest fall of the output, in units per second; the rising rate when empty (Default: rise)

## Parameters

| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
| `rise` | 1/s | required |  | Fastest rise of the output, in units per second |
| `fall` | 1/s | rise |  | Fastest fall of the output, in units per second; the rising rate when empty |

_Parameter descriptions are in English in both languages._

## Model

At the start the output equals the input. Over each accepted solver step of length h it moves toward the input by at most rise·h up and fall·h down, from the value the step before left, so a step of the input becomes a ramp of slope rise (or −fall). When the input comes from a step source or a comparator, whose jump falls inside the step (a step source's at the step's end, where the solver lands it), the output moves only for the part of the step after the jump, so the ramp starts at the jump whatever the step size. rise and fall are in units per second; fall defaults to rise. The block has direct feedthrough.

## Common mistakes

- The rates are per second of simulated time. Code generation writes the block at the code's sample time ts, moving at most rise·ts up and fall·ts down per sample, when it feeds the duty cycle a PWM reads; anywhere else it is left out, and you build it from a zDelay, a sum and a limiter of rise·ts.
- rise and fall must be positive. Inside a loop the limit adds a delay that depends on the step size; keep it out of fast inner loops.

Problems rules: `compile.error`

## Datasheet and sources

There is no datasheet.

## Example

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

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