> ## Documentation Index
> Fetch the complete documentation index at: https://docs.plantpredict.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Charge & Discharge Limits

export const POI = () => <Tooltip tip="Point of Interconnection: where the plant connects to the utility grid; metering and delivery point for contractual obligations.">
    POI
  </Tooltip>;

export const Transformer = () => <Tooltip tip="Device connecting two AC circuits at different voltages; losses comprise constant no-load (core) and load-dependent (winding) components.">
    transformer
  </Tooltip>;

export const HV = () => <Tooltip tip="High Voltage: portion of a plant's electrical infrastructure connecting it to the utility grid via step-up transformers and transmission lines.">
    HV
  </Tooltip>;

export const MV = () => <Tooltip tip="Medium Voltage: electrical infrastructure between inverter output and the plant collection point, including step-up transformers and AC cabling.">
    MV
  </Tooltip>;

export const LGIA = () => <Tooltip tip="Large Generator Interconnection Agreement: contract defining the maximum power export limit at the point of interconnection.">
    LGIA
  </Tooltip>;

## Summary

Charge and discharge limits determine the maximum power that can flow into or out of the battery at each timestep. The [Dispatch Algorithms](dispatch_algorithms) set the *intent* to charge or discharge; the charge/discharge limits determine *how much* power is actually available for each operation. These limits account for the available PV power, ESS inverter capacity and losses, ESS <MV /> <Transformer /> losses, <HV /> equipment losses, and the <LGIA /> interconnect constraint.

In both directions, the limit is set by the lesser of two competing factors: the energy target and the ESS hardware capacity (primarily the inverter). During charging, the energy target depends on the dispatch algorithm—ranging from PV power that would otherwise be curtailed to the full available PV output. During discharging, the energy target is the remaining headroom below the LGIA limit at the <POI />. For Custom Dispatch, the user directly controls both charge and discharge power levels as a fraction of inverter capacity, as detailed below.

## Inputs

| Name                                  | Symbol             | Units | Description                                                             |
| ------------------------------------- | ------------------ | ----- | ----------------------------------------------------------------------- |
| **PV MV Transformer Output**          | $P_{PV,MV}$        | W     | PV power output from MV transformer, before HV losses                   |
| **PV Power After Availability**       | $P_{PV,avail}$     | W     | PV output after availability losses, before LGIA curtailment            |
| **Grid Limit (LGIA)**                 | $P_{POI}$          | MW    | Maximum allowed power at point of interconnection                       |
| **HV Equipment Losses**               | $L_{HV}$           | W     | Total HV transformer and transmission line losses (from PV-only pass)   |
| **ESS MV Transformer Rating**         | $P_{MV,rated,ESS}$ | MVA   | ESS MV transformer nameplate capacity                                   |
| **ESS MV No-Load Loss**               | $L_{NL,ESS}$       | %     | ESS MV transformer no-load loss as a percentage of $P_{MV,rated,ESS}$   |
| **ESS MV Full-Load Loss**             | $L_{FL,ESS}$       | %     | ESS MV transformer full-load loss as a percentage of $P_{MV,rated,ESS}$ |
| **ESS Inverter Rated AC Power**       | $P_{AC,rated,ESS}$ | MW    | ESS inverter nameplate AC power rating                                  |
| **ESS Inverter Efficiency**           | $\eta_{inv}$       | %     | ESS inverter conversion efficiency                                      |
| **Custom Inverter Capacity Fraction** | $f_{cap}$          | —     | Per-timestep inverter capacity fraction, 0 to 1 (Custom Dispatch only)  |

***

## Outputs

| Name                          | Symbol          | Units | Description                           |
| ----------------------------- | --------------- | ----- | ------------------------------------- |
| **Available Charge Power**    | $P_{charge}$    | W     | Maximum charge power at battery DC    |
| **Available Discharge Power** | $P_{discharge}$ | W     | Maximum discharge power at battery DC |

***

## Detailed Description

All charge and discharge limits are calculated at the battery DC terminals (Node 1). The calculations trace power from the measurement point (POI or MV bus) back through losses to determine how much DC power can actually reach or leave the battery. All inputs are converted to watts before use in equations ($P_{POI}$: MW → W, $P_{AC,rated,ESS}$: MW → W, $P_{MV,rated,ESS}$: MVA → VA).

### Charge Limits

Each charge limit calculation follows the same four steps: determine a starting power, subtract ESS MV transformer losses, cap at inverter capacity, and apply inverter efficiency. The choice of dispatch algorithm affects the starting power (Step 1) and, for Custom Dispatch, the inverter capacity limit (Step 3). The result is clamped to zero if negative.

#### Step 1: Charging Starting Power

**LGIA Excess algorithm:**

The LGIA Excess algorithm uses the PV excess above the interconnect limit, traced back from the POI to the MV bus by adding the portion of total HV losses attributable to $P_{excess}$:

$$
P_{excess} = \max(P_{PV,avail} - P_{POI},\; 0)
$$

$$
P_{c,start} = P_{excess} + L_{HV} \times \frac{P_{excess}}{P_{PV,MV}}
$$

The proportional scaling of $L_{HV}$ assumes HV losses scale linearly with power. Because HV losses are quadratic in current, this slightly overestimates the charge limit. This approximation only affects the determination of the charge limit; the actual losses are correctly captured in the second-pass plant-level power flow.

**Energy Available and Custom Dispatch algorithms:**

Both algorithms use the full PV MV transformer output as starting power:

$$
P_{c,start} = P_{PV,MV}
$$

#### Step 2: ESS MV Transformer Loss

The starting power passes through the ESS MV transformer:

$$
P_{inv,AC} = P_{c,start} - L_{MV,ESS}(P_{c,start})
$$

where $L_{MV,ESS}$ is computed using the [Transformer Loss Model](/models/ac-losses/transformer_loss_model) with $P_{MV,rated,ESS}$, $L_{NL,ESS}$, and $L_{FL,ESS}$.

#### Step 3: Inverter Capacity Limit

For the LGIA Excess and Energy Available algorithms, the power available to the energy storage system after transformer losses is limited by the ESS inverter's rated AC capacity:

$$
P_{inv,capped} = \min(P_{AC,rated,ESS},\; P_{inv,AC})
$$

For the Custom Dispatch algorithm, the user specifies the inverter operating point as a fraction $f_{cap}$ of rated capacity, capped by the PV-derived power from Steps 1–2:

$$
P_{inv,capped} = \min(f_{cap} \times P_{AC,rated,ESS},\; P_{inv,AC})
$$

#### Step 4: Inverter Efficiency

The inverter efficiency $\eta_{inv}$ is converted from percent to a fraction before use in equations.

$$
P_{charge} = P_{inv,capped} \times \eta_{inv}
$$

For the Energy Available algorithm, $P_{charge}$ is used by the [Dispatch Algorithms](dispatch_algorithms) to determine whether to set the charge flag (when above zero).

### Discharge Limit

The discharge limit determines how much DC power the battery can deliver, traced from the POI back to the battery DC terminals. The calculation mirrors the charge pipeline in reverse.

#### Step 1: Discharging Starting Power

Two independent constraints determine the maximum discharge power at the POI:

**LGIA headroom:**

The battery can only discharge up to the remaining capacity below the LGIA limit after accounting for the PV output:

$$
P_{d,LGIA} = \max(P_{POI} - P_{PV,avail},\; 0)
$$

**Storage hardware limit:**

The maximum power the storage system can deliver to the POI is the inverter capacity reduced by ESS MV transformer and HV equipment losses:

$$
P_{d,hardware} = P_{AC,rated,ESS} - L_{MV,ESS} - L_{HV,ESS}
$$

where $L_{MV,ESS}$ is the ESS MV transformer loss computed for $P_{AC,rated,ESS}$ using the [Transformer Loss Model](/models/ac-losses/transformer_loss_model), and $L_{HV,ESS}$ is the total HV equipment loss computed by running the post-MV-transformer power ($P_{AC,rated,ESS} - L_{MV,ESS}$) through the plant's [HV equipment chain](/models/ac-losses/plant_level_losses).

Note that $L_{HV,ESS}$ is evaluated for the storage power alone, not the combined PV+storage flow. Because HV losses are quadratic in current, this underestimates the true incremental loss and therefore slightly overestimates the discharge limit. This approximation only affects the determination of the discharge limit; the actual losses are correctly captured in the second-pass plant-level power flow, which uses the combined output.

**Combined constraint:**

The discharge starting power is the lesser of the two limits:

$$
P_{d,start} = \min(P_{d,LGIA},\; P_{d,hardware})
$$

#### Step 2: HV and ESS MV Equipment Losses

The starting power is traced backward from the POI through HV equipment and ESS MV transformer to determine the power at the inverter AC terminals:

$$
P_{inv,AC} = P_{d,start} + L_{HV,ESS} + L_{MV,ESS}
$$

$L_{MV,ESS}$ is recalculated for the actual power at the transformer ($P_{d,start} + L_{HV,ESS}$). If the limiting constraint in Step 1 is the LGIA headroom, this power is lower than $P_{AC,rated,ESS}$ and the MV loss differs from the value used in Step 1. If the limit is set by the ESS hardware, the power is the same and the loss is unchanged.

#### Step 3: Inverter Capacity Limit

For the LGIA Excess and Energy Available algorithms, the hardware limit in Step 1 guarantees that $P_{inv,AC}$ never exceeds $P_{AC,rated,ESS}$, so $P_{inv,capped} = P_{inv,AC}$.

For the Custom Dispatch algorithm, the user specifies the inverter operating point directly, bypassing Steps 1–2:

$$
P_{inv,capped} = f_{cap} \times P_{AC,rated,ESS}
$$

Because Custom Dispatch does not check LGIA headroom, the combined PV+ESS power at the POI can exceed the LGIA limit. Any excess is curtailed in the second-pass plant-level power flow. It is the user's responsibility to set the custom dispatch instructions to avoid exceeding the LGIA limit, as there are intentionally no safeguards for this dispatch algorithm.

#### Step 4: Inverter Efficiency

The inverter AC power is converted to battery DC power by dividing by inverter efficiency:

$$
P_{discharge} = \frac{P_{inv,capped}}{\eta_{inv}}
$$

***
