> 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/basics/sources/controlled-voltage-source.md).

# Controlled Voltage Source

## Description

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

The **Controlled Voltage Source** block, located in the **OPAL-RT SPS Software/Sources** library, converts a Simulink® input signal into an equivalent voltage source. The generated voltage is driven by the input signal of the block.

You can initialize the Controlled Voltage Source block with a specific [AC ](#user-content-fn-1)[^1]or [DC ](#user-content-fn-2)[^2]voltage. If you want to start the simulation in steady state, the Simulink input must be connected to a signal that begins the simulation as a sinusoidal or DC waveform that corresponds to the initial values.

{% hint style="info" %}
The Simulink input signal must be a complex value (phasor) when you use the Controlled Voltage Source block in a phasor simulation, because the SPS software does not automatically convert input signals from time-domain signals to complex (phasor) signals.
{% endhint %}

## Ports

### Input

|                                                               |                                                                         |
| ------------------------------------------------------------- | ----------------------------------------------------------------------- |
| <p><strong>s</strong> — Control signal<br>Physical signal</p> | Simulink physical signal input port associated with the control signal. |

### Conserving

|                                                                         |                                                                                                     |
| ----------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| <p><strong>+</strong> — Positive terminal<br>Specialized electrical</p> | Specialized electrical conserving port associated with the positive terminal of the voltage source. |
| <p><strong>-</strong> — Negative terminal<br>Specialized electrical</p> | Specialized electrical conserving port associated with the negative terminal of the voltage source. |

## Parameters

|                                                                                                        |                          |                                                                                                                                                                                                                                                                                                                                         |
| ------------------------------------------------------------------------------------------------------ | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><strong>Initialize</strong> — Enable source initialization<br><code>on</code> (default)             | <code>off</code></p>     | Initializes the Controlled Voltage Source block with the specified values of the **Initial amplitude (V)**, **Initial phase (deg)**, and **Initial frequency (Hz)** parameters.                                                                                                                                                         |
| <p><strong>Source type</strong> — AC or DC voltage source<br><code>AC</code> (default)                 | <code>DC</code></p>      | <p>Type of voltage source. Select <code>AC</code> (default) to initialize the Controlled Voltage Source block with an AC voltage source. Select <code>DC</code> to initialize the Controlled Voltage Source block with a DC voltage.<br><strong>Dependencies</strong> To enable this parameter, select <strong>Initialize</strong>.</p> |
| <p><strong>Initial amplitude (V)</strong> — Amplitude at simulation start<br><code>0</code> (default)  | scalar</p>               | <p>Initial amplitude of the source, in volts (V).<br><strong>Dependencies</strong> To enable this parameter, select <strong>Initialize</strong>.</p>                                                                                                                                                                                    |
| <p><strong>Initial phase (deg)</strong> — Phase at simulation start<br><code>0</code> (default)        | scalar</p>               | <p>Initial phase of the source, in degrees.<br><strong>Dependencies</strong> To enable this parameter, select <strong>Initialize</strong> and set <strong>Source type</strong> to <code>AC</code>.</p>                                                                                                                                  |
| <p><strong>Initial frequency (Hz)</strong> — Frequency at simulation start<br><code>0</code> (default) | nonnegative scalar</p>   | Initial frequency of the source, in hertz (Hz).**Dependencies** To enable this parameter, select **Initialize** and set **Source type** to `AC`.                                                                                                                                                                                        |
| <p><strong>Measurements</strong> — Source measurements<br><code>None</code> (default)                  | <code>Voltage</code></p> | Select `Voltage` to measure the voltage across the terminals of the Controlled Voltage Source block. To measure and voltage, place a Multimeter block in your model to display the selected measurements during the simulation.                                                                                                         |

In the **Available Measurements** pane of the Multimeter block, the measurement is identified by a label followed by the block name:

| Measurement | Label   |
| ----------- | ------- |
| **Voltage** | `Usrc:` |

## Examples

#### Generate 60 Hz Sinusoidal Voltage with Third Harmonic

The `power_controlvolt` example uses Controlled Voltage Source blocks to generate a 60 Hz sinusoidal voltage containing a third harmonic. One Controlled Voltage Source block is initialized as a 120 V AC voltage source with an initial frequency of 60 Hz and initial phase set to 0. The second Controlled Voltage Source block is not initialized.

[^1]: **AC**, or Alternating Current, is an electric current that periodically reverses direction. Unlike Direct Current (DC), which flows in a single direction, AC varies in amplitude and direction, typically represented as a sinusoidal waveform. It is commonly used in power supply systems for homes and industries due to its efficiency in transmission over long distances. AC can be characterized by its frequency, measured in hertz (Hz), which indicates the number of cycles per second.

[^2]: **DC**, or Direct Current, refers to an electric current that flows consistently in one direction. It is characterized by a constant voltage level, which can be either positive or negative. In electrical systems, a DC voltage source maintains a steady output regardless of the current drawn, making it essential for various applications, including batteries and electronic devices. DC is distinct from alternating current (AC), where the flow of electricity periodically reverses direction.


---

# 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/basics/sources/controlled-voltage-source.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.
