Skip to content

Commit

Permalink
Merge pull request #30 from openego/features/release0.1
Browse files Browse the repository at this point in the history
Features/release0.1
  • Loading branch information
WolfBunke authored Mar 29, 2018
2 parents 970b677 + 70810d7 commit 03378ba
Show file tree
Hide file tree
Showing 17 changed files with 251 additions and 163 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ A speciality in this context is that transmission grids are described by the 380
Installing Developer Version
============================

Create a virtualenvironment (where you like it) and activate it:
Create a virtualenvironment (where you like it) and activate it:

.. code-block::
$ virtualenv eGo --clear -p python3.5
$ source venv/bin/activate
$ pip install -e git+https://github.com/openego/eGo@dev#egg=eGo
$ pip3 install -e git+https://github.com/openego/eGo@dev#egg=eGo --process-dependency-links --allow-all-external
Copyleft
Expand Down
1 change: 1 addition & 0 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.. toctree::
:maxdepth: 7
:glob:
:titlesonly:

API <api/modules>
65 changes: 58 additions & 7 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""This file is part of
"""This file is part of
It is developed in the project open_eGo: https://openegoproject.wordpress.com
Expand Down Expand Up @@ -37,6 +37,10 @@
#sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('../'))


sys.path


# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand All @@ -52,14 +56,18 @@
'sphinx.ext.coverage',
'sphinx.ext.imgmath' ,
'sphinx.ext.viewcode',
# 'sphinx.ext.autosummary',
'sphinx.ext.autosummary',
# 'sphinxcontrib.napoleon',#enable Napoleon interpreter of docstrings Sphinx v<=1.2
'sphinx.ext.napoleon', #enable Napoleon Sphinx v>1.3
# 'sphinx_paramlinks',#to have links to the types of the parameters of the functions
'numpydoc',
'sphinxcontrib.httpdomain', # for restfull API
'sphinxcontrib.autohttp.flask',
'sphinx.ext.extlinks' # enables external links with a key
]



# Napoleon settings
napoleon_google_docstring = True
napoleon_numpy_docstring = True
Expand All @@ -84,8 +92,51 @@
'Shapely object')
}

# test oedb implementation
def rstjinja(app, docname, source):
"""
Render our pages as a jinja template for fancy templating goodness.
"""
# Make sure we're outputting HTML
if app.builder.format != 'html':
return
src = source[0]
rendered = app.builder.templates.render_string(
src, app.config.html_context
)
source[0] = rendered

def setup(app):
app.connect("source-read", rstjinja)

import requests

oep_url= 'http://oep.iks.cs.ovgu.de/'

# get data from oedb test
power_class = requests.get(oep_url+'/api/v0/schema/model_draft/tables/ego_power_class/rows/', ).json()

import json
path = os.getcwd()
json_file ='../ego/scenario_setting.json'

with open(path +'/'+json_file) as f:
scn_set = json.load(f)



html_context = {
'power_class': power_class,
'scn_setting': scn_set
}






# add RestFull API
httpexample_scheme = 'https'


# Add any paths that contain templates here, relative to this directory.
Expand All @@ -104,7 +155,7 @@

# General information about the project.
project = u'eGo'
copyright = u'2015-2017, open_eGo-Team'
copyright = u'2015-2018, open_eGo-Team'
author = u'open_eGo-Team'


Expand All @@ -113,7 +164,7 @@
# built documents.
#
# The short X.Y version.
version = '0.0.1'
version = '0.1.0'
# The full version, including alpha/beta/rc tags.
release = '0.0.1dev'

Expand Down Expand Up @@ -175,11 +226,11 @@ def __getattr__(cls, name):

MOCK_MODULES = ['ding0', 'ding0.results', 'shapely']
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
MOCK_MODULES = ['libgeos', 'geos', 'libgeos_c', 'geos_c','libgeos_c.so.1',

MOCK_MODULES = ['libgeos', 'geos', 'libgeos_c', 'geos_c','libgeos_c.so.1',
'libgeos_c.so', 'shapely', 'geoalchemy2', 'geoalchemy2.shape ']



# -- Options for HTML output ----------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion doc/developer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ eDisGo units
------------

.. csv-table:: List of variables and units
:file: https://raw.githubusercontent.com/openego/eDisGo/dev/doc/units_table.csv
:url: https://raw.githubusercontent.com/openego/eDisGo/dev/doc/units_table.csv
:delim: ;
:header-rows: 1
:widths: 5, 1, 1, 5
Expand Down
14 changes: 8 additions & 6 deletions doc/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Installation
```

With your activated environment `cd` to the cloned directory and run
``pip3 install -e eGo`` . This will install all needed packages into your environment.
``pip3 install -e eGo --process-dependency-links --allow-all-external`` . This will install all needed packages into your environment.

.. warning::

Expand All @@ -42,14 +42,16 @@ With your activated environment `cd` to the cloned directory and run
``pip3 install -e git+https://github.com/openego/PyPSA.git@dev#egg=PyPSA``
and Folium for an web based ploting with
``pip3 install -e [email protected]:python-visualization/folium.git@5739244acb9868d001032df288500a047b232857#egg=folium``
Check if the `config.json <https://github.com/openego/eTraGo/blob/dev/etrago/tools/config.json>`_

Check if the `config.json <https://github.com/openego/eTraGo/blob/dev/etrago/tools/config.json>`_
file from eTraGo is installed in your libary ``/lib/python3.5/site-packages/etrago/tools`` .
If not copy and paste this file into this folder.
If not copy and paste this file into this folder.

If Database connection or table erros appears use: ``pip3 install -e [email protected]:openego/ego.io.git@3b76dfddea14d67eb4421b6223bf981d8851e4e6#egg=ego.io``


Using eGo:
==========

1. check and prepare your eGo setting in ``ego/scenario_setting.json``
2. Start your calculation with in the directory of ``eGo/ego`` with
``python3 ego_main.py``
2. Start your calculation with in the directory of ``eGo/ego`` with ``python3 ego_main.py``
2 changes: 1 addition & 1 deletion doc/whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ See what's new as per release!
:backlinks: top


.. include:: whatsnew/v0-1-0.rst
.. include:: whatsnew/v0-0-1.rst
.. incluede:: whatsnew/v0-1-0.rst
13 changes: 9 additions & 4 deletions doc/whatsnew/v0-1-0.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Release v0.1.0 (March 26, 2018)
Release v0.1.0 (March 29, 2018)
+++++++++++++++++++++++++++++++

As this is the second release of eGo. This Release is still under construction and not ready for a normal use.
As this is the second release of eGo. This Release introduce the resulte class
and is still under construction and not ready for a normal use.



Expand All @@ -10,7 +11,11 @@ Added features
--------------

* Update of Interface between eTraGo and eDisGo (specs)
* New structure of eGo module
* Restructuring of functions
* New structure of eGo module / resulte class
* Restructuring of functions
* Add import function of eTraGo results form oedb

Notes
-----

* The 'direct_specs' function is not working and needs to be set to ``false``
Binary file added ego/data/ding0_grids/ding0_grids__1802.pkl
Binary file not shown.
24 changes: 17 additions & 7 deletions ego/ego_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

## Logging
logging.basicConfig(format='%(asctime)s %(message)s',level=logging.INFO)

logger = logging.getLogger(__name__)
ego_logger = logging.getLogger('ego')

fh = logging.FileHandler('ego.log', mode='w')
fh.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
fh.setFormatter(formatter)

logger.addHandler(fh)
ego_logger.addHandler(fh)


if __name__ == '__main__':
# import scenario settings **args of eTraGo
Expand Down Expand Up @@ -66,8 +80,6 @@
if args['global']['recover']:
eTraGo = etrago_from_oedb(session,args)



# use eTraGo results from ego calculations if true
# ToDo make function edisgo_direct_specs()

Expand Down Expand Up @@ -105,6 +117,7 @@
mv_grid = get_mvgrid_from_bus_id(session, bus_id) # This function can be used to call the correct MV grid

if args['global']['eDisGo']:

logging.info('Starting eDisGo')

# ToDo move part as function to utilities or specs
Expand All @@ -115,7 +128,7 @@

# ToDo get ding0 grids over db
# ToDo implemente iteration
file_path = '/home/dozeumbuw/ego_dev/src/ding0_grids__1802.pkl'
file_path = 'data/ding0_grids/ding0_grids__1802.pkl'

#mv_grid = open(file_path)

Expand All @@ -127,7 +140,7 @@
scenario = Scenario(etrago_specs=specs,
power_flow=(),
mv_grid_id=mv_grid_id,
scenario_name= args['global']['scn_name'])
scenario_name= args['eTraGo']['scn_name'])

network = Network.import_from_ding0(file_path,
id=mv_grid_id,
Expand Down Expand Up @@ -170,6 +183,3 @@
# possible aggregation of results

# exports: total system costs, plots, csv export files

if __name__ == '__main__':
pass
18 changes: 9 additions & 9 deletions ego/scenario_setting.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"global": {
"eTraGo": true,
"eDisGo": false,
"eDisGo": true,
"db": "oedb",
"result_id": 359,
"recover": false,
Expand All @@ -11,30 +11,30 @@
"db": "oedb",
"gridversion": null,
"method": "lopf",
"pf_post_lopf": true,
"start_snapshot": 4000,
"end_snapshot" : 4001,
"pf_post_lopf": false,
"start_snapshot": 1,
"end_snapshot" : 5,
"scn_name": "SH NEP 2035",
"solver": "gurobi",
"lpfile": false,
"results": false,
"export": false,
"storage_extendable": true,
"storage_extendable": false,
"generator_noise": true,
"reproduce_noise": false,
"minimize_loading": false,
"k_mean_clustering": 15,
"k_mean_clustering": false,
"network_clustering": false,
"parallelisation": false,
"skip_snapshots": false,
"line_grouping": false,
"branch_capacity_factor": 0.1,
"branch_capacity_factor": 1,
"load_shedding": false,
"comments": null
},
"eDisGo": {
"direct_specs": false,
"specs": false,
"comments": "Malte Test cf 0.1, SH SQ"
"specs": true,
"comments": "make a comment, SH SQ"
}
}
4 changes: 2 additions & 2 deletions ego/tools/economics.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def annuity_per_period(capex, n, wacc, t):
wacc : float
Weighted average cost of capital
ToDo:
-----
ToDo
----
t : int
Timesteps in hours
i : float
Expand Down
24 changes: 16 additions & 8 deletions ego/tools/io.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Input & output functions of eGo
Input & output functions of eGo
"""
__copyright__ = "ZNES"
Expand Down Expand Up @@ -31,10 +31,16 @@ def geolocation_buses(network, session):
of Countries from RenpassGisParameterRegion
in order to locate the buses
ToDo:
1) check eTrago stack generation plots and
other in order of adaptation
Parameters
----------
network : Network
eTraGo Network
session : sqlalchemy
session to oedb
ToDo
----
- check eTrago stack generation plots and other in order of adaptation
"""
# Start db connetion
Expand Down Expand Up @@ -114,16 +120,16 @@ def etrago_from_oedb(session, args):
"""
Function with import eTraGo results for the Database.
Parameter:
Parameters
----------
session (obj):
sqlalchemy session to the OEDB
args (dict):
args from eGo scenario_setting.json
ToDo:
-----
ToDo
----
add Mapping for grid schema
make it more generic -> class?
"""
Expand Down Expand Up @@ -178,7 +184,9 @@ def series_results(name, column, session, meta_args, result_id, ormclass):
"""
Function to get Time Series as pandas DataFrames by the result_id
# TODO: check index of bus_t and soon is wrong!
ToDo
----
- check index of bus_t and soon is wrong!
"""
# TODO: pls make more robust
Expand Down
Loading

0 comments on commit 03378ba

Please sign in to comment.