Control method for grid-connected and off-grid cooperative adaptive switching of virtual power plant

By constructing a state-space model of a virtual power plant and iteratively optimizing it, the problems of voltage fluctuation and frequency deviation during the grid-connected/off-grid switching process of the virtual power plant were solved, achieving efficient and stable operation of the virtual power plant and extending the service life of the equipment.

CN121507902APending Publication Date: 2026-02-10SICHUAN CHUANNENG INTELLIGENT NETWORK IND CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511562744.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-30
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

Existing virtual power plants are prone to voltage fluctuations and frequency deviations during grid-connected/off-grid switching, especially in scenarios involving multiple distributed energy sources, where power surges are significant, they cannot cope with sudden changes in grid frequency, and the complexity of collaborative control is high.

Method used

The state matrix, disturbance matrix, input matrix, and output matrix of the virtual power plant are constructed and transformed into a standard state-space model. Through the dynamic equations of frequency deviation, voltage deviation, energy storage state of charge, and power gap, the state coefficient matrix, input coefficient matrix, disturbance coefficient matrix, and direct transmission coefficient matrix of the state-space model are constructed. Historical data is collected for iterative optimization, and the optimal dynamic coefficients are output to achieve adaptive control for grid-connected and off-grid switching.

Benefits of technology

It effectively reduces voltage fluctuations and frequency deviations during grid-connected and off-grid switching, extends the service life of various parts of the virtual power plant, and achieves efficient and stable grid-connected/off-grid switching, demonstrating significant engineering application value and economic benefits.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121507902A_ABST
    Figure CN121507902A_ABST
Patent Text Reader

Abstract

The invention discloses a control method for grid-connected and off-grid cooperative adaptive switching of a virtual power plant, and the method comprises the steps: constructing a state matrix, a disturbance matrix, an input matrix and an output matrix of the virtual power plant, and converting the matrixes into a state space model in a standard form; constructing a state coefficient matrix, an input coefficient matrix, a disturbance coefficient matrix, an output coefficient matrix and a direct transmission coefficient matrix of the state space model based on the dynamic equation; performing iterative optimization on the dynamic coefficient to obtain a convergent state space model; and outputting the predicted output matrix, and controlling the switching process of grid connection and grid disconnection. According to the method, voltage fluctuation and frequency deviation in the off-grid and grid-connected switching process can be effectively reduced, the service life of each part of the virtual power plant is prolonged, efficient, stable and reliable operation of grid-connected / off-grid switching of the virtual power plant is realized, and the method has remarkable engineering application value and economic benefit.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of virtual power plant control and management, and specifically to a control method for coordinated adaptive switching between grid connection and off-grid operation of a virtual power plant. Background Technology

[0002] A virtual power plant (VFP) is a power source that uses advanced information and communication technologies and software systems to aggregate and coordinate distributed generation (DG), energy storage systems, controllable loads, electric vehicles, and other energy sources (DERs) to participate in the electricity market and grid operation as a special type of power plant. The grid connection and disconnection processes of VFPs can cause fluctuations in the existing operating state. Optimizing the control strategies for grid connection and disconnection switching of VFPs can effectively reduce the impact of these switching processes on the operational stability of the VFP. However, existing VFP switching control methods have significant technical shortcomings. Existing technologies are prone to voltage fluctuations (>5%) and frequency deviations (>0.1Hz) during grid connection / disconnection switching, especially in scenarios involving multiple distributed energy sources, where power surges are significant and the VFP cannot cope with sudden changes in grid frequency. Furthermore, the heterogeneous protocols of distributed power sources (PV, wind power), energy storage systems (BESS), and adjustable loads (temperature-controlled loads) result in high complexity for coordinated control. Summary of the Invention

[0003] To address the aforementioned shortcomings in the existing technology, this invention provides a control method for the coordinated adaptive switching of virtual power plant grid connection and off-grid operation, ensuring the stable operation of the virtual power plant during the grid connection and off-grid switching process.

[0004] To achieve the above-mentioned objectives, the technical solution adopted by this invention is as follows:

[0005] A control method for adaptive switching of virtual power plant grid connection and off-grid operation is provided, comprising:

[0006] Step S1: Construct the state matrix of the virtual power plant Perturbation matrix Input matrix and output matrix And convert it into a standard form of state-space model;

[0007] Step S2: Construct the state matrix Mid-frequency deviation Voltage deviation Energy storage state of charge and power gap The dynamic equation;

[0008] Step S3: Based on frequency deviation Dynamic equations and voltage deviation Dynamic equations and power gap Dynamic equations and energy storage state of charge The dynamic equations are used to construct the state coefficient matrix of the state-space model. Input coefficient matrix Perturbation coefficient matrix Output coefficient matrix and direct transmission coefficient matrix ;

[0009] Step S4: Collect the state matrix, disturbance matrix, and input matrix of the historical grid-connected and off-grid switching processes in the virtual power plant, and initialize the state coefficient matrix. Perturbation coefficient matrix and input coefficient matrix The dynamic coefficients are iteratively optimized, and the optimal dynamic coefficients are output based on the objective function of the optimal dynamic coefficients, thus obtaining a convergent state-space model.

[0010] Step S5: Collect the state coefficient matrix of the current virtual power plant in grid-connected or off-grid status. Perturbation coefficient matrix and input coefficient matrix The model is input into a convergent state-space model, and the predicted output matrix is ​​output to obtain the predicted actual frequency of the grid connection point when the grid is connected or disconnected. Actual voltage and interaction power It controls the switching process between grid connection and off-grid.

[0011] Further, step S1 includes:

[0012] Step S11: Based on the frequency deviation of the virtual power plant during grid connection and off-grid switching processes. Voltage deviation Energy storage state of charge and power gap Establish the state matrix of the virtual power plant ;

[0013] ;

[0014] Where t represents the moment when the grid connection and off-grid handover process is executed;

[0015] Step S12: Based on the fluctuations in photovoltaic output in the virtual power plant Wind power output fluctuation and rigid load sudden change Constructing the perturbation matrix ;

[0016] ;

[0017] Step S13: Based on the active power output of distributed power sources in the virtual power plant The charging and discharging power of the energy storage system and the regulating power of flexible loads Constructing the control input matrix ;

[0018] ;

[0019] Step S14: Based on the actual frequency of the grid connection point Actual voltage Interaction power with grid connection point Construct the output matrix ;

[0020] ;

[0021] Step S15: Convert the state matrix Perturbation matrix Input matrix and output matrix Transform it into a standard state-space model;

[0022] ;

[0023] in, The state coefficient matrix, For the input coefficient matrix, The perturbation coefficient matrix, To output the coefficient matrix, This is the direct transmission coefficient matrix. is the derivative of the state matrix.

[0024] Furthermore, frequency deviation The dynamic equation is:

[0025] ;

[0026] in, Let S be the derivative of the frequency deviation, and S be the equivalent inertial time constant. This is the frequency damping coefficient;

[0027] The voltage deviation The dynamic equation is:

[0028] ;

[0029] in, The time constant of the voltage response, For reactive power deficit, This is the voltage droop factor. Voltage deviation The derivative;

[0030] The energy storage state of charge The dynamic equation is:

[0031] ;

[0032] in, For the charging and discharging efficiency of energy storage systems, For the real-time capacity of the energy storage system, This refers to the rated capacity of the energy storage system.

[0033] The power gap The dynamic equation is:

[0034] ;

[0035] in, The derivative of the power gap, The power response time constant is Here, i represents the power input compensation amount, I represents the type of power input compensation, and i represents the quantity of power input compensation. Let represent the disturbance power, u represent the type of disturbance power, and U represent the number of disturbance power types.

[0036] Further, step S3 includes:

[0037] Step S31: Based on frequency deviation Dynamic equations and voltage deviation Dynamic equations and power gap Dynamic equations and energy storage state of charge The dynamic equations are used to construct the state coefficient matrix. ;

[0038] ;

[0039] Step S32: Based on the control input matrix in the dynamic equation Construct the input coefficient matrix from the coefficients ;

[0040] ;

[0041] Step S32: Construct the perturbation coefficient matrix using the perturbation terms in the dynamic equation. ;

[0042] ;

[0043] Step S34: Output coefficient matrix and direct transmission coefficient matrix Used to describe the state matrix and input matrix For the output matrix The influence of output matrix The actual frequency in Actual voltage , For the rated frequency, Rated voltage, interactive power When connected to the grid, it equals a power deficit. When offline, the value is equal to 0;

[0044] Then output coefficient matrix Direct transmission coefficient matrix .

[0045] Further, step S4 includes:

[0046] Step S41: Collect the state matrix, disturbance matrix, and input matrix of the historical grid-connected and off-grid switching processes in the virtual power plant to obtain N sets of state matrices. Perturbation matrix and input matrix ,

[0047] in, These are the state matrix, disturbance matrix, and input matrix for the Nth historical grid connection and off-grid handover process, respectively.

[0048] Step S42: Initialize the state coefficient matrix Perturbation coefficient matrix and input coefficient matrix

[0049] Each dynamic coefficient in h is the dynamic coefficient The numbering will be used to initialize the state coefficient matrix. Perturbation coefficient matrix and input coefficient matrix Input the state-space model and include the state matrix of the historical grid-connected and off-grid switching processes. Perturbation matrix and input matrix In the input state-space model, the predicted output matrix is ​​calculated. n is the number of times the network was switched to or off-grid in the past;

[0050] Step S43: Construct an iterative optimization model that iteratively optimizes each dynamic coefficient;

[0051] Step S44: Use the iterative optimization model to initialize the dynamic coefficients. Perform N iterations of optimization to obtain N dynamic coefficients. Input the N dynamic coefficients into the state-space model respectively, and use the state matrix, disturbance matrix and input matrix of the N grid-connected and off-grid switching processes to obtain N predicted output matrices.

[0052] Step S45: Construct an objective function to output the optimal dynamic coefficients, and use the objective function to select the optimal dynamic coefficients from the N dynamic coefficients;

[0053] ;

[0054] in, This is the selection function for the optimal dynamic coefficients. A set of dynamic coefficients formed by N dynamic coefficients;

[0055] Step S46: Obtain the state coefficient matrix Perturbation coefficient matrix and input coefficient matrix For each dynamic coefficient in the matrix, output the optimal dynamic coefficients and the optimal state coefficient matrix. Perturbation coefficient matrix and input coefficient matrix And the optimal state coefficient matrix Perturbation coefficient matrix and input coefficient matrix From the input state-space model, a convergent state-space model is obtained.

[0056] Furthermore, the iterative optimization model is as follows:

[0057] ;

[0058] in, The h-th dynamic coefficient is obtained from the nth iteration of optimization. The h-th dynamic coefficient obtained in the (n-1)th iteration optimization. The norm distance between the predicted output matrix and the true output matrix. The gain coefficient of the h-th dynamic coefficient. This is the output matrix for the (n-1)th grid-connected / off-grid handover prediction. This is the actual output matrix for the (n-1)th grid-connected / off-grid switching.

[0059] The beneficial effects of this invention are as follows: This solution is used for control strategy optimization during the off-grid and grid-connected switching process of a virtual power plant. It utilizes the current operating state of the virtual power grid to predict the operating parameters of the grid connection point during off-grid and grid-connected switching, thereby reducing the impact on the operational stability of the virtual power plant and achieving coordinated adaptive switching control. This invention can effectively reduce voltage fluctuations and frequency deviations during off-grid and grid-connected switching, extend the service life of various parts of the virtual power plant, and achieve efficient, stable, and reliable operation of the virtual power plant during grid-connected / off-grid switching, demonstrating significant engineering application value and economic benefits. Attached Figure Description

[0060] Figure 1 A flowchart of the control method for adaptive switching between grid connection and off-grid operation of a virtual power plant. Detailed Implementation

[0061] The specific embodiments of the present invention are described below to enable those skilled in the art to understand the present invention. However, it should be understood that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, various changes are obvious as long as they are within the spirit and scope of the present invention as defined and determined by the appended claims. All inventions utilizing the concept of the present invention are protected.

[0062] like Figure 1 As shown, a control method for adaptive switching of grid-connected and off-grid operations in a virtual power plant includes:

[0063] Step S1: Construct the state matrix of the virtual power plant Perturbation matrix Input matrix

[0064] and output matrix And convert it into a standard state-space model.

[0065] Step S1 specifically includes the following steps:

[0066] Step S11: Based on the frequency deviation of the virtual power plant during grid connection and off-grid switching processes. Voltage deviation Energy storage state of charge and power gap Establish the state matrix of the virtual power plant ;

[0067] ;

[0068] Where t represents the moment when the grid connection and off-grid handover process is executed;

[0069] In this embodiment, frequency deviation The voltage deviation is the difference between the actual frequency and the rated frequency during grid-connected and off-grid switching. The difference between the grid connection point voltage and the rated voltage represents the state of charge of the energy storage. The state of charge (SOC) of the energy storage system needs to be maintained between 20% and 80% to ensure the system's lifespan and power deficit. This is the difference between the total output of the distributed power source and the load. Rapid compensation is required during switching to avoid frequency collapse.

[0070] Step S12: Based on the fluctuations in photovoltaic output in the virtual power plant Wind power output fluctuation and rigid load sudden change Constructing the perturbation matrix ;

[0071] ;

[0072] In this embodiment, photovoltaic power output fluctuation The fluctuation in wind power output is mainly caused by changes in solar radiation intensity. Mainly caused by sudden changes in wind speed and rigid load. Mainly caused by the start and stop of the load;

[0073] Step S13: Based on the active power output of distributed power sources in the virtual power plant The charging and discharging power of the energy storage system and the regulating power of flexible loads Constructing the control input matrix ;

[0074] ;

[0075] Step S14: Based on the actual frequency of the grid connection point Actual voltage Interaction power with grid connection point Construct the output matrix ;

[0076] ;

[0077] Step S15: Convert the state matrix Perturbation matrix Input matrix and output matrix Transform it into a standard state-space model;

[0078] ;

[0079] in, The state coefficient matrix, For the input coefficient matrix, The perturbation coefficient matrix, To output the coefficient matrix, This is the direct transmission coefficient matrix. is the derivative of the state matrix.

[0080] Step S2: Construct the state matrix Mid-frequency deviation Voltage deviation Energy storage state of charge and power gap The dynamic equation.

[0081] Constructing the state matrix Mid-frequency deviation Dynamic equations and voltage deviation Dynamic equations and energy storage state of charge The dynamic equations and power gap The dynamic equation;

[0082] Frequency deviation The dynamic equation is:

[0083] ;

[0084] in, Let S be the derivative of the frequency deviation, and S be the equivalent inertial time constant. When connected to the grid, the inertia of the large power grid is taken as S = 5~10s, and when disconnected from the grid, S = 1~2s. Here is the frequency damping coefficient and the power gap. The larger the value, the greater the rate of frequency change, the greater the inertia, and the smoother the frequency change. Frequency deviation is determined by power supply and demand imbalance and system inertia. Inertia is provided during grid connection or off-grid operation. The larger the power gap, the faster the frequency changes.

[0085] Voltage deviation is determined by reactive power supply and demand imbalance and line impedance. When connected to the grid, it is supported by the grid voltage, and when disconnected from the grid, it is maintained by inverter droop control.

[0086] Voltage deviation The dynamic equation is:

[0087] ;

[0088] in, This is the time constant of the voltage response, such as the reactive power regulation delay of an inverter; The reactive power gap represents the difference between the reactive power output of distributed generation and the reactive power demand of the load. This is the voltage droop factor, which is enabled when off-grid and set to 0 when connected to the grid. Voltage deviation The derivative of the reactive power gap. The larger the reactive power gap, the faster the voltage changes, the larger the droop coefficient, and the stronger the voltage stability.

[0089] Energy storage state of charge The state of charge of energy storage is determined by the charging and discharging power and capacity of the energy storage system. The dynamic equation is:

[0090] ;

[0091] in, For the charging and discharging efficiency of energy storage systems, For the real-time capacity of the energy storage system, This refers to the rated capacity of the energy storage system.

[0092] Power gap It is the difference between the total output of distributed power sources and the total load demand, energy storage, or flexible load regulation; power deficit. The dynamic equation is:

[0093] ;

[0094] in, The derivative of the power gap, The power response time constant is Here, i represents the power input compensation amount, I represents the type of power input compensation, and i represents the quantity of power input compensation. Let represent the disturbance power, u represent the type of disturbance power, and U represent the number of disturbance power types.

[0095] The rate of change of the power gap is proportional to the difference between the current gap and the compensation amount, enabling rapid gap convergence. Distributed power sources include photovoltaics, wind power, and micro gas turbines, whose output is affected by the environment or control commands (voltage / frequency needs to be maintained when off-grid).

[0096] Step S3: Based on frequency deviation Dynamic equations and voltage deviation Dynamic equations and power gap Dynamic equations and energy storage state of charge The dynamic equations are used to construct the state coefficient matrix of the state-space model. Input coefficient matrix Perturbation coefficient matrix Output coefficient matrix and direct transmission coefficient matrix .

[0097] Step S3 specifically includes the following steps:

[0098] Step S31: Based on frequency deviation Dynamic equations and voltage deviation Dynamic equations and power gap Dynamic equations and energy storage state of charge The dynamic equations are used to construct the state coefficient matrix. ;

[0099] ;

[0100] According to frequency deviation The dynamic equation, frequency deviation Due to its own damping and power gap The effect is that the frequency damping coefficient is used. The frequency deviation is constructed using the equivalent inertial time constant S. State coefficient, voltage deviation Due to its own sagging effect, the time constant is used. and voltage droop coefficient Constructing voltage deviation The state coefficient, similarly, the power gap Affected by its own decay.

[0101] Step S32: Based on the control input matrix in the dynamic equation Construct the input coefficient matrix from the coefficients ;

[0102] ;

[0103] The charging and discharging power of the energy storage system Energy storage state of charge Impact, and energy storage state of charge Initial input items and rated capacity and charge / discharge efficiency Related to this, therefore, the charging and discharging efficiency With rated capacity The ratio is used to control the charging and discharging power. Input coefficients; regulating power of flexible loads As part of the disturbance power, it is mainly related to the power gap. As a control and regulation power Input coefficients;

[0104] Step S32: Construct the perturbation coefficient matrix using the perturbation terms in the dynamic equation. ;

[0105] ;

[0106] Step S34: Output coefficient matrix and direct transmission coefficient matrix Used to describe the state matrix and input matrix For the output matrix The influence of output matrix The actual frequency in Actual voltage , For the rated frequency, Rated voltage, interactive power When connected to the grid, it equals a power deficit. When offline, the value is equal to 0;

[0107] Then output coefficient matrix Direct transmission coefficient matrix .

[0108] Step S4: Collect the state matrix, disturbance matrix, and input matrix of the historical grid-connected and off-grid switching processes in the virtual power plant, and initialize the state coefficient matrix. Perturbation coefficient matrix and input coefficient matrix The dynamic coefficients are iteratively optimized, and the optimal dynamic coefficients are output based on the objective function of the optimal dynamic coefficients, thus obtaining a convergent state-space model.

[0109] Step S4 specifically includes the following steps:

[0110] Step S41: Collect the state matrix, disturbance matrix, and input matrix of the historical grid-connected and off-grid switching processes in the virtual power plant to obtain N sets of state matrices. Perturbation matrix and input matrix ,

[0111] in, These are the state matrix, disturbance matrix, and input matrix for the Nth historical grid connection and off-grid handover process, respectively.

[0112] Step S42: Initialize the state coefficient matrix Perturbation coefficient matrix and input coefficient matrix Each dynamic coefficient in Dynamic coefficient Including charge and discharge efficiency Rated capacity Frequency damping coefficient Equivalent inertial time constant S, time constant Voltage droop coefficient and power response time constant In subsequent iterative optimization processes, each dynamic coefficient is optimized simultaneously, using different gain coefficients. h represents the dynamic coefficient. The numbering will be used to initialize the state coefficient matrix. Perturbation coefficient matrix and input coefficient matrix Input the state-space model and include the state matrix of the historical grid-connected and off-grid switching processes. Perturbation matrix and input matrix In the input state-space model, the predicted output matrix is ​​calculated. n is the number of times the network was switched to or off-grid in the past;

[0113] Step S43: Construct an iterative optimization model that iteratively optimizes each dynamic coefficient;

[0114] ;

[0115] in, The h-th dynamic coefficient is obtained from the nth iteration of optimization. The h-th dynamic coefficient obtained in the (n-1)th iteration optimization. The norm distance between the predicted output matrix and the true output matrix. The gain coefficient of the h-th dynamic coefficient. This is the output matrix for the (n-1)th grid-connected / off-grid handover prediction. This is the actual output matrix for the (n-1)th grid-connected / off-grid switching;

[0116] Step S44: Use the iterative optimization model to initialize the dynamic coefficients. Perform N iterations of optimization to obtain N dynamic coefficients. Input the N dynamic coefficients into the state-space model respectively, and use the state matrix, disturbance matrix and input matrix of the N grid-connected and off-grid switching processes to obtain N predicted output matrices.

[0117] Step S45: Construct an objective function to output the optimal dynamic coefficients, and use the objective function to select the optimal dynamic coefficients from the N dynamic coefficients;

[0118] ;

[0119] in, This is the selection function for the optimal dynamic coefficients. A set of dynamic coefficients formed by N dynamic coefficients;

[0120] Step S46: Obtain the state coefficient matrix Perturbation coefficient matrix and input coefficient matrix For each dynamic coefficient in the matrix, output the optimal dynamic coefficients and the optimal state coefficient matrix. Perturbation coefficient matrix and input coefficient matrix And the optimal state coefficient matrix Perturbation coefficient matrix and input coefficient matrix From the input state-space model, a convergent state-space model is obtained.

[0121] Step S5: Collect the state coefficient matrix of the current virtual power plant in grid-connected or off-grid status. Perturbation coefficient matrix and input coefficient matrix The model is input into a convergent state-space model, and the predicted output matrix is ​​output to obtain the predicted actual frequency of the grid connection point when the grid is connected or disconnected. Actual voltage Interaction power with grid connection point It controls the switching process between grid connection and off-grid.

[0122] This solution is used to optimize the control strategy during the off-grid and grid-connected switching process of a virtual power plant. It uses the current operating status of the virtual power grid to predict the operating parameters of the grid connection point during the off-grid and grid-connected switching, thereby reducing the impact on the operating stability of the virtual power plant and realizing coordinated adaptive switching control.

[0123] This invention can effectively reduce voltage fluctuations and frequency deviations during off-grid and grid-connected switching processes, extend the service life of various parts of the virtual power plant, and achieve efficient, stable, and reliable operation of the virtual power plant during grid-connected / off-grid switching. It has significant engineering application value and economic benefits.

Claims

1. A control method for adaptive switching between grid connection and off-grid operation of a virtual power plant, characterized in that, include: Step S1: Construct the state matrix of the virtual power plant Perturbation matrix Input matrix and output matrix And convert it into a standard form of state-space model; Step S2: Construct the state matrix Mid-frequency deviation Voltage deviation Energy storage state of charge and power gap The dynamic equation; Step S3: Based on frequency deviation Dynamic equations and voltage deviation Dynamic equations and power gap Dynamic equations and energy storage state of charge The dynamic equations are used to construct the state coefficient matrix of the state-space model. Input coefficient matrix Perturbation coefficient matrix Output coefficient matrix and direct transmission coefficient matrix ; Step S4: Collect the state matrix, disturbance matrix, and input matrix of the historical grid-connected and off-grid switching processes in the virtual power plant, and initialize the state coefficient matrix. Perturbation coefficient matrix and input coefficient matrix The dynamic coefficients are iteratively optimized, and the optimal dynamic coefficients are output based on the objective function of the optimal dynamic coefficients, thus obtaining a convergent state-space model. Step S5: Collect the state coefficient matrix of the current virtual power plant in grid-connected or off-grid status. Perturbation coefficient matrix and input coefficient matrix The model is input into a convergent state-space model, and the predicted output matrix is ​​output to obtain the predicted actual frequency of the grid connection point when the grid is connected or disconnected. Actual voltage and interaction power It controls the switching process between grid connection and off-grid.

2. The control method for coordinated adaptive switching between grid connection and off-grid operation of a virtual power plant according to claim 1, characterized in that, Step S1 includes: Step S11: Based on the frequency deviation of the virtual power plant during grid connection and off-grid switching processes. Voltage deviation Energy storage state of charge and power gap Establish the state matrix of the virtual power plant ; ; Where t represents the moment when the grid connection and off-grid handover process is executed; Step S12: Based on the fluctuations in photovoltaic output in the virtual power plant Wind power output fluctuation and rigid load sudden change Constructing the perturbation matrix ; ; Step S13: Based on the active power output of distributed power sources in the virtual power plant The charging and discharging power of the energy storage system and the regulating power of flexible loads Constructing the control input matrix ; ; Step S14: Based on the actual frequency of the grid connection point Actual voltage Interaction power with grid connection point Construct the output matrix ; ; Step S15: Convert the state matrix Perturbation matrix Input matrix and output matrix Transform it into a standard form of state-space model; ; in, The state coefficient matrix, For the input coefficient matrix, The perturbation coefficient matrix, To output the coefficient matrix, This is the direct transmission coefficient matrix. is the derivative of the state matrix.

3. The control method for coordinated adaptive switching between grid connection and off-grid operation of a virtual power plant according to claim 2, characterized in that, The frequency deviation The dynamic equation is: ; in, Let S be the derivative of the frequency deviation, and S be the equivalent inertial time constant. This is the frequency damping coefficient; The voltage deviation The dynamic equation is: ; in, The time constant of the voltage response, This is a reactive power deficit. This is the voltage droop factor. Voltage deviation The derivative; The energy storage state of charge The dynamic equation is: ; in, For the charging and discharging efficiency of energy storage systems, For the real-time capacity of the energy storage system, This refers to the rated capacity of the energy storage system. The power gap The dynamic equation is: ; in, The derivative of the power gap, The power response time constant is Here, i represents the power input compensation amount, I represents the type of power input compensation, and i represents the quantity of power input compensation. Let represent the disturbance power, u represent the type of disturbance power, and U represent the number of disturbance power types.

4. The control method for coordinated adaptive switching between grid connection and off-grid operation of a virtual power plant according to claim 3, characterized in that, Step S3 includes: Step S31: Based on frequency deviation Dynamic equations and voltage deviation Dynamic equations and power gap Dynamic equations and energy storage state of charge The dynamic equations are used to construct the state coefficient matrix. ; ; Step S32: Based on the control input matrix in the dynamic equation Construct the input coefficient matrix from the coefficients ; ; Step S32: Construct the perturbation coefficient matrix using the perturbation terms in the dynamic equation. ; ; Step S34: Output coefficient matrix and direct transmission coefficient matrix Used to describe the state matrix and input matrix For the output matrix The influence of output matrix The actual frequency in Actual voltage , For the rated frequency, Rated voltage, interactive power When connected to the grid, it equals a power shortage. When offline, the value is equal to 0; Then output coefficient matrix Direct transmission coefficient matrix .

5. The control method for coordinated adaptive switching between grid connection and off-grid operation of a virtual power plant according to claim 4, characterized in that, Step S4 includes: Step S41: Collect the state matrix, disturbance matrix, and input matrix of the historical grid-connected and off-grid switching processes in the virtual power plant to obtain N sets of state matrices. Perturbation matrix and input matrix , in, These are the state matrix, disturbance matrix, and input matrix for the Nth historical grid connection and off-grid handover process, respectively. Step S42: Initialize the state coefficient matrix Perturbation coefficient matrix and input coefficient matrix Each dynamic coefficient in h is the dynamic coefficient The numbering will be used to initialize the state coefficient matrix. Perturbation coefficient matrix and input coefficient matrix Input the state-space model and include the state matrix of the historical grid-connected and off-grid switching processes. Perturbation matrix and input matrix In the input state-space model, the predicted output matrix is ​​calculated. n is the number of times the network was switched to or off-grid in the past; Step S43: Construct an iterative optimization model that iteratively optimizes each dynamic coefficient; Step S44: Use the iterative optimization model to initialize the dynamic coefficients. Perform N iterations of optimization to obtain N dynamic coefficients. Input the N dynamic coefficients into the state-space model respectively, and use the state matrix, disturbance matrix and input matrix of the N grid-connected and off-grid switching processes to obtain N predicted output matrices. Step S45: Construct an objective function to output the optimal dynamic coefficients, and use the objective function to select the optimal dynamic coefficients from the N dynamic coefficients; ; in, This is the selection function for the optimal dynamic coefficients. A set of dynamic coefficients formed by N dynamic coefficients; Step S46: Obtain the state coefficient matrix Perturbation coefficient matrix and input coefficient matrix For each dynamic coefficient in the matrix, output the optimal dynamic coefficient and the optimal state coefficient matrix. Perturbation coefficient matrix and input coefficient matrix And the optimal state coefficient matrix Perturbation coefficient matrix and input coefficient matrix From the input state-space model, a convergent state-space model is obtained.

6. The control method for coordinated adaptive switching between grid connection and off-grid operation of a virtual power plant according to claim 5, characterized in that, The iterative optimization model is as follows: ; in, The h-th dynamic coefficient is obtained from the nth iteration of optimization. The h-th dynamic coefficient obtained in the (n-1)th iteration optimization. The norm distance between the predicted output matrix and the true output matrix. The gain coefficient of the h-th dynamic coefficient. This is the output matrix for the (n-1)th grid-connected / off-grid handover prediction. This is the actual output matrix for the (n-1)th grid-connected / off-grid switching.