Thanks to visit codestin.com
Credit goes to github.com

Skip to content

transition-zero/tza-pypsa

Repository files navigation

TransitionZero Logo

TZ-Analysis-PyPSA

License Python Active Development

This repo contains code developed by the Analysis team at TransitionZero (TZA) to build and solve with PyPSA models. TZA-PyPSA allows us to modularly construct and work with PyPSA network models.

TZA-PyPSA can be used to build a PyPSA model from scratch, but there are a set of pre-built models that a user can call as a starting point for their analysis. Please see all pre-built models are available in tza-pypsa here. See instructions below on how to use a pre-built model or how you can build your own.

Contributors

Model construction and validation:

Data:

Getting started

Setup

Firstly, clone or download this repository (or an older version) and then navigate into the directory.

cd tza-pypsa

Next, install tza-pypsa into your local environment by running:

pip install -e .

That's it! You are now ready to use tza-pypsa as shown below. However, you will need to install additional packages before doing so, which are:

Usage (running a model)

Working with a pre-built model

You can either build your model or use a pre-built model. With a pre-built model, you can construct and run a PyPSA model with only a few lines of code. For instance, you can run the ASEAN at an hourly resolution between 2023 and 2050 at 10-year timesteps as shown below:

from tz_pypsa.model import Model
from tz_pypsa.constraints import constr_bus_self_sufficiency

# load a pre-defined stock model (returns PyPSA network)
network = (
  Model
  .load_model(
    'ASEAN', 
    years=[2023, 2030, 2040, 2050], 
    frequency='1h'
  )
)

# add stock constraints ((optional))
constr_bus_self_sufficiency(network)

# solve the model
network.optimize(
  solver_name='highs',
  solver_options={"solver": "pdlp"},
)

# export results to csv
network.export_to_csv_folder('some-output-folder-name')

Please see one of the pre-built models to understand how the files should be written and structured.

Contributing and Support

We strongly welcome anyone interested in contributing to this project. If you have any ideas, suggestions or encounter problems, feel invited to file issues or make pull requests on GitHub.

To discuss ideas for the project, please contact @amanmajid

Contributing rules:

  • Do not contribute to master directly without a pull request, wherever possible.
  • Create issues and allocate an individual.
  • One pull request per issue.

About

A minimal PyPSA model to be used for analysis projects

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 7