> 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/reec_a.md).

# REEC\_A

## Description

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

The **Renewable Energy Electrical Controller - Type A (REEC\_A)** block, located in the **Control Smart Inverters library**, is a WECC standard dynamic model used to represent the electrical control of inverter-based resources (IBRs) such as photovoltaic (PV) plants, wind power plants (Type 3/4), and battery energy storage systems (BESS) in positive-sequence stability studies. It regulates current, voltage, and reactive power using measurements at the Point of Measurement (POM), while tracking voltage and reactive power objectives defined at the Point of Interconnection (POI). The block model mainly contains three parts as shown in figure below:

* Active current controls, which generate the active current command Ipcmd
* Reactive current controls, which generate the reactive current command Iqcmd
* The converter current limit logic, which limits the active and reactive current to within the ratings of the converter

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

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

### Active power control

Active power control passes the upstream plant controller reference through a first-order dynamic with limits and an optional speed dependency selected by PFlag (PFlag in {0,1}).

### Reactive Power Control <a href="#reactive-power-control" id="reactive-power-control"></a>

Reactive power control supports multiple modes via flag combinations (PfFlag, QFlag, VFlag), including local constant Q control, constant power factor control, terminal voltage control, and coordinated Q/V control.

| Control mode                                 | PfFlag | QFlag | VFlag               |
| -------------------------------------------- | ------ | ----- | ------------------- |
| **Local constant Q control**                 | 0      | 0     | 1 or 0 (irrelevant) |
| **Local constant power factor (pf) control** | 1      | 0     | 1 or 0 (irrelevant) |
| **Local terminal voltage control**           | 0      | 1     | 0                   |
| **Local coordinated Q/V control**            | 0      | 1     | 1                   |

A proportional reactive current injection path with deadband is available for voltage dips and is disabled by setting Kqv = 0 (or by setting Vup and Vdip, for example, to 2 and 0, respectively).

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-42d9c660f43bd54bbdb2b11049efcba96db3ca42%2FCSI_REEC_A_state.png?alt=media" alt="" width="350"><figcaption><p>State transitions in the REEC_A</p></figcaption></figure>

Parameters Iqfrz and Thld shape the post-fault behavior:

* if $Thld > 0$, Iqinj is held at Iqfrz for $Thld$ seconds after the voltage dip clears;
* if $Thld < 0$, Iqinj is held at its last state (equal to Iqv) for $|Thld|$ seconds;
* if $Thld = 0$, Iqinj resets immediately when the dip ends. $Thld2$ can hold the active current limit (Ipmax) at its fault value for $Thld2$ seconds after the dip clears.

### Current limit logic <a href="#current-limit-logic" id="current-limit-logic"></a>

Current limit logic enforces a semicircular limit in quadrants 1 and 4 (generator operation with Ipmin = 0 and total current <= Imax) and resolves P/Q priority using PqFlag.

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

## 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-ae0be97b780a0a5171b6b22c3e8a2e0e6606e823%2FCSI_REEC_A_mask_GeneralTab.png?alt=media" alt="" width="700"><figcaption></figcaption></figure>

| Parameter  | Description                                                                                                                        | Variable & Constraints                |
| ---------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
| **PfFlag** | <p>Power factor control selection:<br>- Q control, which can be driven by an external signal (0)<br>- Power factor control (1)</p> | PfFlag ∈ {0, 1}                       |
| **VFlag**  | <p>Voltage/Q control selection:<br>- Voltage control (0)<br>- Q control (1)</p>                                                    | VFlag ∈ {0, 1}                        |
| **Tp**     | Active power filter time constant for electrical power (s). Typical: 0.02.                                                         | Tp recommended range: \[0, 0.1]       |
| **Vmax**   | Voltage regulator upper output limit (pu). Typical: 1.1.                                                                           | Vmax recommended range: \[1.05, 1.1]  |
| **Vmin**   | Voltage regulator lower output limit (pu). Typical: 0.9.                                                                           | Vmin recommended range: \[0.9, 0.95]  |
| **Vref1**  | User-defined reference bias (pu); can be fixed or set externally                                                                   | Vref1 unconstrained                   |
| **Qmax**   | Maximum reactive power limit (pu). To disable, a high value (for example 9999) can be used.                                        | Qmax recommended range: \[OEM, 9999]  |
| **Qmin**   | Minimum reactive power limit (pu). To disable, a low value (for example -9999) can be used.                                        | Qmin recommended range: \[-9999, OEM] |
| **QFlag**  | <p>Reactive power control selection:<br>- Constant power factor or Q control (0)<br>- Voltage or Q control (1)</p>                 | QFlag ∈ {0, 1}                        |
| **Kqp**    | Proportional gain of Q regulator (dimensionless). Typically zero when using voltage-based control                                  | Kqp unconstrained                     |
| **Kqi**    | Integral gain of Q regulator (1/s)                                                                                                 | Kqi unconstrained                     |
| **Kvp**    | Voltage regulator proportional gain (dimensionless)                                                                                | Kvp unconstrained                     |
| **Kvi**    | Voltage regulator integral gain (1/s)                                                                                              | Kvi unconstrained                     |
| **Kqv**    | Voltage error to reactive current gain (dimensionless). If zero, no dynamic Iq response to voltage deviation.                      | Kqv recommended range: \[0, 5]        |
| **Tiq**    | Time constant for Iq control response (s). Typical: 0.02.                                                                          | Tiq recommended range: \[0.01, 0.1]   |

#### Reactive current injection during voltage dips

| Parameter | Description                                                                                                                                                           | Variable & Constraints                 |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- |
| **Vup**   | High voltage threshold for reactive current injection (pu). If Vup > 99, Iq injection is reduced or disabled.                                                         | Vup recommended range: \[1.05, 2]      |
| **Vdip**  | Low voltage threshold for reactive current injection (pu). Below this value, the inverter injects Iq for voltage support.                                             | Vdip recommended range: \[-1, 0.95]    |
| **dbd1**  | Lower bound of voltage error deadband (pu).                                                                                                                           | dbd1 recommended range: \[-0.15, 0]    |
| **dbd2**  | Upper bound of voltage error deadband (pu).                                                                                                                           | dbd2 recommended range: \[0, 0.15]     |
| **Iqh1**  | Maximum reactive current injection limit (pu).                                                                                                                        | Iqh1 recommended range: \[0.1, Imax]   |
| **Iql1**  | Minimum reactive current injection limit (pu).                                                                                                                        | Iql1 recommended range: \[-Imax, -0.1] |
| **Trv**   | Voltage measurement filter time constant (s). Typical: 0.02.                                                                                                          | Trv recommended range: \[0, 0.1]       |
| **Thld**  | Hold time for reactive current injection state after voltage\_dip returns to zero (s). If > 0: hold at Iqfrz; if < 0: hold last state (equal to Iqv); if = 0: no hold | Thld unconstrained                     |
| **Thld2** | Hold time for active current limit Ipmax at its fault value after voltage\_dip returns to zero (s)                                                                    | Thld2 unconstrained                    |
| **Iqfrz** | Held value of reactive current during post-dip hold (pu). Set to 0 to disable hold                                                                                    | Iqfrz unconstrained                    |

#### Active power control

| Parameter | Description                                                                                                          | Variable & Constraints                 |
| --------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------- |
| **Pmax**  | Maximum active power limit (pu). Typical: 1.                                                                         | Pmax recommended range: \[1, 1.15]     |
| **Pmin**  | Minimum active power limit (pu). For REEC\_A, this is typically non-negative.                                        | Pmin recommended range: \[0, 0.05]     |
| **Tpord** | Power reference filter time constant (s). Typical: 0.02.                                                             | Tpord recommended range: \[0.01, 0.1]  |
| **dPmax** | Maximum power ramp-up rate (pu/s). Typical: 999 to disable ramp-up limiting.                                         | dPmax recommended range: \[0.1, 999]   |
| **dPmin** | Maximum power ramp-down rate (pu/s). Typical: -999 to disable ramp-down limiting.                                    | dPmin recommended range: \[-999, -0.1] |
| **PFlag** | <p>Active power control selection:<br>-if no dependency (0)<br>- Active current command has speed dependency (1)</p> | PFlag ∈ {0, 1}                         |

#### Current limit logic

| Parameter  | Description                                                                       | Variable & Constraints            |
| ---------- | --------------------------------------------------------------------------------- | --------------------------------- |
| **Imax**   | Maximum converter current limit for combined P and Q (pu).                        | Imax recommended range: \[1, 1.2] |
| **PqFlag** | <p>P/Q priority for current limiting:<br>- Q priority (0)<br>- P priority (1)</p> | PqFlag ∈ {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="Voltage-dependent limits" %}

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

The VDL1 and VDL2 characteristics are defined by four Vq-Iq pairs (VDL1) and four Vp-Ip pairs (VDL2), all in per unit.

| Parameter    | Description               | Variable & Constraints |
| ------------ | ------------------------- | ---------------------- |
| **Vq1**      | VDL1 voltage point 1 (pu) | Vq1 unconstrained      |
| **Vq2**      | VDL1 voltage point 2 (pu) | Vq2 unconstrained      |
| **Vq3**      | VDL1 voltage point 3 (pu) | Vq3 unconstrained      |
| **Vq4**      | VDL1 voltage point 4 (pu) | Vq4 unconstrained      |
| **Iq1**      | VDL1 Iqmax point 1 (pu)   | Iq1 unconstrained      |
| **Iq2**      | VDL1 Iqmax point 2 (pu)   | Iq2 unconstrained      |
| **Iq3**      | VDL1 Iqmax point 3 (pu)   | Iq3 unconstrained      |
| **Iq4**      | VDL1 Iqmax point 4 (pu)   | Iq4 unconstrained      |
| **Vp1**      | VDL2 voltage point 1 (pu) | Vp1 unconstrained      |
| **Vp2**      | VDL2 voltage point 2 (pu) | Vp2 unconstrained      |
| **Vp3**      | VDL2 voltage point 3 (pu) | Vp3 unconstrained      |
| **Vp4**      | VDL2 voltage point 4 (pu) | Vp4 unconstrained      |
| **Ip1**      | VDL2 Ipmax point 1 (pu)   | Ip1 unconstrained      |
| **Ip2**      | VDL2 Ipmax point 2 (pu)   | Ip2 unconstrained      |
| **Ip3**      | VDL2 Ipmax point 3 (pu)   | Ip3 unconstrained      |
| **Ip4**      | VDL2 Ipmax point 4 (pu)   | Ip4 unconstrained      |
| {% 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-1b5a69ccc3e2692f8a2e0c9eaf3987cafacc506d%2FCSI_REEC_A_mask_InitCond.png?alt=media" alt="" width="450"><figcaption></figcaption></figure>

| Parameter     | Description                           | Variable & Constraints |
| ------------- | ------------------------------------- | ---------------------- |
| **Vref0**     | Initial voltage reference (pu)        | Vref0 unconstrained    |
| **Pref0**     | Initial active power reference (pu)   | Pref0 unconstrained    |
| **Qref0**     | Initial reactive power reference (pu) | Qref0 unconstrained    |
| {% endtab %}  |                                       |                        |
| {% endtabs %} |                                       |                        |

## Inputs

| Input      | Description                                                                                           |
| ---------- | ----------------------------------------------------------------------------------------------------- |
| **Vt**     | Terminal voltage measured at the POC (pu)                                                             |
| **pfaref** | Power factor angle reference (rad)                                                                    |
| **Pe**     | Active power measured at the POC (pu)                                                                 |
| **Qgen**   | Reactive power measured at the POC (pu)                                                               |
| **wg**     | Generator speed from the drive train model (pu)                                                       |
| **Pref**   | Active power reference (pu); initialized from load-flow or provided by an external plant controller   |
| **Qext**   | Reactive power reference (pu); initialized from load-flow or provided by an external plant controller |

## Outputs

| Output    | Description                   |
| --------- | ----------------------------- |
| **Iqcmd** | Reactive current command (pu) |
| **Ipcmd** | Active current command (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/reec_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.
