> 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/fundamental-pll-driven.md).

# Fundamental (PLL-Driven)

## Description

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

The **Fundamental (PLL-Driven)** block, located in the **OPAL-RT SPS Software/Sensors and Measurements** library, computes the fundamental value of the input 3 over a running window of one cycle of fundamental frequency given by input 1.

The reference frame required for the computation is given by the input 2.

Based on the Fourier analysis of a periodic signal, the fundamental value of a signal *f*(*t*) can be expressed as

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

a \cos(\omega\_0 t)
\+
b \sin(\omega\_0 t)
\\\[8pt]

# a

\frac{2}{T}
\int\_{t-T}^{t}
f(t), \cos(\omega\_0 t), dt
\\\[8pt]

# b

\frac{2}{T}
\int\_{t-T}^{t}
f(t), \sin(\omega\_0 t), dt
\\\[8pt]

T = \frac{1}{f\_0}
\quad
f\_0 : \text{Fundamental frequency}
\\\[8pt]
\omega\_0 = 2\pi f\_0
\\\[8pt]
$$

The magnitude and phase of the fundamental is calculated by

$$
\text{Magnitude} = \sqrt{a^{2} + b^{2}} \qquad \text{Phase} = \arctan(b/a) \\\[8pt]
$$

To resolve these equations, the block uses the input 1 (Freq) for *f*<sub>0</sub> and input 2 (wt) for ω<sub>0</sub>*t*. These two input signals are normally connected to the outputs of a PLL block.

As this block uses a running average window, one cycle of simulation must complete before the outputs give the correct magnitude and angle. For the first cycle of simulation, the outputs are held to the values specified by the initial input parameter.

## Parameters

<table data-header-hidden><thead><tr><th width="250.04449462890625"></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>Specify the minimum frequency value that sets the buffer size of the Variable Time Delay block used inside the block to compute the fundamental value. Default is 45.</td></tr><tr><td><strong>Initial input [ Mag, Phase-relative-to-PLL (degrees) ]</strong></td><td>Specify the initial magnitude and phase in degrees of the input signal. Default is [1, 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.22210693359375"></th><th></th></tr></thead><tbody><tr><td><strong>Freq</strong></td><td>Fundamental frequency (Hz) required by the computation. This input is normally connected to the output Freq of a PLL block.</td></tr><tr><td><strong>wt</strong></td><td>Angle of the reference frame (rad/s) required for the computation. This input is normally connected to the output wt of a PLL block.</td></tr><tr><td><strong>In</strong></td><td>Connects to the signal to be analyzed. Typical input signals are voltages or currents measured by the Current Measurement or Voltage Measurement block.</td></tr><tr><td>|u| <strong>Magnitude</strong></td><td>Returns the magnitude of the fundamental in the same unit as the input signal.</td></tr><tr><td><span class="math">\angle u</span> <strong>Magnitude</strong></td><td>Returns the phase of the fundamental, in degrees, relative to the reference frame wt (input 2).</td></tr></tbody></table>

## Characteristics

<table data-header-hidden><thead><tr><th width="249.55560302734375"></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, for Input 3 (In)</td></tr></tbody></table>

## Examples

The power\_FundamentalPLLDriven model compares the Fourier block (with a specified fundamental frequency of 60 Hz) output to the Fundamental (PLL-Driven) block output. The PLL-Driven block outputs accurate magnitude and phase even if the fundamental frequency of the input signal varies during the simulation.

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/fundamental-pll-driven.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.
