https://github.com/catalyst-cooperative/gridkit

GridKit is an power grid extraction toolkit

https://github.com/catalyst-cooperative/gridkit

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.0%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

GridKit is an power grid extraction toolkit

Basic Info
  • Host: GitHub
  • Owner: catalyst-cooperative
  • License: mit
  • Default Branch: master
  • Size: 228 KB
Statistics
  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Fork of bdw/GridKit
Created about 6 years ago · Last pushed over 6 years ago
Metadata Files
Readme License

README.md

Code (v1.0): DOI

ENTSO-E extract: DOI

GridKit is a power grid extraction toolkit

GridKit uses spatial and topological analysis to transform map objects from OpenStreetMap into a network model of the electric power system. It has been developed in the context of the SciGRID project at the Next Energy research institute, to investigate the possibility of 'heuristic' analysis to augment the route-based analysis used in SciGRID. This has been implemented as a series of scripts for the PostgreSQL database using the PostGIS spatial extensions.

The network model is intended to be used in power systems analysis applications, for example using the PYPOWER system, or the PyPSA toolkit. In general this will require the following:

  • Careful interpretation of results (e.g. power lines and stations may have multiple voltages).
  • Realistic information on generation and load in the system (electrical supply and demand).
  • Reasonable, possibly location specific assumptions on the impedance of lines, depending on their internal structure. Unlike SciGRID, such assumptions have not yet been applied.

Of note, PyPSA implements several methods of network simplification, which is in many cases essential for ensuring that the power flow computations remain managable.

Data exports

Data exports created at March 14, 2016 for North America and Europe can be downloaded from zenodo. These exports are licensed under the Open Database License because they derive from OpenStreetMap data. They follow the same file structure as SciGRID. The file util/network.py contains a parser for these files.

Requirements

  • Python (2.7 or higher)
  • PostgreSQL (9.4 or higher)
  • PostGIS (2.1 or higher)
  • osm2pgsql (0.88.1 or higher)
  • Optionally psycopg2 (2.6 or higher)
  • Optionally osm-c-tools

How to Use (the simple way)

Download a power extract from enipedia:

wget http://enipedia.tudelft.nl/OpenStreetMap/EuropePower.zip
unzip EuropePower.zip

Ensure you have a user for postgresql with permissions to create databases and modify schemas. For example:

createuser -d gridkit

Run gridkit.py:

python gridkit.py EuropePower.osm

The --pg option takes a series of key=value pairs, which are parsed into database connection options. For example to connect to a host on 10.0.0.160 listening on port 9000:

python gridkit.py --pg host=10.0.0.160 port=9000 EuropePower.osm

The files gridkit-highvoltage-vertices.csv contains a CSV file with all high-voltage stations, and gridkit-highvoltage-edges.csv contains a CSV file with all high-voltage lines. You may use --full-export to export all other lines, too.

How to Use (the hard way)

Download a full-planet dump from planet.openstreetmap.org or a geographically-bounded extract from geofabrik.

Extract the power information

osmconvert my_area.osm.pbf -o=my_area.o5m
osmfilter my_area.o5m --keep='power=*' -o=my_area_power.o5m

Alternatively for extracting a specific region from the planet file (my_area.poly should a polygon filter file, which you can acquire from polygons.openstreetmap.fr):

osmconvert planet-latest.osm.pbf -B=my_area.poly -o=my_area.o5m

PostgreSQL configuration

GridKit assumes that you have the psql and osm2pgsql binaries available. Configuring access to the postgresql server is implemented using standard environment variables. Thus, prior to importing the openstreetmap source data, you should use something like:

export PGUSER=my_username PGDATABASE=my_database PGPASSWORD=my_password

Optionally also:

export PGHOST=server_hostname PGPORT=server_port

For more information, check out the linked documentation.

Extraction process

Import data using the script:

./import-data.sh /path/to/data.o5m database_name

The database_name parameter is optional if the PGDATABASE environment variable has been set. Running the extraction process is just:

./run.sh

You should expect this, depending on your machine and the size of your dataset, to take anywhere from 5 minutes to a few hours. Afterwards, you can extract a copy of the network using:

psql -f export-topology.sql

Which will copy the network to a set of CSV files in /tmp:

  • /tmp/heuristic_vertices.csv and /tmp/heuristic_links.csv contain the complete network at all voltage and frequency levels.

  • /tmp/heuristic_vertices_highvoltage and /tmp/heuristic_links_highvoltage contain the high-voltage network (>220kV) at any frequency which is not 16.7Hz.

Some things to watch out for

This process requires a lot of memory and significant amounts of CPU time. It also makes a lot of copies of the same data. This is very useful for investigating issues and tracking changes by the system. It also means that you should probably not use this on resource-constrained systems, such as docker containers in constrained virtual machines or raspberry pi's.

Queries have been typically optimized to make the best possible use of indices, but whether they are actually used is sensitive to query planner specifics. Depending on the specifics, PostgreSQL tuning may be necessary to run the extraction process efficiently.

The resultant network will in almost all cases be considerably more complex than equivalent networks (e.g. from SciGRID or the Bialek model. For practical applications, it is highly advisable to use simplification.

Analysis Utilities

Aside from the main codebase, some utilities have been implemented to enable analysis of the results. Notably:

  • util/network.py allows for some simple analysis of the network, transformation into a PYPOWER powercase dictionary, and 'patching' of the network to propagate voltage and frequency information from neighbors.
  • util/load_polyfile.py transforms a set of poly files into import statements for PostgreSQL, to allow data statistics per area, among other things.

Owner

  • Name: Catalyst Cooperative
  • Login: catalyst-cooperative
  • Kind: organization
  • Email: hello@catalyst.coop
  • Location: United States of America

Catalyst is a small data engineering cooperative working on electricity regulation and climate change.

GitHub Events

Total
Last Year

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 174
  • Total Committers: 3
  • Avg Commits per committer: 58.0
  • Development Distribution Score (DDS): 0.155
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Bart Wiegmans b****s@g****m 147
Bart Wiegmans b****s@n****e 21
Bart Wiegmans b****s@b****m 6
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: over 2 years ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

requirements.txt pypi
  • argparse ==1.2.1
  • cycler ==0.9.0
  • matplotlib ==1.5.0
  • numpy ==1.10.2
  • pyparsing ==2.0.6
  • python-dateutil ==2.4.2
  • pytz ==2015.7
  • recordclass ==0.4
  • scipy ==0.16.1
  • six ==1.10.0
  • wsgiref ==0.1.2