annular.satellite_model.multi_profile_strategy ============================================== .. py:module:: annular.satellite_model.multi_profile_strategy Classes ------- .. autoapisummary:: annular.satellite_model.multi_profile_strategy.MultiProfileBiddingStrategy Module Contents --------------- .. py:class:: MultiProfileBiddingStrategy(demands_path: pathlib.Path | str, forecasts_path: pathlib.Path | str, carrier_prices_path: pathlib.Path | str, cronian_config_path: pathlib.Path | str, tariff_folder: pathlib.Path | str | None = None, tariff_categories: dict[str, str | int] | None = None, floor_price: int = 0, horizon_size: int = 48, cronian_storage_model: str = 'simple', forecast_scaling_factor: float = 1.5, **kwargs) Bases: :py:obj:`annular.satellite_model.satellite_model.SatelliteModel` A 24-hour bidding strategy to bid using multiple profiles based on multiple scenarios. .. seealso:: annular.tariffs.TariffManager :param demands_path: Path to csv file with demand values per timestamp, with different flexibility as separate columns named 'flex+N'. :param forecasts_path: Path to csv file containing the electricity price forecast based on which multiple forecast scenarios will be generated by adjusting with the `forecast_scaling_factor`. :param carrier_prices_path: Path to csv file containing price timeseries for any energy carrier other than electricity such as methane, hydrogen, etc. :param cronian_config_path: Path to the Cronian configuration describing the prosumer's demand and assets for building its optimization model. :param tariff_folder: Path to the folder with tariff data; passed to a TariffManager. :param tariff_categories: Dictionary that indicates the tariff category the satellite is subject to. Keys are categories, and values are the levels in that category. :param floor_price: Minimum price to bid at, defaults to 0. :param horizon_size: Full length of the horizon to use for an optimization iteration, i.e., bidding window + look ahead period, in number of snapshots. :param forecast_scaling_factor: Factor to scale up/down the electricity price forecast from the base scenario to create multiple forecast scenarios. :param cronian_storage_model: Type of storage model (`simple` or `complex`) to use in the optimization model if prosumer has storage assets. :param kwargs: Any other keyword arguments are passed to the initialization of the base class. .. py:attribute:: cur_timestamp_idx :value: 0 .. py:attribute:: floor_price :value: 0 .. py:attribute:: horizon_size :value: 48 .. py:attribute:: forecast_scaling_factor :value: 1.5 .. py:attribute:: storage_model :value: 'simple' .. py:attribute:: demands :value: None .. py:attribute:: base_forecast :value: None .. py:attribute:: carrier_prices :value: None .. py:attribute:: manager .. py:attribute:: max_electricity_withdrawal_so_far :value: 0.0 .. py:property:: bidding_window :type: pandas.Index Returns current bidding window as a pandas Index of timestamps. .. py:method:: determine_bids() -> pandas.DataFrame Determine bids based on multiple forecast price scenarios. Different forecast price scenarios are made as variation of the given electricity_price_forecast. An optimization is run based on each of these scenarios, to determine the corresponding demand profile. The set of these profiles is submitted in a single exclusive group, all bid for at ceiling price. :returns: A collection of bids covering the current bidding window. .. py:method:: meet_demand(market_price: numpy.ndarray | None, demand_met: numpy.ndarray | None) -> None Process the amount of demand that was met. Solve the cronian model again, now with the electric power fixed to the values given from the central market. Record dispatch of assets and update the state of charge for any storage assets. :param market_price: Price of electricity as provided per timestep. :param demand_met: Amount of demand that was met at the market price per timestep. .. py:method:: _update_internal_state(horizon: pandas.Index) -> None Store intermediate values to carry over to the next rolling horizon. Specifically, these values are the energy levels of storage assets if any. :param horizon: Current optimization horizon. .. py:method:: _get_horizon(length: int = None) -> pandas.Index Select the relevant horizon index values at the current timestamp index. :param length: length of the desired horizon in number of timestamps. Uses `self.horizon_size` when `None` is given. :returns: Pandas Index object of the selected horizon values. .. py:method:: make_forecast_scenarios(base_forecast: pandas.DataFrame, forecast_scaling_factor: float) -> dict[str, pandas.DataFrame] :staticmethod: Create different scenarios from a base forecast. The different scenarios are created by either scaling the base forecast according to some profile, or by scaling a fixed profile according to a numerical property of the base forecast. The following scenarios are created: - scale_up: `base_forecast_values * forecast_scaling_factor` - scale_down: `base_forecast_values / forecast_scaling_factor` - scale_up_increasing: `base_forecast_values * linear_increase` - scale_down_increasing: `base_forecast_values * linear_decrease` - peak_mid: `base_forecast_values * peak_shape_scaling` - valley_mid: `base_forecast_values * valley_shape_scaling` - day_period_boost: `base_forecast_values * boost_day_period` - morning_evening_boost: `base_forecast_values * boost_morning_evening` - base_min_day_period_boost: `base_forecast_min * boost_day_period` - base_min_morning_evening_boost: `base_forecast_min * boost_morning_evening` - base_max_day_period_boost: `base_forecast_max * boost_day_period` - base_max_morning_evening_boost: `base_forecast_max * boost_morning_evening` :param base_forecast: Electricity price forecast used as a base for generating different scenarios of electricity price variations. :param forecast_scaling_factor: Factor to scale the base forecast to create different scenarios. :returns: Electricity price forecast scenarios. :raises ValueError: If the length of the forecast is not 24. .. py:method:: plot_forecast_scenarios(forecast_scenarios: dict[str, pandas.DataFrame], output_path) -> None :staticmethod: Plot the electricity price forecast scenarios. :param forecast_scenarios: Dictionary of forecast scenarios. :param output_path: Path where the plot will be saved. .. py:method:: determine_power_profile(horizon: pandas.Index, scenario_forecast: pandas.DataFrame) -> list[float] Determine electricity consumption/generation profile based on a given scenario. :param horizon: Time horizon. :param scenario_forecast: DataFrame containing forecasted electricity prices. :param model: Abstract pyomo optimization model. :returns: Optimized electricity power profile for the given forecast price. .. py:method:: _make_bids(profiles: dict[str, list[float]]) -> pandas.DataFrame Create a bids table to submit given profiles as an exclusive group. Actual bid entries are only made for timestamps with non-zero demand. :param profiles: dictionary of lists of demand values for each timestamp. :returns: pd.DataFrame table of the constructed bids. .. py:method:: _create_model(horizon: pandas.Index) -> pyomo.environ.AbstractModel Create a model instance using `cronian`. :param horizon: Timestamps spanning the optimization horizon currently of interest. :param e_price: Forecasted electricity price. :returns: Abstract model for this satellite in the current optimization horizon. .. py:method:: _add_cost_objective(model: pyomo.environ.AbstractModel) -> pyomo.environ.AbstractModel Create a cost minimization or revenue maximization objective. Depending on the sign of the `electric_power` variable, the objective minimizes electricity consumption cost or maximizes revenues from electricity generated locally. It also minimizes the cost of consuming other externally priced energy carriers such as methane, biomass, etc. :param model: Pyomo model to add the cost objective to. :returns: The given model object, now with `cost_objective` added. .. py:method:: _define_max_electricity_withdrawal(model: pyomo.environ.AbstractModel) -> pyomo.environ.AbstractModel Define maximum electricity withdrawal for modeling capacity tariffs. This function defines the maximum electricity withdrawal in the current optimization horizon to which a capacity tariff charge is applied. Directly computing max withdrawal as `max (withdrawals in current horizon, previous maximum withdrawal)` will lead to a nonlinear optimization problem due to the max() operator. We linearize this by introducing a variable representing the maximum power withdrawal and enforcing the following constraints on it: (1) It must be greater than or equal to the instantaneous withdrawals in the current horizon. (2) It must be greater than or equal to the recorded maximum withdrawal from previous horizons. :param model: Pyomo model to add the constraint to. :returns: The given model object, now with `capacity_tariff_constraint` added. .. py:method:: _add_contracted_capacity_limit_constraint(model: pyomo.environ.AbstractModel) -> pyomo.environ.AbstractModel Constrain max electricity withdrawal based on contracted transport limit. NOTE: We assume that the unit of the contracted_transport_limit is MW. :param model: Pyomo model to add the constraint to. :returns: The given model object, now with `max_withdrawal_in_previous_constraint` added.