> 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/mean-variable-frequency.md).

# Mean (Variable Frequency)

## Description

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

The **Mean (Variable Frequency)** block, located in the **OPAL-RT SPS Software/Sensors and Measurements** library, computes the mean value of the signal connected to the second input of the block.

The mean value is computed over a running average window of one cycle of the frequency of the signal:

$$
\text{Mean}(f(t))
=================

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

f(t) : \text{input signal},\quad T = 1/\text{fundamental frequency}
\\\[8pt]
$$

This block uses a running average window.

Therefore, one cycle of simulation must complete before the block outputs the computed mean value. For the first cycle of simulation, the output is held constant to the specified initial value.

## Parameters

<table data-header-hidden><thead><tr><th width="250.22210693359375"></th><th></th></tr></thead><tbody><tr><td><strong>Initial frequency (Hz)</strong></td><td>Specify the frequency of the first cycle of simulation. Default is 60.</td></tr><tr><td><strong>Minimum frequency (Hz)</strong></td><td>The minimum frequency value determines the buffer size of the Variable Time Delay block used inside the block to compute the mean value. Default is 45.</td></tr><tr><td><strong>Initial input (DC component)</strong></td><td>Specify the initial value of the input during the first cycle of simulation. Default is 0.</td></tr><tr><td><strong>Sample time</strong></td><td>Specify the sample time of the block, in seconds. Set to 0 to implement a continuous block. Default is 0.</td></tr></tbody></table>

## Inputs and Outputs

<table data-header-hidden><thead><tr><th width="250.04437255859375"></th><th></th></tr></thead><tbody><tr><td><strong>Freq</strong></td><td>The frequency of the signal.</td></tr><tr><td><strong>In</strong></td><td>Connects to the signal to be analyzed.</td></tr><tr><td><strong>X</strong></td><td>The mean value of the signal.</td></tr></tbody></table>

## Characteristics

<table data-header-hidden><thead><tr><th width="250.22216796875"></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>

## Examples

The power\_MeanVariableFrequency model compares the Mean block to the Mean (Variable Frequency) block for three identical input signals. It shows that, even if the frequency of the input signals varies during the simulation, the Mean (Variable Frequency) block outputs correct values.

The model sample time is parameterized by the Ts variable with 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/mean-variable-frequency.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.
