Skip to content

Commit

Permalink
add doc, screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
ojdo committed Jul 27, 2016
1 parent 3f22f08 commit ec187ad
Show file tree
Hide file tree
Showing 8 changed files with 607 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
doc/_build/*
*~
*.pyc
*.pyc
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

dhmin is a [mixed integer linear programming](https://en.wikipedia.org/wiki/Integer_programming) optimization model developed for planning of district heating or cooling networks.

## Screenshot

<a href="doc/img/rundh-mnl-result.png"><img src="doc/img/rundh-mnl-result.png" alt="Result power flow configurations for provided minimal input dataset" style="width:600px"></a>

## Features

* dhmin is a mixed integer linear programming model for single-commodity energy infrastructure networks systems with a focus on high spatial resolution.
Expand Down
177 changes: 177 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
# Makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build

# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext

help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"

clean:
rm -rf $(BUILDDIR)/*

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."

singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."

pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."

json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."

htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."

qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/urbs.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/urbs.qhc"

devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/urbs"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/urbs"
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."

latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."

latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."

latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."

text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."

man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."

texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."

info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."

gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."

changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."

linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."

doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."

xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."

pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
83 changes: 83 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# -*- coding: utf-8 -*-

import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

extensions = [
'sphinx.ext.intersphinx',
'sphinx.ext.mathjax',
]

#templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'

project = u'urbs'
copyright = u'2014-2016, tum-ens'
version = '0.5'
release = '0.5'

exclude_patterns = ['_build']
#pygments_style = 'sphinx'

# HTML output

htmlhelp_basename = 'urbsdoc'

# LaTeX output

latex_elements = {
'papersize': 'a4paper',
'pointsize': '11pt',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'urbs.tex', u'urbs Documentation',
u'tum-ens', 'manual'),
]

# Manual page output

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'urbs', u'urbs Documentation',
[u'tum-ens'], 1)
]


# Texinfo output

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'urbs', u'urbs Documentation',
u'tum-ens', 'urbs', 'A linear optimisation model for distributed energy systems',
'Miscellaneous'),
]


# Epub output

# Bibliographic Dublin Core info.
epub_title = u'urbs'
epub_author = u'tum-ens'
epub_publisher = u'tum-ens'
epub_copyright = u'2014-2016, tum-ens'

epub_exclude_files = ['search.html']


# Intersphinx

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'http://docs.python.org/': None,
'pandas': ('http://pandas.pydata.org/pandas-docs/stable/', None),
'matplotlib': ('http://matplotlib.org/', None)}

Binary file added doc/img/rundh-mnl-result.pdf
Binary file not shown.
Binary file added doc/img/rundh-mnl-result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
99 changes: 99 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
.. dhmin documentation master file, created by
sphinx-quickstart on Wed Sep 10 11:43:04 2014.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
.. module:: dhmin

dhmin: Mathematical optimisation model for district energy distribution networks
================================================================================

:Maintainer: Johannes Dorfner, <[email protected]>
:Organization: `Chair of Renewable and Sustainable Energy Systems`_,
Technical University of Munich
:Version: |version|
:Date: |today|
:Copyright:
The model code is licensed under the `GNU General Public License 3.0
<http://www.gnu.org/licenses/gpl-3.0>`_.
This documentation is licensed under a `Creative Commons Attribution 4.0
International <http://creativecommons.org/licenses/by/4.0/>`_ license.


Contents
--------

User's manual
^^^^^^^^^^^^^

These documents give a general overview and help you getting started from after
the installation (which is covered in the `README.md`_ file on GitHub) to you
first running model.

.. toctree::


Features
--------
* `dhmin`_ is a mixed-integer linear programming model for single-commodity
energy distribution networks.
* It finds the minimum cost (invest + operation - revenue) energy distribution
network for a given set of energy source locations (source vertices) and a
set of demand locations (possible customers).
* Temporal resolution is variable, but incurs a strong limit on the feasible
spatial resolution. I.e. with about 2-3 timesteps, hundreds or several
thousand edges are possible in reasonable time.
* Thanks to `pandas`_ and `GeoPandas`_ complex data analysis code is short and
concise.
* The model code itself is very short thanks to relying on the `Pyomo`_
package.
* The model code is structured identical to the more general `urbs`_ model.


Screenshots
-----------

This is a typical result plot created by function `dhmintools.plot_flows_min`
for the accompanying minimal example dataset. There are (not shown) two demand
edges (with x,y coordinates [5,7 to 4,9] and [7,2 to 6,3]) in this graph.
Three possible source vertices (red dots) with sufficient capacity are located
at the vertices with coordinates [2,2] [2,7] [9,9] and feature different
generation costs, [9,9] being cheaper than the other two.

.. image:: img/rundh-mnl-result.*
:width: 95%
:align: center

The first subplot **Pmax** shows the power flow from the cheapest source vertex
(north east) to the two demand locations, indicating that both locations can be
connected economcially. The two plots **t1040** and **t1600** show the
minimum-cost power flow configuration for the provided partial load situations.

The second row shows the power flow configuration that occur when outages of
the source vertices occur. As only vertex [9,9] is used exclusively anyway,
only its outage (last plot) changes the

The built pipe capacity and layout is planned so that a) satisfying all
profitable demands at minimum costs and b) that all pre-determined contigency
situations can be handled with the constructed capacities.

Dependencies
------------

* `Python`_ versions 2.7 or 3.x are both supported.
* `pyomo`_ for model equations and as the interface to optimisation solvers
(CPLEX, GLPK, Gurobi, ...). Version 4 recommended, as version 3 support
(a.k.a. as coopr.pyomo) will be dropped soon.
* `pandas`_ for input and result data handling, report generation
* Any solver supported by pyomo (GLPK, CBC, CPLEX, Gurobi, ...)

.. _dhmin: https://github.com/tum-ens/dhmin
.. _GeoPandas: http://geopandas.org/
.. _glpk: https://www.gnu.org/software/glpk/
.. _Chair of Renewable and Sustainable Energy Systems: http://www.ens.ei.tum.de/
.. _matplotlib: http://matplotlib.org
.. _pandas: http://pandas.pydata.org
.. _pyomo: http://www.pyomo.org
.. _python: https://www.python.org/
.. _README.md: https://github.com/tum-ens/dhmin/blob/master/README.md
.. _urbs: https://github.com/tum-ens/urbs
Loading

0 comments on commit ec187ad

Please sign in to comment.