> 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/rt-lab/simulink-blocks-reference/microgrid-testbed-library/active-power-controller.md).

# Active Power Controller

## Description

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-6c2f250c119f5745782c20388ddcb32294243151%2FMG_active_power_controller_block.png?alt=media" alt="" width="233"><figcaption></figcaption></figure>

The **Active Power Control** block, located in the **microGrid Testbed/Control** library, regulates the active power flow at the Point of Common Coupling (PCC) when the microgrid is connected to an external AC grid, allowing adjustment of active power settings to maintain stability.

{% hint style="danger" %}
This block requires a valid RT-LAB license on both the workstation and the simulator, with the OP1420 feature enabled. For more information, see [Microgrid Control & DERs](https://www.opal-rt.com/docs/rt-lab/model-and-simulation/power-systems-with-artemis/microgrid-control-and-ders.md).
{% endhint %}

## Mask parameters

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-0dcfc733dae86fbac1bd06fdbb7f5edce24ab6cf%2FMG_active_power_controller_mask.png?alt=media" alt="" width="445"><figcaption></figcaption></figure>

<table><thead><tr><th width="240.39996337890625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Sample time</strong></td><td>Simulation time step. Unit: s</td></tr><tr><td><strong>Active Power Diesel limits</strong></td><td>Minimum and maximum values for Diesel generation (pu)</td></tr><tr><td><strong>Active Power BESS limits</strong></td><td>Minimum and maximum values available for energy storage using BESS (pu)</td></tr><tr><td><strong>State of Charge (SoC) limits</strong></td><td>Minimum and maximum values of State of Charge (pu)</td></tr><tr><td><strong>Inner state of charge (SoC) limits</strong></td><td>Minimum and maximum values of Inner State of Charge (pu)</td></tr></tbody></table>

## Inputs

<table><thead><tr><th width="240.4000244140625">Input</th><th>Description</th></tr></thead><tbody><tr><td><strong>P renewable (PV+WT)</strong></td><td>Renewable active power, measured or forecasted (pu)</td></tr><tr><td><strong>P load</strong></td><td>Load active power, measured or forecasted (pu)</td></tr><tr><td><strong>SoC</strong></td><td>State of Charge of the BESS (pu)</td></tr><tr><td><strong>P PCC</strong></td><td>Active power reference at the PCC (pu)</td></tr><tr><td><strong>Dispatch mode</strong></td><td>Dispatch mode selection.<br>0: Load-Following, 1: Cycle-Charging, 2: Power-Smoothing</td></tr><tr><td><strong>Islanded</strong></td><td>Operating mode.<br>0: islanded, 1: grid-connected</td></tr></tbody></table>

## Outputs

<table><thead><tr><th width="240.4000244140625">Output</th><th>Description</th></tr></thead><tbody><tr><td><strong>DG P ref</strong></td><td>Diesel generator active power reference (pu)</td></tr><tr><td><strong>Load shed P ref</strong></td><td>Load-shedding command (pu)</td></tr><tr><td><strong>Curtail P ref</strong></td><td>Renewable active power curtailment command (pu)</td></tr><tr><td><strong>BESS P temp ref</strong></td><td>ESS active power reference (pu)</td></tr><tr><td><strong>PCC P ref</strong></td><td>Active power reference for the grid (pu)</td></tr><tr><td><strong>P net</strong></td><td>Net active power mismatch (pu)</td></tr><tr><td><strong>Dispatch mode</strong></td><td>Dispatch mode.<br>0: Load-Following, 1: Cycle-Charging, 2: Power-Smoothing. No unit</td></tr></tbody></table>


---

# 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/rt-lab/simulink-blocks-reference/microgrid-testbed-library/active-power-controller.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.
