forked from PyPSA/PyPSA
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
518 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,8 +32,14 @@ pypsa.egg-info/ | |
|
||
files.txt | ||
|
||
*.org | ||
tom_notes.org | ||
|
||
|
||
*.aux | ||
|
||
website/examples/*.py | ||
|
||
*.zip | ||
|
||
*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../doc/_build/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 += "<ul id=\"{}menu\">\n".format("sub"*(n+1)) | ||
|
||
menu += "".join(["<li><a href=\"{}\">{}</a></li>\n".format(root_path + i[0],i[1]) if i[0] != item and i[0] != html_name else "<li><span class=\"current\">{}</span></li>\n".format(i[1]) for i in filled_layer]) | ||
|
||
menu += "</ul>\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 = """<!DOCTYPE html | ||
PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" | ||
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> | ||
<html> | ||
<head> | ||
<title>{} | nworbmot:tombrown</title> | ||
<link rel=\"stylesheet\" type=\"text/css\" href=\"{}\" /> | ||
</head> | ||
<body> | ||
<div id="outer_box"> | ||
<div id="header"> | ||
{} | ||
""".format(name, root_path + "theme.css", menu) | ||
|
||
|
||
html += "\n\n</div>\n\n<div id=\"main\">\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 = '<div id="content">' | ||
|
||
if start_string not in org_html: | ||
print("Start string not found, skipping") | ||
return | ||
|
||
|
||
end_string = '<div id="postamble" class="status">' | ||
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</body>\n</html>\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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../doc/img |
Oops, something went wrong.