> 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/pulse-and-signal-generators/three-phase-programmable-generator.md).

# Three Phase Programmable Generator

## Description

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

The **Three Phase Programmable Generator** block, located in the **OPAL-RT SPS Software/Sources / Signal Generator Sources** library, generates a three-phase sinusoidal signal with time-varying parameters. This vectorized signal usually represents a set of three-phase voltages or currents. You can program the time variation for the amplitude, phase, or frequency of the fundamental component of the signal. In addition, you can program two harmonics and superimpose them on the fundamental signal.

## Characteristics

<table data-header-hidden><thead><tr><th width="250.22222900390625"></th><th></th></tr></thead><tbody><tr><td>Sample Time</td><td><ul><li>Specified in the <strong>Sample Time</strong> parameter</li><li>Continuous if <strong>Sample Time</strong> = 0</li></ul></td></tr><tr><td>Scalar Expansion</td><td>No</td></tr><tr><td>Dimensionalized</td><td>No</td></tr></tbody></table>

## Parameters

<table data-header-hidden><thead><tr><th width="250.3333740234375"></th><th></th></tr></thead><tbody><tr><td><strong>Positive-sequence [ Amplitude, Phase (degrees), Freq (Hz) ]</strong></td><td>Specify the amplitude (in volts, amperes, or pu), the phase (in degrees), and the frequency (in hertz) of the positive-sequence component of the three-phase signal. Default is [100, 0, 60].</td></tr><tr><td><strong>Time variation of</strong></td><td><p>Specify whether you want to program the time variation of the amplitude, phase, or frequency.</p><p>If you do not want to program a generator time variation, select None (default).</p><p>The time variation applies to the three phases of the source except when the <strong>Type of variation</strong> parameter is set to Table of amplitude-pairs. In that case, you can apply a variation to phase A only.</p></td></tr><tr><td><strong>Type of variation</strong></td><td><p>Specify the type of variation to apply to the amplitude, phase, or frequency specified by the <strong>Time variation of</strong> parameter.</p><p>Options include Step, Ramp (default), Modulation (for sinusoidal modulation), and Table of amplitude-pairs (a series of step changes of amplitude or phase at specific times).</p></td></tr><tr><td><strong>Step magnitude</strong></td><td>This parameter is visible only when the <strong>Type of Variation</strong> parameter is set to Step. Specify the amplitude of the step change of the magnitude of a positive-sequence amplitude (in volts, amperes, or pu), phase (in degrees), or frequency (in hertz). Default is -0.5 .</td></tr><tr><td><strong>Rate of change (value/s)</strong></td><td><p>This parameter is visible only when the <strong>Type of Variation</strong> parameter is set to Ramp.</p><p>Specify the rate of change of amplitude (in volts/second, amperes/second, or pu/second), phase (in degrees/second), or frequency (in hertz/second). Default is 10.</p></td></tr><tr><td><strong>Amplitude of the modulation</strong></td><td><p>This parameter is visible only when the <strong>Type of Variation</strong> parameter is set to Modulation.</p><p>Specify the amplitude of the modulation for the amplitude, frequency, or phase, as specified in the <strong>Time variation of</strong> parameter.</p><p>Default is 0.3.</p></td></tr><tr><td><strong>Frequency of the modulation (Hz)</strong></td><td><p>This parameter is visible only when the <strong>Type of Variation</strong> parameter is set to Modulation.</p><p>Specify the frequency of the modulation for the amplitude, phase, or frequency, as specified in the <strong>Time variation of</strong> parameter.</p><p>Default is 2.</p></td></tr><tr><td><strong>Variation timing (s) [Start, End]</strong></td><td><p>This parameter is visible only when the <strong>Type of Variation</strong> parameter is set to Step, Ramp, or Modulation.</p><p>Specify the time, in seconds, when the programmed time variation takes effect and stops.</p><p>Default is [0.2 1.2].</p></td></tr><tr><td><strong>Variation on phase A only</strong></td><td><p>This parameter is visible only when the <strong>Type of Variation</strong> parameter is set to Table of time-amplitude pairs. When this parameter is selected, the time variation specified by the <strong>Amplitude</strong> or <strong>phase values</strong> and <strong>Time values</strong> parameters is applied on phase A only.</p><p>Default is selected.</p></td></tr><tr><td><strong>Amplitude or phase values (degrees)</strong></td><td><p>This parameter is visible only when the <strong>Type of Variation</strong> parameter is set to Table of time-amplitude pairs. Use this parameter to specify the amplitude or phase values of phase A when <strong>Variation on phase A only</strong> is selected. Otherwise, use it to specify the positive sequence amplitudes or phase values (in degrees) corresponding to times specified in the <strong>Time values</strong> parameter.</p><p>Default is [1 0.2 1.2 1.0].</p></td></tr><tr><td><strong>Time values</strong></td><td><p>This parameter is visible only when the <strong>Type of Variation</strong> parameter is set to Table of time-amplitude pairs. Specify the times, in seconds, when the amplitude or phase will change, according to the values specified in the <strong>Amplitude or phase values</strong> parameter.</p><p>Default is [0 0.1 0.15 0.2].</p></td></tr><tr><td><strong>Harmonic generation</strong></td><td><p>Select this check box to enable programming of two harmonics that can be superimposed on the fundamental voltage of the source.</p><p>Default is cleared.</p></td></tr><tr><td><strong>A</strong></td><td><p>[Order (n), Amplitude, Phase (degrees), Seq(0, 1 or 2)]: This parameter is visible only when the <strong>Harmonic generation</strong> check box is selected.</p><p>Specify the order, amplitude, phase, and the type of sequence (1 = positive-sequence; 2 = negative-sequence; 0 = zero-sequence) of the first harmonic to superimpose on the fundamental signal.</p><p>Default is [3 5 -25 0]. Specify 1 for the harmonic order and 1 for the sequence to produce a positive-sequence amplitude change without imbalance and without harmonics. Specify 1 for the harmonic order and 0 or 2 for the sequence to produce a signal imbalance without harmonics.</p></td></tr><tr><td><strong>B</strong></td><td><p>[Order (n), Amplitude, Phase (degrees), Seq(0, 1 or 2)]: This parameter is visible only when the Harmonic generation check box is selected.</p><p>Specify the order, amplitude, phase, and the type of sequence (1 = positive-sequence; 2 = negative-sequence; 0 = zero-sequence) of the second harmonic to superimpose on the fundamental signal.</p><p>Default is [5 10 35 2].</p></td></tr><tr><td><strong>Harmonic timing (s) [Start, End]</strong></td><td>This parameter is visible only when the <strong>Harmonic generation</strong> check box is selected. Specify the time, in seconds, when the harmonic generation is superimposed on the fundamental signal and the time when it stops. Default is [ 0.05 99].</td></tr><tr><td><strong>Sample time</strong></td><td><p>Specify the sample time of the block, in seconds.</p><p>Set to 0 to implement a continuous block. Default is 0.</p></td></tr></tbody></table>

## Inputs and Outputs

<table data-header-hidden><thead><tr><th width="250.22216796875"></th><th></th></tr></thead><tbody><tr><td><strong>abc</strong></td><td>Returns the vectorized signal of phases a, b, and c.</td></tr><tr><td><strong>m</strong></td><td>Simulink® output vector containing eight internal signals.</td></tr></tbody></table>

<table data-header-hidden><thead><tr><th width="120.111083984375"></th><th width="179.6666259765625"></th><th></th></tr></thead><tbody><tr><td><strong>Signal</strong></td><td><strong>Signal Names</strong></td><td><strong>Definition</strong></td></tr><tr><td>1-3</td><td>Mag_abc</td><td>Magnitudes of the fundamental component of a, b, c signals</td></tr><tr><td>4-6</td><td>Phase_abc (deg)</td><td>Phases of the fundamental component of a, b, c signals (degrees)</td></tr><tr><td>7</td><td>Freq (Hz)</td><td>Frequency of the fundamental component of a, b, c signals (hertz)</td></tr><tr><td>8</td><td>wt (rad)</td><td>Instantaneous angle of the rotating vector of the positive-sequence component (radians)</td></tr></tbody></table>

## Examples

The power\_ThreePhaseProgrammableGenerator model shows two applications of the Three-Phase Programmable Generator block.

In the top model, a sinusoidal modulation of amplitude is programmed from 0.1 s to 0.6 s. Then a positive-sequence signal sag is produced from 0.7 s to 0.9 s by adding a positive-sequence harmonic of order 1 with a 180-degree phase-shift.

In the bottom model, a frequency ramp is programmed from 0.1 s to 0.6 s, and then two harmonics (2nd and 5th) are added from 0.7 s to 0.9 s. The magnitude, phase, and frequency of positive-sequence component are measured using a PLL and a Positive-Sequence (PLL-Driven) block. Variations of measured quantities are compared with specified values available at the measurement output (m).

The model sample time is parameterized with variable Ts (default value Ts=50e-6). To simulate the continuous Three-Phase Programmable Generator block, specify Ts = 0 in the MATLAB® Command Window before starting the simulation.


---

# 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/pulse-and-signal-generators/three-phase-programmable-generator.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.
