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
TODO
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 = make_subplots(rows=3, cols=1, subplot_titles=["Solar profile", "Price", "SOC"])
fig.add_trace(go.Scatter(y=e_soc[:24], name="SOC"), row=3, col=1)
fig.add_trace(go.Scatter(y=solar, name="solar", line_shape="hv"), row=1, col=1)
fig.add_trace(
go.Scatter(y=solar_power_to_grid, name="solar to gird", line_shape="hv"), row=1, col=1
)
fig.add_trace(go.Scatter(y=prices, name="price", line_shape="hv"), row=2, col=1)
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
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
Close
Hashes for solar_and_storage-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca459b976b0eba0b44f5a1b6faae26b3727a6e313e2cea30e9b3d0fd97deac7c |
|
MD5 | 4e71f60d4aaae0846f6db21c875805f8 |
|
BLAKE2b-256 | f577b587159f6400f6199d94a287e80d3f48b5ac08264fab76820f811ca9c55c |