Skip to content

This project addresses the challenge of determining the optimal configuration of residential photovoltaic (PV) systems and battery storage to maximize long-term economic benefits.

Notifications You must be signed in to change notification settings

SyedZainAbbas/Optimal-Residential-Energy-System-Sizing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Optimal Residential Energy System Sizing

This project addresses the challenge of determining the optimal configuration of residential photovoltaic (PV) systems and battery storage to maximize long-term economic benefits. The model integrates high-resolution household demand data, weather conditions, and techno-economic parameters to compute the net present value (NPV) of different system configurations over a 20-year horizon.


🔎 Problem Statement

Residential solar PV systems are becoming increasingly important for sustainable energy generation. However, their intermittent nature requires careful planning and integration with battery energy storage systems (BESS) to ensure reliability and maximize self-consumption.

The core question is:
What is the optimal PV capacity ($CAP_{PV}$) and battery capacity ($CAP_{B}$) for a household that maximizes the 20-year NPV of the system?


📐 Mathematical Formulation

PV Generation Model

The PV power output at time $t$ is given by:

$$ P_{PV,t} = A_c \cdot \frac{G_t}{1000} \cdot \eta_{PV,t} $$

with

$$ A_c = \alpha^{-1} \cdot CAP_{PV} $$

$$ \eta_{PV,t} = \eta_{ref} \cdot \Bigg(1 - \beta \cdot (T_{c,t} - T_{c,ref}) + \gamma \cdot \log \frac{G_t}{G_{ref}} \Bigg), \quad \text{if } G_t > 0 $$

$$ T_{c,t} = T_{a,t} + h \cdot G_t $$

where $G_t$ is the solar irradiance, $T_{a,t}$ the ambient temperature, and $\alpha, \beta, \gamma, h$ are fixed parameters.


Battery Model

The battery power $P_{B,t}$ depends on the state of charge (SOC), the required power $P_{req,t}$, and the installed battery capacity $CAP_B$:

$$ P_{req,t} = P_{HH,t} - P_{PV,t} $$

The SOC is updated as:

$$ SOC_t = \begin{cases} SOC_{t-1} - \frac{P_{B,t}}{\eta_B \cdot CAP_B \cdot 60}, & P_{B,t} > 0 \quad \text{(discharging)} \\ SOC_{t-1} - \frac{\eta_B}{CAP_B \cdot 60} \cdot P_{B,t}, & P_{B,t} < 0 \quad \text{(charging)} \end{cases} $$

with initial condition $SOC_0 = 1$.


Power Balance with Grid

The net power drawn from or fed into the grid is:

$$ P_{D,t} = P_{HH,t} - P_{PV,t} - P_{B,t} $$


Net Present Value (NPV)

Total revenues include self-consumed PV energy and feed-in to the grid:

$$ R = E_{PV} \cdot p_{FI} + (E_{HH} - E_D) \cdot p_{EL} $$

The 20-year NPV is computed as:

$$ NPV = -C_{0,PV} - C_{0,B} + \sum_{T=1}^{20} \frac{R - C_{M,PV}}{(1 + i_{INV})^T} $$

with investment and maintenance costs:

$$ C_{0,PV} = c_{PV} \cdot CAP_{PV}, \quad C_{0,B} = c_B \cdot CAP_B, \quad C_{M,PV} = c_{M,PV} \cdot CAP_{PV} $$


⚙️ Optimization Approach

The problem is formulated as a constrained optimization task:

$$ \max_{CAP_{PV}, , CAP_B \geq 0} ; NPV(CAP_{PV}, CAP_B) $$

To solve this, the repository employs SciPy’s optimization routines (e.g., Nelder-Mead, Powell, L-BFGS-B). These allow efficient search over the continuous decision space without requiring closed-form derivatives.


👉 The repository provides a generic implementation of these models and optimization routines, which can be applied to different household load and weather datasets.

Required Data Files

1. data/hh_demand.csv

Contains hourly household electricity demand data

2. data/params.csv

Contains system parameters

3. data/weather.csv

Contains weather data

Where:

  • Ta: Ambient temperature (°C)
  • G_Gk: Global horizontal irradiance (W/m²)

Models

The optimization includes:

  • Solar PV Model: Calculates PV power output based on irradiance, temperature, and efficiency
  • Battery Model: Tracks state of charge and power flow with round-trip efficiency
  • Economic Model: Calculates NPV considering investment costs, revenues, and operation & maintenance

About

This project addresses the challenge of determining the optimal configuration of residential photovoltaic (PV) systems and battery storage to maximize long-term economic benefits.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published