> 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-current-source.md).

# Controlled Current 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-7b444964bff2a8dd570d439c01cf5db0a801b309%2Fcontrolled_current_source_block.png?alt=media" alt=""><figcaption></figcaption></figure></div>

The **Controlled Current Source** block, located in the **OPAL-RT SPS Software/Sources** library, converts the Simulink® input signal into an equivalent current source. The generated current is driven by the input signal of the block. The positive current direction is as shown by the arrow in the block icon.

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

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

## Ports

### Input

|                                                                                                 |                                                                             |
| ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| <p><strong>S</strong> — Signal to convert into equivalent current source<br>Simulink signal</p> | Simulink signal that you want to convert into an equivalent current source. |

### Conserving

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

## Parameters

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

|                                                                                                                     |                          |                                                                                                                                                                                                                                                                                        |
| ------------------------------------------------------------------------------------------------------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><strong>Initialize</strong> — Whether to initialize Controlled Current Source block<br><code>On</code> (default) | <code>Off</code></p>     | Whether to initialize the Controlled Current Source block with the specified **Initial current**, **Initial phase**, and **Initial frequency** parameters.                                                                                                                             |
| <p><strong>Source type</strong> — Type of current source<br><code>AC</code> (default)                               | <code>DC</code></p>      | Type of current source. Select `AC` (default) to initialize the Controlled Current Source Block as an AC current source. Select `DC` to initialize the Controlled Current Source block as a DC current.**Dependencies** To enable this parameter, select the **Initialize** parameter. |
| <p><strong>Initial amplitude</strong> — Initial peak current<br><code>0</code> (default)                            | nonnegative scalar</p>   | <p>Initial peak current for the initialization of the source, in ampere (A).<br><strong>Dependencies</strong> To enable this parameter, select the <strong>Initialize</strong> parameter.</p>                                                                                          |
| <p><strong>Initial phase</strong> — Initial phase<br><code>0</code> (default)                                       | nonnegative scalar</p>   | <p>Initial phase for the initialization of the source, in degrees.<br><strong>Dependencies</strong> To enable this parameter, select the <strong>Initialize</strong> parameter and set <strong>Source type</strong> to <code>AC</code>.</p>                                            |
| <p><strong>Initial frequency</strong> — Initial frequency<br><code>0</code> (default)                               | nonnegative scalar</p>   | <p>Initial frequency for the initialization of the source, in hertz (Hz).<br><strong>Dependencies</strong> To enable this parameter, select the <strong>Initialize</strong> parameter and set <strong>Source type</strong> to <code>AC</code>.</p>                                     |
| <p><strong>Measurements</strong> — Option to measure current<br><code>None</code> (default)                         | <code>Current</code></p> | Select `Current` to measure the current flowing through the Controlled Current Source block. Place a Multimeter block in your model to display the selected measurements during the simulation.                                                                                        |

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

| Measurement | Label   |
| ----------- | ------- |
| **Current** | `Isrc:` |

## Examples

The `power_controlcurr` example uses a Controlled Current Source to generate a 60-Hz current modulated at 5 Hz.

[^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-current-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.
