-
Notifications
You must be signed in to change notification settings - Fork 12
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
186 changed files
with
11,484 additions
and
855 deletions.
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
[flake8] | ||
exclude = meta/migrations/ | ||
ignore = E265 | ||
ignore = E265, W503 | ||
max-line-length = 100 | ||
per-file-ignores = | ||
__init__.py : F401 |
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 |
---|---|---|
@@ -1,4 +1,10 @@ | ||
*.pyc | ||
*.png | ||
*.egg-info | ||
*.html | ||
.idea | ||
results/ | ||
_build | ||
jupyter_notebooks | ||
*/import_export_plot/data_csv_output/ | ||
*/import_osmnx/data/ |
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
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
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,10 @@ | ||
Authors | ||
======= | ||
|
||
--**alphabetic order**-- | ||
|
||
* Jann Launer | ||
* Johannes Röder | ||
* Joris Zimmermann | ||
* Marie-Claire Gering | ||
* oakca |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 oemof developing group | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,88 @@ | ||
|badge_travis| |badge_coverage| | ||
|
||
~~~~ | ||
DHNx | ||
~~~~ | ||
|
||
This package provides an open toolbox for district heating and cooling network | ||
optimization and simulation models. | ||
|
||
.. contents:: | ||
|
||
About | ||
===== | ||
|
||
The aim of DHNx is to provide a toolbox for building models of | ||
district heating/cooling systems. | ||
|
||
Quickstart | ||
========== | ||
|
||
If you have a working Python3 environment, use pypi to install the latest DHNx version: | ||
|
||
.. code:: bash | ||
pip install dhnx | ||
Install the developer version of DHNx by cloning DHNx to your computer and running | ||
|
||
.. code:: bash | ||
pip install -e DHNx | ||
in your virtualenv. | ||
|
||
Check out the | ||
`examples <https://github.com/oemof-heat/DHNx/tree/dev/examples>`_ to get started. | ||
|
||
Documentation | ||
============= | ||
|
||
The documentation (work in progress) can be found here | ||
`<https://dhnx.readthedocs.io/en/latest/>`_. | ||
To build the docs locally using sphinx-build run the following in a terminal. | ||
|
||
.. code:: bash | ||
sphinx-build docs <build-dir> | ||
Contributing | ||
============ | ||
|
||
Everybody is welcome to contribute to the development of DHNx. The `developer | ||
guidelines of oemof <https://oemof.readthedocs.io/en/stable/developing_oemof.html>`_ | ||
are in most parts equally applicable to DHNx. | ||
|
||
License | ||
======= | ||
|
||
MIT License | ||
|
||
Copyright (c) 2020 oemof developing group | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
|
||
.. |badge_coverage| image:: https://coveralls.io/repos/github/oemof-heat/DHNx/badge.svg?branch=dev&service=github | ||
:target: https://coveralls.io/github/oemof-heat/DHNx?branch=dev | ||
:alt: Test coverage | ||
|
||
.. |badge_travis| image:: https://api.travis-ci.org/oemof/DHNx.svg?branch=dev | ||
:target: https://travis-ci.org/oemof/DHNx | ||
:alt: Build status |
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 @@ | ||
__version__ = "0.0.1" |
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,12 @@ | ||
__version__ = "0.0.1" | ||
|
||
from . import input_output | ||
from . import network | ||
from . import plotting | ||
from . import model | ||
from . import simulation | ||
from . import dhn_from_osm | ||
from . import optimization | ||
from . import optimization_add_components | ||
from . import optimization_dhs_nodes | ||
from . import optimization_oemof_heatpipe |
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,9 @@ | ||
attribute,type,unit,default,description,status,requirement | ||
id,int,n/a,n/a,Unique id,Input,required | ||
component_type,str,--,Consumer,Component type,Input,optional | ||
lat,float,n/a,n/a,Geographic latitude,Input,optional | ||
lon,float,n/a,n/a,Geographic longitude,Input,optional | ||
mass_flow,float/sequence,kg/s,n/a,Mass flow,Input,optional | ||
delta_temp_drop,float/sequence,kg/s,n/a,Temperature drop from inlet to return,Input,optional | ||
zeta_inlet,float,--,n/a,Localized pressure loss coefficient for inlet flow,Input,optional | ||
zeta_return,float,--,n/a,Localized pressure loss coefficient for return flow,Input,optional |
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,3 @@ | ||
attribute,type,unit,default,description,status,requirement | ||
component_type,str,--,Environment,Component type,Input,optional | ||
temp_env,float/sequence,deg C or K,n/a,Environment temperature,Input,optional |
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,7 @@ | ||
attribute,type,unit,default,description,status,requirement | ||
id,int,n/a,n/a,Unique id,Input,required | ||
component_type,str,--,Fork,Component type,Input,optional | ||
lat,float,n/a,n/a,Geographic latitude,Input,optional | ||
lon,float,n/a,n/a,Geographic longitude,Input,optional | ||
zeta_inlet,float,--,n/a,Localized pressure loss coefficient for inlet flow,Input,optional | ||
zeta_return,float,--,n/a,Localized pressure loss coefficient for return flow,Input,optional |
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,9 @@ | ||
attribute,type,unit,default,description,status,requirement | ||
id,int,n/a,n/a,Unique id,Input,required | ||
component_type,str,--,Pipe,Component type,Input,optional | ||
from_node,int,n/a,n/a,Node where Pipe begins,Input,required | ||
to_node,int,n/a,n/a,Node where Pipe ends,Input,required | ||
length,float,m,n/a,Length of the Pipe,Input,optional | ||
diameter,float,mm,n/a,Inner diameter of the pipes,Input,optional | ||
heat_transfer_coeff,float,W/(m*K),n/a,Heat transfer coefficient,Input,optional | ||
roughness,float,mm,n/a,Roughness of pipes,Input,optional |
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 @@ | ||
attribute,type,unit,default,description,status,requirement | ||
id,int,n/a,n/a,Unique id,Input,required | ||
component_type,str,--,Producer,Component type,Input,optional | ||
lat,float,n/a,n/a,Geographic latitude,Input,optional | ||
lon,float,n/a,n/a,Geographic longitude,Input,optional | ||
temp_inlet,float/sequence,deg C or K,n/a,Inlet temperature at producer,Input,optional | ||
zeta_inlet,float,--,n/a,Localized pressure loss coefficient for inlet flow,Input,optional | ||
zeta_return,float,--,n/a,Localized pressure loss coefficient for return flow,Input,optional |
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 @@ | ||
component_class,list_name,description | ||
Environment,environment,"Environment" | ||
Producer,producers,"Heat producer" | ||
Consumer,consumers,"Heat consumer" | ||
Fork,forks,"Node where several pipes meet" | ||
Pipe,pipes,"Pipes representing double pipes (feed and return) that connect nodes" |
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,93 @@ | ||
# -*- coding: utf-8 | ||
|
||
""" | ||
This module is designed to hold functions for importing networks and building | ||
footprints from openstreetmap. | ||
This file is part of project dhnx (). It's copyrighted | ||
by the contributors recorded in the version control history of the file, | ||
available from its original location: | ||
SPDX-License-Identifier: MIT | ||
""" | ||
|
||
try: | ||
import geopandas as gpd | ||
|
||
except ImportError: | ||
print("Need to install geopandas to process osm data.") | ||
|
||
import pandas as pd | ||
|
||
try: | ||
from shapely.ops import nearest_points | ||
from shapely.geometry import LineString | ||
|
||
except ImportError: | ||
print("Need to install shapely to download from osm.") | ||
|
||
|
||
def connect_points_to_network(points, nodes, edges): | ||
r""" | ||
Parameter | ||
--------- | ||
points : geopandas.GeoDataFrame | ||
Points to connect to the network | ||
nodes : geopandas.GeoDataFrame | ||
Nodes of the network | ||
edges : geopandas.GeoDataFrame | ||
Edges of the network | ||
Returns | ||
------- | ||
points : geopandas.GeoDataFrame | ||
Points connected to the network | ||
nodes : geopandas.GeoDataFrame | ||
Original nodes of the network and | ||
nearest connecting points on the | ||
network's edges. | ||
edges : geopandas.GeoDataFrame | ||
Edges of the network. | ||
""" | ||
edges_united = edges.unary_union | ||
|
||
len_nodes = len(nodes) | ||
len_points = len(points) | ||
|
||
# assign ids to new points | ||
n_points = [] | ||
n_nearest_points = [] | ||
n_edges = [] | ||
|
||
for i, point in enumerate(points.geometry): | ||
id_nearest_point = len_nodes + i | ||
|
||
id_point = len_nodes + len_points + i | ||
|
||
nearest_point = nearest_points(edges_united, point)[0] | ||
|
||
n_points.append([id_point, point]) | ||
|
||
n_nearest_points.append([id_nearest_point, nearest_point]) | ||
|
||
n_edges.append([id_point, id_nearest_point, LineString([point, nearest_point])]) | ||
|
||
n_points = gpd.GeoDataFrame( | ||
n_points, | ||
columns=['index', 'geometry']).set_index('index') | ||
|
||
n_nearest_points = gpd.GeoDataFrame( | ||
n_nearest_points, | ||
columns=['index', 'geometry']).set_index('index') | ||
|
||
n_edges = gpd.GeoDataFrame(n_edges, columns=['u', 'v', 'geometry']) | ||
|
||
joined_nodes = pd.concat([nodes, n_nearest_points], sort=True) | ||
joined_edges = pd.concat([edges, n_edges], sort=True) | ||
|
||
return n_points, joined_nodes, joined_edges |
Oops, something went wrong.