> 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/phase-lock-loop/pll-3ph.md).

# PLL (3ph)

## Description

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

The **PLL (3ph)** block, located in the **OPAL-RT SPS Software/Control** library, determines frequency and fundamental component of three-phase signal phase angle.

The PLL (3ph) block models a Phase Lock Loop (PLL) closed-loop control system, which tracks the frequency and phase of a sinusoidal three-phase signal by using an internal frequency oscillator. The control system adjusts the internal oscillator frequency to keep the phases difference to 0.

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-f4750a7e03502428e387f9e299320833e4b694af%2FPLL_3P_internal_diagramm.png?alt=media" alt=""><figcaption><p>Internal diagram of the PLL</p></figcaption></figure>

The three-phase input signal is converted to a dq0 rotating frame (Park transform) using the angular speed of an internal oscillator. The quadrature axis of the signal, proportional to the phase difference between the abc signal and the internal oscillator rotating frame, is filtered with a Mean (Variable Frequency) block. A Proportional-Integral-Derivative (PID) controller, with an optional automatic gain control (AGC), keeps the phase difference to 0 by acting on a controlled oscillator. The PID output, corresponding to the angular velocity, is filtered and converted to the frequency, in hertz, which is used by the mean value.

## Characteristics

<table data-header-hidden><thead><tr><th width="250.2222900390625"></th><th></th></tr></thead><tbody><tr><td>Sample Time</td><td>Specified in the <strong>Sample Time</strong> parameter. Continuous when <strong>Sample Time</strong> = 0.</td></tr><tr><td>Scalar Expansion</td><td>No</td></tr><tr><td>Dimensionalized</td><td>No</td></tr><tr><td>Zero-Crossing Detection</td><td>Yes</td></tr></tbody></table>

## Ports

### Input

<table data-header-hidden><thead><tr><th width="249.77777099609375"></th><th></th></tr></thead><tbody><tr><td><strong>abc</strong> — Normalized three-phase signals<br>Vector</td><td>Normalized three-phase signals, in pu.</td></tr></tbody></table>

### Output

<table data-header-hidden><thead><tr><th width="250.22216796875"></th><th></th></tr></thead><tbody><tr><td><strong>freq</strong> — Measured frequency<br>Scalar</td><td>Measured frequency, in hertz.</td></tr><tr><td><strong>wt</strong> — Angle synchronized on zero crossing of fundamental of phase A<br>Scalar in the range [0, 2*pi]</td><td>Angle (rad) varying between 0 and 2*pi, synchronized on zero crossings of the fundamental (positive-sequence) of phase A.</td></tr></tbody></table>

## Parameters

<table data-header-hidden><thead><tr><th width="250"></th><th></th></tr></thead><tbody><tr><td><strong>Minimum frequency (Hz)</strong> — Minimum expected frequency of input signal<br>45 (default) | positive scalar</td><td><p>Minimum expected frequency of the input signal.</p><p>This parameter sets the buffer size of the Mean (Variable Frequency) block used inside the block to compute the mean value.</p></td></tr><tr><td><strong>Initial inputs [ Phase (degrees), Frequency (Hz) ]</strong> — Initial phase and frequency of input signal<br>[0, 60] (default) | vector of two elements</td><td>Initial phase and frequency of the input signal.</td></tr><tr><td><strong>Regulator gains [ Kp, Ki, Kd ]</strong> — Proportional, integral, and derivative gains of internal PID controller<br>[180, 3200, 1] (default) | vector of three elements</td><td>Proportional, integral, and derivative gains of the internal PID controller. Use the gains to tune the PLL response time, overshoot, and steady-state error performances.</td></tr><tr><td><strong>Time constant for derivative action (s)</strong> — Time constant for first-order filter<br>1e-4 (default) | nonnegative scalar</td><td>Time constant for the first-order filter of the PID derivative block.</td></tr><tr><td><strong>Maximum rate of change of frequency (Hz/s)</strong> — Maximum positive and negative slope of signal frequency<br>12 (default) | positive scalar</td><td>Maximum positive and negative slope of the signal frequency.</td></tr><tr><td><strong>Filter cut-off frequency for frequency measurement (Hz)</strong> — Second-order lowpass filter cut-off frequency<br>25 (default) | scalar</td><td>Second-order lowpass filter cut-off frequency.</td></tr><tr><td><strong>Sample time</strong> — Block sample time<br>0 (default) | nonnegative scalar</td><td>Sample time of the block, in seconds. Set to 0 to implement a continuous block.</td></tr><tr><td><strong>Enable automatic gain control</strong> — Automatic gain control option<br>on (default) | off</td><td><p>When you select this parameter, the PLL block optimizes its performances by scaling the PID regulator signal according to the input signal magnitude.</p><p>Select this option when the input signal is not normalized.</p></td></tr></tbody></table>

## Examples

The power\_PLL example shows the use of the PLL (3ph) and PLL blocks.

The PLL block is fed by a sinusoidal signal of 60 Hz, increasing to 61 Hz from 0.5 s to 1.5 s. Notice that the frequency reaches the new frequency in a short response time.

The PLL (3ph) block is fed by three-phase sinusoidal signals increasing from 60 Hz to 61 Hz between 0.5 and 1.5 seconds. The PLL (3ph) frequency reaches the new frequency faster than the PLL due to the additional phase information.

The model sample time is parameterized with the variable Ts (with a default value of 0). To discretize the PLL block, at the MATLAB® command prompt, enter

{% code lineNumbers="true" %}

```matlab
Ts = 50e-6
```

{% endcode %}


---

# 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/phase-lock-loop/pll-3ph.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.
