solph version of oemof.network.energy_system

class oemof.solph._energy_system.EnergySystem(timeindex=None, timeincrement=None, infer_last_interval=None, **kwargs)[source]

Bases: oemof.network.energy_system.EnergySystem

A variant of the class EnergySystem from <oemof.network.network.energy_system.EnergySystem> specially tailored to solph.

In order to work in tandem with solph, instances of this class always use solph.GROUPINGS <oemof.solph.GROUPINGS>. If custom groupings are supplied via the groupings keyword argument, solph.GROUPINGS <oemof.solph.GROUPINGS> is prepended to those.

If you know what you are doing and want to use solph without solph.GROUPINGS <oemof.solph.GROUPINGS>, you can just use EnergySystem <oemof.network.network.energy_system.EnergySystem>` of oemof.network directly.

  • timeindex (pandas.DatetimeIndex)
  • timeincrement (iterable)
  • infer_last_interval (bool) – Add an interval to the last time point. The end time of this interval is unknown so it does only work for an equidistant DatetimeIndex with a ‘freq’ attribute that is not None. The parameter has no effect on the timeincrement parameter.
  • kwargs
oemof.solph._energy_system.create_time_index(year: int = None, interval: float = 1, number: int = None, start: datetime.datetime = None)[source]

Create a datetime index for one year.


To create 8760 hourly intervals for a non leap year a datetime index with 8761 time points need to be created. So the number of time steps is always the number of intervals plus one.

  • year (int, datetime) – The year of the index. If number and start is set the year parameter is ignored.
  • interval (float) – The time interval in hours e.g. 0.5 for 30min or 2 for a two hour interval (default: 1).
  • number (int) – The number of time intervals. By default number is calculated to create an index of one year. For a shorter or longer period the number of intervals can be set by the user.
  • start (datetime.datetime or datetime.date) – Optional start time. If start is not set, 00:00 of the first day of the given year is the start time.


>>> len(create_time_index(2014))
>>> len(create_time_index(2012))  # leap year
>>> len(create_time_index(2014, interval=0.5))
>>> len(create_time_index(2014, interval=0.5, number=10))
>>> len(create_time_index(2014, number=10))
>>> str(create_time_index(2014, interval=0.5, number=10)[-1])
'2014-01-01 05:00:00'
>>> str(create_time_index(2014, interval=2, number=10)[-1])
'2014-01-01 20:00:00'