solar-and-storage


Namesolar-and-storage JSON
Version 0.0.10 PyPI version JSON
download
home_pageNone
SummaryModelling for Solar and Storage
upload_time2024-11-25 22:47:21
maintainerNone
docs_urlNone
authorPeter Dudfield
requires_pythonNone
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Solar and Storage
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

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
```python
import numpy as np

from solar_and_storage.solar_and_storage import SolarAndStorage

```
Make the fake price and solar data
```python
# 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
```python
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
```python
fig = solar_and_storage.get_figure()

fig.show(rendered="browser")
```


![Example1](examples/images/battery_solar.png)

The first plot shows the solar profile, the second shows the prices that day. The third shows the battery profile.  Finally the fourth shows profit.
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](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
  <tbody>
    <tr>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/peterdudfield"><img src="https://avatars.githubusercontent.com/u/34686298?v=4?s=100" width="100px;" alt="Peter Dudfield"/><br /><sub><b>Peter Dudfield</b></sub></a><br /><a href="https://github.com/openclimatefix/solar-and-storage/commits?author=peterdudfield" title="Code">💻</a></td>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/gilbertgong"><img src="https://avatars.githubusercontent.com/u/5944694?v=4?s=100" width="100px;" alt="gilbertgong"/><br /><sub><b>gilbertgong</b></sub></a><br /><a href="https://github.com/openclimatefix/solar-and-storage/commits?author=gilbertgong" title="Code">💻</a></td>
    </tr>
  </tbody>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "solar-and-storage",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Peter Dudfield",
    "author_email": "info@openclimatefix.org",
    "download_url": "https://files.pythonhosted.org/packages/ee/c0/e70d9482ba09b4c6fab112c09489a402188fee2dfa4aad82e7faab095cd8/solar_and_storage-0.0.10.tar.gz",
    "platform": null,
    "description": "# Solar and Storage\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-)\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n\nA Python Library to run solar and storage optimization.\nThis uses mixed integer linear programming and maximises revenue made by charging and discharging the battery.\nThe model uses variable prices and a solar generation profile.\n\n## Installation\n\n```\npip install solar-and-storage\n```\n\n\n## Example\n\nImport the packages\n```python\nimport numpy as np\n\nfrom solar_and_storage.solar_and_storage import SolarAndStorage\n\n```\nMake the fake price and solar data\n```python\n# make prices\nprices = np.zeros(24) + 30\nprices[6:19] = 40\nprices[9] = 50\nprices[12:14] = 30\nprices[16:18] = 50\nprices[17] = 60\n\n# make solar profile\nsolar = np.zeros(24)\nsolar[8:16] = 2.0\nsolar[10:14] = 4.0\n```\n\nThen run optimization\n```python\nsolar_and_storage = SolarAndStorage(prices=prices, solar_generation=list(solar))\nsolar_and_storage.run_optimization()\nresult_df = solar_and_storage.get_results()\n```\n\n\n\nNow plot the data\n```python\nfig = solar_and_storage.get_figure()\n\nfig.show(rendered=\"browser\")\n```\n\n\n![Example1](examples/images/battery_solar.png)\n\nThe first plot shows the solar profile, the second shows the prices that day. The third shows the battery profile.  Finally the fourth shows profit.\nYou can see that the battery charged from the solar site at the end of the solar maximum\n\n\n\n## Thanks\n\nThanks you to the follow repos for inspiration\n- https://github.com/ADGEfficiency/energy-py-linear\n- https://github.com/wzyfrank/battery/\n- https://github.com/greysonchung/Battery-Optimisation/\n- https://github.com/edu230991/battery-optimization/\nsdk-python-ci.yml\n\n## Contributors \u2728\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n  <tbody>\n    <tr>\n      <td align=\"center\" valign=\"top\" width=\"14.28%\"><a href=\"https://github.com/peterdudfield\"><img src=\"https://avatars.githubusercontent.com/u/34686298?v=4?s=100\" width=\"100px;\" alt=\"Peter Dudfield\"/><br /><sub><b>Peter Dudfield</b></sub></a><br /><a href=\"https://github.com/openclimatefix/solar-and-storage/commits?author=peterdudfield\" title=\"Code\">\ud83d\udcbb</a></td>\n      <td align=\"center\" valign=\"top\" width=\"14.28%\"><a href=\"https://github.com/gilbertgong\"><img src=\"https://avatars.githubusercontent.com/u/5944694?v=4?s=100\" width=\"100px;\" alt=\"gilbertgong\"/><br /><sub><b>gilbertgong</b></sub></a><br /><a href=\"https://github.com/openclimatefix/solar-and-storage/commits?author=gilbertgong\" title=\"Code\">\ud83d\udcbb</a></td>\n    </tr>\n  </tbody>\n</table>\n\n<!-- markdownlint-restore -->\n<!-- prettier-ignore-end -->\n\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Modelling for Solar and Storage",
    "version": "0.0.10",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c4b2b205781cebb7e64a3ed9802b6dab9cdf37f0ef2646ac043aabebdf2d92b1",
                "md5": "ba20ab8a8dbbd8106d50009f5c474806",
                "sha256": "28438d8a4308ab3037b394cbd1f60c15eb6f7ef9862a3e6ab52bd08f6a3bdb50"
            },
            "downloads": -1,
            "filename": "solar_and_storage-0.0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ba20ab8a8dbbd8106d50009f5c474806",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6449,
            "upload_time": "2024-11-25T22:47:20",
            "upload_time_iso_8601": "2024-11-25T22:47:20.036033Z",
            "url": "https://files.pythonhosted.org/packages/c4/b2/b205781cebb7e64a3ed9802b6dab9cdf37f0ef2646ac043aabebdf2d92b1/solar_and_storage-0.0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eec0e70d9482ba09b4c6fab112c09489a402188fee2dfa4aad82e7faab095cd8",
                "md5": "f031e331b3210a808141f126b82dcb10",
                "sha256": "c67914eb166eb432ba909af6f63f7a48e56d8f98856a8b9aba9c9b04ed10e64d"
            },
            "downloads": -1,
            "filename": "solar_and_storage-0.0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "f031e331b3210a808141f126b82dcb10",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7308,
            "upload_time": "2024-11-25T22:47:21",
            "upload_time_iso_8601": "2024-11-25T22:47:21.661546Z",
            "url": "https://files.pythonhosted.org/packages/ee/c0/e70d9482ba09b4c6fab112c09489a402188fee2dfa4aad82e7faab095cd8/solar_and_storage-0.0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-25 22:47:21",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "solar-and-storage"
}
        
Elapsed time: 0.49317s