1. Introduction
Today, a remarkable and accelerated transformation is taking place in the electrification of European countries, as the European Union has set two significant challenges related to emission reductions, the first being that greenhouse gas emissions should be reduced by 20 percent compared to the 1990 level and the second being that each Member State should achieve 20 percent of its energy consumption from renewable sources [
1,
2,
3].
Due to this increased electrification, electricity distribution systems have to evolve and adapt to changing requirements to facilitate and accommodate this change. These changes include handling higher loads, accommodating higher currents, managing bi-directional power flows, optimizing network configurations for efficiency, and mitigating congestion using flexibility sources [
4].
In order to contribute to the stability of the electricity system, flexibility can be defined as the ability to change generation or consumption patterns in response to an external signal (activation signals). This is an important force for the drivers, some examples of which are: integrating renewable energy, which is intermittent and difficult to predict; electrifying systems that consume more, including electric vehicles; maintaining the balance between production and demand; and helping to decarbonize the electricity system [
5,
6].
Different authors propose using flexibility to solve grid congestions. Authors in [
7] discuss all aspects of electric vehicle deployment, particularly their grid support functions in the vehicle-to-grid (V2G) system. It also examines the integration of the electrified fleet with renewable energy sources into the smart grid. In a nutshell, the authors use the V2G capabilities of EVs and analyze their potential, but they do not consider the optimization of flexibility, i.e., the use of flexibility in an optimal way.
The study [
8] examines the technical feasibility and potential benefits of using energy storage to increase the transmission capacity of congested transmission systems serving regions of the country with large amounts of renewable energy generation. It also includes a brief description of the various storage applications and reviews previous work by EPRI and others investigating the use of storage in the transmission system. In short, it uses energy storage but does not rely on optimization. In contrast, several studies [
9,
10,
11] propose a market-based mechanism to alleviate distribution grid congestions through a centralized and coordinated home energy management system (HEMS). In this model, the distribution system operator (DSO) applies dynamic tariffs (DT) and daily power-based network tariffs (DPT) to manage congestions induced by EVs and HP. Definitely, it uses demand as network flexibility but does not realize optimal power flows (OPF) [
12,
13].
Another source of flexibility to be taken into account is the variation of the demand in the industry. In the literature [
14,
15,
16,
17], it is studied how to implement this new concept to the distribution networks. However, no optimization of the power flow is carried out.
Optimising engineering problems involves three steps. The first part is based on the mathematical formulation of the problem to be solved. At this point we are in the various cases of optimization that are explained in the literature [
18]. The second part is to choose a programming environment and to model the equations for that specific environment. Nowadays there are many different types of languages, and therefore it is interesting to have a comparison between them, and this comparison is done in the literature [
19]. Finally, there is the choice of the solver that will do the solving and return the value of the objective function. There are many solvers, the most common being Gurobi, GLPK, CPLEX, and IPOPT.
With regard to the optimization of congested electricity distribution networks, this is explained in [
20], but no source of flexibility is used. OPF formulations have been analyzed in [
21,
22,
23]. One of them is a non-convex OPF. This implies that finding the global optimal solution cannot be guaranteed. To solve this, for radial networks, the convex second-order cone optimal power flow (SOCP-OPF) [
24,
25,
26] has been studied. While [
24,
25] study the properties of the SOCP-OPF formulation, ref. [
26] includes photovoltaic and diesel generators into the model.
The aim of this paper is to analyze two optimal power flow model formulations used in the literature: (i) the so-called bus injection model (BIM), a non-convex, non-linear optimal power flow model, and (ii) the branch flow model (BFM), a relaxed convex second-order cone optimization problem. Our contributions include a comparative evaluation of BIM and BFM in terms of network loss optimization, focusing on metrics such as execution time and loss minimization. In addition, these models can provide optimal battery scheduling based on specific battery capacities and locations. The objective of this battery scheduling is to reduce the load in distribution lines when a predefined threshold is exceeded, thereby ensuring the safety levels of the distribution networks.
In this work, we also evaluate the proposed models through a real congestion management case study. Our goal is to offer valuable insights and solutions for designing power distribution systems that are robust and resilient for a sustainable future.
The content of this study is structured as follows:
Section 2 describes the methodology used in this work, while
Section 3 includes the formulation of the first model, called the bus injection Model, the formulation of the second proposed model, called the branch flow Model, the formulation of the battery model and the objective function of the problem. The case study in
Section 4 shows the characteristics and peculiarities of the network under study. The simulation results are presented in
Section 5. Finally, in
Section 6, conclusions are drawn.
2. Methodology
The methodology shown in
Figure 1 describes two different optimization models for battery scheduling within an electricity distribution network. This methodology considers the parameters of the network, generation profiles, demand profiles, and battery parameters to create and execute the optimization analysis.
Module 1—Distribution network modelling: Using Pandapower, a Python-based software, this module constructs a detailed model of the distribution network. This process simulates the realistic network behavior and interactions.
Module 2—Power flow simulation: Using the standard Newton-Raphson method, this module performs a power flow simulation to determine critical metrics such as branch power flows, voltage deviations at each bus, and transformer loads. This simulation identifies potential network overloads and areas for improvement.
Assessment of loading criteria: An integral part of the methodology is the assessment of network assets against pre-defined DSO thresholds. Exceeding these thresholds triggers the implementation of the optimal battery charge/discharge schedule to mitigate congestion risks and improve network reliability.
Module 3—Optimization model comparison: This module entails a comparative analysis of two optimization models: the branch-current-based model (BIM) and the branch-flow model (BFM). The primary objective is to minimize overall network losses, adhering to the following criteria: BIM Optimization Model: This model formulates an admittance matrix encapsulating the power flow equations and network constraints, including battery model constraints and optimal congestion management strategies. The evaluation focuses on performance metrics such as execution time and the effectiveness of loss minimization. BFM Optimization Model: Contrasting the BIM, the BFM does not incorporate an admittance matrix but still models the power flow equations and network constraints, along with battery model constraints and optimal congestion management. The evaluation similarly emphasizes the efficiency in execution time and loss reduction. Finally, the optimization problem is solved using an interior point solver combined by the branch and bound for tracking the binary variables.
3. OPF Formulations
3.1. Bus Injection Model Formulation
The calculation of the variables in an electrical network is usually carried out using load flow. This method makes it possible to obtain the power flowing through the network and the different voltage or current values at each point in the network. However, the operation of the network entails the need to satisfy specific demands and safety constraints. The task of operating the network, therefore, is to fulfill this demand while complying with grid constraints and minimizing a specific objective function simultaneously. This operation is obtained by applying an optimization problem based on the load flow equations, which is called optimal power flow.
The bus injection model (BIM) equations require several network characteristics to be obtained. Specifically, it is first necessary to obtain the admittance matrix of the grid in order to carry out all the calculations. The admittance matrix is very well known, but in this article, its basis is recalled as being key to the development of the model in question.
The matrix size is n × n, where n is the number of nodes in the network. For its calculation, it is necessary to differentiate between the diagonal elements of the matrix and the off-diagonal elements. The method to follow for each is:
- (i)
Diagonal elements (): equals the sum of all admittances connected to bus i ().
- (ii)
Elements outside the diagonal (): equals the admittance between bus i and j () changed sign.
This gives the admittance matrix
. This can also be expressed as the sum of two matrices, the real part (
) and the imaginary part (
) of
, as shown in Equation (
1). This form is used in this model as it allows working only with real values, making the calculations much more straightforward.
First, the indices associated with the variables or parameters are shown in
Table 1. These indicate more precisely which specific element the variable or parameter refers to.
Table 2 shows the nomenclature of the variables used in this formulation, and
Table 3 depicts the required model parameters. These have a fixed value that is given by the network characteristic itself.
The BIM formulation is the most common formulation and is mainly based on node-related variables. The power balances at the nodes are shown in Equations (
2) and (
3).
This power is related to generation and demand according to Equations (
4) and (
5). In this way, power injected into the grid is considered positive and negative if consumed.
In order to solve the load flow, it is necessary to fix the voltage and angle of a particular node. As usual, the chosen Slack node corresponds to the connection to the high-voltage transformer. The modulus of the voltage and its angle are set according to (
6):
The main objective of this optimization is that the lines do not exceed a certain percentage of load. To achieve this, it is necessary to obtain variables concerning the lines and not only concerning the nodes. In this formulation, as seen in the (
8) and (
9) equations, the powers between nodes are calculated to impose a limit on them, thus limiting their load.
For the BIM model, the constraint is given by the maximum apparent power of the line, so the Equation (
10)
3.2. Brach Flow Model Formulation
A second-order cone problem (SOCP) is an optimization problem that is convex, leading to global optimum solutions. To obtain an SOCP using the BFM formulation and find a globally optimal solution, we make a relaxation of the equations, which is explained below.
The indices of this model add two more elements that take into account whether nodes are the origin or the destination of a line. This is seen in the
Table 4.
In this model, the bus voltage and line current are squared, and the angle of the voltages is not taken into account, as can be seen in
Table 5.
In the BFM model, no use is made of the admittance matrix, and the resistance and impedance of each line are used directly. Below is the
Table 6 with the parameters.
The second formulation of the optimal load flow is called the branch flow model (BFM). Unlike the previous one, this model uses mainly line variables instead of node variables and is designed for radial networks.
The slack node’s active and reactive power balances are shown in (
11) and (
12), respectively. This differs from the others as it will always be the source node of the lines and never the destination node. The balance at the rest of the nodes is detailed in (
13) and (
14). This considers the power losses caused by the resistance and inductance of the lines. The consumption at a node is equal to the input power minus the output power.
The consumption equations are shown in Equations (
15) and (
16). They represent the expected demand minus the power generated at that node. Unlike the BFM model, positive power is considered at a node if consumed and negative injected into the grid.
The voltage drop is expressed according to (
17). As in the previous case, the slack voltage is set to a specific value. These voltages refer to the bus voltage squared, just as the current is also the line current squared. This variable change makes it possible to obtain linear equations, facilitating their calculation. In addition, it should be noted that the admittance matrix is not necessary in this formulation.
The power flowing between nodes is expressed according to (
19). However, this constraint is clearly non-linear and also non-convex. This is a problem for its resolution, as it makes it challenging to obtain the global optimum of the problem. To solve it, the constraint is relaxed to transform into (
20), obtaining a convex constraint.
This relaxation, however, can lead to a physically meaningless result if the equality is not satisfied. For this reason, once the simulation has been carried out, it is necessary to check that the result obtained complies with the equality constraint. If this is not the case, the objective function must be modified, and an iterative process must be executed.
For the BFM model, according to the percentage of the maximum allowable load, the square of the current flowing through the lines is also limited according to the expression (
21).
3.3. Battery Model
Batteries have the unique ability to inject and absorb power flows in a controlled manner. This allows the load on a line to be dynamically adjusted and energy to be efficiently redistributed. Challenges such as grid congestion, integrating intermittent renewables, and improving power supply stability and quality can be addressed by harnessing this capability.
The battery variables are the same in both models and are discussed in
Table 7:
Subsequently, the battery-related parameters are also shown, which, as with the variables, are the same for both models. Below is the
Table 8 with the parameters.
Next, the sources of flexibility, in this case batteries, are modeled. Each battery’s state of charge (SOC) is calculated according to (
22). This considers the battery’s performance, which produces power losses when interacting with the grid.
Battery charging is limited to an operating range according to (
23) to increase the life cycle of the battery, as this avoids complete charge/discharge cycles. Each battery’s initial state of charge is shown in (
24).
The charging and discharging power of the battery is restricted according to (
25) and (
26), respectively. This ensures that the battery is constantly charging or discharging.
The power generated at nodes with flexibility is shown in (
27) and is equal to the discharge power minus the load power.
3.4. Object Function
The objective function is the last equation to be defined in the optimization problem, aimed at minimizing the network losses. Thus, in the first model, the objective function to be minimized is expressed as (
28):
On the other hand, in the second model, the objective function minimized is seen in expression (
29).
It can be seen that in both functions, the same is calculated but in different ways due to the different model formulations. However, this does not affect the result. In both models, the losses are minimized either by Ohm’s law or by the basic formulae for electricity transmission networks.
4. Case Study
The network used in the analysis of this study is a 116-node Spanish distribution network with a rated voltage of 25 kV, while the rated power at the first section (from node 1 to node 2) is 10.5 MVA. It consists of a mainline with two branches, as seen in
Figure 2. The characteristics and parameters of the network can be found in
Appendix A.
Focusing on the energy demand data of the network, these are distributed over the different nodes. The demand for each node in the network can be seen in
Figure 3. In this figure, the aim is to show the behavior of these nodes and to see the scale of magnitude of the consumption, which ranges between 0 and 0.6.
On the other hand, the aggregate demand at the slack node of such a network over a year can be seen in
Figure 4. It can be seen that there are some peaks in demand at 9 and 10 MVA. However, the demand remains relatively constant throughout the year at around 4 MVA base and 7 MVA peak. It should be noted that there are times when demand is 0, and this is supposed to be due to network maintenance days.
Note that if we look at the enlargement of
Figure 4, we can observe a periodicity in the behavior of consumption, where consumption is higher during the week than at weekends.
Once all the data are known, the optimal power flow models developed can be analyzed and tested.
5. Results
The results obtained have been validated with a load flow calculation tool (Matpower), verifying that the results comply with the power flow equations.
5.1. Line Congestion Analysis at the Initial Situation
Currently, the analyzed network does not have a source of flexibility. A series of power flows are carried out during different periods of high demand to check whether the network needs congestion mitigation mechanisms. Specifically, the most interesting analysis focuses on the week with the highest consumption from days 202 to 209, which corresponds to 22th July to 28th July. The overall result for all lines can be seen in
Figure 5.
As the above figure can be difficult to interpret, as an example, the result for the most congested line is shown in
Figure 6:
It can be seen that line 9 of the network is overloaded up to four times. Accordingly, the distribution system operator (DSO) is evaluating the installation of a flexibility source based on a battery at node 49 to avoid grid congestion.
5.2. Optimal Battery Operation for Grid Congestion Management
The proposed battery is planned to be installed at node 49, as the network configuration is a bifurcation network, with node 49 being the point where it splits in two. This is the optimal node to avoid the congestion.
Figure 5 shows how, from one line onwards, the distribution of the power circulating in the network drops considerably, and this change occurs at this node where there is a bifurcation.
The characteristics of the battery are shown in
Table 9. As an initial hypothesis, an initial state of charge of 50% is assumed, as this is not a very high and quite probable value.
With the introduction of the battery, we can start to decongest the network. We will limit the maximum apparent power that can circulate through the line to 90%. The limit is set at 90% for distribution system operator security reasons. This is because the predictions they make can be erroneous, thus ensuring that the network always works correctly.
To operate the battery optimally and avoid congestion, the optimal power flow explained in
Section 2 and
Section 3 is executed. The result of the battery operation is shown in
Figure 7.
It can be observed that the periods of congestion on line 9 have disappeared and that, in general, the grid operates more smoothly, i.e., its load percentage is lower in cases where optimal power flows are used, thanks to the use of the battery. The battery optimizes the operation of the network and reduces the load on the distribution lines by feeding and withdrawing energy from the network.
It will be on display that the optimal power flow of the line never reaches the safety limit set by the DSO (yellow discontinuous line); this is an important aspect to highlight as in some scenarios, the DSO forecast can be wrong, and this 10% safety limit prevents the network from operating under stress.
5.3. Comparison between the Two Optimization Models
We will compare the two models in different areas of interest to decide which is more optimal and scalable once we have seen that the two models are valid for decongesting the network.
On the one hand, we will focus on battery usage. If we look at
Figure 8, we can see that both models’ instantaneous state of charge is the same. This is quite logical, as they both optimize the SOC.
Figure 9 shows the change in the behavior of the stresses of the nodes during optimization; it can be seen that these generally have smaller and flatter peaks. However, as there were no problems before, now there are no problems either, although the behavior is better.
On the other hand, a box/whisker plot is used to analyze the result of the objective function. In
Figure 10, it is possible to see that the function of the BFM model is slightly better than that of the BIM model. If we calculate the real error between the two solutions, we can see that the maximum difference is 0.11641 in the first iteration. This difference decreases as the days go by.
Then, the modelstat of the optimizations is studied, as it gives us information about the model concerned: validation of the model, effective optimization, and the possibility of generalizing to new scenarios. In our case, the modelstat for the two models is different. For the BIM model, it is 8, which in GAMS means proven optimal, meaning that it has been mathematically proven to meet all the requirements of the problem but that the model does not assure you that it is the best solution. However, in the BFM it is 1, which in GAMS means globally optimal, meaning that it is the best probable solution.
When looking at the results concerning the computational time of operation of each model in
Figure 11, it can be seen that the time taken by the BFM to perform each optimization is approximately four times longer than the BIM model.
Specifically, in
Table 10, the calculation time of each period is analyzed, leaving a list of the values of the 7 optimized periods.
6. Conclusions
This paper investigates asset congestions in power distribution lines, which could occur due to increasing electrification. This work compares two optimal power flow models, the bus injection model and the branch flow model, to minimize losses and mitigate the congestion. The study demonstrates that these models maintain congestion below 90% of the line capacity, highlighting the identical resource management efficiency of both models. Another interesting finding is that battery usage is identical in both formulations when mitigating line congestions, indicating consistent resource management.
In addition, the objective function value of the BFM model was slightly higher than that of the BIM model, underlining the effectiveness of the proposed formulation The maximum difference between the two solutions in the simulation of one day is 0.11, corresponding to the first day simulated; the following days, the error between the two models is of the order of 0.01. In this case, the relaxation gap remains zero throughout the optimization period, suggesting robustness in solving the proposed problem. In terms of computation times, the BIM model is notably more efficient than the BFM as observed in
Table 10, in practically all simulation periods the computation time of the BFM is four times longer than the computation time of the BIM. However, it is important to consider that the BFM model achieves a global optimum. In the case study of this paper, the results of the objective function are quite similar. However, generally speaking, BIM cannot ensure finding a global optimum.
Finally, when observing the voltage drops in the network nodes, it can be seen that even though there are no problems with the voltage limits, when the optimization is carried out and the battery is introduced, the levels improve with respect to the initial case; specifically, before introducing the battery, the voltage peaks dropped to 0.992 pu and now only to 0.994 pu, as can be seen in
Figure 9. It should be noted that, in the battery state of charge, in this case the results of the BIM and the BFM are identical.
For future research directions, it is suggested to explore the integration of demand-side flexibility or electric vehicles to alleviate excessive stress on batteries. This approach would leverage three sources of flexibility and enhance adaptability within the electricity grid. Such areas offer new opportunities to further improve the efficiency and management of the electricity system. In addition, it is also suggested to introduce different renewable generation sources, such as photovoltaic or wind, together with their respective generation profiles to analyze the dynamic behavior of the grid.