Introduction

With the continuous growth of electricity demand, the Distributed Generation (DG) in power systems has gradually received widespread attention (Lv et al. 2023). Distributed power generation, as a new type of power supply method, has low carbon, high efficiency, and reliability. It is considered an important component in the future power system. Traditional self-healing research in power systems mainly relies on centralized control strategy. Although this approach can to some extent meet the self-healing needs of the power system, it insufficient to handle complex faults in distributed distribution networks (Malekshah et al. 2022; Mu et al. 2021). Traditional methods are unable to fully leverage the advantages of distributed power sources due to their lack of flexibility and real-time performance, as well as their difficulty in handling the multi-source collaborative operation of distributed power sources. In addition, traditional research often has problems such as low accuracy and slow response speed for fault diagnosis and localization in distributed power distribution networks (Afsari et al. 2024; Guan et al. 2021). To overcome these limitations, an algorithm that combines Quantum Particle Swarm Optimization (QPSO) and Binary Particle Swarm Optimization (BPSO) is proposed in this study, namely the QPSO-BPSO algorithm. The QPSO algorithm can enhance its global search ability by simulating the principles of quantum mechanics and utilizing properties such as quantum bits and quantum entanglement. The BPSO algorithm processes discrete optimization problems through binary encoding, making it particularly suitable for optimizing switch states. The combination of the two algorithms can not only handle continuous power allocation problems, but also discrete switch state problems, providing an effective optimization method for fault self-healing in distributed power distribution networks. The QPSO-BPSO algorithm aims to improve the efficiency and reliability of self-healing in power systems, providing more feasible solutions for the safe operation of distributed power distribution networks. The innovation of the research is mainly reflected in the QPSO-BPSO algorithm and its application in fault self-healing of distributed power distribution networks. Based on optimization algorithms, the research aims to improve the efficiency and reliability of self-healing in power systems, while enhancing the real-time and flexibility, and better adapting to the multi-source collaborative operation requirements of distributed power sources.

The study consists of four parts. The first part reviews existing research. The second part is the structural design and optimization research of dynamic micro-grids based on QPSO-BPSO. The third part is the verification analysis of the dynamic micro-grid comprehensive optimization and self-healing control strategy. The last part summarizes the entire text.

Related works

To solve the power quality in distribution systems, different control strategies and technologies have been proposed. Krishna et al. adopted a novel control strategy called FOFLC. As an order control strategy, it was used to enhance the UPOC operation. A fine recursive filter was used to construct a FOFL controller, which was implemented in the MATLAB (Krishna et al. 2022). Kar et al. designed a multi-level inverter using a multi-harmonic PR controller to achieve current control, reduce the switching elements, and improve the efficiency of electronic converters. However, these methods had limitations in dealing with multi-source collaborative operations of distributed power sources, especially in terms of real-time performance and flexibility (Kar et al. 2021). Moutis and Alizadeh-Mousavi accurately calculated the MV waveform of voltage and current in T/F using digital twin method, and captured all harmonic content in real time. It was not affected by asymmetric loads, identifying most system faults (Moutis and Alizadeh-Mousavi 2020). Rahman et al. utilized a collaborative multi-agent system to achieve proportional power sharing in micro-grids. The coupling of distributed control and communication technology for low-voltage micro-grids was established through the MAS framework and graph theory. These studies demonstrate the potential of multi-agent systems in micro-grid control and communication, but they typically require complex communication architectures and high computational resources (Rahman et al. 2020). Hanada et al. considered the weighted average consensus algorithm for handling distributed power scheduling and load balancing problems. This method provided a stop** criterion for consensus algorithms by analyzing the relationship between the eigenvalues of graph Laplacian operators and the number of iterations. However, consensus algorithms may encounter problems such as slow convergence speed and high computational resource consumption when dealing with large-scale distributed systems (Hanada et al. 2021).

To continuously improve flexible energy management and self-healing technology in power system, many experts have conducted research on it. Bagherzadeh et al. proposed an optimization strategy for coordinating flexible energy and self-healing management, integrating renewable energy, electric vehicles, and demand response plans. This self-healing method was used to find the optimal recovery mode (Bagherzadeh et al. 2021). Gazijahani et al. designed a self-healing micro-grid. The hybrid heterogeneous power generation resources were determined and the remote controllable switches were allocated. The distribution network was divided into micro-grids. The operation scheduling was decomposed into interconnection and is-landing modes, using adjustable interval optimization to reduce its sensitivity to renewable energy fluctuations. When the main power grid was interrupted, load and power generation balance was achieved in an isolated state through methods such as dividing fault areas, executing resource rescheduling, network reconstruction, and load discharge (Gazijahani et al. 2020). Dong et al. designed a transactional reactive power control strategy to provide reactive power support, and improve voltage configuration. At the same time, an operation sequence was integrated into the service recovery process to ensure operational constraints (Dong et al. 2021). Mousavizadeh et al. proposed a model based on the Mixed Integer Linear Programming for forming and scheduling dynamic micro-grids in distribution systems. The graph related theory was used to formulate the optimal formation of micro-grids. Benders decomposition technique was used to address the computational problem (Mousavizadeh et al. 2021). Arefifiar et al. explored the importance and challenges of self-healing technology in power systems, especially during frequent short-term and long-term power outages. Through a systematic literature review, this paper briefly described the concept of self-healing in distribution systems and categorized existing research based on key factors such as self-healing optimization objectives, control measures, and solutions. In addition, multiple self-healing improvement techniques were compared, providing better methods for comparison and selection for new researchers (Arefifar et al. 2023). Compared with the above research, the QPSO-BPSO algorithm provides a novel optimization framework that combines the global search capability of quantum behavior particle swarm optimization and the discrete solution space processing capability of binary particle swarm optimization. The uniqueness of this algorithm lies in its ability to simultaneously handle both continuous and discrete optimization problems, which is particularly important for fault self-healing in distribution networks, as they not only need to optimize power flow but also determine switch states. In addition, the QPSO-BPSO algorithm theoretically has faster convergence speed and higher solving accuracy, which makes it significantly advantageous in real-time performance and efficiency.

In summary, many experts have conducted in-depth research on power quality issues, flexible energy management, and self-healing technologies in the power system. However, there are still some areas that can be optimized, such as limitations in dealing with specific problems, computational complexity, and system robustness. Therefore, the study proposes a DG fault self-healing technology based on the QPSO-BPSO algorithm to improve the efficiency and robustness, ho** to make more contributions to the sustainable development and safe operation of the power system.

Structural design and optimization of dynamic micro-grid based on QPSO-BPSO

The first section of Chapter 2 delves into the micro-grid structure, including the constituent elements, topology, and interconnection with the main power grid. The second section focuses on the dynamic micro-grid economic and technological optimization, as well as self-healing control strategies based on the QPSO-BPSO. The principle and application of QPSO-BPSO algorithm are deeply analyzed, elaborating the role of QPSO-BPSO algorithm in micro-grid economic and technological optimization.

Design and functional analysis of micro-grid structure and self-healing control system

The micro-grid is a part of a distributed power distribution network, typically composed of local distributed energy resources, storage devices, and loads, with a certain degree of autonomy. It can be connected to the main power supply or independently on demand. The typical structure diagram of micro-grid is shown in Fig. 1.

Fig. 1
figure 1

Typical structure diagram of micro-grid

In Fig. 1, the micro-grid, as a small power system, is connected to the higher-level power grid through the common connection point PCC in its network structure. This connection point allows the micro-grid to connect to various distributed power sources, including micro gas turbines, wind turbines, photovoltaic cells, fuel cells, and energy storage devices, forming a diverse energy combination. In micro-grids, control strategies consider both local and overall control, adopting various means to adjust the DG sources and energy storage components with various characteristics (Dornelas and Lima 2023). Network topology is used to accurately determine the operational status of a system. Therefore, micro-grids can quickly take effective control measures after faults occur, ensuring that the system maintains normal operation under complex conditions. The micro-grid is linked to the main grid through the static switch at the public connection point PCC. This connection not only enables the micro-grid to rely on distributed power sources and distribution networks to supply power to loads during grid connected operation, but also achieves smooth switching between isolated and grid connected operation modes. In the operation, the micro-grid flexibly adjusts the power supply scheme, which is supplied by distributed power sources and distribution networks according to the load to carry. It can ensure the adaptability to different load demands. The micro-grid is also connected to the medium and low voltage distribution network, which improves the distribution and utilization efficiency of energy through coordinated operation with the distribution network (Nikolić et al. 2021; Li et al. 2021). This connection enables micro-grids to better integrate into the entire power system and fully leverage their advantages. Finally, when a fault occurs, the micro-grid can operate in isolation to avoid power outages for important users in the micro-grid. This emergency measure greatly enhances the reliability of micro-grid systems, ensuring that the system can still provide stable power supply in the event of inevitable failures (Camilo López et al. 2022). The three-layer structure of the micro-grid self-healing control function is shown in Fig. 2.

Fig. 2
figure 2

Three-layer structure of micro-grid self-healing control function

In Fig. 2, the system adopts a three-layer structure, including a perception layer, an evaluation layer, and a decision-making layer, forming an orderly fault detection, system operation status evaluation, and control protection. The perception layer is located at the bottom layer, which is responsible for collecting, monitoring, and executing control commands. It utilizes advanced technology to monitor and collect various indicators and device parameters in real-time, providing basic information for real-time monitoring. This layer is also responsible for executing various control commands. The evaluation layer, as an intermediate link between the perception layer and the decision-making layer, can parse the data uploaded by the perception layer, analyze the system's operation status, and judge the system's operational risks. Based on perception, system fault diagnosis, simulation and other means, it can reflect the actual operating status of the system, and divide the system operating status through system vulnerability assessment, system risk assessment and other methods. When a fault occurs, the evaluation layer can perceive, locate, and isolate the system fault, and evaluate the control instructions and strategies issued by the control layer through simulation methods. The decision-making layer is located at the top, which is the core of the entire control process. Based on the evaluation of the system's operational status by the evaluation layer, the decision-making layer adopts corresponding control methods. Different control plans are developed for different types of faults and operating states to ensure stable and safe operation of the micro-grid system. These three layers of organic collaborative work constitute the complete micro-grid self-healing control system, which achieves comprehensive monitoring and flexible control of the system through perception, evaluation, and decision-making, to ensure the stability and reliability in various operating and fault situations.

Dynamic micro-grid economic and technological optimization and self-healing control strategy ground on QPSO-BPSO

Fault detection and self-healing are crucial for ensuring power supply in micro-grid systems. The system utilizes monitoring devices to quickly identify abnormal signals such as voltage dips or frequency deviations, and analyzes waveform changes to identify fault types. After confirming the fault, network topology analysis is performed to locate the fault and evaluate its impacts. Therefore, the control system develops recovery strategies that may involve network reconfiguration, is-landing mode, or power output adjustment. After implementing the strategy, the system monitors the recovery effect and makes necessary adjustments. Key data records are used for subsequent analysis and optimization, while guiding operator decision-making.

Dynamic micro-grid optimization pursues the optimal operating state of economy and technology. In terms of economy, optimization algorithms and control strategies are adopted to maximize operational efficiency, reduce total network loss, and minimize energy loss during operation. Technical optimization mainly focuses on achieving the highest power quality. The optimization goal for voltage deviation is to ensure that the voltage deviation of all nodes reaches the minimum value by adjusting the control strategy. This involves using reasonable algorithms and control measures to ensure that the voltage of each node in the micro-grid is stable and close to the rated value, thereby achieving the best power quality. Specifically, the expression is shown in Eq. (1).

$$\min \left( {\Delta V} \right) = \sum\limits_{i = 1}^{n} {\frac{{\Phi \left( {\left| {\Delta V_{i} - \delta V_{i} } \right|} \right)}}{{V_{i} }}}$$
(1)

Equation (1) is to minimize the sum of squared deviations between the voltage of each node and its rated value. Among them, \(i\) signifies the node. \(n\) signifies the node of the micro-grid. \(V_{i}\) signifies the voltage of \(i\), \(\Delta V_{i}\) is the voltage deviation of \(i\), and \(\Delta V_{i} = V_{i} - 1\) can be obtained. \(\delta V\) is the maximum voltage deviation within the standard range \(i\). The study uses a standard of − 5% to +5%. \(x\) means the maximum voltage deviation, as shown in Eq. (2).

$$\Phi \left( x \right) = \left\{ \begin{gathered} 0,x \le 0 \hfill \\ x,x > 0 \hfill \\ \end{gathered} \right.$$
(2)

Equation (2) defines the situation where the voltage deviation exceeds the maximum allowable voltage deviation. The goal of micro-grid loss optimization is to minimize the active and reactive power loss through flow control, as shown in Eq. (3).

$$f{}_{{\Delta S_{L} }} = \left\{ \begin{gathered} \sum\limits_{i = 1}^{M} {R_{i} \frac{{P_{i}^{2} + Q_{i}^{2} }}{{\left| V \right|_{i}^{2} }}} \hfill \\ \sum\limits_{i = 1}^{M} {X_{i} \frac{{P_{i}^{2} + Q_{i}^{2} }}{{\left| V \right|_{i}^{2} }}} \hfill \\ \end{gathered} \right.$$
(3)

In Eq. (3), \(M\) represents the system branches. \(X_{i}\) represents the reactance of \(i\). \(R_{i}\) represents the resistance of \(i\). \(P_{i}\) represents the active amplitude of \(i\). \(V_{i}\) represents the voltage of \(i\). \(Q_{i}\) signifies the reactive power amplitude of \(i\). The efficiency goal of micro-grid operation is to improve the power factor of DG as much as possible while maintaining qualified voltage, thereby achieving the best economic benefits. To maximize the power factor for DG, the objective function Eq. (4) is used for optimization to achieve the best power factor and economic benefits in system operation.

$$\min \left( \frac{1}{E} \right) = \frac{1}{N}\sum\limits_{i = 1}^{N} {\frac{{Q_{dgi} }}{{\sqrt {P_{dgt}^{2} + Q_{dgt}^{2} } }}}$$
(4)

In Eq. (4), \(N\) represents the specific number of distributed generators. The overall objective function of micro-grid operation is shown in Eq. (5).

$$F = \min \left(f_{\Delta l^{\prime}} ,f_{{\Delta S_{L} }} ,\frac{1}{E}\right)$$
(5)

The constraints for optimizing the operation of micro-grids are mainly divided into variable constraints and power flow constraints. The variable constraints cover the operating voltage of each node, the active power output of each distributed power source, and the reactive capacity of the compensating capacitor. The variable constraints can be expressed through power flow equations or power flow constraints to ensure that the current in the micro-grid does not exceed the system carrying capacity and maintain stable operation, as shown in Eq. (6).

$$\left\{ \begin{gathered} P_{k\min } \le P_{k} \le P_{k\max } \hfill \\ Q_{k\min } \le Q_{k} \le Q_{k\max } \hfill \\ V_{j\min } \le V_{j} \le V_{j\max } \hfill \\ \end{gathered} \right.$$
(6)

In Eq. (6), \(k\) represents the node. \(Q_{k\max }\), and \(Q_{k\min }\) represent the maximum and minimum values of reactive power injected by distributed power sources on \(k\). \(P_{k\max }\) and \(P_{k\min }\) signify the maximum and minimum values of active power. \(V_{j\max }\) and \(V_{j\min }\) signify the maximum and minimum operating voltages of node \(j\).

$$\left\{ \begin{gathered} \Delta P_{i} = P_{is} - \sum\limits_{j \in i}^{n} {V_{i} V_{j} \left( {G_{ij} \cos \theta_{ij} + B_{ij} \sin \theta_{ij} } \right) = 0} \hfill \\ \Delta Q_{i} = Q_{is} - \sum\limits_{j \in i}^{n} {V_{i} V_{j} \left( {G_{ij} \sin \theta_{ij} - B_{ij} \cos \theta_{ij} } \right) = 0} \hfill \\ \end{gathered} \right.$$
(7)

In Eq. (7), \(i\) and \(j\) both represent nodes. \(n\) signifies the number of system nodes, and \(i = 1,2, \ldots ,n,\). \(G_{ij}\), \(B_{ij}\) and \(\theta_{ij}\) represent the admittance and phase difference between \(i\) and \(j\). \(j \in i\) signifies the node connected to \(i\). The battery limit is shown in Eq. (8).

$$0 \le P\left( t \right)_{s} \le P_{S,\max }$$
(8)

In Eq. (8), \(P_{S,\max }\) represents the maximum energy storage of the battery. \(P\left( t \right)_{s}\) is the storage capacity of the battery at time \(t\). The battery current limit is shown in Eq. (9).

$$\Delta I\left( t \right)_{s} \le \Delta I_{\max }$$
(9)

In Eq. (9), \(\Delta I_{\max }\) signifies the maximum charging and discharging current of the battery. \(\Delta I\left( t \right)_{s}\) signifies the change in battery current at time \(t\). The constraint conditions in the study are processed as penalty functions, and the extended objective function is shown in Eq. (10).

$$F\left( x \right) = f\left( x \right) + k_{1} U_{1} + k_{2} U_{2}$$
(10)

In Eq. (10), the original total objective function is represented by \(f\left( x \right)\). \(k_{1}\) and \(k_{2}\) are set as penalty factors, usually selecting larger values to emphasize the punishment for constraints. The variables \(U_{1}\) and \(U_{2}\) are used to represent inequality constraints and equality constraints, respectively. Enhancing the search ability of particles can enable them to perform repeated iterative calculations in feasible solution regions. The position of particles in OPSO is calculated by \(\Phi \left( {x,t} \right)\), as shown in Eq. (11).

$$\int {\left| \Psi \right|}^{2} dxdydz = \int {Qdxdydz = 1}$$
(11)

The function \(Qdxdydz\) represents the probability density of the three-dimensional position coordinates of a particle at a certain moment. Equation (11) is transformed to obtain particle position update, as shown in Eq. (12).

$$\left\{ \begin{gathered} P_{d} = \frac{{r_{1} P_{id} + r_{2} P_{gd} }}{{r_{1} + r_{2} }} \hfill \\ m = \frac{1}{M}\sum\limits_{i = 1}^{M} {P_{i} } \hfill \\ L\left( {t + 1} \right) = 2\beta \ln \left| {m - x\left( t \right)} \right| \hfill \\ x\left( {t + 1} \right) = P \pm \frac{1}{2}L\left( {t + 1} \right)\ln \frac{1}{u} \hfill \\ \end{gathered} \right.$$
(12)

In Eq. (12), \(P_{d}\) refers to the numerical magnitude corresponding to the particles in the \(d\) dimension, reflecting that all particles converge at their own \(P\) point, i.e. \(P = \left( {P_{1} ,P_{2} , \ldots ,P_{d} } \right)\). \(r_{1}\) and \(r_{2}\) signify random variables between [0, 1]. \(M\) refers to the particle swarm size. \(m\) signifies the average value corresponding to particles being in the global optimal position condition. \(L\) refers to the characteristic length of DELTA potential wells. \(\beta\) is the contraction factor. \(E\) represents the energy, that is, \(E = \frac{{h^{2} \beta }}{2m}\). The particle swarm optimization is displayed in Fig. 3.

Fig. 3
figure 3

Particle swarm optimization algorithm process

In Fig. 3, firstly, the parameter values are set, and then the velocity and position of the particle swarm are initialized randomly. Initialization sets the position and velocity of each particle at the beginning of an algorithm. These initial values are usually randomly generated to ensure broad coverage of the search space. The position of each particle is usually randomly initialized within the defined search space. The initial velocity of particles is generally set to a small value or close to zero, ensuring that the initial exploration does not skip potential optimization areas due to excessive velocity. Subsequently, fitness calculation is performed on each particle to determine its fitness size. The fitness of particles is compared with their past best fitness \(P\). If the effect is better, \(P\) is updated to the best historical value of the current particle. Next, the fitness of each particle is compared with the fitness of the historical best position \(P\) of all particles. If it is better, then \(P_{g}\) is updated to the current particle's position. In Fig. 3, concepts such as random factors and inertia factors are also included, which are important components of the exploration and utilization capabilities of regulatory algorithms, ensuring a balance between global and local search. The particle information is updated relying on Eq. (12). Finally, whether the termination condition has been met is checked. If not, the particle fitness is return to compare. Otherwise, the final result is output. If the fitness value of the optimal particle in the particle swarm reaches or exceeds the preset target threshold, the algorithm terminates.

$$v_{i}^{d} = wv_{i}^{d} + c_{1} r_{1} \left( {p_{i}^{d} - x_{i}^{d} } \right) + c_{2} r_{2} \left( {p_{g}^{d} - x_{i}^{d} } \right)$$
(13)

In Eq. (13), \(i = 1,2, \ldots ,m\) signifies the size of the particle swarm. \(d = 1,2, \ldots ,D\) signifies the search dimension. \(c_{1}\) and \(c_{2}\) represent a random number and a non-negative number. \(w\) represents the inertia factor, which is a non-negative number. It can further expand the search space. \(r_{1}\) and \(r_{2}\) are random numbers, with the values between 0 and 1. The particle position update is shown in Eq. (14).

$$\left\{ \begin{gathered} x_{id}^{k} = 1,r < S\left( {v_{id}^{k - 1} } \right) \hfill \\ x_{id}^{k} = 0,r \ge S\left( {v_{id}^{k - 1} } \right) \hfill \\ \end{gathered} \right.$$
(14)

In Eq. (14), the range for \(r\) is [0,1]. The \(S\left( x \right)\) function expression is shown in Eq. (15).

$$S\left( x \right) = \left\{ \begin{gathered} 0.98, \, x > V_{\max } \hfill \\ - 0.98, \,x < - V_{\max } \hfill \\ \frac{1}{{1 + e^{ - x} }}, \,- V\max < x < V_{\max } \hfill \\ \end{gathered} \right.$$
(15)

In the subsequent stages, the agent needs to have a fault information collection function to obtain the required data information in the monitoring data collection system and effectively monitor fault information based on real-time data. Once the fault is clearly identified, the agent will conduct research and analysis on the network organization, focusing on the power output of the self weight and other related situations. Subsequently, the agent will be responsible for sending these clear fault information to the processing system to support further operations and decisions, as shown in Fig. 4.

Fig. 4
figure 4

Optimization strategy process of network recovery agent system

Figure 4 shows the optimization strategy of the network recovery agent system for rapid power system recovery post-failure. Initially, the system collects real-time power data (voltage, current, frequency) to identify faults. Then it analyzes the network topology and load, and assesses the fault impact. Based on this analysis, a recovery strategy is developed, potentially involving network reconfiguration, power output adjustment, or switching to islanded modes. After risk assessment, the strategy is sent for approval. After approval, the system executes the recovery command and continuously monitors the process, ready to adapt to new changes.

Finally, in micro-grid systems, the uncertainty mainly arises from fluctuations in renewable energy output, errors in load forecasting, and the reliability of equipment operation. These uncertainties can be divided into three categories: technical uncertainty, model uncertainty, and data uncertainty. Technical uncertainty is related to equipment performance and faults, such as reduced inverter efficiency or battery aging issues. Model uncertainty involves simplifying mathematical models based on assumptions and imprecision in parameter estimation. Data uncertainty is mainly caused by issues with the quality and real-time performance of data collection.

In order to effectively address these uncertainties, the following strategies have been adopted. Firstly, improving the accuracy of data collection technology and sensors has improved the quality and real-time performance of data, providing a solid data foundation for decision support systems. The second is to regularly update and calibrate the model to adapt to technological developments and changes, and use machine learning algorithms to optimize parameter estimation to reduce model bias. Finally, a comprehensive risk assessment and management framework is implemented to mitigate the risks brought about by uncertainty through equipment redundancy, backup power supply, and flexible operational strategies.

Verification analysis of dynamic micro-grid comprehensive optimization and self-healing control strategy

The research adopts a comprehensive QPSO-BPSO algorithm for optimization of discrete and continuous variables, which is applied to distributed power generation units, loads, and network structures. A multi-agent system driven dynamic optimization method for micro-grids is proposed. A distributed micro-grid system in a certain city is analyzed for performance comparison. The dynamic micro-grid is displayed in Fig. 5.

Fig. 5
figure 5

Dynamic micro-grid diagram

As shown in Fig. 5, the dynamic micro-grid includes three types of power generation equipment: fuel cell (DG1, capacity of 25 kW), micro gas turbine (DG2, capacity of 30 kW), and photovoltaic unit (capacity of 10 kW). In addition, the system also includes a battery storage unit (with a capacity of 5 kW, and DG3 combination) for storing and regulating excess energy. The micro-grid is controlled by 16 switches, and the on/off status of each switch can be optimized and configured through algorithms to adapt to changes in network load and fault recovery needs.

To apply the QPSO-BPSO algorithm in MATLAB/Simulink, initial parameters such as the number of particles, iterations, cognitive and social factors, and velocity and position limits are set. An objective function is defined to minimize energy loss, optimize load balance, and enhance network stability, while considering constraints like device capacity and stability standards. A dynamic micro-grid simulation with power units, storage, and controls is developed. The algorithm is executed, updating particle positions and velocities until reaching the end condition or maximum iterations. Energy consumption, reliability, and response time are compared to evaluate optimization, and all data is recorded and analyzed for further optimization. However, when rebuilding the network topology, it is important to pay attention to its limitations. Table 1 displays the dynamic micro-grid parameters.

Table 1 Dynamic micro-grid parameters

As shown in Table 1, the node to node section represents the connection between two nodes in the micro-grid. The line impedance section is the line impedance, usually measured in ohms (Ω), representing the loss of electrical energy during transmission. End load (kW) is the end load, in Kilowatts (kW), representing the power of the load connected to a specific node, and each corresponding value represents the total load connected to each node. The micro-grid is a small power network that operates independently or be connected to the central grid. The power transmission between nodes depends on lines with specific impedance values. The end load represents the electrical equipment on each node. The last three connections do not indicate the end load because they do not directly connect to the load. The optimization results of period A dynamic micro-grid are displayed in Table 2.

Table 2 Dynamic micro-grid optimization results during period A

In Table 2, the Contact switch is used to control the connection and disconnection of various parts of the power grid. Line loss (kW) measurement represents the energy efficiency loss in power transmission. Node voltage is recorded in volts (V), reflecting the voltage state of a specific node. The offset power factor has no unit, which is an indicator of electrical energy transmission efficiency, compared to actual power and apparent power. In the initial stage A, the photovoltaic generator unit operated in MPPT mode, achieving a maximum power of 8 kW. At this point, the photovoltaic generator unit not only supplied power to the load, but also charged the excess electrical energy to the battery. Throughout the system, the fuel cell and micro gas turbine was in normal operation, while the branch switch was closed. Multi-objective optimization operations were achieved through the QPSO-BPSO algorithm, which was used to optimize the micro-grid. Based on the optimization results, the upper agent sent control instructions to the distributed generator set, and commanded the network structure agent to turn on or off the corresponding contact switches according to the optimization results to further optimize its performance. The optimization results of the period C dynamic micro-grid are displayed in Table 3.

Table 3 Dynamic micro-grid optimization results in period C

In Table 3, during period C, due to weather factors, the output power of the photovoltaic unit decreased to 1 kW. To meet the injection power demand of node 3, the battery was forced to discharge. However, due to the maximum injection power limit of 6 kW for node 3, the period B network structure couldn’t maintain the required standards for normal operation. Therefore, it is necessary to readjust the operation and network status. In this case, the injection power limitation of node 3 imposed limitations on meeting the demand for load power, resulting in some network structures being unable to meet the requirements. The data results in Table 3 can ensure the optimal adjustment plan required for the safe and reliable operation of dynamic micro-grids. The relay protection action and generator state response after three-phase short circuit fault are shown in Fig. 6.

Fig. 6
figure 6

Relay protection action and generator status response after three-phase short circuit fault

In Fig. 6, the system experienced a sudden three-phase short circuit fault at the initial operating time t = 0 s. At 0.2 s, the relay protection device quickly acted and successfully cut off the faulty line. The generator state, including speed and rotor angle, is presented in Fig. 6. It is represented using normalized scales. After the fault occurred, the system experienced transient operational instability, resulting in a significant difference in rotor angles between the generators. In this case, the system used the spare capacity left by the generator for autonomous primary frequency regulation and introduced an STG module for secondary frequency regulation to stabilize system operation. The self-healing response of the system and the dynamic parameters of the generator after a short circuit fault are shown in Fig. 7.

Fig. 7
figure 7

System self-healing response and generator parameter dynamics after short circuit fault

Figure 7a and b respectively represent the speed and rotor angle of the generator during secondary simulation. After a short circuit fault occurred at t = 0.2 s during system operation, the relay protection quickly took actions and cut off the faulty line. Subsequently, the system activated the PMU devices of each generator intelligent agent to calibrate system operating parameters and collect relevant data, which were then provided to the controller for calculation. The controller within the generator intelligent agent node generated control signals at the generator end, thereby affecting the controller adjustment, i.e. adjusting the power injected or absorbed by the generator intelligent agent node. Based on the control framework proposed in the study, the system can quickly recover to a stable operating state in a short of space, realizing rapid consistency between generator speed and rotor angle, and successfully achieving self-healing. The output characteristics are shown in Fig. 8.

Fig. 8
figure 8

Output characteristics of micro-grid self-healing model

Figure 8a shows the 24-h output of the photovoltaic generator. It basically conformed to the sunrise and sunset pattern. The output was higher during the day and lower at night. Figure 8b displays the 24-h output of the wind turbine. It basically conformed to the local wind power variation pattern. The output was larger when the wind speed was high, and smaller when the wind speed was low. Figure 8c shows the output power of the battery. It conformed to the charging and discharging characteristics. It was charged for energy storage during the day and discharged for power supply at night. Therefore, the proposed self-healing model for micro-grids comprehensively considers the output characteristics of photovoltaics, wind power, and batteries, and achieves automatic monitoring, diagnosis, and recovery of micro-grid systems through intelligent control and coordinated scheduling. The optimization control effect and the QPSO-BPSO algorithm performance are shown in Fig. 9.

Fig. 9
figure 9

Optimization control effect analysis and QPSO-BPSO algorithm performance comparison

According to the analysis in Fig. 9a, before and after optimizing control, the network loss of the system decreased from 0.135 to 0.049 kW, while the maximum power supply capacity increased from 1.696 to 2.311. This optimization process triggered an increase in the switch actions, which were 3 and 8 times respectively. Although the number of switch operations is relatively high, the active power loss is significantly reduced, and the maximum capacity of the system is significantly improved. In Fig. 9b, the numerical analysis is conducted on the QPSO-BPSO algorithm and traditional PSO. The superiority of the improved PSO is verified by comparing the performance of the two algorithms. During the iteration, the fitness of the QPSO-BPSO decreased faster than the traditional PSO, reaching the optimal value more quickly. In order to analyze the effectiveness of the designed micro-grid source load storage automation control technology in practical environments, two practical scenarios, Alpha and Bravo, are set up for testing and analysis. The Alpha scenario is a photovoltaic load storage micro-grid with a total installed capacity of 190 kW, and the Bravo scenario is an inverter micro-grid with a rated power of 35 kW. The QPSO-BPSO algorithm is compared with the single time section method and virtual energy storage coordination method. The voltage imbalance during control is tested to ensure that it matches the preset value, as shown in Fig. 10.

Fig. 10
figure 10

Voltage imbalance matching the preset value

In Fig. 10, as the number of partitions increased, the voltage imbalance of different methods decreased, which is closer to the preset value. In Fig. 10a, in the Alpha scenario, the voltage imbalance of the single time period method reached 97.3% at 50 partitions, while the virtual energy storage coordination method reached 98.4% at 10 partitions and decreased to 96.7% at 50 partitions. The QPSO-BPSO algorithm achieved 99.7% in 10 partitions and decreased to 98.9% in 50 partitions. In Fig. 10b, the voltage imbalance of the single time period method and the virtual energy storage coordination method for 50 partitions under Bravo conditions were 96.3% and 95.8%, respectively, which were consistent with the preset values. The QPSO-BPSO algorithm was 99.8% for 10 partitions and 98.4% for 50 partitions. The results indicate that the designed method can effectively improve the accuracy of voltage distribution.

Discussion

The QPSO-BPSO algorithm has shown advantages in self-healing control and operational optimization of micro-grids. Under peak load conditions, the system successfully outputs 7 kW through battery discharge, demonstrating self-healing capability. This is difficult to achieve in traditional control strategies. Compared with existing technologies, the QPSO-BPSO algorithm has potential advantages in global search speed and quality. For example, compared with the FOFLC control strategy proposed by Krishna et al. (2022) and the multi-level inverter design proposed by Kar et al. (2021), the QPSO-BPSO algorithm may be more effective in reducing the number of switching elements and improving the efficiency of electronic converters. In addition, compared with the weighted average consensus algorithm proposed by Hanada et al. (2021), the QPSO-BPSO algorithm provides a direct and efficient solution for distributed power scheduling and load balancing problems.

Energy companies should consider integrating the QPSO-BPSO algorithm into their energy management system to achieve more efficient power configuration and load management. Through algorithm optimization, the company can improve fault response speed, reduce system recovery time, and enhance energy efficiency. In addition, the company can optimize algorithms to better integrate renewable resources such as wind and solar energy, and promote the green transformation of the energy structure.

Policy makers should encourage and support innovation and research and development of micro-grid technology, especially the self-healing control strategy. Incentives such as tax incentives, subsidies, or research and development funding can be implemented to encourage energy companies to adopt advanced algorithms such as QPSO-BPSO. At the same time, policy makers should consider formulating relevant standards and regulations to guide the design and operation of micro-grids, ensuring that the integration of new technologies does not have adverse effects on existing power systems.

Future research should focus on further improving the QPSO-BPSO algorithm and its applicability in different power systems and application scenarios. How to integrate algorithms more effectively with existing power grid technologies and management strategies, and how to further improve the stability and economy of micro-grids through algorithm optimization can be further explored. In addition, future research should also focus on the performance and reliability of algorithms during large-scale deployment, providing theoretical and technical support for the sustainable development of the power system.

Conclusion

The development of smart grids urgently requires the intelligent management and self-healing technology of micro-grids. This study optimized the structure, operation, and self-healing control of micro-grids based on the QPSO-BPSO algorithm, achieving flexible energy management and comprehensive improvement of system performance. During peak load, the system outputted 7 kilowatts through battery discharge, effectively meeting the load demand and demonstrating self-healing characteristics. The system could also intelligently dispatch photovoltaic and wind turbines to adapt to energy changes. Under the control of QPSO algorithm, the operating efficiency of the system was improved, active power loss was reduced, and power supply capacity was enhanced. Even with frequent switch operations, the overall performance was still significantly improved, meeting the requirements for improving system economy and safety. The application of QPSO-BPSO algorithm in micro-grid systems is limited by computational resources, complexity of parameter tuning, convergence stability, and management of optimization coupling for continuous and discrete variables. The algorithm also needs to adapt to the volatility of renewable energy, dynamic changes in network topology, and ensure compatibility with existing power hardware and meet safety standards. Therefore, future research will delve into the application of QPSO-BPSO algorithm in micro-grid systems, especially its performance in handling multiple fault types and adapting to dynamic network topologies. The research focus will be on two core areas. Firstly, analyzing the diagnostic and localization capabilities of algorithms in various fault situations such as single-phase grounding, two-phase short circuit, and three-phase fault improves the response speed and accuracy of micro-grid systems to faults. Secondly, examining the adaptability of the algorithm to dynamic changes in network topology, including network structure reconstruction, node addition and deletion, and changes in connection methods ensures that the algorithm can maintain optimization effects and system stability in different network configurations.