Skip to content

flixOpt.interface

This module contains classes to collect Parameters for the Investment and OnOff decisions. These are tightly connected to features.py

Classes

InvestParameters

InvestParameters(fixed_size: Optional[Union[int, float]] = None, minimum_size: Union[int, float] = 0, maximum_size: Optional[Union[int, float]] = None, optional: bool = True, fix_effects: Union[Dict, int, float] = None, specific_effects: Union[Dict, int, float] = None, effects_in_segments: Optional[Tuple[List[Tuple[Skalar, Skalar]], Dict[Effect, List[Tuple[Skalar, Skalar]]]]] = None, divest_effects: Union[Dict, int, float] = None)

Bases: Interface

collects arguments for invest-stuff

Parameters:

Name Type Description Default
fix_effects None or scalar

Fixed investment costs if invested. (Attention: Annualize costs to chosen period!)

None
divest_effects None or scalar

Fixed divestment costs (if not invested, e.g., demolition costs or contractual penalty).

None
fixed_size (int, float)

Determines if the investment size is fixed.

None
optional bool

If True, investment is not forced.

True
specific_effects scalar or Dict[Effect: Union[int, float, np.ndarray]

Specific costs, e.g., in €/kW_nominal or €/m²_nominal. Example: {costs: 3, CO2: 0.3} with costs and CO2 representing an Object of class Effect (Attention: Annualize costs to chosen period!)

None
effects_in_segments list or List[ List[Union[int,float]], Dict[cEffecType: Union[List[Union[int,float]]

Linear relation in segments [invest_segments, cost_segments]. Example 1: [ [5, 25, 25, 100], # size in kW {costs: [50,250,250,800], # € PE: [5, 25, 25, 100] # kWh_PrimaryEnergy } ] Example 2 (if only standard-effect): [ [5, 25, 25, 100], # kW # size in kW [50,250,250,800] # value for standart effect, typically € ] # € (Attention: Annualize costs to chosen period!) (Args 'specific_effects' and 'fix_effects' can be used in parallel to InvestsizeSegments)

None
minimum_size scalar

Min nominal value (only if: size_is_fixed = False).

0
maximum_size (scalar, Optional)

Max nominal value (only if: size_is_fixed = False).

None

Functions

infos
infos(use_numpy=True, use_element_label=False) -> Dict

Generate a dictionary representation of the object's constructor arguments. Excludes default values and empty dictionaries and lists. Converts data to be compatible with JSON.

Parameters:

use_numpy bool: Whether to convert NumPy arrays to lists. Defaults to True. If True, numeric numpy arrays (np.ndarray) are preserved as-is. If False, they are converted to lists. use_element_label bool: Whether to use the element label instead of the infos of the element. Defaults to False. Note that Elements used as keys in dictionaries are always converted to their labels.

Returns: Dict: A dictionary representation of the object's constructor arguments.

to_json
to_json(path: Union[str, Path])

Saves the element to a json file. This not meant to be reloaded and recreate the object, but rather used to document or compare the object.

Parameters:

path : Union[str, pathlib.Path] The path to the json file.

OnOffParameters

OnOffParameters(effects_per_switch_on: Union[Dict, Numeric] = None, effects_per_running_hour: Union[Dict, Numeric] = None, on_hours_total_min: Optional[int] = None, on_hours_total_max: Optional[int] = None, consecutive_on_hours_min: Optional[Numeric] = None, consecutive_on_hours_max: Optional[Numeric] = None, consecutive_off_hours_min: Optional[Numeric] = None, consecutive_off_hours_max: Optional[Numeric] = None, switch_on_total_max: Optional[int] = None, force_switch_on: bool = False)

Bases: Interface

on_off_parameters class for modeling on and off state of an Element. If no parameters are given, the default is to create a binary variable for the on state without further constraints or effects and a variable for the total on hours.

Parameters:

Name Type Description Default
effects_per_switch_on (scalar, array, TimeSeriesData)

cost of one switch from off (var_on=0) to on (var_on=1), unit i.g. in Euro

None
effects_per_running_hour scalar or TS

costs for operating, i.g. in € per hour

None
on_hours_total_min scalar

min. overall sum of operating hours.

None
on_hours_total_max scalar

max. overall sum of operating hours.

None
consecutive_on_hours_min scalar

min sum of operating hours in one piece (last on-time period of timeseries is not checked and can be shorter)

None
consecutive_on_hours_max scalar

max sum of operating hours in one piece

None
consecutive_off_hours_min scalar

min sum of non-operating hours in one piece (last off-time period of timeseries is not checked and can be shorter)

None
consecutive_off_hours_max scalar

max sum of non-operating hours in one piece

None
switch_on_total_max integer

max nr of switchOn operations

None
force_switch_on bool

force creation of switch on variable, even if there is no switch_on_total_max

False

Attributes

use_off property
use_off: bool

Determines wether the OFF Variable is needed or not

use_consecutive_on_hours property
use_consecutive_on_hours: bool

Determines wether a Variable for consecutive off hours is needed or not

use_consecutive_off_hours property
use_consecutive_off_hours: bool

Determines wether a Variable for consecutive off hours is needed or not

use_switch_on property
use_switch_on: bool

Determines wether a Variable for SWITCH-ON is needed or not

Functions

infos
infos(use_numpy=True, use_element_label=False) -> Dict

Generate a dictionary representation of the object's constructor arguments. Excludes default values and empty dictionaries and lists. Converts data to be compatible with JSON.

Parameters:

use_numpy bool: Whether to convert NumPy arrays to lists. Defaults to True. If True, numeric numpy arrays (np.ndarray) are preserved as-is. If False, they are converted to lists. use_element_label bool: Whether to use the element label instead of the infos of the element. Defaults to False. Note that Elements used as keys in dictionaries are always converted to their labels.

Returns: Dict: A dictionary representation of the object's constructor arguments.

to_json
to_json(path: Union[str, Path])

Saves the element to a json file. This not meant to be reloaded and recreate the object, but rather used to document or compare the object.

Parameters:

path : Union[str, pathlib.Path] The path to the json file.