HOMER computes the battery throughput (Qthrpt, kWh) as the sum of the discharge energy. HOMER estimates the lifetime of the battery in years by dividing Qlifetime (kWh) by Qthrpt (kWh/yr), where

the battery throughput Qthrpt is defined as: the change in energy level of the battery bank, measured after charging losses and before discharging losses.

**Here is a simplified code, for one time-step with discharging of battery. "//" indicates a comment:**

deltaQ = -BatteryDischargePower / eta_d;

if (deltaQ < 0) // i.e. if energy is leaving the battery

battery_throughput = battery_throughput - deltaQ; // sum the energy that leaves the battery

Above, eta_d is the discharge efficiency and BatteryDischargePower is the energy supplied from the battery (i.e. to an external load). So deltaQ is the energy removed from the battery before the discharge efficiency (loss) is applied. The throughput is the sum of deltaQ, which is generally smaller than the charging energy but greater than the discharge energy.

**An example demonstrate the impact of round trip efficiency:**

Assume the battery round trip efficiency is 81%. This will be divided into 90% charging efficiency and 90% discharging efficiency: sqrt(0.81) = 0.90

Start with a (theoretically) fully empty battery (0 kWh energy content). We charge the battery 111.11 kWh. HOMER calculates the new battery energy content to be 100 kWh (111.11 kWh * 0.9).

Then discharge the battery fully. We get 90 kWh of energy out.

The throughput for this cycle is 100 kWh. If we have a CellCube FB10-XXX battery (lifetime 876,000 kWh), and we apply this cycle 876 times per year, the battery life is 10 years (the float life is 20 years, so the lifetime throughput is exhausted first).