> 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/hypersim/library-blocks-reference/control-smart-inverters/repc_a.md).

# REPC\_A

## Description

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-64ae3d44122f56a3b4b610a4fdcaa88033bca335%2FCSI_REPC_A_block.png?alt=media" alt="" width="215"><figcaption></figcaption></figure>

The **Renewable Energy Plant Controller – Type A (REPC\_A)** block, located in the **Control Smart Inverters library**, is the WECC standard plant-level controller for inverter-based resources (IBRs) such as photovoltaic (PV) plants, wind plants (Type 3/4), and battery energy storage systems (BESS). It coordinates the plant to meet grid-level voltage, reactive power, and active power objectives at the Point of Interconnection (POI) using measurements at the Point of Measurement (POM), with optional compensation for electrical separation between POM and POI. The block includes two main control paths: a reactive/voltage control path (voltage control or reactive power control) and an active power control path (optionally with frequency support).

The four control modes are:

* Voltage control
* Reactive power control
* Active power control
* Active power control to support frequency regulation

{% hint style="danger" %}
This block requires a valid license on both the simulator and the workstation with the feature SMART INVERTER enabled.
{% endhint %}

### Voltage control

When the selector **RefFlag = 1**, it regulates plant voltage using measurements at the Vreg bus (POM). The compensation selector VcompFlag determines how the voltage drop Vdrop between measurement and control points is estimated:

* VcompFlag = 1: Impedance-based line-drop compensation using $R\_c$ and $X\_c$

$$
V\_{\text{drop}} = I \cdot \left(R\_c + j X\_c\right)
$$

* VcompFlag = 0: Reactive-power-based voltage drop estimation

$$
V\_{\text{drop}} = K\_c \cdot Q\_{\text{branch}}
$$

The compensated voltage feeds a PI controller to regulate plant voltage to the POI reference.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-8d081be793ab9ade652f704a28c61d82a89f78fd%2FCSI_REPC_A_voltage_Q_control.png?alt=media" alt="" width="700"><figcaption><p>Voltage and reactive power control</p></figcaption></figure>

By setting **VcompFlag=1** and **RefFlag=1**, the voltage control with current compensation will be implied; the user needs to be cautious about the input voltage (Vreg) and input reference voltage (VRef):

* **Vreg: use local bus voltage (POM)**
* **VRef: use remote bus voltage (POI)**
* **Ibranch: use the current flowing in the branch between POM and POI (the compensated line current)**
* **Set LocalControl = 0**

{% hint style="info" %}
Using this mode of operation in an EMT simulation is not straightforward. Although the functionality is modeled, connecting a remote bus and correctly mapping the associated controls can be challenging.
{% endhint %}

### Reactive power control

When the selector **RefFlag = 0**, it regulates the reactive power flow Qbranch (measured at the POM) using a PI controller. Voltage and reactive power control are mutually exclusive within the same path.

### Active power control

The REPC\_A model includes a dedicated active‑power control path for regulating the plant’s active‑power output.

When **FreqFlag = 1**, the controller regulates Pbranch using a PI controller considering: Plant\_Pref and the frequency-dependent active power response dP/dF.

The PI controller includes anti-windup: the integral term freezes when the controller output reaches its limits or during abnormal voltage conditions.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-283a420ef43aa2261a0a9b869469abae9228aa46%2FCSI_REPC_A_active_power_control.png?alt=media" alt="" width="700"><figcaption><p>Active power control</p></figcaption></figure>

### Active power control to support frequency regulation <a href="#active-power-control-to-support-frequency-regulation" id="active-power-control-to-support-frequency-regulation"></a>

Frequency support is implemented by generating active‑power ramp commands in response to frequency deviations when **FreqFlag = 1**. Deviations outside the specified deadband produce upward or downward active‑power rate commands, defined by **Dup** and **Ddn**, which are processed through the active‑power control loop to deliver a dynamic frequency response.

## Mask parameters

{% tabs %}
{% tab title="General" %}

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-7eb05654c213f71a83ad9a8396cd3b7dabef4201%2FCSI_REPC_A_mask_GeneralTab.png?alt=media" alt="" width="700"><figcaption></figcaption></figure>

| Parameter        | Description                                                                                                     | Variable & Constraints                |
| ---------------- | --------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
| **VcompFlag**    | <p>Select compensation method:<br>0 = reactive droop;<br>1 = current compensation.</p>                          | VcompFlag ∈ {0, 1}                    |
| **LocalControl** | <p>Local bus control:<br>0 = use remote voltage after current compensation; 1 = use local terminal voltage.</p> | LocalControl ∈ {0, 1}                 |
| **Rc**           | Current compensation resistance (pu).                                                                           | Rc recommended range: \[0, 0.01]      |
| **Xc**           | Current compensation reactance (pu).                                                                            | Xc recommended range: \[-0.1, 0.1]    |
| **Vfrz**         | Voltage (pu) below which state s2 is frozen (typical 0.7).                                                      | Vfrz recommended range: \[0.6, 0.9]   |
| **Kc**           | Reactive droop gain.                                                                                            | Kc ∈ \[0, 0.15]                       |
| **Kp**           | Reactive power PI control proportional gain.                                                                    | Kp unconstrained                      |
| **Ki**           | Reactive power PI control integral gain (1/s).                                                                  | Ki unconstrained                      |
| **Tft**          | Lead time constant (s).                                                                                         | Tft ∈ \[0, 0.05]                      |
| **RefFlag**      | Select reactive path control mode: 0 = Q control; 1 = V control.                                                | RefFlag ∈ {0, 1}                      |
| **Tfltr**        | Measurement transducer time constant (s) (typical 0.02).                                                        | Tfltr recommended range: \[0, 0.1]    |
| **dbd2**         | Upper threshold for reactive power control deadband.                                                            | dbd2 ∈ \[0, 1e64]                     |
| **dbd1**         | Lower threshold for reactive power control deadband.                                                            | dbd1 ∈ \[-1e64, 0]                    |
| **emax**         | Maximum error limit (pu).                                                                                       | emax recommended range: \[0.1, 999]   |
| **emin**         | Minimum error limit (pu).                                                                                       | emin recommended range: \[-999, -0.1] |
| **Qmax**         | Upper limit on output of V/Q control (pu).                                                                      | Qmax unconstrained                    |
| **Qmin**         | Lower limit on output of V/Q control (pu).                                                                      | Qmin unconstrained                    |
| **Tfv**          | Lag time constant (s).                                                                                          | Tfv recommended range: \[0.05, 0.5]   |

#### Active power control

| Parameter    | Description                                                               | Variable & Constraints                  |
| ------------ | ------------------------------------------------------------------------- | --------------------------------------- |
| **Tp**       | Lag time constant on electric power measurement (s) (typical 0.02).       | Tp recommended range: \[0.02, 0.5]      |
| **fdbd1**    | Deadband for primary frequency response (underfrequency).                 | fdbd1 ∈ \[-1e64, 0]                     |
| **fdbd2**    | Deadband for primary frequency response (overfrequency).                  | fdbd2 ∈ \[0, 1e64]                      |
| **Ddn**      | Downside droop for primary frequency response (pu/s).                     | Ddn ∈ \[0, 1e64]                        |
| **Dup**      | Upside droop for primary frequency response (pu/s).                       | Dup ∈ \[0, 1e64]                        |
| **Kpg**      | Proportional gain for active power control.                               | Kpg unconstrained                       |
| **femax**    | Maximum error limit (pu).                                                 | femax recommended range: \[0.01, 999]   |
| **femin**    | Minimum error limit (pu).                                                 | femin recommended range: \[-999, -0.01] |
| **Pmax**     | Upper limit on power reference (pu).                                      | Pmax recommended range: \[0, 1]         |
| **Pmin**     | Lower limit on power reference (pu).                                      | Pmin recommended range: \[-1, 0]        |
| **Tlag**     | Lag time constant (s).                                                    | Tlag recommended range: \[0.05, 0.5]    |
| **Kig**      | Integral gain for active power control (1/s).                             | Kig unconstrained                       |
| **FreqFlag** | Enable/disable frequency (active power) control: 0 = disable; 1 = enable. | FreqFlag ∈ {0, 1}                       |

{% hint style="info" %}
Note: In the “Variable & Constraints” column, entries marked recommended range are engineering guidance values and are not software-enforced limits.
{% endhint %}
{% endtab %}

{% tab title="Initial Conditions" %}

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-279f6c8e0c5ad13ad1f6fa833a58b28992a72cae%2FCSI_REPC_A_mask_InitCondTab.png?alt=media" alt="" width="400"><figcaption></figcaption></figure>

| Parameter     | Description                  | Variable & Constraints |
| ------------- | ---------------------------- | ---------------------- |
| **Vinit**     | Initial voltage (pu).        | Vinit unconstrained    |
| **Qinit**     | Initial reactive power (pu). | Qinit unconstrained    |
| **Pinit**     | Initial active power (pu).   | Pinit unconstrained    |
| {% endtab %}  |                              |                        |
| {% endtabs %} |                              |                        |

## Inputs

| Input           | Description                                                                           |
| --------------- | ------------------------------------------------------------------------------------- |
| **Qbranch**     | Reactive power flowing in the branch (pu).                                            |
| **Pbranch**     | Active power flowing in the branch (pu).                                              |
| **Vreg**        | Monitored bus voltage: positive-sequence magnitude (pu) and angle (rad).              |
| **Ibranch**     | Current through the defined branch: positive-sequence magnitude (pu) and angle (rad). |
| **Freq**        | Frequency (pu).                                                                       |
| **Qref**        | Reactive power reference (pu).                                                        |
| **Pplant\_ref** | Active power reference (pu).                                                          |
| **Vref**        | Voltage reference (pu).                                                               |
| **FreqRef**     | Frequency reference (pu).                                                             |

## Outputs

| Output   | Description                             |
| -------- | --------------------------------------- |
| **Pref** | Active power reference (pu).            |
| **Qext** | External reactive power reference (pu). |

## Signals available for monitoring and external I/O connections (via sensors form)

All block inputs and outputs are available as signals for monitoring and for external I/O connections.

## References

\[1] Model User Guide for Generic Renewable Energy System Models, EPRI, October 2023.

## Acknowledgements

{% hint style="info" %}

## Acknowledgements <a href="#acknowledgements" id="acknowledgements"></a>

The development of the <code class="expression">page.vars.block\_name</code> block in the Smart Inverter Control Library is a contribution of CanmetENERGY at Natural Resource Canada.
{% endhint %}


---

# 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/hypersim/library-blocks-reference/control-smart-inverters/repc_a.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.
