# RMS Meter (`rms`)

> The RMS of a signal over a sliding window, while the circuit runs.

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

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

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

## When to use it

Use it when a controller acts on an RMS value during the run, such as an output-voltage regulator of an inverter or an overcurrent trip. Use scope.measure when you only need the number after the run.

## Pins

| Pin | Domain | Meaning |
|---|---|---|
| `in` | signal | Signal to measure |
| `freq` | signal | Optional frequency in hertz, such as a PLL output; when wired it sets the window |
| `out` | signal | RMS value |

## Common parameters

- `f`: Fundamental frequency: the window is cycles/f seconds; a wired freq input replaces it (50 Hz mains, IEC 60038:2009 Table 1) (Default: 50)
- `cycles`: Window length in periods of f; whole periods give exact figures (one cycle, as the Urms(1/2) of IEC 61000-4-30:2015) (Default: 1)

## Parameters

| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
| `f` | Hz | 50 |  | Fundamental frequency: the window is cycles/f seconds; a wired freq input replaces it (50 Hz mains, IEC 60038:2009 Table 1) |
| `cycles` | — | 1 |  | Window length in periods of f; whole periods give exact figures (one cycle, as the Urms(1/2) of IEC 61000-4-30:2015) |

_Parameter descriptions are in English in both languages._

## Model

The output is the square root of the mean of in squared over the last cycles/f seconds. The square is integrated with the trapezoidal rule at every step and the window start is interpolated inside its step, so a window of whole periods gives the exact RMS of a periodic signal at fixed or variable steps. Before a full window has passed, the window is the time elapsed, and at t = 0 the output is the size of the input. When freq is wired and positive it replaces f at every step, so the window stays one period of a signal whose frequency drifts.

## Common mistakes

- A window that is not a whole number of periods leaves a ripple at twice the signal frequency on the output. Set f to the signal frequency, or wire freq from a PLL when the frequency changes.
- The output lags a change of the input by up to one window. A loop that regulates an RMS value must be slower than the window, or it oscillates.

Problems rules: `pin.unconnected`

## Datasheet and sources

A true-RMS meter or power analyser reads the same figure; its data sheet gives the averaging window, often one cycle or 10 cycles at 50 Hz. Set cycles to match when you compare with a bench reading.

## Example

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

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