• Stars
    star
    144
  • Rank 255,590 (Top 6 %)
  • Language
    Python
  • License
    MIT License
  • Created over 7 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Time series aggregation module (tsam). Determines typical operation periods or dereases the temporal resolution. Accelerates model or experiment runs.

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.

The documentation of the tsam code can be found here.

Features

  • flexible handling of multidimensional time-series via the pandas module
  • different aggregation methods implemented (averaging, k-means, exact k-medoids, hierarchical, k-maxoids, k-medoids with contiguity), which are based on scikit-learn, or self-programmed with pyomo
  • hypertuning of aggregation parameters to find the optimal combination of the number of segments inside a period and the number of typical periods
  • novel representation methods, keeping statistical attributes, such as the distribution
  • 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 HiGHS 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 length of a single period, the number of typical periods, the number of segments in each period, the aggregation method and the representation method - here duration/distribution representation which

	aggregation = tsam.TimeSeriesAggregation(raw, 
						noTypicalPeriods = 8, 
						hoursPerPeriod = 24, 
						rescaleClusterPeriods = False,
						segmentation = True,
						representationMethod = "distributionRepresentation",
						distributionPeriodWise = False,
						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-2022 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

The core developer team sits in the Institute of Energy and Climate Research - Techno-Economic Energy Systems Analysis (IEK-3) belonging to the Forschungszentrum Jülich.

Citing and further reading

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

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 is supported by the Helmholtz Association under the Joint Initiative "Energy System 2050 A Contribution of the Research Field Energy" and the program "Energy System Design" and within the BMWi/BMWk funded project METIS.

Helmholtz Logo

More Repositories

1

hplib

Database with efficiency parameters from public Heatpump Keymark datasets as well as parameter-sets and functions in order to simulate heat pumps (manufacturer+model or generic type)
HTML
69
star
2

FINE

The FINE python package provides a framework for modeling, optimizing and assessing energy systems
Python
68
star
3

glaes

Geospatial Land Availability for Energy Systems
Python
49
star
4

LoadProfileGenerator

Program for generating load curves for residential consumers. Agentbased and extremly detailed.
C#
37
star
5

RESKit

A toolkit to help generate renewable energy generation time-series for energy systems analysis
Python
31
star
6

HiSim

HiSim - House Infrastructure Simulator
Python
29
star
7

geokit

Geospatial toolkit for Python
Python
21
star
8

tsib

Time Series Initialization of Buildings
Python
18
star
9

PASSION

Software package for the estimation of rooftop photovoltaic potential with satellite imagery
Jupyter Notebook
15
star
10

pylpg

Python interface for the LoadProfileGenerator
Python
14
star
11

HIM

Hydrogen Infrastructure Model for the analysis of spatially resolved hydrogen infrastructure pathways
Jupyter Notebook
14
star
12

awesome_time_series_energy_system_modelling

11
star
13

bslib

Database with battery parameters based on PerMod (HTW Berlin) as well as functions in order to simulate battery storages (manufacturer+model or generic type)
Python
9
star
14

windtools

Small tools to assist wind energy simulations
Python
5
star
15

DataDesc

Key components of the ecosystem are a metadata schema for software documentation with focus on interfaces, a machine-actionable metadata exchange format and a software toolkit supporting the documentation, extraction and publication of software metadata.
Python
5
star
16

citation-graph-builder

A tool for the creation and visualization of citation networks which combines citation data obtained from parsing the paper's PDF files and querying bibliographic APIs.
TeX
5
star
17

HiSim-Building-Sizer

Python
3
star
18

CuCoPy

The CuCoPy package provides methods for exchanging currencies and adjusting monetary values for inflation until 1960 on a yearly basis.
Python
3
star
19

NoStream

Mit dem Krieg in der Ukraine steht ein Stopp der Erdgaslieferungen aus Russland im Raum. Eine neue Web-Applikation (https://no-stream.fz-juelich.de/) des Forschungszentrums Jülich macht es nun möglich, die Folgen eines solchen – kompletten oder teilweisen – Embargos auf die deutschen Erdgasvorräte zu ermitteln.
Python
3
star
20

tsorb

Time Series of Occupancts in Residential Buildings
Python
2
star
21

ethos.REFLOW

Python
2
star
22

HSCPathways

Calculation of cost and efficiencies of predefined hydrogen supply chain architectures
Jupyter Notebook
1
star
23

ethos-builda-client

Repository for the Python client for ETHOS.BUILDA
Python
1
star
24

ETHOS_PeNALPS

Petri Net Agent based Load Profile Simulator
Python
1
star