1 Introduction

Energy production from renewable sources is becoming critical for current societies. Wind power is one of the main renewable sources. Consequently, improving the efficiency of wind farms (WF) is becoming increasingly important. One of the fields to achieve this goal is in designing the distribution network of onshore wind farms that interconnects the turbines and the substation because this design may have a major impact on the energy losses.

Here, we consider the problem of designing the wind farm network layout, assuming that the locations of the substation and all wind turbine locations are given. The design of the layout includes the choice of links and the type of electrical cables used to establish those links, aiming to minimize both the infrastructure cost and the cost of the energy losses during the wind farm’s lifetime. In the literature, see Cerveira et al. (2016), this problem has been addressed considering the energy losses as deterministic. However, the energy (active and reactive) losses depend on the energy produced by the turbines and the cable types. The turbine’s production is directly influenced by the wind direction and speed, which are uncertain. This makes the deterministic models a major simplification of the real problems. Consequently, if there are variations in wind direction or speed in relation to the deterministic parameters, the deterministic solution may no longer be optimal. Here, we approach this problem by resorting to the recent optimization methodology called distributionally robust optimization (DRO) (Rahimian and Mehrotra 2022). We assume that the exact probability distribution of the turbines’ production is unknown, but it is assumed to belong to an uncertainty set called ambiguity set. This set is formed by all the distributions within a predefined distance of a reference distribution. For the distance, we assume the 1-norm Wasserstein metric. A particular two-stage mixed integer model is proposed, where the choice of links and cable types are first-stage decisions, while the losses depend on the realized scenarios and corresponding probabilities. These losses are not true recurse decisions since their value is uniquely defined for a given scenario. However, computing these losses is not trivial and we rely on a dynamic program. The objective is to minimize the infrastructure cost and the worst-case (with respect to the ambiguity set) expected cost of the energy losses. A major advantage of this model approach is that by varying a single parameter value that controls the size of the ambiguity set, one can obtain the stochastic programming solution and the worst-case scenario (robust optimization) solution.

To solve the model, we propose a decomposition algorithm that, in each iteration, solves a master problem where only a subset of probability distributions in the ambiguity set is considered. Then, with the obtained solution for the master problem, it is checked whether a probability distribution exists, leading to the worst expected value of the losses. If such a distribution is found, an inequality (called optimality cut) is added to the master problem, and the process is repeated. We propose three enhancements with different goals. The first one is to define an aggregation of the optimality cuts, which reduces the number of iterations. The second enhancement consists of introducing a constraint to the master problem imposing a local search in the neighborhood of the current best solution. This heuristic is employed only in the first iterations of the decomposition algorithm and aims to avoid spending too much time solving the intermediate master problems. The last improvement consists of incorporating into the master problem a deterministic component of the cost from energy losses corresponding to a quantile of the reference distribution. This improvement increases the lower bound obtained in each iteration of the decomposition algorithm, thus reducing the gap between the best-known solution and the best lower bound.

Computational experiments are conducted on a set of instances based on real data to compare the several obtained solutions and their costs and to test the algorithm performance with and without the enhancements.

The paper is organized as follows: In Sect. 2, we review the relevant literature review. The problem characteristics are given in Sect. 3. The distributionally robust model is introduced in Sect. 4, and the decomposition algorithm is described in Sect. 5. The discussion of algorithm improvements is done in Sect. 6. The computational experiments and case studies are reported in Sect. 7. Final conclusions and remarks are given in Sect. 8.

2 Literature review

The deterministic problem was considered by Cerveira et al. (2016), where authors propose different mathematical models to optimize the cable network layout, aiming to minimize the sum of the infrastructure cost and the costs of energy losses, considering several cable types. Combining a preprocessing procedure and adding valid inequalities, efficient ILP models were obtained, solving real instances with up to 57 wind turbines (WTs) in less than 480 s. There are other works in the literature under the scope of WF optimization layout (WFLO). Pillai et al. (2015) deal with the problem of determining the substation placement and the layout design of offshore WFs, combining heuristic algorithms and mixed integer linear programming (MILP) models. Wȩdzik et al. (2016) addressed the WF design using a MILP model, taking into account the network layout and cable cross-sections, with and without the power losses. Fischetti and Pisinger (2018) optimize the offshore WF cable routing. They optimize the infrastructure costs and future revenues while considering energy losses under different scenarios. A MILP formulation was proposed. To handle the non-linearity of the model regarding power losses, they combine exact and matheuristic methods. Moreover, some wind scenarios were analyzed in the preprocessing part to compute the power losses. In Fischetti and Pisinger (2019), the same authors give an overview of the different phases in the design of an offshore wind farm and some of the optimization problems involved. Three essential optimization tasks, turbine location, electrical cable routing, and foundation optimization, are analyzed in detail.

Cerveira et al. (2023) consider the onshore WF layout design, knowing the substation and WT location, aiming to minimize the initial investment cost plus the cost of electrical energy losses over the lifetime of the WF, considering that each trench can deploy multiple cables, turning this problem into a more complex variant of the WFLO problems previously addressed. This variant makes the problem most appropriate to the real case and leads to significant gains in the total cost of the solutions. In Cerveira et al. (2021), it is considered a WFLO problem with several substations and a discrete set of possible turbine locations. The combined optimization of WT location and cable connection is also considered in Fischetti and Fischetti (2023).

In Fischetti (2021), two challenges in designing offshore wind farms are addressed: the optimal allocation of wind turbines to minimize interference between them and position-related costs and their electrical interconnection. Mixed integer programming models and heuristic methods are used to solve both problems.

Cazzaro and Pisinger (2022) developed an advanced heuristic for offshore WFLO, based on the variable neighborhood search (VNS) meta-heuristic, to solve the problem of placing hundreds of turbines in a subset of thousands of available locations, taking into account foundation costs and the minimum distance constraint.

Since renewable energies from sources, such as wind and sunlight, are highly affected by uncertain conditions, we have witnessed increased research devoted to optimization under uncertainty applied to energy problems. An overview of chance-constrained optimization, an important tool for decision-making in uncertain environments based on data-driven problems in power systems, is given in Geng and Xie (2019). Using different approaches, MirHassani and Yarahmadi (2017) study the wind farm layout problem under uncertainty, taking into account the wake effect, which has a major impact on the power output, especially in the offshore wind farm.

Li et al. (2022) deal with maintenance decision-making for offshore wind farms under different types of uncertainty inherent to the problem. The uncertainties considered include the stochastic attributes of time to failure, the deviation between actual and predicted component failure times, and uncertain maintenance consequences. A distributionally robust scheduling model for the integrated gas-electricity system (IGES) with electricity and gas load uncertainties is proposed in He et al. (2019). In Dhoot et al. (2021), a quadratic integer formulation of the discretized layout design problem is proposed in order to maximize the produced energy while considering stochastic wind conditions and wake losses.

DRO is a recent technique that generalizes both stochastic programming and robust optimization (Bayraksan and Love 2015; Rahimian and Mehrotra 2022). In stochastic programming, the probability distribution of the uncertain parameters is assumed to be known. This is a very restrictive assumption in practice since, in most cases, as in the case of wind direction and speed, one may have some historical data but not necessarily a probability distribution that holds for the entire wind farm lifetime. On the other hand, robust optimization assumes that the uncertain parameters belong to a given uncertainty set. Although such a set may be formed from historical data, it generally does not use all the historical information, leading to over-conservative solutions. In DRO, the probability distribution of the uncertain parameters is assumed to belong to an ambiguity set. If this set is a singleton, we obtain the stochastic programming approach, and if the probability distribution is supported on a finite discrete set of scenarios and the ambiguity set is wide enough, allowing the probability mass to concentrate in a single scenario, we obtain the robust optimization case.

To the best of our knowledge, DRO has never been used to design wind farms’ layouts. In the context of wind farms, DRO was applied to the generation expansion planning considering the virtual inertia support from wind farms aiming to minimize the generation expansion cost while maximizing the probability of the system fully absorbing renewable energy generation, see Hu et al. (2022). In AlSaba et al. (2023), a multi-objective DRO approach was followed to find the optimal location of wind turbines and solar photovoltaics that minimize the variance of renewable energy sources and maximize power production. DRO has also been used in other energy-related problems. For instance, in the context of energy planning problems, Guevara et al. (2020) compare stochastic approaches and DRO on strategic investment decisions. Arrigo et al. (2022) developed a distributionally robust chance-constrained optimization with a Wasserstein ambiguity set for energy and reserve dispatch.

The mathematical model and the solution procedure depend on the type of uncertainty set considered. Here, we consider a Wasserstein ambiguity set, where the true probability distribution distances from a nominal distribution (using the 1-norm Wasserstein metric) at most a given predefined parameter. This set is also known as the Kantarovich set. For a deeper discussion of ambiguity sets based on the Wasserstein distances, see Esfahani and Kuhn (2018) and Gao and Kleywegt (2016). A Wasserstein distance-based distributionally robust scheduling problem was considered recently in Chen et al. (2021) for a rural microgrid, considering the coordinated interaction among source-grid-load-storage to minimize the operating costs. For this particular ambiguity set, Bansal et al. (2018) show that if the subproblem associated with the recourse variables is a linear or a mixed-binary problem, then the DRO can be solved using a decomposition approach that generalizes the well-known L-shaped algorithm. When the subproblem includes binary variables, it is necessary to provide an approximation of the subproblem using a set of linear inequalities. Here we propose a decomposition approach that deviates from that given in Bansal et al. (2018) since the subproblem is not modeled as a linear or mixed-binary problem, but it is solved using a dynamic program leading to an approximation of the subproblem value through a set of feasibility cuts.

3 Wind farm electrical system

A WF comprises several wind turbines interconnected by a cable network where the electrical current generated by each wind turbine (WT) is transported to the substation, which injects it into the main grid. The cable network associated with an onshore WF has a radial structure which corresponds to a spanning tree, were the root node is the substation. The node set is \(\mathcal {N}_\text {0} = \{0, 1, \dots , n\}\), where node 0 represents the substation and the other nodes, \(\mathcal {N}=\{1,\dots , n\}\), represent the wind turbines. For illustrative purposes, in Fig. 1 , we present a graph layout representation of a WF with one substation and 10 WT, \(\mathcal {N}_\text {0} = \{0, 1, \dots , 10\}\).

The rated current \(I_\textrm{r}\) generated by a WT is given by Cerveira et al. (2016):

$$\begin{aligned} I_\textrm{r}=\frac{P_\textrm{r}}{\sqrt{3}\cdot U \cdot \cos \varphi }, \end{aligned}$$
(1)

where U is the rated voltage of the WF, \(P_\textrm{r}\) is the rated power of each WT, and \(\cos \varphi\) is the power factor which, in WF, is considered very close to 1 and so, we get

$$\begin{aligned} I_\textrm{r}=\frac{P_\textrm{r}}{\sqrt{3} \cdot U} \end{aligned}$$
(2)

The cable network follows Kirchhoff’s current law, which states that the current flowing into a node must equal the current flowing out of it. So, if all the turbines operate at the rated current, the electrical current flowing on a branch toward the substation with t downstream WTs is \(t \cdot I_\textrm{r}\).

The WF presented in Fig. 1 has one substation and 10 WTs arranged in 3 branch lines. A branch line corresponds to the connections and turbines that inject power toward the substation, reaching there through a single branch. One of the branch lines starts with branch (0, 1), another one starts with branch (0, 2), and the other one starts with branch (0, 4).

Fig. 1
figure 1

Wind farm layout example

Assuming in the example of Fig. 1 that \(P_\textrm{r}=2\) MW and \(U=20\) kV (which are typical values for medium size WFs), using Eq. (2), the rated current drawn by each WT is \(I_\textrm{r}=57.735\) A. Then, branch (0, 2) supports the electrical current generated by five downstream WTs (2, 5, 6, 9, and 10), and so, the electrical current flowing through it is \(I_{20}=5 \cdot I_\textrm{r}= 288.675\) A.

As in any other electrical system, branch cables lose energy while carrying electrical current in the WF cable system. The energy losses during the WF lifetime (expected to be around 20 years) represent a considerable cost to the energy provider. There are two types of energy losses to consider: active and reactive power losses. For each branch, these quantities depend on the current intensity passing through the connection and the cable type used. We consider \(n_k\) cable types where each cable type \(k \in K=\{1, 2,..., n_k\}\) is characterized by its section size, its current rating \({I}_{k}\) (representing its maximum supported electrical current), its electrical inductance \({L}_{k}\) and resistance \({R}_{k}\), and its price per meter \(C_{k}\).

For a given current intensity I flowing on a branch, and assuming the short transmission line model, the active power losses P are generically given by Joule’s Law (Cerveira et al. 2016):

$$\begin{aligned} P = {R } \cdot I^2 \end{aligned}$$
(3)

and the reactive power losses Q are generically given by:

$$\begin{aligned} Q = 100 \pi \cdot {L } \cdot I^2 \end{aligned}$$
(4)

where R is the cable resistance, L is the cable inductance (presented on Table 1) and \(100 \pi\) corresponds to the angular frequency of the electrical current (Cerveira et al. 2016).

A wind farm will not permanently operate at its maximum rated power throughout its lifetime, as the electrical power extracted from the WTs depends on the wind speed. So, it is convenient to reflect this behavior in the mathematical formulation, defined as load factor \(l_f\) (a value between 0 and 1). The load factor corresponds to the ratio between the total electrical energy produced by the WF and the energy that could be produced if the WTs were always operating at their rated power throughout the years (Van Kuik 2007). Usually, the load factor is assumed to be a constant, based on real data, and equal for every WT (Cerveira et al. 2016).

So, for a topology x, on branch (ij), with the set \(S_i(x)\) of downstream WTs, of a given cable of type k, characterized by a resistance \({R}_k\), in \(\Omega\)/km, and an inductance \(\textrm{L}_k\), in mH/km, with length \(\ell _{ij}\), in meters, the active power loss \(P_{ij}^{k}(x)\) and reactive power losses \(Q_{ij}^{k}(x)\), following Eqs. (3) and (4), are given by:

$$\begin{aligned} P_{ij}^{k}(x)=\, & {} 3 \cdot \frac{\ell _{ij} \cdot {R_\textrm{k}}}{10^3} \cdot \left( \sum _{l \in S_i(x)} I_\textrm{r} \cdot l_{f_{l}}\right) ^2 \end{aligned}$$
(5)
$$\begin{aligned} Q_{ij}^{k}(x)=\, & {} 3 \cdot \frac{\ell _{ij} \cdot \pi \cdot \mathrm{L_k}}{10^4} \cdot \left( \sum _{l \in S_i(x) } I_\textrm{r} \cdot l_{f_{l}} \right) ^2, \end{aligned}$$
(6)

where \(l_{f_l}\) is the load factor corresponding to wind turbine l. Notice that each branch requires three conductors (one per current phase), which explains factor 3 in Eqs. (5) and (6).

In the particular case on which all the WT have the same load factor \(l_f\), Eqs. (5) and (6) can be simplified. Let t be the number of the downstream WTs, i.e., the cardinality of \(S_i\), the active and reactive power losses of branch (ij) supporting t downstream turbines are given by:

$$\begin{aligned} P_{ij}^{kt}(x)=\, & {} 3 \cdot \frac{\ell _{ij} \cdot R_k}{10^3} \cdot (t \cdot I_\textrm{r} \cdot l_{f})^2 \end{aligned}$$
(7)
$$\begin{aligned} Q_{ij}^{kt}(x)=\, & {} 3 \cdot \frac{\ell _{ij} \cdot \pi \cdot L_k}{10^4} \cdot (t \cdot I_\textrm{r} \cdot l_{f})^2. \end{aligned}$$
(8)

The goal is to obtain the optimal layout to minimize the total costs, including the infrastructure cost and the (worst-case) expected power loss cost during the wind farm’s lifetime. The infrastructure cost accounts for the cable cost and their installation.

To motivate the importance of considering the variation in load factor values, Fig. 2 presents the optimal layouts considering three different load factor values, \(l_f=0.25\), \(l_f=0.35\) and \(l_f=0.5\), for Montalegre wind farm. It is a Portuguese WF with 25 WTs, which will be presented in Sect. 7.1.

The black node with the label “0” represents the substation, and the lines represent the connections between the WT and the substation. Moreover, the WTs on the same branch lines are represented with the same color.Footnote 1 As can be seen, there are differences in the design and in the type of cable used. And so, the optimal solutions depend on the values of the load factor considered, hence the importance of considering the randomness of these values to be closer to the real case.

Fig. 2
figure 2

Montalegre layout for different load factor values

4 Distributionally robust model

In this section, we introduce the distributionally robust (DR) model. The load factor at turbine j\({l_f}_j,\) depends on unpredicted factors, such as wind direction and speed. Here, we assume that the vector \(l_f\) belongs to a discrete uncertainty set \(\Omega\) of scenarios. Each scenario represents a possible realization of the load factors. These values have been calculated considering, for each WT, the wind characteristics and geographical location. The true probability distribution p,  where \(p_{\omega }\) is the probability of scenario \(\omega \in \Omega ,\) is assumed to be unknown, but that belongs to a given set \(\mathbb {A}\), known as ambiguity set.

For a given topology defined by x and a scenario \(\omega \in \Omega\), the active and reactive losses cost value is given by \(R(x,\omega )\). Function \(R(x,\omega )\) is known as the recourse function.

The distribution robust (DR) problem can be written in a general form as follows:

$$\begin{aligned} \min _{x \in X}\left\{ c^tx + \max _{p \in \mathbb {A}} \sum _{\omega \in \Omega } p_{\omega } R(x,\omega )\right\} \end{aligned}$$
(9)

where x corresponds to a topology in the feasible set, X, which will be defined latter.

The goal is to determine the topology that minimizes the infrastructure cost plus the expected cost of active and reactive losses assuming the most unfavorable (regarding that solution) probability distribution of load factors occurs. The DR model coincides with the stochastic programming model if the ambiguity set includes a single probability distribution. Also, if the ambiguity set is large enough, allowing the degenerate probability distributions such that for each scenario \(\omega \in \Omega\) the distribution \(p_{\omega }=1\) and \(p_{\omega '}=0\) for all \(\omega ' \in \Omega , \omega ' \ne \omega ,\) belongs to the ambiguity set, then the DR model coincides with a robust model where the worst-case scenario is considered. Hence, this model also generalizes the two well-known optimization approaches.

Next, we describe several components: the deterministic model, which gives the feasible set of the first-stage solutions, the ambiguity set, and the recourse function.

4.1 Deterministic model to obtain a topology, x

To obtain an appropriate ILP model for the deterministic case, the decision variables are the binary variables \(x_{ij}^{kt}\) that, when equal to 1, indicate that nodes i and j are connected by a cable of type k such that i is the node on the substation side, and this cable supports the current of t downstream wind turbines (including the one located in j), all of them corresponding to the same load factor. Being 0 the root node, arcs (i, 0) are not considered in the formulations.

The mathematical model can be stated as follows:

$$\begin{aligned}&\displaystyle \min \sum _{i \in \mathcal {N}_\text {0}} \sum _{j\in \mathcal {N}}\sum _{k \in K} \sum _{t=1}^{t_{ki}} \left( \left( c_{ij}^{k}+p_{ij}^{kt}+q_{ij}^{kt}\right) \cdot x_{ij}^{kt}\right) \end{aligned}$$
(10)
$$\begin{aligned}&\text{ subject } \text{ to } \nonumber \\&\quad \sum _{j \in \mathcal {N}} \sum _{k \in K} \sum _{t=1}^{t_{k0}} \left( t \cdot x_{0j}^{kt}\right) = n \end{aligned}$$
(11)
$$\begin{aligned}&\sum _{i \in \mathcal {N}_\text {0}} \sum _{k\in K} \sum _{t=1}^{t_{ki}} \left( x_{ij}^{kt}\right) = 1, j \in \mathcal {N}\end{aligned}$$
(12)
$$\begin{aligned}&\sum _{i \in \mathcal {N}_\text {0}} \sum _{k\in K} \sum _{t=1}^{t_{ki}} \left( t \cdot x_{ij}^{kt}\right) =\sum _{i \in \mathcal {N}} \sum _{k=1}^{K} \sum _{t=1}^{t_{kj}} \left( t \cdot x_{ji}^{kt} \right) +1, j\in \mathcal {N} \end{aligned}$$
(13)
$$\begin{aligned}&x_{ij}^{kt}\in \{0,1\}, i \in \mathcal {N}_\text {0}, j\in \mathcal {N}, k\in K, t=1,\dots ,t_{ki} \end{aligned}$$
(14)

where \(p_{ij}^{kt}\) and \(q_{ij}^{kt}\) are given by Eqs. (7) and (8), \(t_{ki}\) is the maximum number of WT that can be supported by a connection outgoing from node i with cable type k. It holds:

$$\begin{aligned} t_{ki}=\left\{ \begin{array}{ll} m_k, &{} \ i=0\\ m_k-1, &{} \ i \in \mathcal {N}\\ \end{array} \right. \end{aligned}$$
(15)

where \(m_k=\left\lfloor \frac{I_{{\text {z}}_{\text {k}}}}{I_{\text {r}}}\right\rfloor\), being \(I_{{\text {z}}_{\text {k}}}\) the maximum current intensity value that cable of type k can support.

The objective function (10) aims to minimize the sum of infrastructure cost and energy loss costs. Constraint (11) guarantees that from the substation, there are branches that support all the n wind turbines. Constraints (12) are the radial structure constraints guaranteeing that each wind turbine \(j\in \mathcal {N}\) has one incoming connection. Constraints (13) are the flow conservation constraints and guarantee that, on each wind turbine \(j\in \mathcal {N}\), if an incoming connection supporting t downstream wind turbines is in the solution, the outgoing connections must support a total of \(t-1\) downstream wind turbines. Finally, constraints (14) are the variable domain constraints.

The feasible set X given in (9) is the set of solutions satisfying (11)–(14).

4.2 Ambiguity set \(\mathbb {A}\)

We assume that the exact probability distribution of the load factors is not known, but it belongs to the ambiguity set \(\mathbb {A}.\) This set includes all the probability distributions within a predefined distance to a reference/nominal distribution, denoted by \(p^*.\) To define the distance between probability distributions, we use the Wasserstein metric of order 1. This metric is defined as:

$$\begin{aligned} W_1(p,q)= \underset{k \in J(p, q)}{\min }\ \sum _{\omega ,\omega ' \in \Omega } \parallel \omega -\omega '\parallel _1 k_{\omega ' \omega }\end{aligned}$$

where J(pq) is the set of all joint probability distributions k with marginal distributions p and q. Thus, \(k_{\omega '\omega }\) is the joint probability of occurrence of scenarios \(\omega\) and \(\omega '\) in distributions p and q, respectively. This metric is then used to build an ambiguity set composed by the set of probability distributions p such that the distance to the reference distribution \(p^*\) does not exceed a given \(\epsilon ,\) \(W_1(p,p^*)\le \epsilon\). Such an ambiguity set is the well-known Wasserstein ambiguity set, also known as the Kantorovich ambiguity set. To model this set, we consider the classical formulation of a feasible set from a transportation problem where the variables are the mass probabilities \(p_{\omega }\) and transportation variables \(k_{\omega ' \omega }\) representing the amount of mass to transport from the reference probability distribution (\(p^*_{\omega '}\)) to probability distribution (\(p_{\omega }).\) This set is modeled as follows:

$$\begin{aligned} \mathbb {A} =\,&\left\{ p \in \mathbb {R}^{|\Omega |}: \sum _{\omega \in \Omega }\sum _{\omega ' \in \Omega } \parallel \omega -\omega '\parallel _1 k_{\omega ' \omega } \le \epsilon \right. \end{aligned}$$
(16)
$$\begin{aligned}&\sum _{\omega ' \in \Omega } k_{\omega ' \omega } =p_{\omega },&\omega \in \Omega , \end{aligned}$$
(17)
$$\begin{aligned}&\sum _{\omega \in \Omega } k_{\omega ' \omega } =p^*_{\omega '},&\omega ' \in \Omega , \end{aligned}$$
(18)
$$\begin{aligned}&\sum _{\omega \in \Omega } p_{\omega } = 1, \end{aligned}$$
(19)
$$\begin{aligned}&p_{\omega } \ge 0,&\omega \in \Omega , \end{aligned}$$
(20)
$$\begin{aligned}&k_{\omega ' \omega } \ge 0,&\omega , \omega ' \in \Omega \}. \end{aligned}$$
(21)

Constraints (16) limit the total distance between p and \(p^*\) (that is, the effort to transport the probability mass of \(p^*\) to the probability mass of p). Constraints (17) state that the mass transported to each scenario \(\omega\) coincides with \(p_{\omega },\) which correspond to the demand constraints in a transportation problem. Constraints (18) state that the mass transported from scenario \(\omega '\) coincides with \(p^*_{\omega '},\) corresponding to the supply constraints. Constraints (19) state that the total mass transported is 1, which, together with non-negativity constraints, ensures the resulting p defines a probability distribution.

4.2.1 Recourse function \(R(x,\omega )\)

For a given topology x and a scenario \(\omega \in \Omega ,\) the value of the active and reactive losses cost, given by \(R(x,\omega ),\) can be computed using the following equation:

$$\begin{aligned} R(x,\omega )&= \sum \limits _{i \in \mathcal {N}_\text {0}}{\sum \limits _{j \in \mathcal {N}}}\sum \limits _{k\in K} \left( \sum \limits _{t=1}^{t_{ki}} x_{ij}^{kt}\right) \left( c_{\text {e}} \cdot h \cdot P_{ij}^{kw}(x) + \frac{c_{\text {e}}}{2} \cdot h \cdot Q_{ij}^{kw}(x)\right) \end{aligned}$$
(22)

where \(c_e\) is the energy cost, h is the number of hours during the expected lifetime, \(P_{ij}^{kw}(x)\) and \(Q_{ij}^{kw}(x)\) are the active power losses and reactive power losses. For each branch (ij) and cable type k,  these losses are obtained from equations (5) and (6), written for each scenario \(\omega\) as follows:

$$\begin{aligned} P_{ij}^{k \omega }(x)=\, & {} 3 \cdot \frac{\ell _{ij} \cdot R_k}{10^3} \cdot \left( \sum _{l \in S_i(x)} I_\textrm{r} \cdot l_{f_{l}}^\omega \right) ^2, \end{aligned}$$
(23)
$$\begin{aligned} Q_{ij}^{k\omega }(x)=\, & {} 3 \cdot \frac{\ell _{ij} \cdot \pi \cdot L_k}{10^4} \cdot \left( \sum _{l \in S_i(x)} I_\textrm{r} \cdot l_{f_l}^\omega \right) ^2. \end{aligned}$$
(24)

Note that in (22) the factor \(\left( \sum _{t=1}^{t_{ki}} x_{ij}^{kt}\right)\) is either zero or one, depending on the given topology x.

5 Decomposition algorithm

To solve the distribution robust problem, we propose a decomposition algorithm. First, we rewrite the problem as follows:

$$\begin{aligned} \min&\> c^t x+\theta \nonumber \\&\theta \ge \sum _{\omega \in \Omega } p_{\omega } R(x,\omega ) \> \> \> \forall p \in \mathbb {A} \nonumber \\&x \in X \end{aligned}$$
(25)

where variable \(\theta\) gives the worst expected value for the cost of the active and reactive losses and is defined by constraints (25). This formulation raises two issues. The first is the number of constraints (25), which is infinite. To circumvent this issue, we generate these inequalities dynamically. This leads to a decomposition algorithm where, in each iteration, a master problem, obtained by considering a subset of inequalities (25), is solved, and a topology x is obtained. Then, for that topology, the algorithm verifies whether there is a violated inequality (25) or proves that no such inequality exists and terminates with the optimal solution. If a violated inequality is found, then the inequality is added to the master problem, and the process is repeated. The second issue is related to the nature of the recourse function. When \(R(x,\omega )\) is modeled as a linear problem, then the linear problem can be dualized and \(R(x,\omega )\) can be replaced in (25) by the linear objective function of the dual problem using the optimal multipliers, see Esfahani and Kuhn (2018) for details. However, here \(R(x,\omega )\) is computed using a dynamic program. Thus, we propose a different approach where a set of feasibility cuts imposes the value of \(R(x,\omega )\). Suppose \(r_{x,\omega }\) gives the value of \(R(x,\omega ).\) For a given solution \(\overline{x}\) obtained by the master problem, we write inequalities (25) as follows:

$$\begin{aligned} \theta \ge \sum _{\omega \in \Omega } p_{\omega } r_{\overline{x},\omega } \left( \sum _{j \in \mathcal {N}_\text {0}, i \in \mathcal {N}, k \in K, \tau \in \{1\ldots t_{kj}\}| \overline{x}_{ji}^{k\tau } =1} x_{ji}^{k\tau }-(n-1) \right) \, \forall p \in \mathbb {A} \end{aligned}$$
(26)

Since any topology has n links, inequalities (26) become active only when

$$\sum _{j, i \in \mathcal {N}, k \in K, \tau \in \{t\ldots t_{kj}\}| \overline{x}_{ji}^{k\tau } =1} x_{ji}^{k\tau } =n.$$

That is, the bound \(\theta \ge \sum _{\omega \in \Omega } p_{\omega } r_{\overline{x},\omega }\) is active only when the topology \(\overline{x}\) is considered, otherwise, the right-hand side is non-positive.

In order to add inequalities (26) for a given first stage solution \(\overline{x},\) we follow the steps:

  1. 1.

    Compute \(R(\overline{x},\omega )\) for each scenario \(\omega \in \Omega\) to obtain \(r_{\overline{x},\omega }.\)

  2. 2.

    Solve the separation problem:

    $$\begin{aligned} \max \left\{ \sum _{\omega \in \Omega } p_{\omega } r_{\overline{x},\omega } \ | \; \; \; p \in \mathbb {A} \right\} \end{aligned}$$
    (27)

Next, we discuss these two steps.

5.1 Computing the recourse function \(R(x,\omega )\)

For a given topology x and a scenario \(\omega \in \Omega\), we need to compute the value of the active and reactive losses cost, given by \(R(x,\omega ).\) Here, we propose a recursive function \(f_i\) to compute the factor \(\left( \sum _{l \in S_i(x) } I_\textrm{r} \cdot l_{f_l}^\omega \right)\) in Eqs. (23) and (24). Let \(f_i(x,\omega )\) denote the current going to turbine i toward the substation when topology x and the scenario of load factor \(\omega\) are realized. It includes the current generated by the immediately previous turbines on the paths to the substation, set \(\mathcal {N}_i^-\), and the current flowing into them generated by all their downstream turbines. This current can be obtained recursively as follows:

$$\begin{aligned} f_i(x,\omega ) = \sum _{j \in \mathcal {N}_i^-} \left( l^{\omega }_j \cdot I_{\text {r}} +f_j(x,\omega ) \right) . \end{aligned}$$

where \(\mathcal {N}_i^-= \left\{ j \in \mathcal {N} \ | \ \sum _{t=1}^{t_{ki}} \sum _{k \in { K}} x_{ij}^{kt} = 1 \right\}\).

5.2 The distribution separation problem

The distribution separation problem is to find the probability distribution \(p \in \mathbb {A}\) that maximizes the expected active and reactive losses:

$$\begin{aligned} \max \left\{ \sum _{\omega \in \Omega } p_{\omega } r_{x,\omega }\ | \ p \in \mathbb {A} \right\} . \end{aligned}$$
(28)

This problem is the variant of the transportation problem where the objective function is given by \(\max \sum _{\omega \in \Omega } p_{\omega } r_{x,\omega },\) and the additional constraint (16) is considered.

5.3 The full decomposition algorithm

Now, we are at position to describe the full decomposition algorithm. The algorithm iterates between solving the master problem, denoted for iteration i by \(M_i,\) and solving the distribution separation problem. Initially, the master problem \(M_0\) is the deterministic model with the objective function replaced by \(c^t x+\theta\) with \(\theta \ge 0.\) In each iteration i,  the master problem \(M_i\) includes all the inequalities (26) added in all the previous iterations. Notice that the value of the optimal solution to a master problem gives a lower bound to the optimal value since we are omitting many constraints (25), thus providing an underestimation of optimal value. On the other hand, the value of the separation problem given by (28) gives an upper bound of the optimal value because it provides the correct (worst) expected cost of a feasible topology (not necessarily the optimal one). Hence, the algorithm provides both a lower bound (LB) and an upper bound (UB) in each iteration. The algorithm terminates when the difference between these bounds is small enough (smaller than the tolerance tol) or other criteria are met, such as a maximum number of iterations, maxiter, is reached or a predefined time limit, maxtime, is exceeded. The detailed description of the algorithm is given by Algorithm 1.

Algorithm 1
figure a

Decomposition algorithm for the distributionally robust wind farm layout optimization problem under uncertainty

It is easy to verify that the algorithm has a finite number of steps since the number of topologies and cables is finite.

6 Enhancement of the decomposition algorithm

Preliminary results showed that Algorithm 1 has a very slow convergence. The main reason is the nature of inequalities (26), which are active only if the solution to the master problem x is one of the solutions already generated. Therefore, if in each iteration a different solution x is generated (even with a higher infrastructure cost), the constraints (26) become redundant, and the losses expected cost will not be counted in the objective function. Notice that the solution to the master problem is given by variables \(x_{ji}^{kt}.\) Hence, a change in the value of these variables can be motivated by a change in the cable type k, not necessarily in the physical topology. Thus, the decomposition algorithm may perform an exhaustive search in the neighborhood of the topologies with low infrastructure cost. Nevertheless, as the infrastructure cost is not underestimated, the algorithm is able to avoid generating high-cost topologies for the master problem. From these observations, we propose three improvements.

The first enhancement consists of replacing constraints (26) with the following constraints:

$$\begin{aligned}&\theta \ge \sum _{\omega \in \Omega } p_{\omega } r_{x,\omega } \left( \sum _{j \in \mathcal {N}_\text {0}, i \in \mathcal {N}| \sum _{k \in K, \tau \in \{1\ldots t_{kj}\}} \overline{x}_{ji}^{k\tau } =1} \sum _{k \in K, \tau \in \{1\ldots t_{kj}\}} x_{ji}^{k\tau }-(n-1) \right) \, \forall p \in \mathbb {A}. \end{aligned}$$
(29)

With this replacement, the inequality remains active whenever the topology is the same, that is, whenever the change is on the cable type or on the number of downstream wind turbines. This change implies that in each iteration of Algorithm 1 a different topology is tested. However, with this replacement of constraints, the cost may be underestimated if the changes are in the cable type.

The second improvement is related to the previous one. In fact, one can expect (as observed during the computational test) that from one iteration to the next one there is a small change in the master solution leading to a small increase of the lower bound. Hence, to speed up the decomposition approach, we perform a local search procedure in the first iterations, with the exception of the first one, which is used to determine a good initial solution. This local search is performed by imposing the following constraint on the master problem:

$$\begin{aligned}&\sum _{{\mathop {\tau \in \{1\ldots t_{kj}\} | \sum _{ \tau \in \{1\ldots t_{kj}\}} \overline{x}_{ji}^{k\tau } =0}\limits ^{j \in \mathcal {N}_0, i \in \mathcal {N}, k \in K,}}} x_{ji}^{k\tau } + \sum _{{\mathop {\tau \in \{1\ldots t_{kj}\} | \sum _{k \in K, \tau \in \{1\ldots t_{kj}\}} \overline{x}_{ji}^{k\tau } =1}\limits ^{j \in \mathcal {N}_0, i \in \mathcal {N}, k \in K,}}} (1-x_{ji}^{k\tau })\le \delta \end{aligned}$$
(30)

This constraint ensures that at most \(\delta\) variables can change their value from the current best solution.

In the computational tests, we split the running time limit into two equal parts. In the first one, we run the heuristic (master model with the additional constraint), and in the second part, we run the master problem without the additional constraint. For \(\delta\), we take value 10.

The third improvement results from observing that there will be active and reactive losses in all possible scenarios. Hence, we would like to include some of these losses in all the master problems. That is, the amount of losses given by \(\theta\) is split into two amounts, one that does not depend on the scenario is added in each iteration and the other that results from inequalities (26). If there exists a most favorable scenario regarding the losses, then we could include the corresponding losses into all the master problems and add the remaining losses (counted as excess to the losses of the most favorable scenario) through inequalities (26). However, in general, for practical problems, there may be no such favorable scenario, as the wind direction that is more favorable for certain wind turbines may not be the most favorable for the remaining ones. Thus, we opted to generate an artificial scenario, \(\omega _0\), considering for all WT a fixed load factor \(l_f^{0}\), that is, \({l_f}_j=l_f^0, j \in N.\) Thus, the initial master problem \(M_0\) is exactly the deterministic model assuming the constant load factor \(l_f^0.\) So, for each scenario, \(\omega\) and turbine j, \(\Delta l^{\omega }_j\) is considered as the variation, from the reference scenario \(\omega _0\), of the load factor in turbine j under scenario \(\omega\). Therefore, the load factor of turbine j under scenario \(\omega\) is \(l_f^{0}+\Delta l^{\omega }_j\).

So, the current leaving turbine j toward the substation, under scenario \(\omega\), denoted by \(I_j^{+\omega },\) is obtained from the following equation:

$$\begin{aligned} {I_j^{+\omega }}=( l_f^{0}+ \Delta l^{\omega }_j)\cdot I_{\text {r}}+ I_{j}^0 + \Delta I_j^{\omega }, \end{aligned}$$
(31)

where \(I_{j}^0\) is the current going to turbine j for scenario \(\omega _0\) and \(\Delta I^{\omega }_j\) is the variation on this value considering scenario \(\omega\). In the calculation of active and reactive losses costs, Eqs. (7) and (8), the current is squared. By developing the square, one obtains

$$\begin{aligned} \left( {I_j^{+\omega }}\right) ^2= IF + I\omega \end{aligned}$$
(32)

where \(IF=\left( l_f^{0}\cdot I_{\text {r}}+ I_{j}^0\right) ^2\) does not depend on the scenario and \(I\omega\) is given by

$$\begin{aligned} 2 \cdot l_f^{0}\cdot \Delta l^{\omega }_j \cdot I_{\text {r}}^2 + {\Delta l^{\omega }_j}^2 \cdot I_{\text {r}}^2 + 2 \cdot \Delta l^{\omega }_j\cdot I_{\text {r}} \cdot I_{j}^0 +2 \cdot l_f^{0}\cdot I_{\text {r}} \cdot \Delta I_j^{\omega } + 2 \cdot \Delta l^{\omega }_j\cdot I_{\text {r}} \cdot \Delta I_j^{\omega } + 2 \cdot I_{j}^0 \cdot \Delta I_j^{\omega }+ {\Delta I_j^{\omega }}^2. \end{aligned}$$

The values of \(I_{j}^0\) and \(\Delta l^{\omega }_j\) are computed using \(f_j(x,\omega _0)\) and \(f_j(x,\omega )\), respectively.

7 Case studies and computational results

The proposed models, algorithm approach, and enhances were applied to three Portuguese WFs: Montalegre with 25 WTs, Alto da Coutada with 50 WTs and Gardunha with 57 WTs, the two last among the largest existing WFs in Portugal.

Table 1 presents the set of \(n_k=12\) cable types used in the computational results. Each cable type \(k \in K=\{1, 2,..., n_k\}\) is characterized by its section size, its current rating \(I_{k}\) (representing its maximum supported electrical current), its electrical inductance \({L}_{k}\) and resistance \({R}_{k}\), and its price per meter \(C_{k}\). The thicker cables are more expensive but have lower resistance and inductance, which lead to lower energy losses by (5) and (6). So, for a connection requiring to support an electrical current I, all cable types k can be used such that \(I_{k} \ge I\), and these cable types represent different trade-offs between the acquisition cost and energy losses cost over time. We have considered 20 years as the expected WF lifetime corresponding to \(h=20 \cdot 24\cdot 365\) h.

Table 1 Electrical characteristics of unipolar cables (LXHIOV) 18/30kV

To generate the ambiguity set, we consider ten scenarios of load factors for each WF. These scenarios were randomly generated taking into account the geographical location of the WTs (WTs located at the same altitude and close to each other have similar load factors) and in such a way that the average load factor coincides with the constant load factor considered for this WF. The scenarios also differ in their average value, which attempts to simulate the cases where the wind speed varies.

The computational results obtained for each WF are presented in the next subsections. The proposed decomposition algorithm involves three optimization models: the master problem, the second-stage problem, and the distributionally separation problem. It was considered a global time limit of 4 h. In the computational experiments, we present the partial times of the three optimization subproblems, the number of iterations, and the obtained upper bounds. For the third improvement, two situations are considered for the energy loss component independent of the scenario. One considers the losses corresponding to the first quartile of load factors, and the other considers the losses corresponding to the minimum of load factors. A time limit of 2 h is considered for each situation. The final lower bound is considered the maximum of the lower bounds obtained, and the final upper bound is the minimum of the upper bounds obtained.

7.1 Montalegre wind farm

The Montalegre WF, located in the north of Portugal, has a total nominal power of 50 MW having \(n=25\) Enercon WTs, model E82/2000, with the rated power of \(P_\textrm{r}=2\) MW, interconnected by a \(U=20\) kV grid. With these settings, the rated current drawn by each WT is \(I_\textrm{r}=57.735A\) (using (1)) and, taking into account the cable properties in terms of maximum electrical current (Table 1), the maximum number of WTs per branch line is 10.

In Table 2, the computational results for Montalegre WF are presented for different values of \(\epsilon\), without and with the enhancements described in Sect. 6. For each case, it is presented the upper bound, “UB”, the time spent in the master problems “Tm”, in the second-stage problems “Tss”, and in the separation problems “Tsp”, the total time “Total”, and the number of iterations, “# iter.”.

Table 2 Computational results—Montalegre WF (Tm master; Tss second-stage; Tsp separation)

For the Montalegre WF, the ground solution, i.e., the solution actually installed is known. Considering the different values of \(\epsilon\) for the ambiguity set radius, the total ground structure costs are shown in Table 3. As we can see, the costs of the ground solution are higher. The solutions obtained with the proposed approach lead to gains of around 9%.

Table 3 Total costs of Montalegre WF ground solution

7.2 Alto da Coutada wind farm

The Alto da Coutada WF, located in the north of Portugal, has \(n=50\) Enercon WTs, model E82/2300, with a rated power \(P_{\text {r}}=2.3\) MW, interconnected by a \(U=20\) kV grid. With these settings, the rated current drawn by each WT is \(I_{\text {r}}=66.795A\), and the maximum number of WTs per branch line is 8. The computational results for Alto da Coutada WF are presented in Table 4.

Table 4 Computational results—Alto da Coutada WF ( \(Tm_0\) master initial; Tm master; Tss second-stage; Tsp separation)

7.3 Gardunha wind farm

The Gardunha WF, located in the center of Portugal, has \(n=57\) WTs (55 Enercon E82/2000 and 2 Enercon E70/E4) all with \(P_{\text {r}}=2\) MW of rated power, interconnected by a \(U=30\) kV grid. With these settings, the rated current drawn by each WT is \(I_{\text {r}}=38.49\) A, and, consequently, the maximum number of WTs per branch line is 15. The total nominal power of the wind farm is 114 MW. The computational results for Gardunha WF are presented in Table 5.

Table 5 Computational results—Gardunha WF (Tm master; Tss second-stage; Tsp separation)

From the computational results, we can draw several conclusions. First, the results clearly show that the enhancements are very important to improving the algorithm’s performance since the final gaps with enhancements are much lower than those without enhancements. With enhancements, the decomposition algorithm provides very low gaps for the Montalegre case, while for the Alto da Coutada and Gardunha, the final gaps are still large, being bigger in the Alto da Coutada. The last two wind farms have at least twice as many turbines as the first one, which will greatly increase the size of the models involved. Furthermore, the substation in Montalegre and Gardunha WF has a central location, while in the Alto da Coutada WF, the substation has a peripheral location, which could explain higher final gaps for Alto da Coutada WF.

We also observe that the final gaps tend to increase when the value of \(\epsilon\) increases. That means the problem becomes more difficult to solve for large values of \(\epsilon ,\) thus when the ambiguity set is large and easier in the pure stochastic optimization case (with \(\epsilon =0).\) Finally, we can also observe that most of the running time is spent solving the master problem. This behavior should be expected, as the deterministic problem is already hard to solve.

8 Conclusions

This paper addresses the problem of designing a wind farm layout, taking into account the uncertain nature of the wind. A major indirect cost in wind farm design is related to the energy losses, which depend on the energy produced at each turbine that ultimately results from the wind direction and speed. We show with an example based on real data that, given fixed turbines and substation positions, the optimal layout depends on the energy produced at each turbine, which is uncertain. That means the layout design should take into account uncertain parameters such as the energy produced at the turbines. To handle this issue, we propose a new model following the recent advances in distributionally robust optimization, where the probability distribution of the uncertain parameters is assumed to belong to an uncertainty set. This model generalizes the models resulting from stochastic programming and robust optimization approaches and allows the decision-maker to devise different solutions (layout configurations) according to the degree of uncertainty considered for the probability distributions.

A decomposition algorithm is introduced. However, the algorithm solves a master problem at each iteration, corresponding to solving the deterministic model with additional constraints (optimality cuts). The decomposition algorithm becomes even harder because the deterministic model is already computationally hard to solve. Moreover, we observe that the optimality cuts are weak in the sense that they act as feasibility cuts that are active just for a single topology design (first-stage solution). Consequently, the decomposition tends to have many iterations. However, despite being an exact algorithm, the algorithm can be stopped at each iteration, providing, in that case, a feasible solution and a lower bound. In order to enhance the algorithm, three improving strategies are discussed: one to reduce the number of iterations by generating stronger optimality cuts, other to solve intermediate master problems heuristically, and the last one to improve the lower bounds.

Computational results are reported on data from real wind farm case studies. These results show that the proposed improvement strategies are essential to speed up the decomposition algorithm, allowing the easiest instances to obtain solutions with very small gaps. Thus, the approach can be used to devise real topologies, taking into account the wind speed and direction uncertainty and allowing the decision-maker to control the degree of conservatism by controlling a single parameter that defines the ambiguity set.

As future research, we aim to address the more complex case of solving the problem where the position of the turbines is not previously known.