This repository contains a mathematical modeling framework designed to optimize photovoltaic (PV) panel orientation for maximum energy yield and economic return.
Developed as part of the Mathematics 1b (01002) course at the Technical University of Denmark (DTU), the project integrates vector calculus with real-world energy market data to simulate solar performance in Danish weather conditions.
The core objective is to determine the optimal tilt (
- Total Energy Output (kWh): Maximizing raw generation based on solar irradiance flux.
- Economic Efficiency (DKK): Minimizing household electricity costs by aligning generation with consumption patterns and volatile spot prices (Nord Pool).
-
Solar Position: Uses
pvlibto track solar Zenith and Azimuth angles specific to DTU's coordinates ($55.79^\circ$ N,$12.52^\circ$ E). -
Flux Integration: Calculates the instantaneous flux through the panel surface using vector projection:
$$\text{Flux} = \int_{T} (\vec{S} \cdot \vec{n}) , dt$$ Where$\vec{S}$ is the solar irradiance vector and$\vec{n}$ is the panel's normal vector. -
Numerical Integration: Utilizes Simpson's rule (
scipy.integrate.simpson) to aggregate power into total energy over daily and yearly intervals.
- Spot Price Integration: Ingests hourly electricity prices (
Elspotprices_2023_hourly.csv) and typical household consumption profiles. - Grid Interaction: Simulates the cost/benefit of self-consumption vs. selling excess power back to the grid (including tariffs and fees).
- Core Logic: Python, NumPy, SymPy
- Solar Physics:
pvlib(Photovoltaic Library) - Optimization & Integration:
scipy - Data Handling: Pandas (CSV processing for spot prices)
- Visualization: Matplotlib
The project is divided into physical modeling and economic optimization modules.
-
Install Dependencies:
pip install numpy pandas matplotlib scipy pvlib sympy
-
Run Economic Optimization: To find the optimal angles based on 2023 spot prices:
python Energiforbrug_Optimering/Energiforbrug_Optimering.py
-
Visualize Solar Positions: To plot elevation curves for a specific date:
python Solpositionsmodellering/solarposition_models.py
The simulation performs a grid search over valid
- Output: Generates
energy_data.csvcontaining hourly generation profiles for the optimal configuration. - Insights: The model demonstrates that the angle for maximum energy often differs from the angle for maximum profit, primarily due to the correlation between peak spot prices and evening consumption.
DTU*# README for Solpanel 04 Project (01002 Matematik 1b
- Yuxuan Zhang (s234807)
- Oscar Thorsted Svendsen (s224177)
- Carl Schmidt-Svejstrup (s234840)
- Mikkel Broch-Lips (s234860)
- David Lindahl (s234817)
- Nikolaj Holst Jakobsen (s234818)