diff --git a/.gitignore b/.gitignore index 3ec22b832..d6a5241ce 100644 --- a/.gitignore +++ b/.gitignore @@ -32,8 +32,14 @@ pypsa.egg-info/ files.txt -*.org +tom_notes.org *.pdf *.aux + +website/examples/*.py + +*.zip + +*.html \ No newline at end of file diff --git a/website/doc b/website/doc new file mode 120000 index 000000000..05af2cfb6 --- /dev/null +++ b/website/doc @@ -0,0 +1 @@ +../doc/_build/html \ No newline at end of file diff --git a/website/download/index.org b/website/download/index.org new file mode 100644 index 000000000..c9a9a1ee0 --- /dev/null +++ b/website/download/index.org @@ -0,0 +1,8 @@ +#+TITLE: Python for Power System Analysis: Download +#+OPTIONS: toc:nil no default TOC + + +See the [[../doc/installation.html][installation instructions]]. + +You can also see/download the code directly from +[[https://github.com/FRESNA/PyPSA][github]]. diff --git a/website/examples/index.org b/website/examples/index.org new file mode 100644 index 000000000..d5bc8361a --- /dev/null +++ b/website/examples/index.org @@ -0,0 +1,66 @@ +#+TITLE: Python for Power System Analysis: Examples +#+OPTIONS: toc:nil no default TOC + +These examples demonstrate PyPSA using [[http://jupyter.org/][Jupyter/iPython notebooks]]. To +download the notebook files directly, replace the example file ending +=.html= with =.ipynb=. + +For some of the examples you may have to download data from the +=examples= folder in the [[https://github.com/FRESNA/PyPSA][PyPSA github +repository]]. + +- [[./minimal_example_pf.html][*Minimal example of power flow*]] - This script performs a non-linear + power flow for a three-node network. +- [[./minimal_example_lopf.html][*Minimal example of linear optimal power flow*]] - This script performs + a linear optimal power flow for a three-node network. +- [[./transformer_example.html][*Transformer example*]] - Minimal example of transformer with + non-trivial phase shift and tap ratio. +- *SciGrid German network* + - [[./scigrid-lopf-then-pf.html][*Linear OPF then non-linear PF on the SciGRID German network*]] - + This script performs a linear optimal power flow on the [[http://scigrid.de/][SciGRID]] + network for Germany for a full day and then examines the results. + A full non-linear power flow is then performed on the network + with the optimised dispatch. + - [[./scigrid-sclopf.html][*Security-constrained LOPF on the SciGRID German network*]] - This + script performs a security-constrained linear optimal power flow + on the [[http://scigrid.de/][SciGRID]] network for Germany, taking into account several + possible branch outages. + - [[./add_load_gen_trafos_to_scigrid.html][*Attaching load, generation, transformers and missing lines to the + SciGRID German network*]] - This script attaches load, conventional + generation data and wind and solar data, transformers and missing + lines to the [[http://scigrid.de/][SciGRID]] network for Germany. It then exports the + resulting network for use in the script above. Only a single + day's worth of data is in the [[https://github.com/FRESNA/PyPSA][PyPSA github repository]]; a full year + (2011) of load and wind/solar data can be downloaded [[./scigrid-with-load-gen-trafos-2011.zip][here]]. +- [[./ac-dc-lopf.html][*Meshed AC-DC network*]] - This example demonstrates multiply-connected + AC-DC meshed networks with an example of 3 separate synchronous AC + areas connected by a 3-node DC network. +- [[./unit-commitment.html][*Generator Unit Commitment Examples*]] - This tutorial runs through + examples of unit commitment for generators at a single bus. Examples + of minimum part-load, minimum up time, minimum down time, start up + costs, shut down costs and ramp rate restrictions are shown. +- [[./simple-electricity-market-examples.html][*Simple Electricity Market Examples*]] - This tutorial gradually builds + up more and more complicated energy-only electricity markets in + PyPSA, starting from a single bidding zone, going up to multiple + bidding zones connected with transmission (NTCs) along with variable + renewables and storage. +- *Coupling to Other Energy Sectors* + - [[./lopf-with-heating.html][*Linear optimal power flow with coupling to the heating sector*]] - In + this example three locations are optimised, each with an electric + bus and a heating bus and corresponding loads. At each location + the electric and heating buses are connected with heat pumps; heat + can also be supplied to the heat bus with a boiler. The electric + buses are connected with transmission lines and there are + electrical generators at two of the nodes. + - [[./power-to-gas-boiler-chp.html][*Power-to-Gas with Gas Boiler and Combined-Heat-and-Power unit*]] + - [[./power-to-heat-water-tank.html][*Power-to-Heat with Water Tank*]] + - [[./battery-electric-vehicle-charging.html][*Transport: Charging Battery Electric Vehicle with Solar Panel*]] + - [[./chained-hydro-reservoirs.html][*Chained Hydroelectric Reservoirs*]] + - [[./replace-generator-storage-units-with-store.html][*Replacing Generators and Storage Units with Fundamental Stores and + Links*]] - This notebook demonstrates how generators and storage + units can be replaced by more fundamental components (Stores and + Links), and how their parameters map to each other. + + +If you have a nice example of using PyPSA, send your iPython notebook to +Tom Brown (brown at fias.uni-frankfurt.de). diff --git a/website/forum/index.org b/website/forum/index.org new file mode 100644 index 000000000..48c2dfb18 --- /dev/null +++ b/website/forum/index.org @@ -0,0 +1,6 @@ +#+TITLE: Python for Power System Analysis: Forum +#+OPTIONS: toc:nil no default TOC + + + +PyPSA has a Google Group [[https://groups.google.com/group/pypsa][forum / mailing list]]. diff --git a/website/generate.py b/website/generate.py new file mode 100644 index 000000000..31adb0c66 --- /dev/null +++ b/website/generate.py @@ -0,0 +1,144 @@ +# make the code as Python 3 compatible as possible +from __future__ import print_function, division, absolute_import + +import os, markdown, sys, getopt + + +hierarchy = [["index.html","home"], + ["download/index.html","download"], + ["examples/index.html","examples"], + ["doc/index.html","documentation"], + ["publications/index.html","publications"], + ["forum/index.html","forum"], +] + + + +def process_org(org_name): + """Build HTML page and write it.""" + + html_name = org_name[:-4] + ".html" + + root_path = org_name.count("/")*"../" + + hierarchy_path = [] + + def find_path(layer,path,hierarchy_path): + if len(path) > 0 and path[-1] == html_name: + hierarchy_path += path + else: + for item in layer: + new_path = path + [item[0]] + if len(item) > 2: + new_layer = item[2] + else: + new_layer = [] + find_path(new_layer,new_path,hierarchy_path) + + find_path(hierarchy,[],hierarchy_path) + + hierarchy_path.append("") + + layer = hierarchy + + name = "" + + menu = "" + + for n,item in enumerate(hierarchy_path): + + bare_layer = [i[0] for i in layer] + + filled_layer = [[i[0],i[0][:i[0].rfind(".")]] if len(i) < 2 else i for i in layer] + + menu += "\n" + + if item != "": + full_item = layer[ bare_layer.index(item)] + for i in filled_layer: + if i[0] == html_name: + name = i[1] + else: + full_item = [] + + if len(full_item) < 3: + break + + layer = full_item[2] + + + html = """ + + +{} | nworbmot:tombrown + + + +
+\n\n
\n\n" + + + command = "emacs {} --batch -f org-html-export-to-html --kill".format(org_name) + + os.system(command) + + f = open(html_name,"r") + + org_html = f.read() + + f.close() + + + if "outer_box" in org_html: + print("File is already processed, skipping") + return + + start_string = '
' + + if start_string not in org_html: + print("Start string not found, skipping") + return + + + end_string = '
' + if end_string not in org_html: + print("End string not found, skipping") + return + + new = org_html[org_html.find(start_string)+len(start_string):org_html.find(end_string)] + + + html = html + new + "\n\n\n\n" + + f = open(html_name,"w") + + f.write(html) + + f.close() + + return html + + +for path, sub_dirs, file_names in os.walk("."): + + if "/old" in path: + continue + + for file_name in file_names: + if file_name[-4:] == ".org": + full_name = os.path.join(path,file_name)[2:] + print(full_name) + process_org(full_name) diff --git a/website/img b/website/img new file mode 120000 index 000000000..a6c822ffd --- /dev/null +++ b/website/img @@ -0,0 +1 @@ +../doc/img \ No newline at end of file diff --git a/website/index.org b/website/index.org new file mode 100644 index 000000000..bc350478d --- /dev/null +++ b/website/index.org @@ -0,0 +1,189 @@ +#+TITLE: PyPSA: Python for Power System Analysis + +* About + +PyPSA stands for "Python for Power System Analysis". It is pronounced +"pipes-ah". + +PyPSA is a [[http://www.gnu.org/philosophy/free-sw.en.html][free +software]] toolbox for simulating and optimising modern power systems +that include features such as 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 - those liable to be updated are listed in the +[[./doc/todo.html][TODO list]]. + +PyPSA was initially developed by the +[[https://fias.uni-frankfurt.de/physics/schramm/renewable-energy-system-and-network-analysis/][Renewable +Energy Group]] at [[https://fias.uni-frankfurt.de/][FIAS]] to carry out +simulations for the [[http://condynet.de/][CoNDyNet project]], financed +by the [[https://www.bmbf.de/en/index.html][German Federal Ministry for +Education and Research (BMBF)]] as part of the +[[http://forschung-stromnetze.info/projekte/grundlagen-und-konzepte-fuer-effiziente-dezentrale-stromnetze/][Stromnetze +Research Initiative]]. + +* Download + +See the [[./doc/installation.html][installation instructions]]. + +You can also see/download the code directly from +[[https://github.com/FRESNA/PyPSA][github]]. + +* Documentation + +[[./doc/index.html][Documentation as a website]] + +[[./doc/PyPSA.pdf][Documentation as a PDF]] + +[[./doc/quick_start.html][Quick start]] + +[[./examples/index.html][Examples]] + +* What PyPSA does and does not do (yet) + +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) +- 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) + +It has models for: + +- meshed multiply-connected AC and DC networks, with controllable + converters between AC and DC networks +- standard types for lines and transformers following the + implementation in + [[https://www.uni-kassel.de/eecs/fachgebiete/e2n/software/pandapower.html][pandapower]] +- conventional dispatchable generators +- generators with time-varying power availability, such as wind and + solar generators +- storage units with efficiency losses +- simple hydroelectricity with inflow and spillage +- coupling with other energy carriers +- 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/index.html][examples]] + +Functionality that will definitely be added soon (see also +[[./doc/todo.html][TODO list]]): + +- Multi-year investment optimisation +- Simple RMS simulations with the swing equation +- Distributed active power slack +- Non-linear power flow solution using + [[https://en.wikipedia.org/wiki/Holomorphic_embedding_load_flow_method][analytic + continuation]] in the complex plane following + [[https://github.com/SanPen/GridCal][GridCal]] + +Functionality that may be added in the future: + +- Unit Commitment using MILP +- 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 [[http://julialang.org/][Julia]] + + +* Example scripts as Jupyter/iPython notebooks + +There are [[./examples/index.html][extensive examples]] available as +Jupyter/iPython notebooks. + + +* Screenshots + +Some screenshots: + +#+CAPTION: Line loading with high wind feed-in in North Germany. +[[./img/line-loading.png]] + +#+CAPTION: Nodal prices with high wind feed-in in North Germany. +[[./img/lmp.png]] + + +#+CAPTION: Reactive power in Germany. +[[./img/reactive-power.png]] + +#+CAPTION: Aggregated feed-in over a day. +#+ATTR_HTML: :width 700px +[[./img/stacked-gen.png]] + +#+CAPTION: Storage operation. +#+ATTR_HTML: :width 700px +[[./img/storage-scigrid.png]] + +#+CAPTION: Curtailment of wind. +#+ATTR_HTML: :width 700px +[[./img/scigrid-curtailment.png]] + +#+CAPTION: Meshed AC-DC hybrid nework. +[[./img/meshed-ac-dc.png]] + +#+CAPTION: Investment optimisation results for 95% CO2 reduction in Europe. +#+NAME: fig:investment +#+ATTR_HTML: :width 700px +[[./img/euro-pie-pre-7-branch_limit-1-256.png]] + +* What PyPSA uses under the hood + +PyPSA is written and tested to be compatible with both Python 2.7 and +Python 3.5. + +It leans heavily on the following Python packages: + +- [[http://ipython.org/][pandas]] for storing data about components and + time series +- [[http://www.numpy.org/][numpy]] and [[http://scipy.org/][scipy]] for + calculations, such as linear algebra and sparse matrix calculations +- [[http://www.pyomo.org/][pyomo]] for preparing optimisation problems + (currently only linear) +- [[https://networkx.github.io/][networkx]] for some network + calculations +- [[http://pytest.org/][py.test]] for unit testing +- [[https://docs.python.org/3/library/logging.html][logging]] for + managing messages + +The optimisation uses pyomo so that it is independent of the preferred +solver (you can use e.g. the free software GLPK or the commercial +software Gurobi). + +The time-expensive calculations, such as solving sparse linear +equations, are carried out using the scipy.sparse libraries. + +* Mailing list + +PyPSA has a Google Group [[https://groups.google.com/group/pypsa][forum +/ mailing list]]. + + + + +* Citing PyPSA + +If you use PyPSA for your research, we would appreciate it if you could cite the project. +There is currently no official publication on PyPSA, but we're working +on it. In the meantime you can cite the Zenodo DOI for the latest release: +[[https://doi.org/10.5281/zenodo.582307][https://zenodo.org/badge/DOI/10.5281/zenodo.582307.svg]]. + + +* Licence + +PyPSA is released as free software under the +[[http://www.gnu.org/licenses/gpl-3.0.en.html][GPLv3]]. diff --git a/website/publications/index.org b/website/publications/index.org new file mode 100644 index 000000000..ff372e47e --- /dev/null +++ b/website/publications/index.org @@ -0,0 +1,16 @@ +#+TITLE: Python for Power System Analysis: Publications +#+OPTIONS: toc:nil no default TOC + +There is no official publication on PyPSA yet (we're working on it), but the following papers have used the software: + +- J. H\ouml{}rsch, T. Brown, [[https://arxiv.org/abs/1705.07617][The role of spatial scale in joint optimisations of generation and transmission for European highly renewable scenarios]], 2017, accepted to [[http://eem2017.com/][14th International Conference on the European Energy Market - EEM 2017]], [[https://arxiv.org/abs/1705.07617][preprint]] +- D. Schlachtberger, T. Brown, S. Schramm, M. Greiner, [[https://arxiv.org/abs/1704.05492][The Benefits of Cooperation in a Highly Renewable European Electricity Network]], 2017, [[https://arxiv.org/abs/1704.05492][preprint]] +- J. H\ouml{}rsch, H. Ronellenfitsch, D. Witthaut, T. Brown, [[https://arxiv.org/abs/1704.01881][Linear Optimal Power Flow Using Cycle Flows]], 2017, [[https://arxiv.org/abs/1704.01881][preprint]] +- Joao Gorenstein Dedecca, Rudi A. Hakvoort, Paulien M. Herder, [[http://www.sciencedirect.com/science/article/pii/S0360544217302931][Transmission expansion simulation for the European Northern Seas offshore grid]], Energy, Volume 125, 15 April 2017, Pages 805-824, [[https://doi.org/10.1016/j.energy.2017.02.111][doi]] + +If you have written a paper or report using PyPSA, please send us the +link so we can add it here by emailing Tom Brown (brown at +fias.uni-frankfurt.de). + +If you want to cite PyPSA, you can cite the Zenodo DOI for the latest release: +[[https://doi.org/10.5281/zenodo.582307][https://zenodo.org/badge/DOI/10.5281/zenodo.582307.svg]]. diff --git a/website/theme.css b/website/theme.css new file mode 100644 index 000000000..bc05db49f --- /dev/null +++ b/website/theme.css @@ -0,0 +1,80 @@ + +#outer_box +{ +width:760px; +margin-left: auto; +margin-right: auto; +font-size:120%; +text-align: justify; +line-height: 130%; +} + + +#header { + margin-top: 2em; + font-size:120%; +} + + +#headshot +{ +padding:3px; +float: right; +position: relative; +margin: 0 0 20px 40px; +} + +h1 +{ +font-size:150%; +line-height:1.4em; +} + +h2 +{ +font-size:120%; +line-height:1.4em; +} + +h3 +{ +font-size:110%; +line-height:1.4em; +} + +#submenu { + padding: 0; + margin: 0 0 0 0; + height: 2em; /* Setting a height makes it act like a block */ + font-size:100%; + } + +#submenu li { + display: inline; + padding: 0 15px 0 0; + margin: 0; + } + + + +#subsubmenu { + padding: 0; + margin: 0 0 0 0; + height: 3.5em; /* Setting a height makes it act like a block */ + } + +#subsubmenu li { + display: inline; + padding: 0 10px 0 0; + margin: 0; + } + + + +.current { + font-weight: bold; +} + +.figure { padding: 1em; } + +.figure p { text-align: center; }