9.4 Economic dispatch in renewable energy systems using chance constraints
Preamble: Install Pyomo and a solver
This cell selects and verifies a global SOLVER for the notebook. If run on Google Colab, the cell installs Pyomo and the ipopt solver via the IDEAS repository, then sets SOLVER to use the ipopt solver. If run elsewhere, it assumes Pyomo and the Mosek solver have been previously installed and sets SOLVER to use the Mosek solver via the Pyomo SolverFactory. It then verifies that SOLVER is available.
Problem description
In this notebook, we will explore the applications of chance constraints to an area where high-probability guarantees on the system's functioning are required - the economic dispatch (ED) problem.
The problem considers the short-term determination of the optimal production of energy to meet all energy demands. Let denote a set of nodes, each of which is representing cities, industrial districts, power generators, or combinations of these. Each node may have:
a certain energy demand ;
a power generator whose energy production needs to be between and units of power. The cost of producing one unit of power at node is given by a variable cost . Importantly, not all the nodes have demand and generation, more specifically it is possible for a node to have only generation or only demand.
The goal is to determine for each node the optimal production level , such that
the total energy demand is met
no production limits are exceeded
the total energy production costs are minimized.
If we fully control the energy production and the customer demand is known, can formulate the problem as the following MILO problem:
Now, assume that we have built several offshore wind turbines. These wind turbines combined together produce a random non-negative amount of extra energy, denoted by . For a fixed value of , the optimization problem to be solved is thus to 'fill in' to the remaining energy demand not satisfied by wind power:
The problem, however, is that is a random variable and is typically not fully known before the generation levels of conventional generators have to be set. Because of stochastic fluctuations in wind power generation, the ED problem is best modeled as a stochastic optimization problem. The intermittency of wind generation makes it almost impossible to perfectly balance supply and demand on a real-time basis, but in practice there is some tolerance for error, i.e., certain degree of mismatch between supply and demand can be easily adjusted for.
To formulate the problem under this assumption, let us denote by:
the tolerance of the absolute power mismatch between supply and demand;
is the risk level at which we are willing to accept for the supply to deviate from the demand more than ;
the non-negative random variable describing the total power production of offshore wind turbines.
In this setting, instead of requiring that the supply and demand are matched perfectly, we require that the absolute difference remains below power threshold using the following chance constraint:
To formulate the problem as an MILO, we can break up this absolute-value function including constraint into two individual chance constraints - note that in this way we relax the constraint because requiring that two one-sided constraints hold with probability each is not the same as requiring that together they hold with probability , but in practice we can fine-tune the to adapt for this change.
Such breaking up leads us to the following optimization problem with chance constraints:
In this notebook, we will solve this problem using the SAA approach to chance constraints, with the wind power production using modeled with historical data of 500 outcomes of the total wind production.
Data import
We first import the necessary packages and define a function that reads all the necessary node and wind production random sample data.
The wind production samples can be accessed through the wind_production_samples variable - a list of 500 equiprobable outcomes for the wind generation.
Let us take a look into the wind production data, including a Kernel Density Estimate. We see that is has two modes. This paper explains what one could do with this.
The nodes dictionary contains for every information about , , , . In our dataset, there is a clear separation of the nodes into nodes that only consume power, and nodes that only produce power, which can be seen by inspecting the node properties.
Let us now provide some locations to our producers and consumers and visualize the data, using bubbles proportional to the size of demand (for consumers) and maximum generation capacity (for producers).
MILO reformulation for the chance-constrained ED problem
Since we have a discrete set of possible wind production outcomes, we can reformulate the chance-constrained ED problem as a mixed-integer linear optimization problem. More specifically, we introduce a binary variable for each sample of the wind production, which, thanks to the big- technique, determines whether the constraint related to the -th sample is allowed to be violated or not, and add one constraint to ensure that the total probability that the constraint is violated is at most , i.e.,
The resulting MILO is
For each sample, the supply and demand constraints are deactivated when and otherwise. Note that we only use one single variable for each constraint. Indeed, having two separate and will yield the same objective value, but the model would be incorrect with respect to the violation of the supply and demand constraints introduced earlier.
The constants 's here should be selected based on the data: one reasonable choice for that will certainly work out is to take it equal to the left-hand side minus while replacing for .
We now define the Python function which implements this model. Note that the model is formulated with and as mutable model parameters, so that we can repeatedly solve the same model instance, upon modifying the parameters. In turn, this requires the constants to be expressions.
For demonstration purposes, we now solve the model for the provided instance and wind production outcomes and report the optimal objective value you obtain for and .
Visualizing and understanding the solution
Sensitivity analysis
Next, we will study the sensitivity of the optimal solution and value to the different risk guarantee levels - this helps the decision maker find a level that offers the best risk-reward tradeoff. To this end, we solve the same MILO varying the values first of (for fixed ) and then of (for fixed ).
Based on the above plots, we can make the following observations:
Smaller values and lead to more infeasibilities, which is to be expected. Smaller allow for less constraint violations/relaxations, whereas smaller Delta make constraints tighter (and thus easier to violate).
The reason why the plot becomes flat for high and values is because production is no longer needed. For instance, a high means we can ignore the worst-case sample scenarios, whereas higher means that we do not need to produce to match demand.