{"id":20200974,"url":"https://github.com/openclimatefix-archives/solar-and-storage","last_synced_at":"2026-04-29T00:35:28.914Z","repository":{"id":65757062,"uuid":"580338074","full_name":"openclimatefix/solar-and-storage","owner":"openclimatefix","description":"Solar and Storage optimization code","archived":false,"fork":false,"pushed_at":"2025-03-13T09:45:28.000Z","size":149,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T10:11:05.679Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openclimatefix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":["openclimatefix"],"patreon":null,"open_collective":"openclimatefix","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2022-12-20T10:09:54.000Z","updated_at":"2025-03-13T14:20:35.000Z","dependencies_parsed_at":"2023-02-23T21:00:16.918Z","dependency_job_id":null,"html_url":"https://github.com/openclimatefix/solar-and-storage","commit_stats":{"total_commits":24,"total_committers":3,"mean_commits":8.0,"dds":"0.20833333333333337","last_synced_commit":"c2b48b53a6386ee80944aaa730b5565bcafc4147"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openclimatefix%2Fsolar-and-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openclimatefix%2Fsolar-and-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openclimatefix%2Fsolar-and-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openclimatefix%2Fsolar-and-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openclimatefix","download_url":"https://codeload.github.com/openclimatefix/solar-and-storage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248208604,"owners_count":21065203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T04:46:21.945Z","updated_at":"2026-04-29T00:35:28.872Z","avatar_url":"https://github.com/openclimatefix.png","language":"Python","funding_links":["https://github.com/sponsors/openclimatefix","https://opencollective.com/openclimatefix"],"categories":[],"sub_categories":[],"readme":"# Solar and Storage\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-)\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\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 ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/peterdudfield\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/34686298?v=4?s=100\" width=\"100px;\" alt=\"Peter Dudfield\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ePeter Dudfield\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/openclimatefix/solar-and-storage/commits?author=peterdudfield\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/gilbertgong\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/5944694?v=4?s=100\" width=\"100px;\" alt=\"gilbertgong\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003egilbertgong\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/openclimatefix/solar-and-storage/commits?author=gilbertgong\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenclimatefix-archives%2Fsolar-and-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenclimatefix-archives%2Fsolar-and-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenclimatefix-archives%2Fsolar-and-storage/lists"}