> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/smart-power-simulation-software-sps/blocks-functions-tools/control-and-measurements/analysis/rms.md).

# RMS

## Description

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-fa0d34c7b1191c2b5b8dfaa06767f21976bf22bf%2FRMS_block.png?alt=media" alt=""><figcaption></figcaption></figure>

The **RMS** block, located in the **OPAL-RT SPS Software/Sensors and Measurements** library, computes the true root mean square (RMS) value of the input signal. The true RMS value of the input signal is calculated over a running average window of one cycle of the specified fundamental frequency:

$$
RMS(f(t))
=========

\sqrt{
\frac{1}{T}
\int\_{t-T}^{t}
f(t)^{2}, dt
}
\\\[8pt]
$$

where *f*(*t*) is the input signal and *T* is 1/(fundamental frequency).

As this block uses a running average window, one cycle of simulation must complete before the output gives the correct value. For the first cycle of simulation, the output is held to this specified initial RMS value.

## Characteristics

<table data-header-hidden><thead><tr><th width="250.333251953125"></th><th></th></tr></thead><tbody><tr><td>Sample Time</td><td>Specified in the <strong>Sample Time</strong> parameter. Continuous if <strong>Sample Time</strong> = 0.</td></tr><tr><td>Scalar Expansion</td><td>Yes, of the parameters.</td></tr><tr><td>Dimensionalized</td><td>Yes.</td></tr></tbody></table>

## Ports

### Input

<table data-header-hidden><thead><tr><th width="249.5555419921875"></th><th></th></tr></thead><tbody><tr><td><strong>Port_1</strong> — Input signal<br>Scalar | vector</td><td>The input signal for which the block computes the RMS value, specified as a scalar or vector.</td></tr></tbody></table>

### Output

<table data-header-hidden><thead><tr><th width="249.5555419921875"></th><th></th></tr></thead><tbody><tr><td><strong>Port_1</strong> — RMS of input signal<br>Scalar | vector</td><td>The RMS value of the input signal, returned as a scalar or vector.</td></tr></tbody></table>

## Parameters

<table data-header-hidden><thead><tr><th width="249.77783203125"></th><th></th></tr></thead><tbody><tr><td><strong>True RMS value</strong> — Compute true or fundamental RMS value<br>on (default) | off</td><td>Select this check box to have the block compute the true RMS value of the input signal. Clear this check box to have the block compute the fundamental value of the input signal divided by sqrt(2).</td></tr><tr><td><strong>Fundamental frequency (Hz)</strong> — Fundamental frequency<br>60 (default) | positive scalar</td><td>Specify the fundamental frequency, in hertz, of the input signal.</td></tr><tr><td><strong>Initial RMS value</strong> — Initial RMS value<br>120 (default) | nonnegative scalar</td><td>Specify the initial RMS value of the output signal.</td></tr><tr><td><strong>Sample time</strong> — Sample time of block<br>0 (default) | nonnegative scalar</td><td>Specify the sample time of the block, in seconds. Set to 0 to implement a continuous block.</td></tr></tbody></table>

## Examples

**Calculate True RMS Value for Signal with Harmonics and at Fundamental Frequency**

The power\_RMS\_THD example shows two applications of the RMS Measurement block. One RMS block calculates the true RMS value of a signal with harmonics, and another RMS calculates the RMS value of the same signal at the fundamental frequency.

The model sample time is parameterized by the Ts variable set to a default value of 50e-6 s. Set Ts to 0 in the command window to simulate the model in continuous mode.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/smart-power-simulation-software-sps/blocks-functions-tools/control-and-measurements/analysis/rms.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
