Skip to main content

Time series aggregation module (tsam) to create typical periods

Project description

Build Status Version Documentation Status PyPI - License codecov badge

Forschungszentrum Juelich Logo

tsam - Time Series Aggregation Module

tsam is a python package which uses different machine learning algorithms for the aggregation of time series. The data aggregation can be performed in two freely combinable dimensions: By representing the time series by a user-defined number of typical periods or by decreasing the temporal resolution. tsam was originally designed for reducing the computational load for large-scale energy system optimization models by aggregating their input data, but is applicable for all types of time series, e.g., weather data, load data, both simultaneously or other arbitrary groups of time series.

If you want to use tsam in a published work, please kindly cite one of our latest journal articles:

The documentation of the tsam code can be found here.

Features

  • flexible read-in and handling of multidimensional time-series via the pandas module
  • different aggregation methods implemented (averaging, k-means, exact k-medoids, hierarchical), which are based on scikit-learn or pyomo
  • flexible integration of extreme periods as own cluster centers
  • weighting for the case of multidimensional time-series to represent their relevance

Installation

Directly install via pip as follows:

pip install tsam

Alternatively, clone a local copy of the repository to your computer

git clone https://github.com/FZJ-IEK3-VSA/tsam.git

Then install tsam via pip as follow

cd tsam
pip install . 

Or install directly via python as

python setup.py install

In order to use the k-medoids clustering, make sure that you have installed a MILP solver. As default coin-cbc is used. Nevertheless, in case you have access to a license we recommend commercial solvers (e.g. Gurobi or CPLEX) since they have a better performance.

Examples

Basic workflow

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

	import pandas as pd
	import tsam.timeseriesaggregation as tsam

Read in the time series data set with pandas

	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

	aggregation = tsam.TimeSeriesAggregation(raw, 
						noTypicalPeriods = 8, 
						hoursPerPeriod = 24, 
						clusterMethod = 'hierarchical')

Run the aggregation to typical periods

	typPeriods = aggregation.createTypicalPeriods()

Store the results as .csv file

	typPeriods.to_csv('typperiods.csv')

Detailed examples

A first example shows the capabilites of tsam as jupyter notebook.

A second example 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 and the test reference years of the DWD.

License

MIT License

Copyright (C) 2016-2019 Leander Kotzur (FZJ IEK-3), Maximilian Hoffmann (FZJ IEK-3), Peter Markewitz (FZJ IEK-3), Martin Robinius (FZJ IEK-3), Detlef Stolten (FZJ IEK-3)

You should have received a copy of the MIT License along with this program. If not, see https://opensource.org/licenses/MIT

About Us

Abteilung VSA

We are the Techno-Economic Energy Systems Analysis department at the Institute of Energy and Climate Research: Electrochemical Process Engineering (IEK-3) belonging to the Forschungszentrum Jülich. Our interdisciplinary department's research is focusing on energy-related process and systems analyses. Data searches and system simulations are used to determine energy and mass balances, as well as to evaluate performance, emissions and costs of energy systems. The results are used for performing comparative assessment studies between the various systems. Our current priorities include the development of energy strategies, in accordance with the German Federal Government’s greenhouse gas reduction targets, by designing new infrastructures for sustainable and secure energy supply chains and by conducting cost analysis studies for integrating new technologies into future energy market frameworks.

Contributions and Users

Within the BMWi funded project METIS we extend the methodology together with the RWTH-Aachen (Prof. Aaron Praktiknjo), the EDOM Team at FAU (PD Lars Schewe) and the Jülich Supercomputing Centre.

METIS Team

Further Reading

If you are further interested in the impact of time series aggregation on the cost-optimal results on different energy system use cases, you can find a publication which validates the methods and describes their cababilites via the following link. A second publication introduces a method how to model state variables (e.g. the state of charge of energy storage components) between the aggregated typical periods which can be found here. Finally yet importantly the potential of time series aggregation to simplify mixed integer linear problems is investigated here.

The publications about time series aggregation for energy system optimization models published alongside the development of tsam are listed below:

Acknowledgement

This work was supported by the Helmholtz Association under the Joint Initiative "Energy System 2050 A Contribution of the Research Field Energy".

Helmholtz Logo

DOI

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tsam-2.0.0.tar.gz (954.4 kB view hashes)

Uploaded Source

Built Distribution

tsam-2.0.0-py3-none-any.whl (31.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page