annular.coupling_components

coupling_components.py: Utilities for coupling using MUSCLE3.

Attributes

logger

Functions

compact_market_info_to_msg(→ libmuscle.Message)

Compact market information to a message.

extract_market_info_from_msg(...)

Extract the market information message.

compact_bids_to_msg(→ libmuscle.Message)

Compact a DataFrame of (block) bids columns into a MUSCLE3 Message.

extract_bids_from_msg(→ pandas.DataFrame)

Reconstruct a DataFrame of (block) bids from a MUSCLE3 Message.

get_coupling_setup(→ ymmsl.Model)

Create the MUSCLE3 coupling configuration for the energy system network.

Module Contents

annular.coupling_components.logger[source]
annular.coupling_components.compact_market_info_to_msg(price: numpy.ndarray | None, scheduled_bids: numpy.ndarray | None, timestamp: float) libmuscle.Message[source]

Compact market information to a message.

Parameters:
  • price – A numpy array with market prices.

  • scheduled_bids – A numpy array with the scheduled bids for a satellite.

  • timestamp – Floating point value to serve as timestamp for model coordination.

Returns:

A muscle3 message where the data attribute is a dictionary with keys “price” and “scheduled_bids”.

annular.coupling_components.extract_market_info_from_msg(msg: libmuscle.Message) tuple[numpy.ndarray | None, numpy.ndarray | None, float][source]

Extract the market information message.

Parameters:

msg – muscle3 Message containing a dictionary with keys “price” and “scheduled_bids” for a single satellite.

Returns:

the market price, scheduled bids as numpy arrays, and the timestamp.

Return type:

tuple

annular.coupling_components.compact_bids_to_msg(bids: pandas.DataFrame, timestamp: float) libmuscle.Message[source]

Compact a DataFrame of (block) bids columns into a MUSCLE3 Message.

This takes bids in the following format:

exclusive_group_id

profile_block_id

sense

timestamp

quantity

acceptance_ratio

price

where:

  • exclusive_group_id: ID of which exclusive group this bid belongs to

  • profile_block_id: ID of which profile block this bid belongs to

  • sense: indicates whether the bid is a demand or a supply bid

  • timestamp: timestamp for this bid

  • quantity: quantity for this bid

  • acceptance_ratio: minimum acceptance ratio between 0 and 1

  • price: price for this bid

and (exclusive_group_id, profile_block_id, sense, timestamp) are its Index.

Every bid must have a profile_block_id, exclusive_group_id and a sense. If a bid does not make use of profile block or exclusive group functionality, the exclusive_group_id must be unique, while profile_block_id can be any value.

The resulting message contains the dataframe converted to a dictionary where

  • column and index names become dictionary keys

  • column and index values become dictionary values.

Parameters:
  • bids – Dataframe table of the bids from a satellite model.

  • timestamp – Floating point value to serve as timestamp for model coordination.

Returns:

MUSCLE3 message object containing the bids table information in a dictionary.

annular.coupling_components.extract_bids_from_msg(msg: libmuscle.Message) pandas.DataFrame[source]

Reconstruct a DataFrame of (block) bids from a MUSCLE3 Message.

The .data attribute of the incoming message should be a dictionary with the following keys: price, quantity, exclusive_group_id, profile_block_id, timestamp.

From this data, a DataFrame in the following format is created:

exclusive_group_id

profile_block_id

sense

timestamp

quantity

acceptance_ratio

price

where:

  • exclusive_group_id: ID of which exclusive group this bid belongs to

  • profile_block_id: ID of which profile block this bid belongs to

  • sense: indicates whether the bid is a demand or a supply bid

  • timestamp: timestamp for this bid

  • quantity: quantity for this bid

  • acceptance_ratio: minimum acceptance ratio between 0 and 1

  • price: price for this bid

and (exclusive_group_id, profile_block_id, sense, timestamp) are its Index.

Every bid must have a profile_block_id, exclusive_group_id and a sense. If a bid does not make use of profile block or exclusive group functionality, the exclusive_group_id must be unique, while profile_block_id can be any value.

Parameters:

msg – MUSCLE3 message object containing the bids table information as a dictionary.

Returns:

Dataframe table of the bids from a satellite model.

annular.coupling_components.get_coupling_setup(config_name: str, number_of_satellites: int) ymmsl.Model[source]

Create the MUSCLE3 coupling configuration for the energy system network.

Parameters:
  • config_name – name of this run to be used as model name

  • number_of_satellites – number of satellites to spin up

Returns:

MUSCLE3 Model object with the standard coupling configuration