A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

whobs-server

This is the code for the online optimization of zero-direct-emission electricity systems with wind, solar and storage (using batteries and electrolysed hydrogen gas) to provide a baseload electricity demand, using the cost and other assumptions of your choice.
https://github.com/PyPSA/whobs-server

Category: Energy Systems
Sub Category: Energy System Modeling Frameworks

Last synced: about 23 hours ago
JSON representation

Repository metadata

Online optimisation tool for wind+solar+storage systems

README.md

model.energy: online optimisation of energy systems

This is the code for the online optimisation of zero-direct-emission
electricity systems with wind, solar and storage (using batteries and
electrolysed hydrogen gas) to provide a baseload electricity demand,
using the cost and other assumptions of your choice. It uses only free
software and open data, including Python for Power System Analysis
(PyPSA)
for the optimisation
framework, the European Centre for Medium-Range Weather Forecasts
(ECMWF) ERA5
dataset

for the open weather data, the atlite
library
for converting weather data
to generation profiles, Clp for
the solver, D3.js for graphics,
Mapbox, Leaflet
and Natural Earth for maps, and
free software for the server infrastructure (GNU/Linux, nginx, Flask,
gunicorn, Redis).

You can find a live version at:

https://model.energy/

Requirements

Software

This software has only been tested on the Ubuntu distribution of GNU/Linux.

Ubuntu packages:

sudo apt install coinor-clp coinor-cbc redis-server

To install, we recommend using miniconda in combination with mamba.

conda install -c conda-forge mamba
mamba env create -f environment.yaml

For (optional) server deployment:

sudo apt install nginx
mamba install gunicorn

Automatic preparation

After installing the dependencies above, run the following line of code:

python prepare.py

This helps you:

  1. Fetch the pre-processed wind and solar data for the globe (around 6.5 GB per weather year specified in config.yaml)
  2. Create folders for results
  3. Fetch static files not included in this repository

Now you are ready to run the server locally.

Generating wind and solar data yourself

The script prepare.py will download everything you need to get
started, including the pre-processed wind and solar data for the
globe. If you want to build this data from scratch from wind and solar
data, follow these instructions. Be warned that the global datasets
take space of 444 GB per weather year.

For the wind and solar generation time series, we use the European
Centre for Medium-Range Weather Forecasts (ECMWF) ERA5
dataset
.

First you need to download the weather data (e.g. wind speeds, direct
and diffuse solar radiation) as cutouts, then you need to convert them
to power system data for particular wind turbines and solar
panels. The weather data is in a 0.25 by 0.25 degree spatial
resolution grid for the whole globe, but to save space, we downscale
it to 0.5 by 0.5 degrees.

Data is downloaded from the European Climate Data Store
(CDS)
using the atlite
library
using the script:

python build_cutouts.py

Note that you need to register an account on the CDS first in order to
get a CDS API key.

As of 19.03.2023 the atlite master cannot cope with such large
cutouts, so you need to use the monthly retrieval
branch

of atlite. If you have shapely 2.0 you will need to backport this bug
fix

by hand in the code.

Set the weather_years you want to download in config.yaml. For
each year it will download 4 quadrants cutouts (4 slices of 90 degrees
of longitude) to cover the whole globe. Each quadrant takes up 111 GB,
so you will need 444 GB per year.

To build the power system data, i.e. wind and solar generation time
series for each point on the globe, run the script:

python convert_and_downscale_cutout.py

Each quadrant is split into two octants, one for the northern half of
the quadrant with solar panels facing south, and the other for the
southern half with solar panels facing north (with a slope of 35
degrees against the horizontal in both cases). The script downscales
the spatial resolution to 0.5 by 0.5 degrees to save disk space. Each
octant takes up 820 MB for both technologies (solar and onshore wind),
so in total for a year we have 820 MB times 8 octants, i.e. 6.5 GB.

Run without server

See the regular WHOBS repository.

Run server locally on your own computer

To run locally you need to start the Python Flask server in one terminal, and redis in another:

Start the Flask server in one terminal with:

python server.py

This will serve to local address:

http://127.0.0.1:5002/

In the second terminal start Redis:

rq worker whobs

where whobs is the name of the queue. No jobs will be solved until
this is run. You can run multiple workers to process jobs in parallel.

Deploy on a publicly-accessible server

Use nginx, gunicorn for the Python server, rq, and manage with supervisor.

See nginx server configuration.

License

Copyright 2018-2023 Tom Brown https://nworbmot.org/

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation; either version 3 of the
License
, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License
for more details.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 1 day ago

Total Commits: 162
Total Committers: 2
Avg Commits per committer: 81.0
Development Distribution Score (DDS): 0.037

Commits in past year: 3
Committers in past year: 1
Avg Commits per committer in past year: 3.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
Tom Brown t****m@n****g 156
Bo Tranberg bo@t****k 6

Committer domains:


Issue and Pull Request metadata

Last synced: 2 days ago

Total issues: 17
Total pull requests: 4
Average time to close issues: 5 months
Average time to close pull requests: 9 days
Total issue authors: 7
Total pull request authors: 1
Average comments per issue: 1.0
Average comments per pull request: 1.0
Merged pull request: 4
Bot issues: 0
Bot pull requests: 0

Past year issues: 0
Past year pull requests: 0
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 0
Past year pull request authors: 0
Past year average comments per issue: 0
Past year average comments per pull request: 0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/PyPSA/whobs-server

Top Issue Authors

  • nworbmot (10)
  • JanFrederickUnnewehr (2)
  • olugovoy (1)
  • christopherstelter (1)
  • pz-max (1)
  • freechelmi (1)
  • DidierVdM (1)

Top Pull Request Authors

  • tranberg (4)

Top Issue Labels

  • enhancement (1)

Top Pull Request Labels


Dependencies

environment.yaml pypi

Score: 4.499809670330265