Modelling for Solar and Storage
Project description
Solar and Storage
A Python Library to run solar and storage optimization. This uses mixed integer linear programming and maximises revenue made by charging and discharging the battery. The model uses variable prices and a solar generation profile.
Installation
pip install solar-and-storage
Example
Import the packages
import numpy as np
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from solar_and_storage.solar_and_storage import SolarAndStorage
Make the fake price and solar data
# make prices
prices = np.zeros(24) + 30
prices[6:19] = 40
prices[9] = 50
prices[12:14] = 30
prices[16:18] = 50
prices[17] = 60
# make solar profile
solar = np.zeros(24)
solar[8:16] = 2.0
solar[10:14] = 4.0
Then run optimization
solar_and_storage = SolarAndStorage(prices=prices, solar_generation=list(solar))
solar_and_storage.run_optimization()
result_df = solar_and_storage.get_results()
Now plot the data
fig = solar_and_storage.get_fig()
fig.show(rendered="browser")
The first plot shows the solar profile, the second shows the prices that day. The third shows the battery profile. You can see that the battery charged from the solar site at the end of the solar maximum
Thanks
Thanks you to the follow repos for inspiration
- https://github.com/ADGEfficiency/energy-py-linear
- https://github.com/wzyfrank/battery/
- https://github.com/greysonchung/Battery-Optimisation/
- https://github.com/edu230991/battery-optimization/ sdk-python-ci.yml
Contributors ✨
Thanks goes to these wonderful people (emoji key):
Peter Dudfield 💻 |
gilbertgong 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file solar_and_storage-0.0.9.tar.gz
.
File metadata
- Download URL: solar_and_storage-0.0.9.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3243e4ffbeb76f373c4dc1a50b1757445af07b8b1c8d05632d4c63ec8e07454 |
|
MD5 | 3b8fee66d977e68b15ccde9a04be60b6 |
|
BLAKE2b-256 | 6ce59ac7e329679bfbc4c59d467eacc5b32fbee5fe8c0510dc81ac229fb2f9a3 |
File details
Details for the file solar_and_storage-0.0.9-py3-none-any.whl
.
File metadata
- Download URL: solar_and_storage-0.0.9-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2255d8826001efde6c2bad97a5033ddb0e454db82a23aba8e59501f0b2643f80 |
|
MD5 | 08bb9e31b7733ae78277d5d236ff6706 |
|
BLAKE2b-256 | 7f064586d89d34bd2e093d563d19095177dfb377b4df958ec9109c58722bac2d |