Skip to content

Imperius99/PV-Battery-Sizing-Optimizer-Visualizer

Repository files navigation

PV Battery Sizing Optimizer & Visualizer

This application helps users calculate the optimal combination of Photovoltaic (PV) system size (number of panels) and external battery capacity to maximize financial savings over a specified period. It utilizes the differential_evolution algorithm from scipy.optimize to find the best configuration within a user-defined budget.

Features

  • Optimization: Automatically finds the optimal number of PV panels and battery size (kWh).
  • Financial Analysis: Calculates investment costs, potential savings, and payback period.
  • Customizable Inputs: Allows configuration of budget, energy prices (fixed, variable, or percentage increase), panel efficiency, battery costs, and more.
  • Visualization: Interactive plots showing:
    • Daily consumption and production (rolling averages).
    • Battery charge levels.
    • Energy bought/sold grid interaction.
    • Cumulative savings over time.
  • Interactive UI: Built with Streamlit for an easy-to-use web interface.

Installation

  1. Clone the repository:

    git clone <repository_url>
    cd PV-Battery-Sizing-Optimizer-Visualizer
  2. Install the required dependencies:

    pip install -r requirements.txt

Usage

Run the application using Streamlit:

streamlit run PV_battery_optimizer_EUR.py

Once running, your web browser should open automatically to the application URL (usually http://localhost:8501).

User Interface Guide

  1. Upload Data: You can upload your own consumption.csv and irradiance.csv files or use the default sample data provided.
  2. Set Parameters: Adjust the slider and input fields for:
    • Budget: Maximum amount you are willing to invest.
    • Projection Years: Number of years to calculate savings for.
    • Energy Prices: Current buy/sell prices and pricing model.
    • System Specs: Panel size, efficiency, battery costs, etc.
  3. Run Optimization: The app will process the inputs and display the optimal configuration and financial projections.

Input Data Formats

If you provide your own data, ensure the CSV files follow these formats:

Consumption Data (consumption.csv)

Should contain daily energy consumption data.

  • Columns: date, energy
  • Units: energy in kWh per day.
  • Format:
    date,energy
    2023-01-01,15.5
    2023-01-02,14.2
    ...

Irradiance Data (irradiance.csv)

Should contain daily horizontal irradiation data.

  • Columns: date, irradiance
  • Units: irradiance in J/cm² per day.
  • Format:
    date,irradiance
    2023-01-01,538
    2023-01-02,285
    ...

Project Structure

  • PV_battery_optimizer_EUR.py: The main application script containing the Streamlit UI and optimization logic.
  • classes.py: Defines the data structures (UserInputs, OptimizationResults, PVSystem, Battery) used across the application.
  • requirements.txt: List of Python libraries required to run the project.
  • consumption.csv & irradiance.csv: Default sample data files.
  • sample_consumption/: Directory containing additional sample consumption data files.

Dependencies

  • Streamlit: For the web interface.
  • Pandas: For data manipulation.
  • NumPy: For numerical operations.
  • Matplotlib: For plotting graphs.
  • SciPy: For the optimization algorithm (differential_evolution).

About

Calculate the most profitable combination of PV area and battery capacity given the input parameters

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages