> 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/battery-energy-storage-system-bess.md).

# Battery Energy Storage System (BESS)

## Description

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

The **Battery energy storage System (BESS)** block, located in the **microGrid Testbed/DER** library, models an electrochemical battery connected to a DC-AC inverter that interfaces with an AC network. The battery charges from the grid and discharges stored energy to supply power when needed. The BESS includes a battery for energy storage, a smoothing capacitor across its outputs, and a Voltage-Source Converter (VSC) that performs the DC/AC conversion to connect the DC battery outputs to an external AC bus.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-ce2ee8d9093abdcc29f2f910fdfb41d4538fed0d%2FMG_BEES_concept.png?alt=media" alt=""><figcaption><p>Basic concept of the BESS</p></figcaption></figure>

{% 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-41f46fb3d7b149d3cd54bd5bbfc8fe77df62549f%2FMG_BEES_mask.png?alt=media" alt=""><figcaption></figcaption></figure>

{% tabs %}
{% tab title="Controller" %}
**Controller and Measurement filters** **tabs**

<table><thead><tr><th width="239.60003662109375">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Prioritiy</strong></td><td>Select whether the controller prioritizes active or reactive power. Active power is given preference if the total power exceeds the converter rating. Alternatively, reactive power is given preference.</td></tr><tr><td><strong>Nominal power Pn</strong></td><td>Nominal converter power, in VA. Default: 60000.</td></tr><tr><td><strong>Nominal frequency fn</strong></td><td>Nominal frequency, in Hz. Default: 50.</td></tr><tr><td><strong>Q regulator gain Kp</strong></td><td>Reactive regulator proportional gain Kp. Default: 1.</td></tr><tr><td><strong>Q regulator gain Ki</strong></td><td>Reactive regulator integral gain Ki. Default: 25.</td></tr><tr><td><strong>P regulator gain Kp</strong></td><td>Active regulator proportional gain Kp. Default: 1.</td></tr><tr><td><strong>P regulator gain Ki</strong></td><td>Active regulator integral gain Ki. Default: 25.</td></tr><tr><td><strong>Current regulator gain Kp</strong></td><td>Current regulator proportional gain Kp. Default: 1.</td></tr><tr><td><strong>Current regulator gain Ki</strong></td><td>Current regulator integral gain Ki. Default: 50.</td></tr><tr><td><strong>Islanded mode voltage regulator gain Kp</strong></td><td>Islanded mode voltage regulator proportional gain Kp. Default: 3.</td></tr><tr><td><strong>Islanded mode voltage regulator gain Ki</strong></td><td>Islanded mode voltage regulator integral gain Ki. Default: 40.</td></tr><tr><td><strong>DC voltage regulator enable</strong></td><td>Enable the DC voltage regulator. Default: unchecked.</td></tr><tr><td><strong>DC link voltage regulator Kp</strong></td><td>DC link voltage regulator proportional gain Kp. Default: 1.</td></tr><tr><td><strong>DC link voltage regulator Ki</strong></td><td>DC link voltage regulator integral gain Ki. Default: 50.</td></tr><tr><td><strong>Current limit</strong></td><td>Current limit. Default: 1.2.</td></tr><tr><td><strong>Sample time</strong></td><td>Block sample time, in seconds. Default: 50e-6.</td></tr><tr><td><strong>Proportional gain</strong></td><td>Proportional gain for the PI controller in PV mode and grid-connected mode. Default: 1.</td></tr><tr><td><strong>Integral gain</strong></td><td>Integral gain for the PI controller in PV mode and grid-connected mode. Default: 5.</td></tr><tr><td><strong>Upper limit</strong></td><td>Upper limit for the PI controller in PV mode and grid-connected mode. Default: 1.</td></tr><tr><td><strong>Lower limit</strong></td><td>Lower limit for the PI controller in PV mode and grid-connected mode. Default: -1.</td></tr><tr><td><strong>Antiwinup gain</strong></td><td>Antiwinup gain for the PI controller in PV mode and grid-connected mode. Default: 1.</td></tr><tr><td><strong>Filter type</strong> (voltage measurements)</td><td>Voltage measurement filter type: Lowpass (default), Highpass, Bandpass, or Bandstop (notch).</td></tr><tr><td><strong>Nominal frequency fn</strong> (voltage measurements)</td><td>Natural frequency of the voltage measurement filter, in Hz. Scalar or vector. Default: 1000.</td></tr><tr><td><strong>Damping ratio Zeta (Q = 1/(2*Zeta))</strong> (voltage measurements)</td><td>Damping ratio of the voltage measurement filter. Typically between 0 and 1. Default: 0.707.</td></tr><tr><td><strong>Filter type</strong> (current measurements)</td><td>Current measurement filter type: Lowpass (default), Highpass, Bandpass, or Bandstop (notch).</td></tr><tr><td><strong>Nominal frequency fn</strong> (current measurements)</td><td>Natural frequency of the current measurement filter, in Hz. Scalar or vector. Default: 1000.</td></tr><tr><td><strong>Damping ratio Zeta (Q = 1/(2*Zeta))</strong> (current measurements)</td><td>Damping ratio of the current measurement filter. Typically between 0 and 1. Default: 0.707.</td></tr></tbody></table>
{% endtab %}

{% tab title="Battery and DC Link" %}
**Battery parameters, discharge parameters and DC link parameters tabs**

<table><thead><tr><th width="239.5999755859375">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Type</strong></td><td>Battery model: Lithium-Ion (default), Lead-Acid, Nickel-Cadmium, Nickel-Metal-Hydride.</td></tr><tr><td><strong>Nominal voltage</strong></td><td>Battery nominal voltage Vnom, in V. Default: 1200.</td></tr><tr><td><strong>Rated capacity</strong></td><td>Battery rated capacity Qrated, in Ah. Minimum effective capacity. Default: 166.67.</td></tr><tr><td><strong>Initial state-of-charge</strong></td><td>Initial state of charge (SOC), in %. 100% is full; 0% is empty. Default: 60.</td></tr><tr><td><strong>Battery response time</strong></td><td>Battery response time (95% of final value), in s. Represents voltage dynamics for a current step. Default: 0.5.</td></tr><tr><td><strong>Determined from the nominal parameters of the battery</strong></td><td>Select to determine the Discharge settings from the Parameters settings values: on (default), off. Dependencies: Selecting this parameter disables the parameters in the Discharge settings.</td></tr><tr><td><strong>Maximum capacity</strong></td><td>Maximum theoretical capacity Q when a discontinuity occurs in the battery voltage, in Ah. Generally 105% of the rated capacity. Dependencies: To enable, in the Parameters settings, set Use a preset battery to no.</td></tr><tr><td><strong>Cut-off Voltage</strong></td><td>Maximum theoretical capacity, Q, when a discontinuity occurs in the battery voltage, in Ah. Generally 105% of the rated capacity. Dependencies: To enable, in the Parameters settings, set Use a preset battery to no.</td></tr><tr><td><strong>Fully charged voltage</strong></td><td>Fully charged voltage Vfull for a given discharge current. Not the no-load voltage. Dependencies: To enable, in the Parameters settings, set Use a preset battery to no.</td></tr><tr><td><strong>Nominal discharge current</strong></td><td>Nominal discharge current, in A, for which the discharge curve is measured. Dependencies: To enable, in the Parameters settings, set Use a preset battery to no.</td></tr><tr><td><strong>Internal resistance</strong></td><td>Battery internal resistance, in ohms. With a preset model, a generic value equal to 1% of nominal power (nominal voltage × rated capacity) is loaded. Resistance is constant during charge and discharge and does not vary with current. Dependencies: To enable, in the Parameters settings, set Use a preset battery to no.</td></tr><tr><td><strong>Capacity</strong></td><td>Amp-hour capacity at nominal voltage. Capacity Qnom extracted until voltage drops under nominal voltage. Dependencies: To enable, in the Parameters settings, set Use a preset battery to no.</td></tr><tr><td><strong>Exponential zone</strong></td><td>Voltage Vexp and capacity Qexp at the end of the exponential zone, as [Voltage (V), Capacity (Ah)]. Voltage should be between Vnom and Vfull. Capacity should be between 0 and Qnom. Dependencies: To enable, in the Parameters settings, set Use a preset battery to no.</td></tr><tr><td><strong>Capacitance</strong></td><td>DC link shunt capacitance, in F. Default: 0.0120.</td></tr><tr><td><strong>Set the initial capacitor voltage</strong></td><td>If selected, the initial capacitor voltage is defined by <strong>Capacitor initial voltage</strong>. If cleared, the software calculates the initial voltage to start in steady state. Default: selected.</td></tr><tr><td><strong>Capacitor initial voltage</strong></td><td>Initial capacitor voltage at simulation start, in V. Not visible and has no effect if <strong>Set the initial capacitor voltage</strong> is not selected.</td></tr><tr><td><strong>Resistance</strong></td><td>DC link shunt branch resistance, in ohms (Ω). Default: 1e12.</td></tr></tbody></table>
{% endtab %}

{% tab title="Voltage source cnverter" %}
**Two-level converter ans series RL branch tabs**

| Parameter                             | Description                                                                                                     |
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| **Model type**                        | Average model (Uref-controlled) is the only converter model type.                                               |
| **Diode on-state resistance**         | Diode internal resistance, in ohms. Default: 1e-3.                                                              |
| **Diode snubber resistance**          | Snubber resistance, in ohms. Set to inf to eliminate the snubbers. Default: 1000.                               |
| **Diode snubber capacitance**         | Snubber capacitance, in F. Set to 0 to eliminate the snubbers. Default: 1e-6.                                   |
| **Diode forward voltage**             | Forward voltage across the conducting diode, in V. Default: 1e-3.                                               |
| **Current source snubber resistance** | Snubber resistance across the two current sources, in ohms. Set to inf to eliminate the snubbers. Default: inf. |
| **Rated voltage**                     | Rated voltage of the BESS, in V.                                                                                |
| **Branch type**                       | Series RL branch.                                                                                               |
| **Resistance R**                      | Series branch resistance (choke resistance), in ohms (Ω). Default: 0.01.                                        |
| **Inductance L**                      | Series branch inductance (choke inductance), in henries (H). Default: 0.0041.                                   |
| {% endtab %}                          |                                                                                                                 |

{% tab title="Measurements" %}

<table><thead><tr><th width="249.79998779296875">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Time contant</strong></td><td>Low-pass filter time constant for power measurements, in seconds. Default: 0.05.</td></tr><tr><td><strong>Cut-off frequency</strong></td><td>Low-pass filter cut-off frequency for voltage and current measurements, in Hz. Default: 10.</td></tr><tr><td><strong>Nominal power of network</strong></td><td>Nominal power of the network, in W. Default: 12e3.</td></tr><tr><td><strong>Time constant for power measurement filter</strong></td><td>Power measurement filter time constant for signal conditioning, in seconds. Default: 0.05.</td></tr><tr><td><strong>Time constant for voltage measurement filter</strong></td><td>Voltage measurement filter time constant for signal conditioning, in seconds. Default: 0.1.</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

## Inputs

<table><thead><tr><th width="250">Input</th><th>Description</th></tr></thead><tbody><tr><td><strong>P ref</strong></td><td>Active power reference of the Battery Energy Storage System, in pu.</td></tr><tr><td><strong>Q ref</strong></td><td>Reactive power reference of the Battery Energy Storage System, in pu.</td></tr><tr><td><strong>V ref</strong></td><td>Voltage reference of the Battery Energy Storage System, in pu.</td></tr><tr><td><strong>GC Mode</strong></td><td>Status of the Battery Energy Storage System: grid-connected mode (1) or grid-forming mode (0).</td></tr><tr><td><strong>BESS mode</strong></td><td>Mode of the Battery Energy Storage System.</td></tr><tr><td><strong>status</strong></td><td>Connection to the microgrid: 1 = connected, 0 = disconnected.</td></tr></tbody></table>

## Outputs

<table><thead><tr><th width="250.800048828125">Output</th><th>Description</th></tr></thead><tbody><tr><td><strong>Measurements</strong></td><td><p>Provides the following measurement signals:</p><ul><li>Vrms Local (kV): RMS BESS voltage, in kV. To obtain pu, divide by the BESS nominal voltage.</li><li>Irms Local (A): RMS BESS current, in A. To obtain pu, divide by the BESS nominal current.</li><li>Q Reserve (pu): Reactive power reserve available from the BESS, in pu.</li><li>Battery Meas: Battery measurements (three signals):</li><li>SOC (%): State of charge, in %.</li><li>Current (A): Battery current, in A.</li><li>Voltage (V): Battery voltage, in V.</li><li>Vbess (V): BESS voltage, in V. To obtain pu, divide by the BESS nominal voltage.</li><li>Ibess (A): BESS current, in A. To obtain pu, divide by the BESS nominal current.</li><li>P (kW): Active power of the BESS, in kW.</li><li>Q (kVAr): Reactive power of the BESS, in kVAr.</li></ul></td></tr><tr><td><strong>A</strong></td><td>BESS circuit connection, phase A.</td></tr><tr><td><strong>B</strong></td><td>BESS circuit connection, phase B.</td></tr><tr><td><strong>C</strong></td><td>BESS circuit connection, phase C.</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/battery-energy-storage-system-bess.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.
