q100opt¶
setup_model module¶
Function for reading data and setting up an oemof-solph EnergySystem.
Please use this module with care. It is work in progress!
Contact: Johannes Röder <johannes.roeder@uni-bremen.de>
SPDX-License-Identifier: MIT
-
q100opt.setup_model.
add_buses
(table)[source]¶ Instantiates the oemof-solph.Buses based on tabular data.
Retruns the Buses in a Dictionary and in a List. If excess and shortage is given, additional sinks and sources are created.
Parameters: table (pandas.DataFrame) – Dateframe with all Buses. Returns: tuple (a tuple containing:) – - nodes ([list]): A list with all oemof-solph Buses of the
- Dataframe table.
- busd ([dict]): Dictionary with all oemof Bus object.
- Keys are equal to the label of the bus.
Examples
>>> import pandas as pd >>> from q100opt.setup_model import add_buses >>> data_bus = pd.DataFrame([['label_1', 0, 0, 0, 0], ... ['label_2', 0, 0, 0, 0]], ... columns=['label', 'excess', 'shortage', 'shortage_costs', ... 'excess_costs']) >>> nodes, buses = add_buses(data_bus)
-
q100opt.setup_model.
add_sinks
(tab, busd, timeseries=None)[source]¶ Parameters: - tab (pd.DataFrame) – Table with parameters of Sinks.
- busd (dict) – Dictionary with Buses.
- timeseries (pd.DataFrame) – (Optional) Table with all timeseries parameters.
Returns: list (oemof Sinks (non fix sources) objects.)
Note
No investment possible.
-
q100opt.setup_model.
add_sinks_fix
(tab, busd, timeseries)[source]¶ Add fix sinks, e.g. for energy demands.
Parameters: - tab (pd.DataFrame) – Table with parameters of Sinks.
- busd (dict) – Dictionary with Buses.
- timeseries (pd.DataFrame) – (Required) Table with all timeseries parameters.
Returns: list (oemof Sinks (non fix sources) objects.)
Note
No investment possible.
-
q100opt.setup_model.
add_sources
(tab, busd, timeseries=None)[source]¶ Parameters: - tab (pd.DataFrame) – Table with parameters of Sources.
- busd (dict) – Dictionary with Buses.
- timeseries (pd.DataFrame) – (Optional) Table with all timeseries parameters.
Returns: list (Oemof Sources (non fix sources) objects.)
-
q100opt.setup_model.
add_sources_fix
(tab, busd, timeseries)[source]¶ Parameters: - tab (pd.DataFrame) – Table with parameters of Sources.
- busd (dict) – Dictionary with Buses.
- timeseries (pd.DataFrame) – Table with all timeseries parameters.
Returns: list (List with oemof Source (only fix source) objects.)
Note
At the moment, there are no additional flow attributes allowed, and nominal_value must be given in the table.
-
q100opt.setup_model.
add_storages
(tab, busd)[source]¶ Parameters: - tab (pd.DataFrame) – Table with parameters of Storages.
- busd (dict) – Dictionary with Buses.
Returns: list (oemof GenericStorage components.)
-
q100opt.setup_model.
add_transformer
(tab, busd, timeseries=None)[source]¶ Parameters: - tab (pandas.DataFrame) – Table with all Transformer parameter
- busd (dict) – Dictionary with all oemof-solph Bus objects.
- timeseries (pandas.DataFrame) – Table with all Timeseries for Transformer.
Returns: list (oemof-solph Transformer objects.)
-
q100opt.setup_model.
check_active
(dct)[source]¶ Checks for active components.
Delete not “active” rows, and the column ‘active’ of all components dataframes.
Parameters: dct (dict) – Holding the Dataframes of solph components Returns: dict
-
q100opt.setup_model.
check_nonconvex_invest_type
(dct)[source]¶ Checks if flow attribute ‘invest.nonconvex’ is type bool, if the attribute is present.
Parameters: dct (dict) – Dictionary with all paramerters for the oemof-solph components. Returns: dict (Updated Dictionary is returned.)
-
q100opt.setup_model.
get_flow_att
(row, ts)[source]¶ Parameters: - row (pd.Series) – Series with all attributes given by the parameter table (equal 1 row)
- ts (pd.DataFrame) – DataFrame with all input time series for the oemof-solph model.
Returns: dict (All Flow specific attribues.)
-
q100opt.setup_model.
get_invest_obj
(row)[source]¶ Filters all attributes for the investment attributes with the prefix`invest.`, if attribute ‘investment’ occurs, and if attribute investment is set to 1.
If the invest attribute “offset” is given and if it is > 0, the invest attribute “nonconvex=True” is added.
Parameters: row (pd.Series) – Parameters for single oemof object. Returns: dict