> 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/ac-voltage-source.md).

# AC 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-1b819bbe3f6a2df5b8631db53372c027bdfec35c%2FAC_voltage-source_block.png?alt=media" alt=""><figcaption></figcaption></figure></div>

The **AC Voltage Source** block, located in the **OPAL-RT SPS Software/Sources** library, implements an ideal AC voltage source. The generated voltage *U* is described by the following relationship:

$$
U=Asin(\omega t+\phi), \space \omega=2\pi f, \space \phi=\text{Phase in radians}
$$

Negative values are allowed for amplitude and phase. A frequency of 0 and phase equal to 90 degrees specify a DC[^1] voltage source. Negative frequency is not allowed; otherwise the software signals an error, and the block displays a question mark in the block icon.

## Ports

### Conserving

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

## Parameters

### Parameters

To edit block parameters interactively, use the Property Inspector. From the Simulink<sup>®</sup> Toolstrip, on the **Simulation** tab, in the **Prepare** gallery, select **Property Inspector**.

|                                                                                                        |                          |                                                                                                                                                                                                                      |
| ------------------------------------------------------------------------------------------------------ | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><strong>Peak amplitude</strong> — Peak amplitude of generated voltage<br><code>100</code> (default) | scalar</p>               | Peak amplitude of the generated voltage, in volts (V).                                                                                                                                                               |
| <p><strong>Phase</strong> — Phase<br><code>0</code> (default)                                          | scalar</p>               | Phase in degrees(deg).                                                                                                                                                                                               |
| <p><strong>Frequency</strong> — Source frequency<br><code>60</code> (default)                          | scalar</p>               | Source frequency in hertz(Hz).                                                                                                                                                                                       |
| <p><strong>Sample time</strong> — Sample period<br><code>0</code> (default) nonnegative                | scalar</p>               | Sample period in seconds (s). The default is `0`, corresponding to a continuous source.                                                                                                                              |
| <p><strong>Measurements</strong> — Measurements option<br><code>None</code> (default)                  | <code>Voltage</code></p> | <p>Select <code>Voltage</code> to measure the voltage across the terminals of the AC Voltage Source block.<br>Place a Multimeter block in your model to display the selected measurements during the simulation.</p> |

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

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

### Load Flow

The load flow parameters define block parameters for use with the Load Flow tool of the Powergui block. These load flow parameters are for model initialization only. They have no impact on the block model or on the simulation performance.

The configuration of the **Load Flow** tab depends on the option selected for the **Generator type** parameter.

<table data-header-hidden><thead><tr><th width="210"></th><th></th></tr></thead><tbody><tr><td><strong>Generator type</strong> — Generator type of voltage source<br><code>swing</code> (defaulFt) | <code>PV</code> | <code>PQ</code></td><td>Specify the generator type of the voltage source. Select <code>swing</code> to implement a generator controlling the magnitude and phase angle of its terminal voltage. Specify the reference voltage magnitude and angle in the <strong>Swing bus or PV bus voltage</strong> and <strong>Swing bus voltage angle</strong> parameters of the Load Flow Bus block connected to the voltage source terminals. Select <code>PV</code> to implement a generator controlling its output active power P and voltage magnitude V. Specify P in the <strong>Active power generation P</strong> parameter of the block. Specify V in the <strong>Swing bus or PV bus voltage</strong> parameter of the Load Flow Bus block connected to the voltage source terminals. You can control the minimum and maximum reactive power generated by the block by using the <strong>Minimum reactive power Qmin</strong> and <strong>Maximum reactive power Qmax</strong> parameters. Select <code>PQ</code> to implement a generator controlling its output active power P and reactive power Q. Specify P and Q in the <strong>Active power generation P</strong> and <strong>Reactive power generation Q</strong> parameters of the block, respectively.</td></tr><tr><td><strong>Active power generation P</strong> — Active power generated by source<br><code>10e3</code> | scalar</td><td>Specify the active power that you want generated by the source, in watts. When the machine operates in motor mode, you specify a negative value.<br><strong>Dependencies</strong> To enable this parameter, set <strong>Generator type</strong> to <code>PV</code> or <code>PQ</code>.</td></tr><tr><td><strong>Reactive power generation Q</strong> — Reactive power generated by source<br>0 (default) | scalar</td><td>Specify the reactive power that you want generated by the source, in vars. A negative value indicates that the reactive power is absorbed by the machine.<br><strong>Dependencies</strong> To enable this parameter, set <strong>Generator type</strong> to <code>PQ</code>.</td></tr><tr><td><strong>Minimum reactive power Qmin</strong> — Minimum reactive power generated by the source<br><code>-inf</code> (default) | scalar</td><td>Minimum reactive power that can be generated by the source while keeping the terminal voltage at its reference value. This reference voltage is specified in the <strong>Swing bus or PV bus voltage</strong> parameter of the Load Flow Bus block connected to the source terminals. The default value is <code>-inf</code>, which means that there is no lower limit on the reactive power output.<br><strong>Dependencies</strong> To enable this parameter, set <strong>Generator type</strong> to <code>PV</code>.</td></tr><tr><td><strong>Maximum reactive power Qmax</strong> — Maximum reactive power generated by the source<br><code>inf</code> (default) | scalar</td><td>Maximum reactive power that can be generated by the source while keeping the terminal voltage at its reference value. This reference voltage is specified in the <strong>Swing bus or PV bus voltage</strong> parameter of the Load Flow Bus block connected to the source terminals. The default value is <code>inf</code>, which means that there is no upper limit on the reactive power output.<br><strong>Dependencies</strong> To enable this parameter, set <strong>Generator type</strong> to <code>PV</code>.</td></tr></tbody></table>

### Examples

The `power_acvoltage` example uses two AC Voltage Source blocks at different frequencies connected in series across a resistor. The sum of the two voltages is read by a Voltage Measurement block.

[^1]: **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/ac-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.
