oemof.solph.EnergySystem¶
solph version of oemof.network.energy_system
- class oemof.solph._energy_system.EnergySystem(timeindex=None, timeincrement=None, infer_last_interval=None, periods=None, use_remaining_value=False, groupings=None)[source]¶
Bases:
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.
- Parameters:
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.
periods (list or None) – The periods of a multi-period model. If this is explicitly specified, it leads to creating a multi-period model, providing a respective user warning as a feedback.
list of pd.date_range objects carrying the timeindex for the respective period;
For a standard model, periods are not (to be) declared, i.e. None. A list with one entry is derived, i.e. [0].
use_remaining_value (bool) – If True, compare the remaining value of an investment to the original value (only applicable for multi-period models)
kwargs
- oemof.solph._energy_system.create_time_index(year: int | None = None, interval: float = 1, number: int | None = None, start: datetime | None = None)[source]¶
Create a datetime index for one year.
Notes
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.
- Parameters:
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.
Examples
>>> len(create_time_index(2014)) 8761 >>> len(create_time_index(2012)) # leap year 8785 >>> len(create_time_index(2014, interval=0.5)) 17521 >>> len(create_time_index(2014, interval=0.5, number=10)) 11 >>> len(create_time_index(2014, number=10)) 11 >>> 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'