Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/pypsa 13 fork #13

Open
wants to merge 149 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
937dfa1
Apply pytest with solver_name as a command line argument
bourbl Aug 2, 2017
648d1cf
Enable time-dependent marginal costs
coroa Aug 1, 2017
45670b2
components: Network.__init__() now takes generic import argument
nworbmot Nov 14, 2017
7185050
components, opf: Passive branches have new attribute s_max_pu
nworbmot Nov 14, 2017
f51e26c
doc, website: Update publications
nworbmot Nov 17, 2017
e10bb84
Website: Add WindAc Africa reference
nworbmot Nov 19, 2017
51fda3d
opf: Change objective from "Lower bound" to "Upper bound"
nworbmot Nov 24, 2017
954e5a5
components: All csv_folder_name to initiate Network but deprecate
nworbmot Nov 24, 2017
a141baa
Work-around pandas 0.21.0 convention change pd.Series().sum() -> nan
coroa Nov 29, 2017
87ccb2b
opf: Use reindex instead of reindex_axis
coroa Nov 29, 2017
f288ff1
pf: find_bus_controls works without any PV buses
coroa Oct 22, 2017
a4862d9
plot: Non-boolean argument to basemap is used as resolution
coroa Oct 20, 2017
dfefbf1
opf: Improve readability of ramp constraints
coroa Sep 4, 2017
b2d408f
opf: Only show results when logging is at least on info level (fixes …
coroa Nov 29, 2017
3e4e846
pf: Fix pf slack bus calc with one bus sub_networks
coroa Nov 29, 2017
8a2ff7c
Merge remote-tracking branch 'gh/timedepmc'
nworbmot Nov 30, 2017
2b02eea
Merge branch 'master' of fias.uni-frankfurt.de:scm/pypsa
nworbmot Nov 30, 2017
8560277
PyPSA Version 0.12.0
nworbmot Nov 30, 2017
715c7b0
doc: Can also install from github with pip
nworbmot Nov 30, 2017
cab8a1a
test: Remove testing of pyomo-hack
coroa Dec 1, 2017
a6a40cf
pf, descriptors: Add degree function for compatibility with NX2.0
coroa Dec 1, 2017
7e8d759
test: Enable running test from other working directories
coroa Dec 1, 2017
ce119e2
Prepare for travis-ci
coroa Dec 1, 2017
7e83c85
README: Add badges
coroa Dec 1, 2017
747e0db
doc: Mention Travis CI under unit testing section
nworbmot Dec 6, 2017
783dbb4
pf: Refactor line and transformer_types
coroa Dec 17, 2017
df2b5e8
io: Refactor importers and exporters in preparation for netcdf support
coroa Dec 17, 2017
ed3208f
travis: Add --quiet to conda calls
coroa Dec 18, 2017
b7f5b99
setup: Add dependency on PYOMO version 5.3
coroa Dec 18, 2017
9bcfbc0
io: Add netcdf importer and exporter
coroa Dec 18, 2017
5bf03cc
io: Only call finish in Importers and Exporter if no exception was ra…
coroa Dec 18, 2017
a54b58c
io: Fix netcdf exporter
coroa Dec 18, 2017
352598b
io: Add compression to series attributes in netcdf exporter
coroa Dec 18, 2017
46c0a29
io: import_components_from_dataframe preserves types of foreign columns
coroa Dec 18, 2017
aa69244
changing test for comparison
Jan 8, 2018
6e1eaca
adding model build only example
Jan 8, 2018
472554a
updating build model test
Jan 8, 2018
f2270c5
test many snapshots
Jan 8, 2018
85d12b8
try on kirchoff
Jan 8, 2018
5877d4b
updating build_model test
Jan 8, 2018
4d36c1b
updating build model example to include links between random linese
Jan 9, 2018
c98b5c5
first implementation speeding up passive branch creation in kirchhoff
Jan 9, 2018
3a22ce6
printing missing negatives
Jan 10, 2018
529c57f
removing unneeded comments
Jan 10, 2018
ff28b62
fix indent
Jan 10, 2018
5def563
fix for unsolvable
Jan 10, 2018
32420da
fix creation of branch_idx and time_ind_params
Jan 10, 2018
375c8b7
constructing cycle constraints in separte function using coo iteration
Jan 10, 2018
7d82dc2
better naming and fixes
Jan 10, 2018
0704bca
removing wip for pr
Jan 10, 2018
76525cb
revert lopf example
Jan 10, 2018
7fc6b04
update example to run over angles, cycles, and kirchhoff
Jan 11, 2018
4169642
calculate effective x_pu/r_pu in calculate_dependent_values
Jan 11, 2018
1dca383
use define_sub_network_cycle_constraints for cycles formulation and u…
Jan 11, 2018
e2abea7
move function above for clarity
Jan 11, 2018
42d96b3
fix typo
Jan 11, 2018
3286c72
use r_pu_eff and x_pu_eff
Jan 11, 2018
1f4ae38
travis: Switch off coveralls on travis until coverage testing works p…
coroa Jan 11, 2018
437a935
using csc instead of csr
Jan 12, 2018
72957b8
Merge pull request #28 from altenexllc/faster_kirchoff_cycle_creation
coroa Jan 14, 2018
2557211
doc, website: add PyPSA paper reference, update year to 2018
nworbmot Jan 17, 2018
5ea2f0e
doc, website: BibTeX for citation of PyPSA paper
nworbmot Jan 19, 2018
2e1b05e
components: Allow the addition of new types of component
nworbmot Jan 19, 2018
364ea17
everywhere: Move component type sets to Network object
nworbmot Jan 19, 2018
39e5418
components: Establish component types based on those available
nworbmot Jan 19, 2018
fabb05c
examples: add examples for adding new components
nworbmot Jan 19, 2018
d5425b5
io: Add the possibility to load from xarray dataset
coroa Jan 20, 2018
9290953
opf, pf: Allow links to end on multiple buses
nworbmot Jan 23, 2018
ad4c184
doc, examples: Document link with multiple outputs
nworbmot Jan 23, 2018
544de1e
io: Fix logging output of netcdf importer
coroa Jan 24, 2018
39b8916
io, doc: Tidy up and document export/import for netCDF files
nworbmot Jan 24, 2018
28d1d25
components: Existing components can now be overridden
nworbmot Jan 25, 2018
f43dbc8
Merge branch 'master' of github.com:PyPSA/PyPSA
nworbmot Jan 25, 2018
db40cde
Merge branch 'multilink'
nworbmot Jan 25, 2018
68c3374
pf, opf: Use override_component_attrs for multilink attributes
nworbmot Jan 25, 2018
d043e1d
component_attrs: Add x_pu_eff to attributes for passive branches
nworbmot Jan 25, 2018
b74c416
PyPSA Version 0.13.0
nworbmot Jan 25, 2018
7daaa73
networkclustering: Fix _consense error message
coroa Jan 26, 2018
c170705
networkclustering: simplify and extend busmap_by_stubs
coroa Jan 26, 2018
76306f3
networkclustering: Support line types
coroa Jan 26, 2018
0c89d3b
graph: Fix minor regression in adjacency_matrix
coroa Jan 30, 2018
6a25642
plot: Add jitter argument to iplot
coroa Jan 30, 2018
b12a291
plot: Fix iplot for unspecified line colors and widths
coroa Jan 30, 2018
fe15090
fixup! plot: Add jitter argument to iplot
coroa Jan 30, 2018
38ecca2
Initialise logging from Network.__init__
coroa Jan 31, 2018
b6eac49
graph, pf: Improve treatment of infinite impedances
coroa Jan 31, 2018
ddc8459
website: Update LOPF cycle flow paper with journal reference
nworbmot Jan 31, 2018
d57fdbf
Merge branch 'master' of github.com:PyPSA/PyPSA
nworbmot Jan 31, 2018
1899570
opf: Clear pyomo model after extracting optimisation results
coroa Feb 3, 2018
ed827cf
descriptors: Add function to clear pypsa output series data
coroa Feb 3, 2018
564826d
Merge branch 'master' of github.com:FRESNA/PyPSA
coroa Feb 3, 2018
88d0cb9
opf: Fix get_shadows for no branches
coroa Feb 4, 2018
d90f05f
examples: use multi-output link for chained reservoir example
nworbmot Feb 11, 2018
0c7dcc8
website, doc: Optimisation includes energy system as a whole
nworbmot Feb 11, 2018
b8691ff
doc, website: Add references to PyPSA-animation
nworbmot Feb 21, 2018
ad009b2
website: Update animation img to remove reservoir from consumers
nworbmot Feb 22, 2018
d08da98
doc: Fix RE-INVEST link
nworbmot Mar 1, 2018
19e4f3a
Merge branch 'pytest_solver'
bourbl Mar 1, 2018
ab36997
Fix copying network with overridden components or component attributes.
bourbl Mar 1, 2018
a5394a3
Revert deletion of logger initialization.
bourbl Mar 1, 2018
2aa833b
io: Fix NetCDF static im-/export with all-standard components
coroa Mar 26, 2018
8c99f8c
io: Fix HDF5 im-/export with empty components and lift the 1000 buses…
coroa Mar 26, 2018
6298680
Merge pull request #31 from bourbl/copy_with_overridden_components
nworbmot Mar 27, 2018
8c0a3b0
components: generalise _retrieve_overridden_components
nworbmot Mar 27, 2018
cc743d1
io: Work around to enable import of HDF5 exports from old PyPSA
nworbmot Mar 27, 2018
ccd1dcd
doc: Remove warning from HDF5; explain why netCDF is better
nworbmot Mar 27, 2018
85bf33f
PyPSA Version 0.13.1
nworbmot Mar 27, 2018
b17530d
website: Add benefits of cooperation sensitivity paper
nworbmot Mar 28, 2018
6ef502a
Update plot.py
jankaeh Apr 19, 2018
26aaf85
website: Add Joao paper on North Sea offshore grid
nworbmot May 14, 2018
b4af4fd
components: Fail properly in Network.add
coroa Jan 30, 2018
31d837d
networkclustering: Allow aggregating only a subset of generators
coroa Mar 1, 2018
cea63aa
plot: Fix regression when choosing bus_colors
coroa Jun 4, 2018
e1cdc39
Merge pull request #33 from jankaeh/patch-1
nworbmot Jun 14, 2018
d21c635
opt: Extend pyomo hack to pyomo 5.6+
coroa Jun 21, 2018
1595d5c
Skip tests against pypower
coroa Jun 21, 2018
3fdeb43
website, doc: Add latest publications, add latest affiliations
nworbmot Jul 25, 2018
b310303
networkclustering: Recalculate capital_cost of aggregated lines
coroa Aug 16, 2018
ca2198b
Fix pandas deprecation warnings
coroa Aug 23, 2018
8ce3440
Correct instructions for import from netCDF
fneum Aug 28, 2018
16e820e
opf: Use pyomo's special treatment of logfiles
coroa Sep 4, 2018
32b3df4
Merge branch 'master' of github.com:PyPSA/pypsa
coroa Sep 4, 2018
629f256
opf: Fix solver_logfile option
coroa Sep 4, 2018
a1a91a6
Corrected an error in "Upgrading PyPSA"
miek770 Sep 18, 2018
2f9fa60
Merge pull request #42 from miek770/patch-1
nworbmot Sep 20, 2018
04cc02c
Fix deprecation warnings about logger.warn and missing sort=False
coroa Oct 2, 2018
54f212a
plot: Use ImportError instead of catch all for basemap and matplotlib…
coroa Oct 26, 2018
7051192
graph: Generation of weighted nx graph falls back to a weight of 0
coroa Oct 26, 2018
05f6fd5
opf: Rescale cycle constraints in the kirchhoff formulation
coroa Oct 26, 2018
032f655
requirements_dev.yml: Remove currently broken anaconda channel
coroa Oct 26, 2018
9ec4062
networkclustering: Add strategy for weighted clustering of capital_cost
coroa Oct 27, 2018
fe1f98d
opf: Allow extra_postprocessing function for reading shadow prices
nworbmot Oct 30, 2018
c28cbb8
Merge branch 'master' of github.com:PyPSA/PyPSA
nworbmot Oct 30, 2018
0da56c4
fixup! networkclustering: Add strategy for weighted clustering of cap…
coroa Nov 6, 2018
680ccd5
networkclustering: Aggregate max_hours in proportion to p_nom and ena…
coroa Nov 12, 2018
990e888
io: Fix saving of network names
coroa Nov 14, 2018
50d1f2d
io: Don't touch HDF5 files on import
coroa Nov 21, 2018
8179db9
fix louvain and spectral clustering. louvain lost 'level' argument
Nov 26, 2018
6cb091a
Add carbon management / biomass example
nworbmot Dec 3, 2018
867c69e
Update landing page comments, features and comparable software
nworbmot Dec 3, 2018
86f2055
networkclustering: Implement custom generator_strategies for aggregat…
coroa Dec 31, 2018
1fe5b73
PyPSA Version 0.13.2
nworbmot Jan 10, 2019
13a0fb6
networkclustering: Fix busmap_by_kmeans docstring to include buses_i …
coroa Jan 22, 2019
d044ed3
Update Networkclustering
ClaraBuettner Feb 4, 2019
1707138
Merge branch 'pypsa_fork' of /home/clara/GitHub/PyPSA_13.2 into featu…
ClaraBuettner Feb 4, 2019
2912d9b
Implement clustering of storage-units from pypsa0.11.0fork
ClaraBuettner Feb 6, 2019
9c6ef5c
Changes for snapshots-clustering
ClaraBuettner Feb 6, 2019
cf98c18
Add s_nom_total for lines
ClaraBuettner Feb 14, 2019
bf07f98
Save load-cluster file
ClaraBuettner Mar 7, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Modified from
# https://github.com/calliope-project/calliope/blob/master/.travis.yml

language: python
sudo: false # Use container-based infrastructure

matrix:
include:
- env:
- PYTHON_VERSION="2.7"
- env:
- PYTHON_VERSION="3.6"

before_install:
- if [[ "$PYTHON_VERSION" == "2.7" ]]; then
wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh;
else
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
fi
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
# Useful for debugging any issues with conda
- conda info -a

install:
- conda create -q -n pypsa python=$PYTHON_VERSION
- conda env update -q -n pypsa --file=requirements.yml
- conda env update -q -n pypsa --file=requirements_dev.yml
- source activate pypsa
# - conda install -q -c conda-forge python-coveralls # don't install on appveyor
- pip install --no-cache-dir .

# before_script: # configure a headless display to test plot generation
# - "export DISPLAY=:99.0"
# - "sh -e /etc/init.d/xvfb start"
# - sleep 3 # give xvfb some time to start

script: "make test"

# after_success:
# - coveralls
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include pypsa/component_attrs/*.csv
include pypsa/standard_types/*.csv
include pypsa/components.csv
include README.rst LICENSE.txt
include requirements.yml
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.PHONY : test sdist upload clean dist

test :
pytest --cov pypsa --cov-report term-missing

sdist :
python setup.py sdist

upload :
twine upload dist/*

clean :
rm dist/*

dist : sdist upload clean
125 changes: 83 additions & 42 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
|badge_travis| |badge_pypi| |badge_license|

-----

################################
Python for Power System Analysis
################################
Expand All @@ -16,18 +20,18 @@ PyPSA is a `free software
<http://www.gnu.org/philosophy/free-sw.en.html>`_ toolbox for
simulating and optimising modern power systems that include features
such as conventional generators with unit commitment, variable wind
and solar generation, storage units, sector coupling and mixed
alternating and direct current networks. PyPSA is designed to scale
well with large networks and long time series.

As of 2017 PyPSA is under heavy development and therefore it is
recommended to use caution when using it in a production environment.
Some APIs may change - the changes in each PyPSA version are listed in
the `doc/release_notes.rst <doc/reslease_notes.rst>`_.



PyPSA was initially developed by the `Renewable Energy Group
and solar generation, storage units, coupling to other energy sectors,
and mixed alternating and direct current networks. PyPSA is designed
to scale well with large networks and long time series.

This project is maintained by the `Energy System Modelling
group <https://www.iai.kit.edu/english/2338.php>`_ at the `Institute for
Automation and Applied
Informatics <https://www.iai.kit.edu/english/index.php>`_ at the
`Karlsruhe Institute of
Technology <http://www.kit.edu/english/index.php>`_. The group is funded by the
`Helmholtz Association <https://www.helmholtz.de/en/>`_ until 2024.
Previous versions were developed by the `Renewable Energy Group
<https://fias.uni-frankfurt.de/physics/schramm/renewable-energy-system-and-network-analysis/>`_
at `FIAS <https://fias.uni-frankfurt.de/>`_ to carry out simulations
for the `CoNDyNet project <http://condynet.de/>`_, financed by the
Expand Down Expand Up @@ -57,14 +61,15 @@ PyPSA can calculate:

* static power flow (using both the full non-linear network equations and
the linearised network equations)
* linear optimal power flow (optimisation of power plant and storage
dispatch within network constraints, using the linear network
equations, over several snapshots)
* linear optimal power flow (least-cost optimisation of power plant
and storage dispatch within network constraints, using the linear
network equations, over several snapshots)
* security-constrained linear optimal power flow
* total electricity system investment optimisation (using linear
network equations, over several snapshots simultaneously for
optimisation of generation and storage dispatch and investment in
the capacities of generation, storage and transmission)
* total electricity/energy system least-cost investment optimisation
(using linear network equations, over several snapshots
simultaneously for optimisation of generation and storage dispatch
and investment in the capacities of generation, storage,
transmission and other infrastructure)

It has models for:

Expand All @@ -80,31 +85,29 @@ It has models for:
* basic components out of which more complicated assets can be built,
such as Combined Heat and Power (CHP) units, heat pumps, resistive
Power-to-Heat (P2H), Power-to-Gas (P2G), battery electric vehicles
(BEVs), etc.; each of these is demonstrated in the `examples
(BEVs), Fischer-Tropsch, direct air capture (DAC), etc.; each of
these is demonstrated in the `examples
<http://www.pypsa.org/examples/>`_


Functionality that will definitely be added soon:
Functionality that may be added in the future:

* Multi-year investment optimisation
* Simple RMS simulations with the swing equation
* Distributed active power slack
* Non-linear power flow solution using `analytic continuation
<https://en.wikipedia.org/wiki/Holomorphic_embedding_load_flow_method>`_
in the complex plane following `GridCal
<https://github.com/SanPen/GridCal>`_

Functionality that may be added in the future:

* Short-circuit current calculations
* Dynamic RMS simulations
* Small signal stability analysis
* Interactive web-based GUI with SVG
* OPF with the full non-linear network equations
* Dynamic EMT simulations
* Unbalanced load flow
* Port to `Julia <http://julialang.org/>`_

Other complementary libraries:

* `pandapower <https://github.com/e2nIEE/pandapower>`_ for more
detailed modelling of distribution grids, short-circuit
calculations, unbalanced load flow and more
* `PowerDynamics.jl
<https://github.com/JuliaEnergy/PowerDynamics.jl>`_ for dynamic
modelling of power grids at time scales where differential equations are relevant



Example scripts as Jupyter notebooks
====================================
Expand All @@ -117,7 +120,12 @@ available as Python scripts in `examples/ <examples/>`_.
Screenshots
===========

The showcase for PyPSA is the `SciGRID example
Results from a PyPSA simulation can be converted into an interactive
online animation using `PyPSA-animation
<https://github.com/PyPSA/PyPSA-animation>`_, see the `PyPSA-Eur-30
example <https://www.pypsa.org/animations/pypsa-eur-30/>`_.

Another showcase for PyPSA is the `SciGRID example
<https://pypsa.org/examples/scigrid-lopf-then-pf-plotly.html>`_ which
demonstrates interactive plots generated with the `plotly
<https://plot.ly/python/>`_ library.
Expand Down Expand Up @@ -147,7 +155,7 @@ What PyPSA uses under the hood
===============================

PyPSA is written and tested to be compatible with both Python 2.7 and
Python 3.5.
Python 3.6.

It leans heavily on the following Python packages:

Expand Down Expand Up @@ -183,12 +191,31 @@ Citing PyPSA


If you use PyPSA for your research, we would appreciate it if you
would cite the following preprint paper (which has not yet been
through peer review):
would cite the following paper:

* T. Brown, J. Hörsch, D. Schlachtberger, `PyPSA: Python for Power
System Analysis <https://arxiv.org/abs/1707.09913>`_, 2017,
`preprint arXiv:1707.09913 <https://arxiv.org/abs/1707.09913>`_
System Analysis <https://arxiv.org/abs/1707.09913>`_, 2018,
`Journal of Open Research Software
<https://openresearchsoftware.metajnl.com/>`_, 6(1),
`arXiv:1707.09913 <https://arxiv.org/abs/1707.09913>`_,
`DOI:10.5334/jors.188 <https://doi.org/10.5334/jors.188>`_


Please use the following BibTeX: ::

@article{PyPSA,
author = {T. Brown and J. H\"orsch and D. Schlachtberger},
title = {{PyPSA: Python for Power System Analysis}},
journal = {Journal of Open Research Software},
volume = {6},
issue = {1},
number = {4},
year = {2018},
eprint = {1707.09913},
url = {https://doi.org/10.5334/jors.188},
doi = {10.5334/jors.188}
}


If you want to cite a specific PyPSA version, each release of PyPSA is
stored on `Zenodo <https://zenodo.org/>`_ with a release-specific DOI.
Expand All @@ -201,8 +228,8 @@ This can be found linked from the overall PyPSA Zenodo DOI:
Licence
=======

Copyright 2015-2017 Tom Brown (FIAS), Jonas Hörsch (FIAS), David
Schlachtberger (FIAS)
Copyright 2015-2019 Tom Brown (KIT, FIAS), Jonas Hörsch (KIT, FIAS),
David Schlachtberger (FIAS)

This program is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as
Expand All @@ -213,3 +240,17 @@ 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 General Public License <LICENSE.txt>`_ for more details.

.. |link-latest-doi| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.786605.svg
.. _link-latest-doi: https://doi.org/10.5281/zenodo.786605

.. |badge_pypi| image:: https://img.shields.io/pypi/v/pypsa.svg
:target: https://pypi.python.org/pypi/pypsa
:alt: PyPI version

.. |badge_license| image:: https://img.shields.io/pypi/l/pypsa.svg
:target: #license

.. |badge_travis| image:: https://img.shields.io/travis/PyPSA/PyPSA/master.svg
:target: https://travis-ci.org/PyPSA/PyPSA
:alt: Build status on Linux
2 changes: 1 addition & 1 deletion doc/comparable_software.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Comparable Software
#######################

The `PyPSA preprint paper <https://arxiv.org/abs/1707.09913>`_
The `PyPSA paper <https://arxiv.org/abs/1707.09913>`_
contains a discussion of PyPSA's features compared to other software
tools and a functionality comparison in Table III.

Expand Down
68 changes: 67 additions & 1 deletion doc/components.rst
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,48 @@ the ``Link`` with ``efficiency = 1``, ``marginal_cost = 0``,
:file: ../pypsa/component_attrs/links.csv


.. _components-links-multiple-outputs:

Link with multiple outputs or inputs
------------------------------------

Links can also be defined with multiple outputs in fixed ratio to the
power in the single input by defining new columns ``bus2``, ``bus3``,
etc. (``bus`` followed by an integer) in ``network.links`` along with
associated columns for the efficiencies ``efficiency2``,
``efficiency3``, etc. The different outputs are then proportional to
the input according to the efficiency; see :ref:`opf-links` for how
these are used in the LOPF and the `example of a CHP with a fixed
power-heat ratio
<https://www.pypsa.org/examples/chp-fixed-heat-power-ratio.html>`_.

To define the new columns ``bus2``, ``efficiency2``, ``bus3``,
``efficiency3``, etc. in ``network.links`` you need to override the
standard component attributes by passing ``pypsa.Network()`` an
``override_component_attrs`` argument. See the section
:ref:`custom_components` and the `example of a CHP with a fixed
power-heat ratio
<https://www.pypsa.org/examples/chp-fixed-heat-power-ratio.html>`_.


If the column ``bus2`` exists, values in the column are not compulsory
for all links; if the link has no 2nd output, simply leave it empty
``network.links.at["my_link","bus2"] = ""``.

For links with multiple inputs in fixed ratio to a single output,
simply reverse the flow in a link with one input and multiple outputs
by setting ``my_link.p_max_pu = 0`` and ``my_link.p_min_pu = -1``.

For multiple inputs to multiple outputs, connect a multi-to-single
link to a single-to-multi link with an auxiliary bus in the middle.


Groups of Components
====================

In the code components are grouped according to their properties.
In the code components are grouped according to their properties in
sets such as ``network.one_port_components`` and
``network.branch_components``.

One-ports share the property that they all connect to a single bus,
i.e. generators, loads, storage units, etc.. They share the attributes
Expand All @@ -453,3 +491,31 @@ nodal power imbalances, i.e. lines and transformers.

Controllable branches are branches whose power flow can be controlled
by e.g. the LOPF optimisation, i.e. links.


.. _custom_components:

Custom Components
=================

If you want to define your own components and override the standard
functionality of PyPSA, you can easily override the standard
components by passing pypsa.Network() the arguments
``override_components`` and ``override_component_attrs``.

For this network, these will replace the standard definitions in
``pypsa.components.components`` and
``pypsa.components.component_attrs``, which correspond to the
repository CSV files ``pypsa/components.csv`` and
``pypsa/component_attrs/*.csv``.

``components`` is a pandas.DataFrame with the component ``name``,
``list_name`` and ``description``. ``component_attrs`` is a
pypsa.descriptors.Dict of pandas.DataFrame with the attribute
properties for each component. Just follow the formatting for the
standard components.

There are examples for defining new components in the git repository
in ``examples/new_components/``, including an example of
overriding e.g. ``network.lopf()`` for functionality for
combined-heat-and-power (CHP) plants.
8 changes: 4 additions & 4 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@

# General information about the project.
project = u'PyPSA'
copyright = u'2016-2017 Tom Brown (FIAS), Jonas Hoersch (FIAS), David Schlachtberger (FIAS)'
author = u'Tom Brown (FIAS), Jonas Hoersch (FIAS), David Schlachtberger (FIAS)'
copyright = u'2015-2019 Tom Brown (KIT, FIAS), Jonas Hoersch (KIT, FIAS), David Schlachtberger (FIAS)'
author = u'Tom Brown (KIT, FIAS), Jonas Hoersch (KIT, FIAS), David Schlachtberger (FIAS)'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u'0.11'
version = u'0.13'
# The full version, including alpha/beta/rc tags.
release = u'0.11.0'
release = u'0.13.2'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
9 changes: 4 additions & 5 deletions doc/design.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Python 3.5.
Network object is the overall container
=======================================

The ``pypsa.components.Network`` is an overall container for all
network components; components cannot exist without a network.
The ``pypsa.Network`` is an overall container for all network
components; components cannot exist without a network.

It is also the object on which calculations, such as power flow and
optimal power flow, are performed.
Expand All @@ -24,9 +24,8 @@ optimal power flow, are performed.
Buses are the fundamental nodes
===============================

The ``pypsa.components.Bus`` is the fundamental node to which all
loads, generators, storage units, lines, transformers and links
attach.
The bus is the fundamental node to which all loads, generators,
storage units, lines, transformers and links attach.

You can have as many components attached to a bus as you want.

Expand Down
Binary file added doc/img/pypsa-animation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading