Introduction

Currently, every nation on earth is working very hard to find solutions to the effects of climate change and the increasing demand for electrical power. Due to the substantial need for power, the associated requirement exists for research pertaining to the production and scheduling of clean energy sources, which necessitates the consideration of stochastic factors. Due to financial and ecological concerns, traditional electricity plants may help in certain ways with power transmission across wide distances. In that manner, the need to mitigate power losses and maintain harmonic distortions within the prescribed ranges has emerged as a critical concern, driven by both practical and financial considerations [1]. The effective delivery of power demand may be decreased if the harmonic distortions exceed their respective limits. The increasing rate of harmonic distortions resulting from common usage of nonlinear loads leads to harmonic limit violations during the transmission of electrical power to fulfill the needs for electricity throughout the distribution system [2,3,4,5,6]. However, the administration of uncertainties related to PV systems, which provide substantial risks for distribution system security, is a serious problem due to their broad application [7]. Scientists have undertaken studies for optimal PV-based distributed generation (DG) unit interconnection to minimize power losses in distribution systems. In the context of PV systems installed in distribution networks, it is important to assess power loss and harmonic distortions. However, solar radiation and electricity load uncertainties pose challenges in this evaluation. To address these challenges, probabilistic distribution system analysis is needed to be employed to ensure the provision of the necessary power to meet demands [8,9,10,11]. The use of stochastic chance constraints in the planning of solar PV systems within the distribution networks, as opposed to relying only on deterministic constraints, has the potential to enhance power efficiency and reliability.

As an important power quality issue, the harmonic is regarded as a problem to be minimized from the power system standpoint [12, 13]. The common utilization of nonlinear loads that occupy prominent places in the electricity grids gives rise to the expansion of this problem. The electric distribution system users may be negatively affected unless a suitable implementation of planning is carried out by considering harmonic distortion in these power networks. However, the power quality can be optimized by properly applying the optimization procedure in power distribution networks. In the literature, there are several studies that consider the effects of harmonics on power systems and the precautions performed to minimize this power quality problem [14,15,16,17,18,19,20,21]. In [14], plug-in electric vehicles have been implemented to prevent harmonic problems in the multi-objective optimization approach. It is important to note that the minimization of harmonics can provide advantages in both technical and economic ways. An optimization algorithm has been proposed to alleviate the total demand distortion related to the current by taking into account passive filters and power quality parameters [15]. The harmonic power quality is the most prominent issue that can be improved to maintain the reliability and security of distribution system users. In [16], the distorted power system with nonlinear equipment has been handled to minimize total harmonic distortion of voltage and current by optimizing the parameters of the hybrid active power filter. An evolutionary approach based on a colonial competitive algorithm has been proposed for the minimization of harmonics in power electronics multilevel inverters in [17]. In [18], a harmonic minimization technique, which uses artificial neural networks to reduce harmonics in cascade multilevel inverters, has been proposed. The harmonics have been reduced by the use of meta-heuristic optimization techniques in multilevel inverters in [19]. In [20], the techniques for quickening the process of harmonic reduction have been presented by applying the GA-based approach. The active filter design has been performed to alleviate harmonic problems by utilizing fuzzy logic approach with the consideration of varying load conditions in [21]. On the other hand, the renewable-based DGs have not been taken into account for the interconnection into power systems in these methodologies.

The harmonic problem has great prominence since the impacts of renewable systems and nonlinear loads have motivated researchers to examine active power networks by including this power quality issue [22,23,24]. However, the harmonic-related issues can present limitations on the renewable DG hosting capacity. In this context, the renewable DG penetration levels have been improved by optimizing the passive filters and considering the harmonic power quality parameters [25, 26]. In [27], the minimization of current harmonics has been performed by the active filter implementation on the power electronics design of grid-connected renewable energy systems. The optimal control design for harmonic alleviation has been implemented by using meta-heuristic optimization algorithms in renewable energy systems, which are connected to the grid in [28]. The control approaches for harmonic minimization in grid-interfaced renewable energy systems have been discussed and presented in [29]. In [30], the active filter design has been proposed for harmonic minimization in grid-connected solar PV and wind turbine sources. In [31], the overall harmonic distortions have been assessed and observed when the various solar PV sources and nonlinear loads have been integrated into the distribution system. The harmonics assessment study has considered by the installation of solar PV-based renewable energy generation units on the distribution grid in [32]. The harmonic evaluation research has been conducted to analyze harmonic distortions in PV-installed grids under various scenarios in [33]. On the other hand, active power loss minimization is also an important problem that can be considered in renewable-integrated distorted distribution grids [34,35,36,37,38].

The studies associated with the influences of renewable DG systems on both power system line losses and harmonic parameters have been implemented by scientists over the past decade [39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56]. In [39], the influences of inverter-based DG systems on the total losses of the distribution grid have been examined by considering harmonic analysis studies. The energy loss minimization problem has been taken into account together with the optimal capacitor installation in DG-integrated distorted distribution networks [40, 41]. It is worth noting that the optimal placement of DG units can give rise to several advantages in terms of minimization of harmonic and power loss problems. The main reason is that power quality gains importance as electricity demands and nonlinear loads gradually increase in the distribution systems. In this context, the annual energy losses have been minimized by performing optimal DG plans for different load levels in the distribution grids with nonlinear loads [42]. The effective utilization of power generated by renewable energy systems is important for maintaining power quality. In [43], the optimal sizes of renewable DGs such as solar PV and wind systems have been investigated while implementing harmonics and power loss minimization in the optimal power flow. The optimization framework, including power losses and harmonic distortions, has been applied to the PV-installed distribution grid in [44]. To observe the impacts of optimal PV allocation, these problems have also been taken into account by including hosting capacity and distribution system reconfiguration in [45] and by considering different load models in [46]. In [47], the optimal DG placement and size have been determined for minimizing harmonic distortions and power losses and improving the voltage profile in the distribution grid by applying a meta-heuristic optimization approach. In [48], the multi-objective optimization framework has been proposed for optimal placement of PV-based DGs and optimal minimization of power losses and harmonic distortions. The optimization problem has been handled by minimizing harmonics and power loss-related issues on renewable energy systems-installed grid in [49]. The optimal DG placement has been implemented to improve losses and harmonic distortions on the distribution network in [50]. The optimal placements and sizes of solar PV and wind turbine sources have been conducted to solve power loss and harmonic distortion minimization problems by considering the uncertainties in loads and renewable energy systems in [51]. In [52], the meta-heuristic optimization approach has been proposed to handle power loss, harmonic, and resonance problems by determining the optimal DG allocation and capacity. In [53], the authors have proposed an optimization approach for obtaining the optimal DG placement and determining the impacts of harmonic distortions on losses. A combined approach has been presented to determine the optimal DG placement and size by minimizing power losses and harmonic distortions and improving voltages on the power network in [54]. The optimal DG placement and capacity problem has been handled by minimizing power losses, maintaining harmonic distortions, and improving voltage profiles on distribution grids in [55]. However, the aforementioned methodologies have been performed in a fully deterministic optimization environment, and these methodologies have not been considered in chance-constrained programming. In [56], the loss minimization problem has been considered for the determination of PV system capacities by taking into account harmonic distortions. In the related study, an analytical method developed jointly with MCS has been employed in the distribution grid. The importance of minimizing power losses and harmonic distortions in ensuring a reliable and uninterrupted power supply to meet demands has become evident based on the evaluation thus far.

Literature gap and motivation for present research work

Nonetheless, a gap exists in the literature about the minimization of losses within the framework of meta-heuristic and stochastic optimization, specifically in relation to harmonic-based chance constraints for various confidence levels (CL) and solar radiation scenarios. The current paper investigates the influence of variabilities in the PV system generation on power losses by considering various solar radiation distributions and CLs. The stochastic optimization approach has been implemented by taking into account harmonic-based chance constraints. A comparative analysis between the proposed approach and the existing literature has been provided in Table 1.

Table 1 The comparative analysis between the proposed approach and the existing literature

The novelties and contributions of the proposed approach presented in this study are as follows:

  1. 1.

    The chance-constrained optimization to determine optimal capacities of PV systems in distribution networks considering power loss and harmonic power quality parameters under a stochastic programming framework by considering different CLs and solar radiation scenarios.

  2. 2.

    This study performs MCS in conjunction with GA to address uncertainties. The pdfs for UTHD, UIHDh, and URMS have been obtained for utilizing a chance-constrained framework.

  3. 3.

    The uncertainty effects of PV systems on grid losses for various solar radiation conditions are also investigated. Specifically, the paper aims to evaluate these impacts within the context of stochastic limits.

  4. 4.

    This study presents a valuable contribution by integrating GA and MCS into a unified approach. The PV system sizing problem has been addressed inside the distribution system using a chance-constrained framework.

  5. 5.

    MCS-embedded GA methodology has been compared with DE in terms of demonstrating the effectiveness of the proposed approach.

The remaining sections of the study are given as follows: The admittance matrix-based harmonic power flow analysis has been presented in the “Methods” section with a probabilistic chance-constrained optimization structure. The modeling and details of the investigated cases have been illustrated in the “Methods” section, with case studies in the “Case studies” section. The simulation results have been presented in the “Results and discussion” section. The conclusions have been given in the “Conclusions” section.

Methods

Harmonic power flow analysis and probabilistic optimization structure

The implementation of harmonic power flow analysis is an important problem from a power quality standpoint. Additionally, handling the power loss minimization problem by using the load flow technique is an extremely challenging task. The strategy that has been essentially recommended in order to successfully carry out the optimization framework calls for an attempt to be made. Consequently, the power flow analysis related to the optimization problem can be performed from a scientific standpoint in order for such an analysis to potentially constitute a viable option. In this present study, the admittance matrix-based harmonic power flow analysis [57] has been taken into account for determining the harmonic power quality parameters in the distribution system. According to the harmonic load flow approach, the harmonic power flow equations are solved for each harmonic degree in a decoupled manner, as in the following:

$${I}_{h}^{{\text{bus}}} = {Y}_{h}^{bus}{V}_{h}^{{\text{bus}}}$$
(1)

where \({I}_{h}^{{\text{bus}}}\) is the vector demonstrating the sum of harmonic currents of PV systems and nonlinear loads for \({h}^{th}\) harmonic order, \({Y}_{h}^{{\text{bus}}}\) is the harmonic-based admittance matrix for \({h}^{th}\) harmonic order, and \({V}_{h}^{{\text{bus}}}\) is the vector of harmonic bus voltages for \({h}^{th}\) harmonic order.

Reducing the power losses associated with the distribution system is the primary purpose of probabilistic, chance-constrained programming, considering the uncertainties in the current study. The planning is necessary to maintain the power quality of the grid in order to minimize network losses and preserve the harmonic-based chance constraints. As a consequence, the losses can be technically viable by delivering the essential PV system capacity over the distribution system.

In this paper, the expected optimal power losses have been alleviated by taking into account harmonic-based chance constraints. The GA approach has been implemented to solve this problem under a stochastic optimization structure in the distribution system. Solar radiation and electrical demand have uncertainties in the optimization framework. The harmonic power quality parameters, which are UTHD, UIHDh, and URMS, have been included in the optimization problem as harmonic-based chance constraints. In the optimal expected power loss minimization problem, the GA approach has been performed with the MCS algorithm. The objective function of expected power loss has been given as follows:

$$f=\frac1{\text{NS}}\sum\limits_{s=1}^\text{NS}\sum\limits_{\text{LN}=1}^\text{NLN}{\mathrm R}_\text{LN}\left|I_\text{LN}^s\right|^2$$
(2)

where \(NS\) is the total number of solar radiation or electricity load states in the planning framework, \(NLN\) is the total number of lines in the distribution system, \({R}_{{\text{LN}}}\) is the resistance of the \({{\text{LN}}}^{th}\) line, and \({I}_{{\text{LN}}}^{s}\) is the line current flowing through the \({{\text{LN}}}^{th}\) the line on the distribution network for \({s}^{th}\) state of solar radiation and electricity load, respectively. The harmonic-based chance constraints are presented as:

$$Pr\left\{{{\text{UTHD}}}^{m,s}(\%)\le {{\text{UTHD}}}^{{\text{max}}}(\%)\right\}\ge {\alpha }_{{\text{UTHD}}} \begin{array}{c}m=1,\dots ,{\text{NLB}}\\ s=1, \dots ,{\text{NS}}\end{array}$$
(3)
$$Pr\left\{{{\text{UIHDh}}}^{m,s}(\%)\le {{\text{UIHDh}}}^{{\text{max}}}(\%)\right\}\ge {\alpha }_{{\text{UIHDh}}} \begin{array}{c}m=1,\dots ,{\text{NLB}}\\ s=1, \dots ,{\text{NS}}\end{array}$$
(4)
$$Pr\left\{{{\text{URMS}}}^{{\text{min}}}\le {{\text{URMS}}}^{m,s}\le {{\text{URMS}}}^{{\text{max}}}\right\}\ge {\alpha }_{{\text{URMS}}} \begin{array}{c}m=1,\dots ,{\text{NLB}}\\ s=1, \dots ,{\text{NS}}\end{array}$$
(5)

where \({{\text{UTHD}}}^{m,s}(\%)\), \({{\text{UIHDh}}}^{m,s}(\%)\), and \({{\text{URMS}}}^{m,s}\) are total voltage harmonic distortion percentage, individual voltage harmonic distortion percentage for \({h}^{th}\) harmonic order, and RMS voltage value at bus \(m\) of the distribution system for \({s}^{th}\) state of solar radiation and electricity load, respectively. \({{\text{UTHD}}}^{{\text{max}}}(\%)\) is the maximum total voltage harmonic distortion percentage, \({{\text{UIHDh}}}^{{\text{max}}}(\%)\) is the maximum individual voltage harmonic distortion percentage for \({h}^{th}\) harmonic order, \({{\text{URMS}}}^{{\text{min}}}\) is minimum RMS voltage value, and \({{\text{URMS}}}^{{\text{max}}}\) is maximum RMS voltage value, respectively. \({\alpha }_{{\text{UTHD}}}\), \({\alpha }_{{\text{UIHDh}}}\), and \({\alpha }_{{\text{URMS}}}\) are the CLs corresponding to UTHD, UIHDh, and URMS, respectively. \({\text{NLB}}\) is the total number of buses in the distribution grid.

With the consideration of penalty function methodology, the total objective function has been obtained by taking into account harmonic-based chance constraint violations:

$${f}^{{\text{total}}} = \begin{array}{c}\begin{array}{c}\frac{1}{{\text{NS}}}\sum\limits_{s=1}^{{\text{NS}}}\sum\limits_{{\text{LN}}=1}^{{\text{NLN}}}{R}_{{\text{LN}}}{\left|{I}_{{\text{LN}}}^{s}\right|}^{2}\\ +{{\text{penmul}}}_{{\text{UTHD}}}\sum\limits_{m=1}^{{\text{NLB}}}\left|{\theta }_{{\text{UTHD}}}^{m}-\left(1-{\alpha }_{{\text{UTHD}}}\right)\right|\\ +{{\text{penmul}}}_{{\text{UIHDh}}}\sum\limits_{m=1}^{{\text{NLB}}}\sum\limits_{h}^{{\text{NH}}}\left|{\theta }_{{\text{UIHDh}}}^{m}-\left(1-{\alpha }_{{\text{UIHDh}}}\right)\right|\end{array}\\ +{{\text{penmul}}}_{{\text{URMS}}}\sum\limits_{m=1}^{{\text{NLB}}}\left|{\theta }_{{\text{URMS}}}^{m}-\left(1-{\alpha }_{{\text{URMS}}}\right)\right|\end{array}$$
(6)

where

$${\theta }_{{\text{UTHD}}}^{m}=1-Pr\left\{{{\text{UTHD}}}^{m,s}(\%)\le {{\text{UTHD}}}^{{\text{max}}}(\%)\right\} \begin{array}{c}m=1,\dots ,{\text{NLB}}\\ s=1, \dots ,{\text{NS}}\end{array}$$
(7)
$${\theta }_{{\text{UIHDh}}}^{m}=1-Pr\left\{{{\text{UIHDh}}}^{m,s}(\%)\le {{\text{UIHDh}}}^{{\text{max}}}(\%)\right\} \begin{array}{c}m=1,\dots ,{\text{NLB}}\\ s=1, \dots ,{\text{NS}}\end{array}$$
(8)
$${\theta }_{{\text{URMS}}}^{m}=1-Pr\left\{{{\text{URMS}}}^{{\text{min}}}\le {{\text{URMS}}}^{m,s}\le {{\text{URMS}}}^{{\text{max}}}\right\} \begin{array}{c}m=1,\dots ,{\text{NLB}}\\ s=1, \dots ,{\text{NS}}\end{array}$$
(9)

where \({{\text{penmul}}}_{{\text{UTHD}}}\), \({{\text{penmul}}}_{{\text{UIHDh}}}\), and \({{\text{penmul}}}_{{\text{URMS}}}\) are the penalty factors multiplied by the harmonic-based chance constraints in case of violations, \({\theta }_{{\text{UTHD}}}^{m}\), \({\theta }_{{\text{UIHDh}}}^{m}\), and \({\theta }_{{\text{URMS}}}^{m}\) are the probabilities of the constraint violations in UTHD, UIHDh, and URMS at bus \(m\) of the distribution system, respectively. The total distribution system’s expected power losses are minimized by maintaining the harmonic-based chance constraints as presented in (6). The penalty factors are multiplied when the harmonic-based chance constraint violations are observed [58]. The optimal result is searched in case the limit violations cause a greater power loss in the total objective function.

Choosing the appropriate size considering the integration of the PV systems is one of the most important factors in determining how well the planning is accomplished on the power system, which is an important fact to highlight. The PV system integration can be implemented by optimizing the appropriate capacity, which also has the potential to deliver the planning decision. Determination of the optimal PV system output power by stochastic planning is necessary for minimizing power losses and maintaining chance constraints.

In this paper, the PV system’s capacities are optimized by taking into account expected power losses and harmonic power quality parameters under chance-constrained programming. The optimal PV system sizes are the decision variables to be determined. The optimal PV system output power at every candidate bus in the distribution system is given as follows:

$$X=\left({x}_{PV}^{1},\dots ,{x}_{PV}^{m},\dots ,{x}_{PV}^{{\text{NPV}}}\right)$$
(10)

where,

$$x_{PV}^\text{min}\leq x_{PV}^m\leq x_{PV}^\text{max}\;m=1,\dots,\text{NPV}$$
(11)

where \({x}_{PV}^{m}\) is the optimal PV system size at bus \(m\) of the distribution system, \({x}_{PV}^{{\text{min}}}\) and \({x}_{PV}^{{\text{max}}}\) are the minimum and maximum limits for the PV system capacity at bus \(m\) of the distribution network, \({\text{NPV}}\) is the total number of candidate buses for PV systems on the distribution system, respectively.

The planning procedure stages for handling the stochastic optimization problem are given in the following:

  1. 1.

    The distribution grid data, pre-defined PV system bus allocations, and harmonic source current components are inputted.

  2. 2.

    The electricity load and solar radiation states are produced from the normal and beta probability density functions, respectively [59].

  3. 3.

    In the GA optimization framework, the population is initialized by considering the PV system output powers.

  4. 4.

    Apply the MCS algorithm by considering the present state of the electricity load and solar radiation \(\left(s=1,\dots ,{\text{NS}}\right)\). Implement stage 7 if all solar radiation and electricity load states are taken into account.

  5. 5.

    UTHD, UIHDh, and URMS are determined at every node of the distribution grid by performing an admittance matrix-based harmonic power flow algorithm for \({s}^{th}\) state.

  6. 6.

    Stage 4 is performed.

  7. 7.

    The probabilistic distributions for UTHD, UIHDh, and URMS are evaluated.

  8. 8.

    The probabilistic distributions of UTHD, UIHDh, and URMS are taken into account for constraint violations. The constraint violation probabilities are evaluated by calculating the mathematical integration of probability density functions over the constraint violation intervals [60]. The example showing this calculation has been presented in Fig. 1 for the harmonic parameters. As per IEEE 519 Standards [61], UTHD and UIHDh maximum limits are prescribed at 5% and 3%, respectively. The minimum and maximum limits of URMS are 0.9 pu and 1.1 pu. As presented in Fig. 1, the K and M areas show the CLs and the L and N areas depict the constraint violation probabilities for UTHD and UIHDh, respectively. The R area shows the CL for URMS, while the P and S areas demonstrate the constraint violation probabilities for URMS.

  9. 9.

    The harmonic-based chance constraints are controlled based on the maintenance of CLs.

  10. 10.

    With consideration of each chromosome, the total objective function is evaluated by dealing with the harmonic chance constraints of UTHD, UIHDh, and URMS.

  11. 11.

    The total objective function is calculated by taking into account the penalty factors for multiplying with the harmonic chance constraint violations when the limits are not satisfied.

  12. 12.

    When the optimization planning criteria are met, the optimal PV system sizes are printed. Otherwise, stage 3 is performed.

  13. 13.

    The optimization outcomes are validated by taking into account harmonic-based chance constraint violations.

Fig. 1
figure 1

The pdf of a UTHD, b UIHDh, c URMS on the distribution system

The flowchart of the probabilistic optimization structure is presented in Fig. 2. In addition, the validation stage of the determined optimization results is illustrated in Fig. 3.

Fig. 2
figure 2

The flowchart of probabilistic optimization structure

Fig. 3
figure 3

The validation stage of determined optimization results

Modelling and details of investigated cases

In the present article, first, the bus allocations, at which the PV system output powers will be integrated into the distribution system, have been inputted. The electricity load and solar radiation states, which have been produced by the respective probability density functions, have then been entered. The population that demonstrates the PV system’s capacities has been started by the GA framework in a random manner. During the GA optimization approach, the PV system output powers have been iteratively produced for the upper level of the optimization framework. The UTHD, UIHDh, and URMS at all buses have been calculated by carrying out the load flow approach by taking into account all electricity demand and solar radiation states in the MCS algorithm for the lower level of optimization framework.

The probability density functions for the harmonic power quality parameters have been obtained with the aid of the MCS approach. Then, the probability density functions for these parameters have been considered in terms of limit violations. The value of the objective function has been obtained by utilizing the factors for penalizing the chance constraints in cases of violations. The optimal PV system output powers determined in GA have been achieved when the criteria of the planning process have been maintained.

In the validation stage of the results, the optimal PV system capacities and distribution system data have first been entered for verification. After that, the MCS approach was conducted to determine the harmonic power quality parameters by performing the load flow algorithm, considering all electricity demand and solar radiation states. At the end of MCS, the probability density functions for these parameters have been obtained. Finally, the limit violation probabilities have been determined for distribution system constraints.

Case studies

The two different solar radiation scenarios, each having 1000 states, have been taken into account by generating from the beta pdf in the probabilistic chance-constrained optimization structure. The probability distributions for these solar radiation scenarios have been presented in Fig. 4.

Fig. 4
figure 4

The probability distributions for solar radiation in a scenario 1, b scenario 2

In this paper, the probabilistic chance-constrained optimization structure has been implemented on 33 bus distribution system with a total demand of 6 MVA. The one-line diagram of this distribution grid is illustrated in Fig. 5.

Fig. 5
figure 5

The 33 bus distribution grid

The distribution grid electrical load, having 1000 states, has been considered by producing from the normal pdf in the optimization structure. The produced electrical load standard deviation has been assumed to be 10% with regard to the original load. The load states are given in Fig. 6.

Fig. 6
figure 6

The electrical load states of the distribution grid

The nonlinear load, which is a six-pulse variable frequency drive (VFD), has been considered in 33 bus distribution network. The harmonic current spectrum of this nonlinear load has been taken from [57]. The nonlinear load powers and buses have been considered as shown in Table 2. The PV system and nonlinear load harmonic current spectra have been presented in Table 3.

Table 2 Nonlinear load buses and powers
Table 3 Harmonic spectra

Results and discussion

In this paper, the parameters of the GA optimization algorithm, which are tolerance in objective function, maximum number of iterations, population size, and crossover rate, have been chosen as 10−6, 200, 30, and 0.8, respectively. These GA parameters have been presented in Table 4.

Table 4 GA parameters considered in this study

The PC with a 2.80-GHz CPU has been used to perform the probabilistic optimization simulations. The nominal PV system output power has been considered at 500 kW for every candidate node in the distribution network. The PV system candidate nodes have been regarded as 5, 11, 16, 17, 19, 22, 24, 25, 26, 28, 30, and 32, respectively.

Scenario 1

In scenario 1, the optimal PV system output powers have been determined by considering 0.85, 0.90, 0.95, and 0.99 CLs for UTHD, UIHDh, and URMS in the probabilistic optimization framework. The optimal capacities of PV systems have been presented in Table 5 for different CLs by implementing the GA optimization approach together with MCS.

Table 5 Optimal PV system capacities for different CLs

As presented in Table 5, the optimal power outputs of PV systems have been determined to be lower on some buses. The buses at which the lower PV system output powers have been obtained by the stochastic optimization process are 19 and 22 for 0.85 and 0.90 CLs, 5, 22, and 24 for 0.95 CL, 19, 22, and 25 for 0.99 CL. These buses have been limited by the harmonic-based chance constraints more than the other buses for the corresponding CLs.

The optimal expected power losses have been shown in Fig. 7 for different CLs in an iterative manner. The optimal power losses have been determined by 156.6 kW, 160.7 kW, 163.5 kW, and 172.6 kW for 0.85, 0.90, 0.95, and 0.99 CLs, respectively. The obtained PV penetration levels are 67.99% for 0.85 CL, 64.84% for 0.90 CL, 58.99% for 0.95 CL, and 54.21% for 0.99 CL. When the convergence has been provided, the number of GA iterations is 129, 75, 55, and 131, whereas the times for simulations are 43427.6, 25551.0, 17863.9, and 42598.5 s for 0.85, 0.90, 0.95, and 0.99 CLs, respectively.

Fig. 7
figure 7

The optimal expected power losses for different CLs

The optimal expected values of power losses for the higher CLs have been found to be greater than the lower CLs. As the CL gets lower, the total penetration level increases and the stochastic constraints relax. Thus, the voltage harmonic distortions increase due to the increment in the hosting capacity of PV systems, which are the harmonic sources in the distribution grid. As the CL increases, the influence of harmonic-based chance constraints on the total PV system capacity gets higher. In other words, the higher amount of total PV capacity is integrated into the distribution system for lower CLs. The expected values of power losses are minimized by the greater PV penetration level. As a result, the power losses get lower as the CL decreases.

In this paper, the DE approach has also been applied to the optimization problem in order to compare with the results determined by GA in scenario 1. For both GA and DE methodologies, the optimal power losses, and optimal PV system sizes are presented in Table 6 together with the number of iterations and simulation times for the convergence. The optimal power losses have been comparatively demonstrated in Fig. 8 for GA and DE methods.

Table 6 Comparison of probabilistic optimization results of GA and DE in scenario 1
Fig. 8
figure 8

Comparison of optimal expected power losses obtained by GA and DE in scenario 1

For scenario 1, the GA methodology has the superiorities in comparison with DE as presented in Table 6 and Fig. 8. For the DE algorithm, the optimal power losses have been obtained by 160.0 kW, 163.8 kW, 166.5 kW, and 174.5 kW for 0.85, 0.90, 0.95, and 0.99 CLs, respectively. The DE approach requires 200 iterations when the convergence is maintained. In addition, the simulation times are 162436.5, 164,381.9, 156719.4, and 156902.6 s for 0.85, 0.90, 0.95, and 0.99 CLs in the DE algorithm. GA and DE methodologies both converge to the optimal results. On the other hand, less computational time and iteration are required for GA in comparison with DE.

The maximum limits and optimal values of PV system output powers are installed at the distribution system for determining the limit violation probabilities in UTHD, UIHDh, and URMS for different CLs to validate the effectiveness of optimization results. This has been done by performing the admittance matrix-based harmonic power flow for 1000 electricity loads and solar radiation states with MCS. The limit violation probabilities have been presented in Table 7.

Table 7 Limit violation probabilities for harmonic parameters

As shown in Table 7, the harmonic-based chance constraint violations have been determined for UTHD and UIHD5 when integrating the maximum limits of PV system output powers. The alleviation of limit violation probabilities has been provided by the optimal values of PV system output powers. The UTHD violation probabilities have been completely mitigated by these optimal output powers. Moreover, the IUHD5 violation probabilities have been maintained to be within their limits for 0.85, 0.90, 0.95, and 0.99 CLs. The limit violation probabilities have not been observed for UIHDhs excluding the 5th harmonic and URMS before and after stochastic optimization. The harmonic-based chance constraint violations have been satisfied within their limits by the optimal PV system capacities for all CLs. The cumulative distribution functions of UTHD, UIHD5, and URMS at bus 14 of the distribution system have been presented in Fig. 9 by taking into account different CLs. The bus 14 is one of the most sensitive buses for harmonic currents in the distribution system. As given in Fig. 9, the UTHD, UIHD5, and URMS violation probabilities have been obtained within the limits of the optimal PV system capacities.

Fig. 9
figure 9

The cumulative distribution functions of harmonic parameters at bus 14 of the distribution grid

Enhancements in minimizing harmonics and power losses are the critical and major issues that are faced by power networks as a result of solar PV systems and demand uncertainties. A variety of benefits, including reductions in these problems, can be offered by the incorporation of PV in the electricity grids when the PV can be integrated in an optimal manner. The electricity network can be potentially affected by the significant number of PV systems hosting this network. This would make optimal power loss essential for ensuring the grid continues to function in a secure manner. How the applicant PV systems can be deployed in terms of optimal capacities is a matter of optimal power loss to be resolved. Improvements in terms of power losses and harmonics-related issues can be observed when the appropriate planning is implemented. The problem of power grid loss minimization by taking into account harmonic distortion and PV system size scheduling has been the focus of this present study, with consideration of stochastic techniques.

Scenario 2

In scenario 2, PV system capacities have been obtained by taking into account 0.85, 0.90, 0.95, and 0.99 CLs for UTHD, UIHDh, and URMS in the stochastic optimization structure. The optimal output powers of PV systems have been illustrated in Table 8 for different CLs by performing a probabilistic optimization framework.

Table 8 Optimal PV system capacities for different CLs

The optimal capacities of PV systems have been found to be lower on some buses. The buses, where the lower PV system capacities have been determined, are 5, 19, 22, 24, 25, and 32 for 0.85 CL; 5, 22, 24, 25, 30, and 32 for 0.90 CL; 5, 19, 22, 24, 25, 30, and 32 for 0.95 CL; and 5, 16, 19, 22, 25, and 26 for 0.99 CL. These nodes have been restricted by the harmonic-based chance constraints more than the remaining buses for the corresponding CLs.

The optimal expected power losses have been iteratively presented in Fig. 10 for 0.85, 0.90, 0.95, and 0.99 CLs. The optimal power losses have been obtained as 147.5 kW, 153.1 kW, 153.8 kW, and 162.1 kW for 0.85, 0.90, 0.95, and 0.99 CLs, respectively. The determined PV penetration levels are 28.59% for 0.85 CL, 28.27% for 0.90 CL, 26.91% for 0.95 CL, and 25.53% for 0.99 CL. When the optimization processes have converged, the number of GA iterations is 81, 61, 78, and 76, while the simulation times are 26691.2, 19570.7, 25046.9, and 24067.8 s for 0.85, 0.90, 0.95, and 0.99 CLs, respectively.

Fig. 10
figure 10

The optimal expected power losses for different CLs

The greater optimal expected values of power losses can be determined in the higher CLs when compared with the lower CLs. An increment in the total PV penetration level and relaxation in the stochastic limits are observed when the CL decreases. As a result of the increase in the total PV system penetration level, the harmonic distortions get higher values. The limitation impact related to harmonic chance constraints on the total PV system penetration level increases for the higher CLs. Therefore, the total PV system hosting capacity of the distribution network increases when the CLs decrease. The higher PV system penetration level can result in the minimization of optimal expected values of power losses. Thus, the decrease in the CLs can minimize the power losses.

In scenario 2, DE methodology has been implemented to the optimization problem for comparing the outcomes obtained by GA. The optimal power losses, optimal PV system capacities, number of iterations, and simulation times are illustrated in Table 9 by using GA and DE methods. The optimal power losses have been presented in Fig. 11 for GA and DE algorithms.

Table 9 Comparison of probabilistic optimization results of GA and DE in scenario 2
Fig. 11
figure 11

Comparison of optimal expected power losses obtained by GA and DE in scenario 2

For scenario 2, the GA approach has the advantages when compared to DE as illustrated in Table 9 and Fig. 11. By using the DE algorithm, the optimal power losses have been determined as 151.6 kW, 153.7 kW, 154.4 kW, and 164.6 kW for 0.85, 0.90, 0.95, and 0.99 CLs, respectively. In the DE algorithm, 200 iterations are needed for the convergence. Furthermore, the simulation times are 158997.6, 154804.7, 154941.2, and 152802.6 s for 0.85, 0.90, 0.95, and 0.99 CLs for the DE approach. Both GA and DE algorithms converge to the optimal outcomes. However, GA requires less computational time and iteration when compared with DE.

For obtaining the limit violation probabilities in harmonic parameters for different CLs, the maximum and optimal values of PV system capacities are integrated into the distribution grid to verify the efficacy of optimization outcomes. The limit violation probabilities have been illustrated in Table 10. As presented in Table 10, the harmonic chance constraint violations have been obtained for UTHD, UIHD5, and UIHD7 by installing the maximum limits of PV system capacities. In this scenario, the limit violation probabilities for maximum values of PV system output powers are greater than those in scenario 1. The reason is that the solar radiation conditions in scenario 2 are higher when compared to those in scenario 1. The limit violation probabilities have been minimized by the optimal PV system capacities. The violation probabilities of UTHD have been completely alleviated by these optimal capacities. In addition, the violation probabilities of UIHD5 have been satisfied to be within the limits for different CLs. Before and after the probabilistic optimization process, the harmonic limit violation probabilities have not been seen for URMS and UIHDhs except for the 5th and 7th harmonics.

Table 10 Limit violation probabilities for harmonic parameters

The cumulative distribution functions corresponding to UTHD, UIHD5, and URMS at bus 14 have been given in Fig. 12. As presented in Fig. 12, the UTHD, UIHD5, and URMS violation probabilities have been determined within their limits by the optimal PV system output powers.

Fig. 12
figure 12

The cumulative distribution functions of harmonic parameters at bus 14 of the distribution grid

When the optimal PV system sizes, which are obtained by GA for 0.99 CL, are integrated into the distribution network, the results of the harmonic load flow have been presented in Table 11 for scenario 2. It is worthy to note that these results have been obtained in the validation stage of optimization outcomes. During the validation stage, the optimal PV system sizes are installed at the distribution system, and the harmonic load flow analysis is performed for 1000 solar radiation and electricity load states under MCS. The harmonic power quality parameter results presented in Table 11 represent the outcomes, which are determined by performing the harmonic load flow for one of the solar radiation and electricity load states. These results include UTHD, UIHDhs for 5th through 49th harmonics, and URMS. As shown in Table 11, the harmonic load flow results are within their limits, which are prescribed by IEEE 519 Standards.

Table 11 The harmonic load flow results in 33 bus distribution network

Power losses and harmonic distortions are critical topics and significant issues faced by the electricity network. In today’s electricity networks, it is vital to handle continually rising electricity consumption while ensuring consistent energy supply to consumers by minimizing power losses and preserving harmonic constraints even in cases of uncertainty. This is because current electricity grid management is faced with enormous problems. The electricity network is now run in very difficult circumstances as a result of increasing consumption, which in turn affects the functioning of the grid. As a result of that, the network’s regime is altered by increasing power losses and harmonic distortions. In order to avoid power outages and grid breakdowns, both safety and confidence in the network are necessarily enhanced by the planning.

To reduce grid network losses, a suitable planning framework is important. Optimizing the PV system capacity allows for the minimization of both power losses and voltage harmonic distortions under stochastic and chance-constrained planning. On the other hand, the increase in these problems can be caused by insufficient planning, which can then give rise to significant issues. Therefore, the PV systems need to be sized in the most effective manner. The PV system capacities are scheduled, and harmonic-based chance constraints are met simultaneously in the process of minimizing power losses.

The positive points of proposed methodology

In this study, the positive points of the proposed methodology are as follows:

  1. 1.

    This paper implements the chance-constrained optimization to obtain optimal sizes of PV systems in distribution networks considering power loss and harmonic power quality parameters under a probabilistic programming framework by taking into account various CLs and solar radiation scenarios.

  2. 2.

    This study applies MCS together with GA to handle uncertainties. The pdfs for UTHD, UIHDh, and URMS have been determined for performing a chance-constrained framework.

  3. 3.

    The uncertain impacts of PV systems on network losses for different solar radiation conditions are considered. This paper evaluates these influences within the framework of probabilistic constraints.

  4. 4.

    This study shows a considerable contribution by implementing GA and MCS in a combined methodology. The optimal PV system capacity problem has been considered in the distribution system by proposing a chance-constrained framework.

  5. 5.

    In this study, the use of stochastic chance constraints in the planning of solar PV systems within the distribution network, as opposed to relying only on deterministic constraints, has the potential to enhance power efficiency and reliability.

  6. 6.

    MCS-embedded GA methodology has been compared with DE in terms of demonstrating the effectiveness of the proposed approach.

  7. 7.

    Both GA and DE have converged to optimal results. However, GA has required less computational time and iteration when compared to DE for scenarios 1 and 2.

In this paper, the stochastic optimization approach has been suggested for enhancing the performance of active distribution systems with uncertainties. The stochastic optimization method includes power loss minimization and optimal PV system sizes as important issues. In the present article, chance-constrained programming has been considered when optimally minimizing power losses and determining optimal PV system sizes in the distribution network. This has been done by performing GA methodology with a stochastic framework.

The UTHD, UIHDh, and URMS, which are obtained by harmonic load flow analysis, have been regarded as the chance constraints. These harmonic power quality parameters have been determined by taking into account the admittance matrix-based harmonic power flow analysis, which has been proposed in [57]. This harmonic power flow analysis method has been shown to present reliable and accurate results, as discussed in [57]. In this manner, the harmonic power flow analysis methodology, which has been applied in this present paper, has also presented meaningful results while implementing the chance-constrained stochastic approach.

In this study, the frameworks of GA and DE methodologies, together with the MCS approach, have been carried out for optimal execution of power loss minimization and determination of optimal PV system sizes. The planning has been performed under different scenarios of solar radiation. In [62], it has been shown that GA can discover meaningful results, and this methodology requires less computational time and iteration when compared with DE. In the related study, both GA and DE methodologies have been shown to present optimal results. Therefore, the GA and DE optimization results are meaningful and reliable in terms of optimal power losses, optimal PV system sizes, simulation times, and iterations when applying the stochastic optimization framework in this present paper.

Conclusions

This study addresses the challenge of optimal power loss within a stochastic optimization framework, accounting for variations in load consumption and solar energy production in a distorted distribution network across diverse solar radiation scenarios. As the installation of substantial solar power production grows, the strategic planning of optimal power loss becomes crucial for the reliable and financially sustainable operation of power grids. Minimizing power loss while considering harmonic distortions can be achieved through a stochastic approach. Optimizing the size of PV systems while adhering to harmonic-based chance constraint limitations is a viable solution to this issue. The simulation results presented in this paper lead to essential conclusions.

  • As the CLs increase, the optimal power losses also rise. The increment in the total PV system capacity and the decrease in the limitation impact of harmonic-based chance constraints are observed in the lower CLs.

  • The increasing total PV system capacity gives rise to greater voltage harmonic distortions. The total PV system penetration level can be limited by the harmonic chance constraints in higher CLs more than in lower ones.

  • Hence, the lower CLs can provide the distribution system with a higher PV system penetration level, which in turn has a minimization impact on the optimal expected values of power losses. Therefore, the lower CLs can result in the minimization trend of power losses.

  • The harmonic-based chance constraints are maintained to be within their limits by the optimal PV system capacities for all CLs under different solar radiation scenarios using the MCS and GA-based approaches.

  • In scenario 1, the optimal power losses for GA methodology have been determined by 156.6 kW, 160.7 kW, 163.5 kW, and 172.6 kW for 0.85, 0.90, 0.95, and 0.99 CLs, respectively. For the DE algorithm, the optimal power losses have been obtained by 160.0 kW, 163.8 kW, 166.5 kW, and 174.5 kW for 0.85, 0.90, 0.95, and 0.99 CLs, respectively. GA and DE methodologies both converge to the optimal results for scenario 1.

  • In scenario 2, the optimal power losses for GA have been obtained as 147.5 kW, 153.1 kW, 153.8 kW, and 162.1 kW for 0.85, 0.90, 0.95, and 0.99 CLs, respectively. By using the DE algorithm, the optimal power losses have been determined as 151.6 kW, 153.7 kW, 154.4 kW, and 164.6 kW for 0.85, 0.90, 0.95, and 0.99 CLs, respectively. Both GA and DE algorithms converge to the optimal outcomes for scenario 2.

  • When the convergence has been provided for scenario 1, the number of GA iterations is 129, 75, 55, and 131, whereas the times for GA simulations are 43427.6, 25551.0, 17863.9, and 42598.5 s for 0.85, 0.90, 0.95, and 0.99 CLs, respectively. The DE approach requires 200 iterations when the convergence is maintained. In addition, the DE simulation times are 162436.5, 164381.9, 156719.4, and 156902.6 s for 0.85, 0.90, 0.95, and 0.99 CLs in the DE algorithm. Thus, less computational time and iteration are required for GA in comparison with DE in scenario 1.

  • When the optimization processes have converged in scenario 2, the number of GA iterations is 81, 61, 78, and 76, while the GA simulation times are 26691.2, 19570.7, 25046.9, and 24067.8 s for 0.85, 0.90, 0.95, and 0.99 CLs, respectively. In the DE algorithm, 200 iterations are needed for the convergence. Furthermore, the DE simulation times are 158997.6, 154804.7, 154941.2, and 152802.6 s for 0.85, 0.90, 0.95, and 0.99 CLs for the DE approach. Hence, GA requires less computational time and iteration when compared with DE in scenario 2.