Skip to content

Commit

Permalink
Merge pull request #9 from FZJ-IEK3-VSA/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
l-kotzur committed Mar 26, 2018
2 parents f5181ff + 2d593f6 commit d51c610
Show file tree
Hide file tree
Showing 7 changed files with 705 additions and 132 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,6 +2,7 @@
__pycache__/
trash/
example/.ipynb_checkpoints/
*.eggs/

# file types to ignore
*.pyc
Expand Down
27 changes: 21 additions & 6 deletions README.md
Expand Up @@ -4,7 +4,9 @@
tsam is a python package which uses different machine learning algorithms for the aggregation of typical periods. It is applicable for all type of time series, eather weather data, load data or both simultaneously. The module is able to significantly reduce input time series for energy system models, and therefore the model's complexity and computational time.


A publication which validates the methods and describes their cababilites is found [`here`](https://www.sciencedirect.com/science/article/pii/S0960148117309783). The manuscript is found [`here`](https://arxiv.org/abs/1708.00420). If you want to use tsam in a published work, please kindly cite that publication.
A publication which validates the methods and describes their cababilites is found [**here**](https://www.sciencedirect.com/science/article/pii/S0960148117309783). The manuscript is found [`here`](https://arxiv.org/abs/1708.00420). If you want to use tsam in a published work, please kindly cite that publication.

A [**second publication**](https://www.sciencedirect.com/science/article/pii/S0306261918300242) introduces a method how to model states (e.g. state of charge of storage) between the aggregated typical periods.

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.597956.svg)](https://doi.org/10.5281/zenodo.597956)

Expand Down Expand Up @@ -35,31 +37,44 @@ In order to use the k-medoids clustering, make sure that you have installed a MI

## Examples

A small example how tsam can be used is decribed as follows
### Basic workflow

A small example how tsam can be used is decribed as follows
```python
import pandas as pd
import tsam.timeseriesaggregation as tsam
```


Read in the time series data set with pandas
```python
raw = pd.read_csv('testdata.csv', index_col = 0)
```

Initialize an aggregation object and define the number of typical periods, the length of a single period and the aggregation method
```python
aggregation = tsam.TimeSeriesAggregation(raw,
noTypicalPeriods = 8,
hoursPerPeriod = 24,
clusterMethod = 'hierarchical')
```

Run the aggregation to typical periods
```python
typPeriods = aggregation.createTypicalPeriods()
```

Store the results as .csv file

```python
typPeriods.to_csv('typperiods.csv')
```

### Detailed examples

A [**first example**](example/aggregation_example.ipynb) shows the capabilites of tsam as jupyter notebook.

A more detailed example showing the capabilites of tsam is found [`here`](https://github.com/FZJ-IEK3-VSA/tsam/blob/master/example/aggregation_example.ipynb) as jupyter notebook.
A [**second example**](example/aggregation_example.ipynb) shows in more detail how to access the relevant aggregation results required for paramtrizing e.g. an optimization.

The example time series are based on a department [publication](http://www.mdpi.com/1996-1073/10/3/361) and the [test reference years of the DWD](http://www.dwd.de/DE/leistungen/testreferenzjahre/testreferenzjahre.html).

Expand Down
110 changes: 53 additions & 57 deletions example/aggregation_example.ipynb

Large diffs are not rendered by default.

480 changes: 480 additions & 0 deletions example/aggregation_optiinput.ipynb

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions requirements.txt
@@ -0,0 +1,4 @@
sklearn>=0.0
pandas>=0.18.1
numpy>=1.11.0
pyomo>=5.3
23 changes: 11 additions & 12 deletions setup.py
@@ -1,17 +1,16 @@
from distutils.core import setup
import os, setuptools
dir_path = os.path.dirname(os.path.realpath(__file__))
with open( os.path.join(dir_path,'requirements.txt') ) as f:
required_packages = f.read().splitlines()

setup(
setuptools.setup(
name='tsam',
version='0.9.4',
version='0.9.5',
author='Leander Kotzur',
url='',
packages = ['tsam',
'tsam.utils',],
install_requires = [
"sklearn>=0.0",
"pandas>=0.18.1",
"numpy>=1.11.0",
"pyomo>=5.3"
]
include_package_data=True, # includes all files in sdist that are tracked in git, additionall using the MANIFEST.in to exclude some of them
packages = setuptools.find_packages(),
py_modules = [],
install_requires = required_packages,
setup_requires = ['setuptools-git']
)

0 comments on commit d51c610

Please sign in to comment.