flixopt.components
This module contains the basic components of the flixopt framework.
Attributes
Classes
LinearConverter
LinearConverter(label: str, inputs: List[Flow], outputs: List[Flow], on_off_parameters: OnOffParameters = None, conversion_factors: List[Dict[str, NumericDataTS]] = None, piecewise_conversion: Optional[PiecewiseConversion] = None, meta_data: Optional[Dict] = None)
Bases: Component
Converts input-Flows into output-Flows via linear conversion factors
Parameters:
Name | Type | Description | Default |
---|---|---|---|
label
|
str
|
The label of the Element. Used to identify it in the FlowSystem |
required |
inputs
|
List[Flow]
|
The input Flows |
required |
outputs
|
List[Flow]
|
The output Flows |
required |
on_off_parameters
|
OnOffParameters
|
Information about on and off states. See class OnOffParameters. |
None
|
conversion_factors
|
List[Dict[str, NumericDataTS]]
|
linear relation between flows. Either 'conversion_factors' or 'piecewise_conversion' can be used! |
None
|
piecewise_conversion
|
Optional[PiecewiseConversion]
|
Define a piecewise linear relation between flow rates of different flows. Either 'conversion_factors' or 'piecewise_conversion' can be used! |
None
|
meta_data
|
Optional[Dict]
|
used to store more information about the Element. Is not used internally, but saved in the results. Only use python native types. |
None
|
Functions
to_json
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:
Name | Type | Description | Default |
---|---|---|---|
path
|
Union[str, Path]
|
The path to the json file. |
required |
Storage
Storage(label: str, charging: Flow, discharging: Flow, capacity_in_flow_hours: Union[Scalar, InvestParameters], relative_minimum_charge_state: NumericData = 0, relative_maximum_charge_state: NumericData = 1, initial_charge_state: Union[Scalar, Literal['lastValueOfSim']] = 0, minimal_final_charge_state: Optional[Scalar] = None, maximal_final_charge_state: Optional[Scalar] = None, eta_charge: NumericData = 1, eta_discharge: NumericData = 1, relative_loss_per_hour: NumericData = 0, prevent_simultaneous_charge_and_discharge: bool = True, meta_data: Optional[Dict] = None)
Bases: Component
Used to model the storage of energy or material.
Storages have one incoming and one outgoing Flow each with an efficiency.
Further, storages have a size
and a charge_state
.
Similarly to the flow-rate of a Flow, the size
combined with a relative upper and lower bound
limits the charge_state
of the storage.
For mathematical details take a look at our online documentation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
label
|
str
|
The label of the Element. Used to identify it in the FlowSystem |
required |
charging
|
Flow
|
ingoing flow. |
required |
discharging
|
Flow
|
outgoing flow. |
required |
capacity_in_flow_hours
|
Union[Scalar, InvestParameters]
|
nominal capacity/size of the storage |
required |
relative_minimum_charge_state
|
NumericData
|
minimum relative charge state. The default is 0. |
0
|
relative_maximum_charge_state
|
NumericData
|
maximum relative charge state. The default is 1. |
1
|
initial_charge_state
|
Union[Scalar, Literal['lastValueOfSim']]
|
storage charge_state at the beginning. The default is 0. |
0
|
minimal_final_charge_state
|
Optional[Scalar]
|
minimal value of chargeState at the end of timeseries. |
None
|
maximal_final_charge_state
|
Optional[Scalar]
|
maximal value of chargeState at the end of timeseries. |
None
|
eta_charge
|
NumericData
|
efficiency factor of charging/loading. The default is 1. |
1
|
eta_discharge
|
NumericData
|
efficiency factor of uncharging/unloading. The default is 1. |
1
|
relative_loss_per_hour
|
NumericData
|
loss per chargeState-Unit per hour. The default is 0. |
0
|
prevent_simultaneous_charge_and_discharge
|
bool
|
If True, loading and unloading at the same time is not possible. Increases the number of binary variables, but is recommended for easier evaluation. The default is True. |
True
|
meta_data
|
Optional[Dict]
|
used to store more information about the Element. Is not used internally, but saved in the results. Only use python native types. |
None
|
Functions
to_json
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:
Name | Type | Description | Default |
---|---|---|---|
path
|
Union[str, Path]
|
The path to the json file. |
required |
Transmission
Transmission(label: str, in1: Flow, out1: Flow, in2: Optional[Flow] = None, out2: Optional[Flow] = None, relative_losses: Optional[NumericDataTS] = None, absolute_losses: Optional[NumericDataTS] = None, on_off_parameters: OnOffParameters = None, prevent_simultaneous_flows_in_both_directions: bool = True, meta_data: Optional[Dict] = None)
Bases: Component
Initializes a Transmission component (Pipe, cable, ...) that models the flows between two sides with potential losses.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
label
|
str
|
The label of the Element. Used to identify it in the FlowSystem |
required |
in1
|
Flow
|
The inflow at side A. Pass InvestmentParameters here. |
required |
out1
|
Flow
|
The outflow at side B. |
required |
in2
|
Optional[Flow]
|
The optional inflow at side B. If in1 got InvestParameters, the size of this Flow will be equal to in1 (with no extra effects!) |
None
|
out2
|
Optional[Flow]
|
The optional outflow at side A. |
None
|
relative_losses
|
Optional[NumericDataTS]
|
The relative loss between inflow and outflow, e.g., 0.02 for 2% loss. |
None
|
absolute_losses
|
Optional[NumericDataTS]
|
The absolute loss, occur only when the Flow is on. Induces the creation of the ON-Variable |
None
|
on_off_parameters
|
OnOffParameters
|
Parameters defining the on/off behavior of the component. |
None
|
prevent_simultaneous_flows_in_both_directions
|
bool
|
If True, inflow and outflow are not allowed to be both non-zero at same timestep. |
True
|
meta_data
|
Optional[Dict]
|
used to store more information about the Element. Is not used internally, but saved in the results. Only use python native types. |
None
|
Functions
to_json
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:
Name | Type | Description | Default |
---|---|---|---|
path
|
Union[str, Path]
|
The path to the json file. |
required |
TransmissionModel
Bases: ComponentModel
Attributes
Functions
create_transmission_equation
Creates an Equation for the Transmission efficiency and adds it to the model
add
add(item: Union[Variable, Constraint, Model], short_name: Optional[str] = None) -> Union[linopy.Variable, linopy.Constraint, Model]
Add a variable, constraint or sub-model to the model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item
|
Union[Variable, Constraint, Model]
|
The variable, constraint or sub-model to add to the model |
required |
short_name
|
Optional[str]
|
The short name of the variable, constraint or sub-model. If not provided, the full name is used. |
None
|
StorageModel
Bases: ComponentModel
Model of Storage
Attributes
Functions
add
add(item: Union[Variable, Constraint, Model], short_name: Optional[str] = None) -> Union[linopy.Variable, linopy.Constraint, Model]
Add a variable, constraint or sub-model to the model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item
|
Union[Variable, Constraint, Model]
|
The variable, constraint or sub-model to add to the model |
required |
short_name
|
Optional[str]
|
The short name of the variable, constraint or sub-model. If not provided, the full name is used. |
None
|
SourceAndSink
SourceAndSink(label: str, source: Flow, sink: Flow, prevent_simultaneous_sink_and_source: bool = True, meta_data: Optional[Dict] = None)
Bases: Component
class for source (output-flow) and sink (input-flow) in one commponent
Parameters:
Name | Type | Description | Default |
---|---|---|---|
label
|
str
|
The label of the Element. Used to identify it in the FlowSystem |
required |
source
|
Flow
|
output-flow of this component |
required |
sink
|
Flow
|
input-flow of this component |
required |
prevent_simultaneous_sink_and_source
|
bool
|
If True, inflow and outflow can not be active simultaniously. |
True
|
meta_data
|
Optional[Dict]
|
used to store more information about the Element. Is not used internally, but saved in the results. Only use python native types. |
None
|
Functions
to_json
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:
Name | Type | Description | Default |
---|---|---|---|
path
|
Union[str, Path]
|
The path to the json file. |
required |
Source
Bases: Component
Parameters:
Name | Type | Description | Default |
---|---|---|---|
label
|
str
|
The label of the Element. Used to identify it in the FlowSystem |
required |
source
|
Flow
|
output-flow of source |
required |
meta_data
|
Optional[Dict]
|
used to store more information about the Element. Is not used internally, but saved in the results. Only use python native types. |
None
|
Functions
to_json
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:
Name | Type | Description | Default |
---|---|---|---|
path
|
Union[str, Path]
|
The path to the json file. |
required |
Sink
Bases: Component
Parameters:
Name | Type | Description | Default |
---|---|---|---|
label
|
str
|
The label of the Element. Used to identify it in the FlowSystem |
required |
meta_data
|
Optional[Dict]
|
used to store more information about the element. Is not used internally, but saved in the results |
None
|
sink
|
Flow
|
input-flow of sink |
required |
Functions
to_json
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:
Name | Type | Description | Default |
---|---|---|---|
path
|
Union[str, Path]
|
The path to the json file. |
required |