battery_optimizer.utils#

Functions

clean_filename(filename)

datetime_to_trading_block(settlement_period)

Calculates the corresponding trading block number for the given time and number of blocks per day.

get_market_type_for_frequency_product(product)

get_true_locations(df)

Get locations of True values in a boolean DataFrame.

Classes

class battery_optimizer.utils.Country(*values)#

Bases: StrEnum

DE = 'de'#
UK = 'uk'#
classmethod from_str(value)#
Parameters:

value (str)

class battery_optimizer.utils.FrequencyProductType(*values)#

Bases: StrEnum

AFRR_CAPACITY_NEG = 'afrr_capacity_neg'#
AFRR_CAPACITY_POS = 'afrr_capacity_pos'#
AFRR_ENERGY_NEG = 'afrr_energy_neg'#
AFRR_ENERGY_POS = 'afrr_energy_pos'#
DCH = 'dch'#
DCL = 'dcl'#
DMH = 'dmh'#
DML = 'dml'#
DRH = 'drh'#
DRL = 'drl'#
FCR = 'fcr'#
class battery_optimizer.utils.FrequencyProductVariable(*values)#

Bases: StrEnum

AFRR_CAPACITY_NEG_VOL = 'afrr_capacity_neg_vol'#
AFRR_CAPACITY_POS_VOL = 'afrr_capacity_pos_vol'#
AFRR_ENERGY_NEG_VOL = 'afrr_energy_neg_vol'#
AFRR_ENERGY_POS_VOL = 'afrr_energy_pos_vol'#
DCH_VOL = 'dch_vol'#
DCL_VOL = 'dcl_vol'#
DMH_VOL = 'dmh_vol'#
DML_VOL = 'dml_vol'#
DRH_VOL = 'drh_vol'#
DRL_VOL = 'drl_vol'#
FCR_VOL = 'fcr_vol'#
class battery_optimizer.utils.IntradayDeliveryLength(*values)#

Bases: StrEnum

half_hour = 'HalfHour'#
quarter_hour = 'QuarterHour'#
class battery_optimizer.utils.IntradayResultAggregationName(*values)#

Bases: StrEnum

minmax = 'minmax'#
raw = 'raw'#
class battery_optimizer.utils.IntradayStrategyName(*values)#

Bases: StrEnum

bucket = 'bucket'#
vwap = 'vwap'#
class battery_optimizer.utils.MarketType(*values)#

Bases: StrEnum

AFRR_CAPACITY = 'afrr_capacity'#
AFRR_ENERGY_NEG = 'afrr_energy_neg'#
AFRR_ENERGY_POS = 'afrr_energy_pos'#
DC = 'dc'#
DM = 'dm'#
DR = 'dr'#
EPEX30MIN = 'epex30min'#
EPEX_DA = 'epexDA'#
EPEX_IDA1 = 'epexIDA1'#
FCR = 'fcr'#
IMBALANCE = 'imbalance'#
INTRADAY = 'intraday'#
N2EX1h = 'n2ex1h'#
class battery_optimizer.utils.ObjectiveName(*values)#

Bases: StrEnum

mel = 'mel'#
mil = 'mil'#
pnl = 'pnl'#
class battery_optimizer.utils.ProblemType(*values)#

Bases: StrEnum

AFRR_ENERGY = 'afrr_energy'#
BOD = 'bod'#
MELMIL = 'melmil'#
MELMILBOA = 'melmilboa'#
MELMILNOW = 'melmilnow'#
PNL = 'pnl'#
class battery_optimizer.utils.RampingLogicName(*values)#

Bases: StrEnum

dc_only = 'dc_only'#
class battery_optimizer.utils.UseCase(*values)#

Bases: StrEnum

BESS = 'bess'#
EV = 'ev'#
battery_optimizer.utils.clean_filename(filename)#
Parameters:

filename (str)

Return type:

str

battery_optimizer.utils.datetime_to_trading_block(settlement_period, blocks_per_day=48)#

Calculates the corresponding trading block number for the given time and number of blocks per day.

Block numbers start from 1 up to the number of blocks per day.

Example 1: in a 30 minutes per block market, i.e. 48 blocks/day, 00:00 -> 1 06:30 -> 14 23:30 -> 48

Example 2: in a 15 minutes per block market, i.e. 96 blocks/day, 00:00 -> 1 12:15 -> 50 12:30 -> 51 12:45 -> 52 23:30 -> 96

Args:

settlement_period (datetime): start time of a trading block blocks_per_day (int, optional): number of trading blocks in one day for this particular market. Defaults to 48.

Raises:

ValueError: Raised if wrong number of trading blocks provided

Returns:

int: corresponding trading block for given time

Parameters:
Return type:

int

battery_optimizer.utils.get_market_type_for_frequency_product(product)#
Parameters:

product (FrequencyProductType)

Return type:

MarketType

battery_optimizer.utils.get_true_locations(df)#

Get locations of True values in a boolean DataFrame.

Parameters: df (pd.DataFrame): DataFrame with boolean values

Returns: list: List of tuples containing (index, column) for True values