Skip to content

flixOpt.core

This module contains the core functionality of the flixOpt framework. It provides Datatypes, logging functionality, and some functions to transform data structures.

Classes

TimeSeriesData

TimeSeriesData(data: Numeric, agg_group: Optional[str] = None, agg_weight: Optional[float] = None)

timeseries class for transmit timeseries AND special characteristics of timeseries, i.g. to define weights needed in calculation_type 'aggregated' EXAMPLE solar: you have several solar timeseries. These should not be overweighted compared to the remaining timeseries (i.g. heat load, price)! fixed_relative_profile_solar1 = TimeSeriesData(sol_array_1, type = 'solar') fixed_relative_profile_solar2 = TimeSeriesData(sol_array_2, type = 'solar') fixed_relative_profile_solar3 = TimeSeriesData(sol_array_3, type = 'solar') --> this 3 series of same type share one weight, i.e. internally assigned each weight = 1/3 (instead of standard weight = 1)

Parameters:

Name Type Description Default
data Union[int, float, ndarray]

The timeseries data, which can be a scalar, array, or numpy array.

required
agg_group str

The group this TimeSeriesData is a part of. agg_weight is split between members of a group. Default is None.

None
agg_weight float

The weight for calculation_type 'aggregated', should be between 0 and 1. Default is None.

None

Raises:

Type Description
Exception

If both agg_group and agg_weight are set, an exception is raised.

Functions

TimeSeries

TimeSeries(label: str, data: Optional[Numeric_TS])

Class for data that applies to time series, stored as vector (np.ndarray) or scalar.

This class represents a vector or scalar value that makes the handling of time series easier. It supports various operations such as activation of specific time indices, setting explicit active data, and aggregation weight management.

Attributes:

Name Type Description
label str

The label for the time series.

data Optional[Numeric]

The actual data for the time series. Can be None.

aggregated_data Optional[Numeric]

aggregated_data to use instead of data if provided.

active_indices Optional[ndarray]

Indices of the time steps to activate.

aggregation_weight float

Weight for aggregation method, between 0 and 1, normally 1.

aggregation_group str

Group for calculating the aggregation weigth for aggregation method.

Functions

make_scalar_if_possible staticmethod
make_scalar_if_possible(data: Optional[Numeric]) -> Optional[Numeric]

Convert an array to a scalar if all values are equal, or return the array as-is. Can Return None if the passed data is None

Parameters:

Name Type Description Default
data (Numeric, None)

The data to process.

required

Returns:

Type Description
Numeric

A scalar if all values in the array are equal, otherwise the array itself. None, if the passed value is None