> ## 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.

# Power Flow to Grid

export const CurtailmentCap = () => <Tooltip tip="Deliberate reduction of plant output to comply with grid constraints or interconnection agreements.">
    Curtailment
  </Tooltip>;

export const AvailabilityLoss = () => <Tooltip tip="Energy loss from the plant or part of the plant being offline due to maintenance or unplanned outages.">
    availability loss
  </Tooltip>;

export const Inverter = () => <Tooltip tip="Power electronics device that sets the operating point on the DC array's I-V curve and converts DC to AC for grid injection.">
    inverter
  </Tooltip>;

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

export const Transformers = () => <Tooltip tip="Devices connecting two AC circuits at different voltages; losses comprise constant no-load (core) and load-dependent (winding) components.">
    transformers
  </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>;

## Summary

Power Flow to Grid computes the combined PV+ESS net power delivered to the grid. Battery DC power is converted to AC through the storage <Inverter /> and traced through the <MV /> <Transformer />. During charging, PV output is reduced by the power diverted to storage; during discharging, battery power is added to PV output. The combined output at MV then triggers a re-run of the [plant-level power flow](/models/ac-losses/plant_level_losses)—the <HV /> transformers losses, transmission lines losses, <AvailabilityLoss />, and <LGIA /> limit are re-calculated and applied; the rest of the PV pipeline is not re-run.

## Inputs

| Name                          | Symbol             | Units | Description                                                                                                  |
| ----------------------------- | ------------------ | ----- | ------------------------------------------------------------------------------------------------------------ |
| **Battery DC Power**          | $P_{DC,batt}$      | W     | DC power at battery terminals, positive = charge, negative = discharge (from [Battery Model](battery_model)) |
| **ESS Inverter Efficiency**   | $\eta_{inv}$       | %     | ESS inverter conversion efficiency                                                                           |
| **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}$                                      |
| **PV MV Transformer Output**  | $P_{PV,MV}$        | W     | PV power output from MV transformer, before HV losses                                                        |
| **Grid Limit (LGIA)**         | $P_{POI}$          | MW    | Maximum allowed power at point of interconnection                                                            |
| **Availability Factor**       | $f_{avail}$        | %     | Flat percentage deduction for estimated downtime                                                             |

***

## Outputs

| Name                      | Symbol         | Units | Description                                                                 |
| ------------------------- | -------------- | ----- | --------------------------------------------------------------------------- |
| **Combined PV+ESS Power** | $P_{combined}$ | W     | Merged PV and ESS power at MV level before HV losses                        |
| **Grid Power**            | $P_{grid}$     | W     | Final plant output at the POI after HV losses, availability, and LGIA limit |

***

## Detailed Description

The power flow traces battery power from the DC terminals to the grid in four steps:

1. **ESS Inverter** — converts DC to AC (or AC to DC) with efficiency losses
2. **ESS MV Transformer** — applies transformer losses to the inverter AC power
3. **Combined PV+ESS Output** — merges PV and ESS power at the MV level (subtracting charge or adding discharge)
4. **Plant-Level Power Flow Re-Run** — applies HV losses, availability, and LGIA limit to the combined output

### Step 1: ESS Inverter

The inverter converts between DC power at the battery terminals and AC power on the low-voltage side of the MV transformer. $\eta_{inv}$ is converted from percentage to fraction before use.

When discharging ($P_{DC,batt} < 0$), the inverter converts DC to AC with efficiency losses:

$$
P_{AC,d} = -P_{DC,batt} \times \eta_{inv}
$$

When charging ($P_{DC,batt} > 0$), the inverter converts AC to DC, requiring more AC input than DC output:

$$
P_{AC,c} = \frac{P_{DC,batt}}{\eta_{inv}}
$$

The inverter efficiency loss is calculated for reporting during both charge and discharge:

$$
L_{inv} = (1 - \eta_{inv}) \times |P_{DC,batt}|
$$

### Step 2: ESS MV Transformer

The storage MV transformer uses the same quadratic loss model as PV transformers (see [Transformer Loss Model](/models/ac-losses/transformer_loss_model)), parameterized by $P_{MV,rated,ESS}$—converted from MVA to VA—$L_{NL,ESS}$, and $L_{FL,ESS}$.

#### Discharge

During discharge (power flows battery → grid), the transformer reduces the power delivered to the MV bus:

$$
P_{MV,d} = P_{AC,d} - L_{MV}(P_{AC,d})
$$

#### Charge (or Idle)

During charge or when the battery is idle (power flows PV → battery via the MV bus), the transformer increases the power drawn from the MV bus—the PV must supply the charge power plus the transformer loss:

$$
P_{MV,c} = P_{AC,c} + L_{MV}(P_{AC,c})
$$

When the battery is idle, the transformer still draws power from the grid to maintain core magnetization. The charge power reduces to the no-load loss alone: $P_{MV,c} = L_{NL,ESS} \times P_{MV,rated,ESS}$.

### Step 3: Combined PV+ESS Output

When charging or idle, PV output is reduced by the total power diverted to storage, $P_{MV,c}$ (which includes MV transformer loss overhead and collapses to the no-load loss when idle, per Step 2):

$$
P_{combined} = P_{PV,MV} - P_{MV,c}
$$

When discharging, battery power is added to the full PV output:

$$
P_{combined} = P_{PV,MV} + P_{MV,d}
$$

When PV is negative and the battery is discharging—possible at night due to auxiliary loads and transformer energization losses—only the battery discharge is delivered: $P_{combined} = P_{MV,d}$.

### Step 4: Plant-Level Power Flow Re-Run

The combined output ($P_{combined}$) replaces the sum of PV block outputs, and the [plant-level power flow](/models/ac-losses/plant_level_losses) is re-run with the new PV + ESS combined power value to determine revised HV losses. The upstream portion of the PV pipeline (irradiance, DC performance, inverter, array-level losses) is not run again; those results are retained. The re-run applies the same three stages as the PV-only pass:

1. **HV equipment** — $P_{combined}$ enters the HV chain and passes through each transformer and transmission line in series; each element reduces the power by its losses and feeds the result to the next element. The final output $P_{HV,out}$ is the power upstream of the <POI /> after all HV losses.

2. **Availability** — a flat percentage deduction for estimated downtime due to maintenance and unplanned outages:

$$
P_{avail} = P_{HV,out} \times \frac{100 - f_{avail}}{100}
$$

3. **LGIA limit** — power exceeding the interconnect capacity ($P_{POI}$, converted from MW to W) is curtailed:

$$
P_{grid} = \min(P_{avail},\, P_{POI})
$$

<CurtailmentCap /> can occur when:

* PV alone exceeds the LGIA limit and the battery does not charge—either because the dispatch intent is not to charge (e.g., discharge target period or non-charge custom instruction), or because hardware limits prevent it (inverter at capacity or battery full)
* The battery discharges while PV is already near the limit, pushing the combined output above the cap (only possible with Custom Dispatch algorithm—other algorithms enforce LGIA headroom on discharge)
* Slight inaccuracies in the simplified loss estimates used by the [charge and discharge limits](charge_discharge_limits) cause the combined output to marginally overshoot
