**1. Introduction**

This paper presents a mathematical model for the maximization of small-scale distributed generation (DG) into existing distribution networks (DNs). In multiple cases, the power generated by DG can result in significant operation condition changes of DN causing expensive capital investments in power system equipment and grid. To avoid such scenarios in a manner to facilitate DG penetration into the grid the model maximizes the integration of multiple DGs into the existing DN by using available active power management tools.

The DG connection into DN has become a vital option considering fighting climate changes, a lack of energy worldwide, and power production diversification. Investments in small-scale DG should increase in systems that allow its penetration. The use of traditional methods and tools for DN planning can significantly decrease DN hosting capacity and jeopardize power quality constraints. Hence, high penetration of DG into the DN has to be carefully planned and implemented by using technical and economic planning strategies.

Determination of maximal possible DG penetration into the distribution grids refers to the so-called maximum hosting capacity problem, which can be solved by using optimization tools and different methods. The maximum hosting capacity and DG allocation can be used for solving various problems that are recognized in the distribution system including power loss and energy loss minimization, hosting capacity maximization, voltage profile improvements, reliability enhancement, etc. Authors in [1–4] investigate the possibility of optimal allocation and sizing of DGs to reduce power losses. Photovoltaic (PV) allocation considering optimal grid reconfiguration for power loss reduction is also

presented in [5]. In [6], the benefit of DGs allocation is assessed to evaluate the cost of energy losses in DN by using the variable cost of energy. Authors in [7] define the DG allocation optimization problem while considering a multiobjective approach based on cost and benefits related to energy loss costs, system reliability, and cost of purchased energy from transmission grids. Papers with a focus on voltage stability enhancement and loss minimization by taking into account different types of DGs are presented in [8] that are based on the modal analysis and continuation power flow in [9]. In [10] authors presented a practical methodology to determine the dynamic hosting capacity for voltage variations due to power injections and harmonics introduced by distributed energy resources. The authors analyze the change of the levels of harmonic distortions and voltage profile change over a specific time period and its effect on network hosting capacity. Authors in [11] introduced an approach to determine suboptimal energy storage allocation based on voltage profile improvement, which prevents power quality deterioration and allows higher DGs penetration.

Many authors are solving maximum hosting capacity by putting DGs size and allocation as a primary objective function and using the DN flexibility for improving its hosting capacity. In [12] the second-order cone programming method is used for the maximization of PV capacity. In the method that uses genetic algorithms (GAs) optimal hosting capacity is maximized by introducing optimal network reconfiguration. Variation of the DG output is not considered in this method [13]. The heuristic approach is presented in [14] to optimize reconfiguration along with the size and DGs location. A mathematical method based on second-order cone programming is presented in [15]. In this paper, the authors considered topological reconfiguration as the only possible DN flexibility and compare the obtained results with previously fixed topology. The mixed-integer linear programming has been used in [16] for DN reconfiguration with possible connectors for DGs in all DN points. Authors in [17] propose a method for optimal placement DGs by using the loss sensitivity factor method. A multiobjective evolutionary algorithm is proposed by authors in [18] for the sizing and determination of the good locations for DGs by minimizing different functions such as the cost of energy losses, cost of service interruptions, the cost of network upgrading, and the cost of energy purchased. In [19] authors propose a multiperiod AC optimal power flow based technique for maximization of grid hosting capacity, which considers flexibilities such as voltage control and energy curtailment. In [20] the authors introduce streamlined capacity analysis, which provides a fast technique to calculate an impact from small-scale photovoltaics. Static and dynamic reconfiguration is applied in [21] for a multiperiod optimal power flow approach, which is used to assess DGs hosting capacity increment. Authors in [22] propose a maximum hosting capacity evaluation method while considering robust optimal operation and control of on-load tap changer transformers (OLTC) and static VAR compensators.

According to the previous insight in the existing literature, optimization methods for optimal allocation and sizing of DGs are various and include analytical methods, numerical methods, and heuristic methods [23]. Characteristics of analytic methods are their easy implementation and execution, but their results are often only indicative. On the other side numerical methods like nonlinear programming and linear programming usually have better convergence characteristics and can guarantee the determination of global optimum in the case of convex optimization problems. However mathematical programming methods are sometimes not suitable for complex DN and multiperiod programming due to a large number of binary variables in certain approaches. Third, heuristic methods are robust and can provide near optimum results for complex optimization problems [23].

Most of the approaches proposed so far, that address the grid hosting capacity problem, usually consider only a partial set of possible control options. Additionally, these approaches are usually defined as mixed-integer nonlinear optimization problems or they use metaheuristics methods to solve the optimization problem. Given the nature of the optimization problem formulation or the method used for the solution of the problem, such approaches cannot guarantee the detection of a global solution. For example, the approach proposed in [21] cast the grid hosting capacity problem as a mixed-integer nonlinear optimization problem while not considering OLTC or optimal DG allocation in

the formulation. Their approach regarding radiality constraints may be insufficient to ensure radiality in grids where there are some zero-injection nodes. Similar goes for the approach used in [16] with the difference that the model is cast as MILP. In addition to that previously mentioned, both of the approaches do not consider multiple operating scenarios derived from real measured data but rather use only the single worst-case scenario for the assessment. Other approaches that were mentioned in the literature overview in addition to the previous do not consider network reconfiguration.

Other approaches that use metaheuristic methods for example [3,4,6], etc. are not suitable to effectively handle the complexity of the model when all control/simulations options (multiscenario, optimal DG allocation and install capacity determination, topology optimization, DG power factor control, and OLTC operation) are taken into account.

From the literature review, it is obvious that there are many methods used for solving the DN hosting capacity problem. When using an approach based on mathematical programming it is very important, like in every other optimization method, to achieve a good convergence rate with low computational requirements. That is why the most mathematical programming models, which are used cannot be implemented in a complex DN and for multiperiod programming. The mathematical programming method based on the SOCP approximations proposed in this paper help to solve some of these issues. Hence, this paper involves effective discretization of time series data (consumption and DG production) by introducing multiperiod fragments thus giving insight into possible operating demand/production scenarios. Significant improvements, in terms of multiperiod optimization and network flexibilities, are achieved by time discretization and by including different network flexibilities (power factor control, OLTC control, and topology reconfiguration) within the hosting capacity optimization problem.

This paper has two significant contributions. First, it gives a possibility for taking into account multiple operating scenarios. This mathematical method is generalized and can be applied for multiperiod optimization (hourly and daily), but this would lead to inconvenient computational time, which is surpassed with scenarios discretization. The other contribution is related to the integration of proposed flexibilities, which allow increment in hosting capacity in existing DN by implementing flexibilities one at a time and combining them into one model. At the end of the paper, mathematical programming models are applied to the modified IEEE 33 bus test case to detect optimal network topology and DG capacity allocation by controlling the DG power factor, OLTC transformer operation, and grid topology configuration. The results are compared with the base model, which does not include any of the DN flexibilities.

## **2. Mathematical Formulation**

The objective function is presented with the following formulation:

$$\text{Minimize } \sum\_{i \in B^F, s \in S} P\_{\text{li}, s} - \sum\_{i \in \text{DI}, j \in \text{DG}\_i^{\text{loc}}, s \in S} P\_{\text{ij}, s}^{\text{DG}\_{\text{int}}} + \sum\_{(ij) \in \text{W}, s \in S} r\_{ij} \frac{p\_{i\text{j}, s}^2 + q\_{i\text{j}, s}^2}{v\_{i, s}^2} \tag{1}$$

The first term appearing in the formulation of the objective function represents the possibility of the export of the energy between the interconnected grids. The second term represents the total install capacity of distributed generation and the third is related to active power losses. The objective function is followed by the set of constraints defined as:

1. Bus active and reactive power balance:

$$\begin{aligned} \sum\_{\substack{i \in \{j, \} \in \mathcal{W}}} p\_{ij, s} &= \sum\_{\substack{(ij) \in \mathcal{W}, \ \text{s} \in \mathcal{S}}} r\_{ij}^{\frac{p\_{ij, s}^{2}}^{2} + q\_{ij, s}^{2}} + P\_{j, s}^{L} - P\_{j, s}^{\text{gen}} - P\_{j, s}^{\text{DG}\_{\text{int}}} + \sum\_{\substack{k \in \{j k\} \in \mathcal{W}, \ \text{s} \in \mathcal{S}}} p\_{jk, s}, & j \in \mathcal{B} \backslash \mathcal{F} \\\\ P\_{j, s}^{\text{gen}} &= \sum\_{k \in \{jk\} \in \mathcal{W}} p\_{jk, s} + P\_{j, s}^{L} - P\_{j, s}^{\text{DG}\_{\text{int}}}, & j \in \mathcal{B}^{F} \\\\ \sum\_{\substack{i \in \{j, i\} \in \mathcal{W}, \ \text{s} \in \mathcal{S}}} q\_{ij, s} &= \sum\_{\substack{i \in \mathcal{V}, \ \text{s} \in \mathcal{S} \end{pmatrix}}} x\_{ij}^{\frac{p\_{ij, s}^{2}}^{2} + q\_{ij, s}^{2}} + Q\_{j, s}^{L} - Q\_{j, s}^{\text{gen}} - Q\_{j, s}^{\text{DL}\_{\text{int}}} + \sum\_{\substack{k \in \mathcal{W}, \ \text{s} \in \mathcal{S} \end{pmatrix}}} q\_{jk, s}, & j \in \mathcal{B} \backslash \mathcal{B}^{F} \end{aligned} \tag{2}$$

2. Branch voltage drop (higher-order terms in the expression for branch voltage drop are left out to linearize the expression):

$$\begin{aligned} \upsilon\_{j,s}^2 - \upsilon\_{i,s}^2 \le r\_{ij} \big( p\_{ji,s} - p\_{ij,s} \big) + \ge\_{ij} \big( q\_{ji,s} - q\_{ij,s} \big) + M \big( 1 - y\_{ij} \big), \ i, j \in \mathcal{W} \\\ \upsilon\_{j,s}^2 - \upsilon\_{i,s}^2 \ge r\_{ij} \big( p\_{ji,s} - p\_{ij,s} \big) + \ge\_{ij} \big( q\_{ji,s} - q\_{ij,s} \big) - M \big( 1 - y\_{ij} \big), \ i, j \in \mathcal{W} \end{aligned} \tag{3}$$

3. Radial network constraints [24]:

$$\begin{aligned} z\_{ij} &\geq 0\\ z\_{ij} &= 0, \quad f \in B^F\\ z\_{ij} + z\_{j\bar{i}} &= 1, \quad \quad (i, \ j) \in W\backslash\mathscr{W}^S\\ z\_{i\bar{j}} + z\_{j\bar{i}} &= y\_{ij\prime} \quad (i, \ j) \in \mathscr{W}^S\\ \sum\_{j \subset \{i, j\} \in \mathscr{W}} z\_{j\bar{i}} &= 1, \quad i \in B\backslash\mathscr{B}^F\\ y\_{i\bar{j}} &\in \{0, 1\}, \quad (i, \ j) \in \mathscr{W}^S \end{aligned} \tag{4}$$

In the distribution networks, a large number of switching operations are even today done manually, given that most of the distribution network switchgear is not fully automatized and centrally controlled due to a lack of underlying communication infrastructure. In these networks, dynamic network reconfiguration is not an option given that every topology change would require a significant amount of time leaving certain consumers out of the operation. Given this, in the proposed model we did not consider dynamic network reconfiguration but a rather static reconfiguration. This means that we determined optimal network topology, which maximizes network hosting capacity, and this topology was kept constant in all considered operating scenarios. Optimal network topology was determined while also optimizing DG connection point and capacity. Modification of the proposed model to include dynamic network reconfiguration is a rather straightforward process that would additionally increase grid hosting capacity but probably not in the amount to apply such a complex operating procedure.

Given this, the proposed approach does not result in frequent network switchgear operation. Other control parameters considered in this paper, OLTC ratio and DG power factor control vary with load and DG production variations.

4. DG connection and capacity constraints:

$$\sum\_{j \in D\_i^{\text{lok}}} y\_{i,j}^{DG} \le 1, \quad \forall i \in DG \tag{5}$$

$$\begin{aligned} \sum\_{j \in DG\_i^{\mathrm{loc}}} P\_{i,j}^{\mathrm{DG}\_{\mathrm{int}}} & \leq P\_i^{\mathrm{DG}\_{\mathrm{max}}}, \ \forall i \in DG \\ 0 \leq P\_{i,j}^{\mathrm{DG}\_{\mathrm{int}}} & \leq y\_{i,j}^{\mathrm{DG}\_i} P\_i^{\mathrm{DG}\_{\mathrm{max}}}, \ \forall \left(i \in DG, \ j \in DG\_i^{\mathrm{loc}}\right) \end{aligned} \tag{6}$$

In real distribution networks, DSOs usually cannot force grid connection location upon *DG* investors to improve voltage stability if the *DG* unit is not the reason for the voltage stability problem. The *DG* investor, in the grid connection study, usually considers a couple of grid connection options and usually chooses the cheapest solution to maximize the profit. In the proposed mathematical model we define upfront the possible grid connection points for each *DG* unit separately. The number of possible grid connection points is arbitrary and the model allows one to consider each system bus as a potential connection point. Given that we simultaneously tried to maximize *DG* penetration, the model determines the optimal grid connection point and installed capacity. The model also reconfigures the network topology. Using these approaches, weak (critical) buses are correctly addressed with the model automatically because the algorithm will automatically "reshape" the network to tackle low voltage problems in parts of the grid due to high load or to tackle high voltage problems due to *DG* production. This is done through network reconfiguration (in the network segments, which are meshed) and optimal *DG* allocation in combination with OLTC control and *DG* power factor control.

5. *DG* power factor constraints:

$$\begin{aligned} \left| Q\_{i,j,s}^{\text{DG}\_{int}} = tg(\boldsymbol{\varrho})\_{i,j,s}^{\text{DG}\_{int}} \cdot \boldsymbol{P}\_{i,j,s}^{\text{DG}\_{int}}, & \; \forall \begin{pmatrix} i \in \text{DG}, & j \in \text{DG}\_i^{\text{loc}} \end{pmatrix} \\ \left| tg(\boldsymbol{\kappa} \text{cc} \cos(\boldsymbol{\varrho}))\_{i,j,s}^{\text{DG}\_{int}} \right| & \leq 0.326 \end{aligned} \tag{7}$$

6. On-load tap changer transformer constraints located in the interconnection substation [25]:

$$tr\_s = 
tau\_{\min} + n\_s \cdot \Delta tap\_\prime \quad 0 \le n\_s \le n\_{s, \max}, \ n\_s \in \text{integer}$$

$$\Delta tap = (tap\_{\max} - tap\_{\min}) / tap\_{\max} \tag{8}$$

$$v\_{1,s}^2 = tr\_s^2 \cdot v\_{0,s'}^2 \qquad v\_{0,s}^2 = \text{const.}$$

The OLTC is an important and very expensive part of a power transformer and the main cause of power transformer failures. The OLTC probability failure can be directly linked to the number of switching operations so the frequent tap change operation significantly reduces the component lifetime. Given that the proposed model approximates real time-series data with a set of representative operating scenarios that are not inter temporally linked, it is not possible to restrict or assess the frequency of tap changer operation and its effect on component lifetime. Once the proposed model determines optimal DG connection points and capacity and optimal network topology, an additional optimization model that optimizes network operation (losses reduction and voltage profile improvement) could be used to assess and limit the frequency of the tap changer operation. In such a model the limitations regarding the frequency of tap changers could be explicitly stated. A previous study regarding this matter indicates that the slow voltage changes could be handled without the too frequent operation of OLTC given that most *DG* units are also capable of providing voltage support usually in the power factor range 0.95 leading/lagging. Additionally, voltage support requirement is initially reduced by network topology reconfiguration, which will reorganize load and production across feeders to improve element loading and bus voltages while considering the defined operational scenario set. where:

