A grid-connected and off-grid switching control method and system

By analyzing real-time and historical data of microgrids, off-grid disturbance scenarios are constructed and generated to generate switching control strategies. This solves the problem that existing technologies do not consider the operating status of microgrids, and achieves smooth transition of microgrids and improved stability of the power system.

CN123183993APending Publication Date: 2026-11-27STATE GRID ZHEJIANG ELECTRIC POWER CO LTD HANGZHOU POWER SUPPLY CO
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611664546.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-27
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing technologies do not fully consider the microgrid's own operating status during grid connection and off-grid switching, resulting in the inability to achieve a smooth transition and affecting the operational stability of the microgrid and the entire power system.

Method used

By acquiring real-time operating data of the target microgrid, analyzing disturbance factors in historical grid connection and off-grid operating data, constructing multiple grid connection and off-grid disturbance scenarios, predicting operational changes, extracting DC bus voltage fluctuations, retrieving the target operating data range, and generating switching control strategies adapted to different disturbance scenarios.

Benefits of technology

It enables a smooth transition of microgrids during grid connection and off-grid switching, effectively suppresses drastic fluctuations in voltage amplitude and frequency, and improves the operational stability of microgrids and the entire power system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123183993A_ABST
    Figure CN123183993A_ABST
Patent Text Reader

Abstract

The application discloses a kind of parallel and off-grid switching control method and system, applied to parallel and off-grid switching technical field, method includes: obtaining the real-time operation data of target microgrid, and determine the target switching time of target microgrid;Each parallel and off-grid disturbance scene is constructed;Based on real-time operation data, the running change condition of target microgrid under each parallel and off-grid disturbance scene is predicted;Based on each DC bus voltage fluctuation and each disturbance factor data in corresponding parallel and off-grid disturbance scene, obtain parallel and off-grid prediction result;Based on parallel and off-grid prediction result, the target operation data range of target microgrid at target switching time is obtained by inversion;Based on target operation data range and real-time operation data, the target parallel and off-grid switching control strategy of target microgrid is obtained.The parallel and off-grid switching control method provided by the application can realize the smooth switching of microgrid parallel and off-grid mode, and ensure the operation stability of microgrid and even the whole power system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of grid-connected and off-grid switching technology, and in particular to a grid-connected and off-grid switching control method and system. Background Technology

[0002] During the operation of a power system, microgrids can adjust between grid-connected and off-grid operating modes according to actual operating conditions to ensure the reliability of power supply to critical loads. Precise control strategies during grid-connected / off-grid switching can prevent drastic fluctuations in microgrid voltage amplitude and frequency, ensuring a smooth transition of the microgrid's operating state and guaranteeing the stable operation of the entire power system.

[0003] Existing control strategies only consider when to switch between grid connection and off-grid operation. For example, when the grid connection point voltage is detected to drop to 85% of the rated value, the off-grid switch is triggered immediately. The control strategy is generated only based on the switching moment, without considering the microgrid's own operating state at the switching moment. This means that the generated control strategy can only achieve grid connection and off-grid switching, but cannot achieve a smooth transition of the microgrid's operating state. Consequently, the microgrid's operating state fluctuates drastically after the grid connection and off-grid operation mode is switched, ultimately reducing the operational stability of the microgrid and even the entire power system. Summary of the Invention

[0004] This invention provides a grid-connected / off-grid switching control method and system to solve the technical problem that existing technologies only consider when to perform grid-connected / off-grid switching without considering the microgrid's own operating state at the switching time, resulting in the inability to achieve a smooth transition of the microgrid's operating state. This invention aims to achieve a smooth switching of the microgrid to grid-connected / off-grid mode, ensuring the operational stability of the microgrid and even the entire power system.

[0005] To address the aforementioned technical problems, this invention provides a method and system for grid-connected / off-grid switching control, the method comprising: Acquire real-time operating data of the target microgrid and determine the target switching time of the target microgrid; Based on the historical on-grid and off-grid operation data of the target microgrid, each disturbance factor is identified, and the impact of each disturbance factor on the operation of the target microgrid is analyzed. Based on the analysis results, each on-grid and off-grid disturbance scenario is constructed. Based on the real-time operating data, predict the operational changes of the target microgrid under each of the grid connection and disconnection disturbance scenarios; The DC bus voltage fluctuation of the target microgrid is extracted from each of the aforementioned operational changes, and the grid connection / disconnection prediction results are obtained based on each of the aforementioned DC bus voltage fluctuations and the corresponding disturbance factor data in the grid connection / disconnection disturbance scenarios. Based on the grid connection and disconnection prediction results, the target operating data range of the target microgrid at the target switching time is obtained by inversion; Based on the target operating data range and the real-time operating data, the target on-grid and off-grid switching control strategy of the target microgrid is obtained.

[0006] Preferably, the step of acquiring real-time operating data of the target microgrid and determining the target switching time of the target microgrid includes: The real-time operating data is analyzed to determine the fluctuation trend of the real-time operating data; Based on the aforementioned fluctuation trend, predictions are made to obtain predicted operational data. The predicted operating data is analyzed based on preset switching conditions to determine the target switching time.

[0007] Preferably, the determination of various disturbance factors based on the acquired historical off-grid operation data of the target microgrid includes: Based on the aforementioned historical on- and off-network operation data, each on- and off-network event is determined; Extract the associated electrical parameter changes for each of the historical on-grid and off-grid events from the historical on-grid and off-grid operation data; The changes in each of the associated electrical parameters are analyzed to determine each of the disturbance factors.

[0008] Preferably, the step of analyzing the impact of each of the disturbance factors on the operation of the target microgrid, and constructing various grid-connected and off-grid disturbance scenarios based on the analysis results, includes: The monotonicity of the impact of each of the aforementioned disturbance factors on the target microgrid is determined to obtain the operational impact situation; The operational impact of each of the aforementioned disturbance factors is analyzed, and the value range of each disturbance factor is obtained based on the monotonicity of the impact, thus yielding the analysis results. Based on the analysis results, each of the above-mentioned on-grid and off-grid disturbance scenarios is constructed.

[0009] Preferably, determining the monotonicity of the impact of each of the disturbance factors on the target microgrid to obtain the operational impact includes: A small-signal perturbation scan is performed on each of the aforementioned perturbation factors to obtain the response direction of the target microgrid; The monotonicity of the influence is determined based on the response direction, and the operational influence is determined based on the monotonicity of the influence.

[0010] Preferably, the step of predicting the operational changes of the target microgrid under each of the grid connection / disconnection disturbance scenarios based on the real-time operational data includes: Obtain real-time power grid operation data of the target power grid; Based on the real-time operation data of the power grid and the real-time operation data, an initial disconnection and disconnection model is constructed. Each of the aforementioned grid connection / disconnection disturbance scenarios is applied to the initial grid connection / disconnection model to obtain the corresponding operational changes.

[0011] Preferably, the step of inverting the target operating data range of the target microgrid at the target switching time based on the grid connection / disconnection prediction results includes: Based on the grid connection and disconnection prediction results, the extreme values ​​of DC bus voltage fluctuations are determined; The target operating data range is obtained by inversion based on the extreme value of the DC bus voltage fluctuation.

[0012] Preferably, the step of obtaining the target on-grid / off-grid switching control strategy for the target microgrid based on the target operating data range and the real-time operating data includes: Determine whether the real-time running data meets the target running data range; If the target operating data range is met, a first target is generated based on the target switching time, and an offline switching control strategy is implemented. If the target operating data range is not met, a second target is generated and an off-grid switching control strategy is implemented based on the difference between the real-time operating data and the target operating data range. The target on-grid and off-grid handover control strategy is obtained based on the first target on-grid and off-grid handover control strategy or the second target on-grid and off-grid handover control strategy.

[0013] Preferably, after obtaining the target on-grid / off-grid switching control strategy for the target microgrid based on the target operating data range and the real-time operating data, the method further includes: Within each defined optimization cycle, the current real-time operating data of the target microgrid is processed, and the target grid-connected / off-grid switching control strategy is updated based on the processing results to obtain the updated target grid-connected / off-grid switching control strategy.

[0014] Another aspect of the present invention provides a grid-connected / off-grid switching control system, comprising: The acquisition module is used to acquire real-time operating data of the target microgrid and determine the target switching time of the target microgrid; The scenario module is used to determine various disturbance factors based on the historical on-grid and off-grid operation data of the target microgrid, analyze the impact of each disturbance factor on the operation of the target microgrid, and construct various on-grid and off-grid disturbance scenarios based on the analysis results. The change module is used to predict the operational changes of the target microgrid under each of the grid connection and disconnection disturbance scenarios based on the real-time operating data; The prediction module is used to extract the DC bus voltage fluctuation of the target microgrid from each of the aforementioned operational changes, and to obtain the grid connection / disconnection prediction result based on each of the aforementioned DC bus voltage fluctuations and the corresponding disturbance factor data in the grid connection / disconnection disturbance scenarios. The range module is used to invert the target operating data range of the target microgrid at the target switching time based on the grid connection and disconnection prediction results; The control module is used to obtain the target on-grid and off-grid switching control strategy of the target microgrid based on the target operating data range and the real-time operating data.

[0015] Compared with the prior art, the beneficial effects of the present invention are at least one of the following: This invention acquires real-time operational data of the target microgrid and determines the target switching time. Simultaneously, it analyzes various disturbance factors and their impact on microgrid operation based on historical grid connection / off-grid operational data, thereby constructing multiple grid connection / off-grid disturbance scenarios. This approach, unlike existing technologies that rely solely on a single trigger condition, fully considers the microgrid's operational state at the switching time. Based on this, the invention predicts the microgrid's operational changes under each disturbance scenario using real-time operational data, extracts DC bus voltage fluctuations, and combines this with disturbance factor data from each scenario to obtain grid connection / off-grid prediction results. This leads to the inversion of the target operational data range for the target switching time. Finally, the real-time operational data is compared with this target operational data range to generate a grid connection / off-grid switching control strategy adaptable to different disturbance scenarios. Because this invention fully considers the real-time operating status of the microgrid at the switching moment and the cumulative impact of various disturbance factors on the operation process, the generated control strategy can not only realize mode switching, but also make precise adjustments according to the DC bus voltage fluctuation and the target operating data range obtained by inversion, thereby realizing a smooth transition of the microgrid operating status, effectively suppressing and eliminating drastic fluctuations in voltage amplitude and frequency during the off-grid switching process, and ultimately significantly improving the operational stability of the microgrid and even the entire power system. Attached Figure Description

[0016] Figure 1 This is a flowchart illustrating the grid-connected / off-grid switching control method in one embodiment of the present invention. Figure 2 This is a schematic diagram of the grid-connected / off-grid switching control system in one embodiment of the present invention; Figure label: Among them, 11. Acquisition module; 12. Scene module; 13. Change module; 14. Prediction module; 15. Range module; 16. Control module. Detailed Implementation

[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0018] In the description of this invention, the terms "first," "second," "third," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined with "first," "second," "third," etc., may explicitly or implicitly include one or more of that feature. In the description of this invention, unless otherwise stated, "a plurality of" means two or more.

[0019] In the description of this invention, it should be noted that, unless otherwise expressly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to fixed connections, detachable connections, or integral connections; they can refer to mechanical connections or electrical connections; they can refer to direct connections or indirect connections through an intermediate medium; and they can refer to communication within two components. The terms "vertical," "horizontal," "left," "right," "upper," "lower," and similar expressions used herein are for illustrative purposes only and do not indicate or imply that the device or component referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as limiting the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items. Those skilled in the art will understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0020] In the description of this invention, it should be noted that, unless otherwise defined, all technical and scientific terms used in this invention have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in this specification is for the purpose of describing specific embodiments only and is not intended to limit the invention. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0021] In power system operation, microgrids ensure the reliability of power supply to critical loads by flexibly switching between grid-connected and off-grid modes. Precise control strategies during the switching process are crucial for preventing drastic voltage and frequency fluctuations and achieving a smooth transition in operating status. However, existing control strategies often only execute switching when a single trigger condition, such as detecting a voltage drop to 85% of the rated value at the grid connection point, is detected. Their decisions are based solely on the electrical quantities at the moment of switching, without fully considering the microgrid's real-time operating status at that time, such as bus energy levels, converter regulation capabilities, and load characteristics. This control approach, which focuses only on the timing of switching while neglecting the internal state of the system, results in strategies that, while capable of completing the mode transition, cannot effectively suppress the switching shock. This leads to drastic fluctuations in the microgrid's operating status after the mode switch, thereby affecting the operational stability of the microgrid and even the entire power system.

[0022] One embodiment of the present invention provides a method for grid-connected / off-grid handover control. For details, please refer to [link to relevant documentation]. Figure 1 , Figure 1 The diagram shown is a flowchart illustrating a grid-connected / off-grid switching control method according to one embodiment of the present invention, including: S1. Obtain the real-time operating data of the target microgrid and determine the target switching time of the target microgrid; S2. Based on the historical on-grid and off-grid operation data of the target microgrid, determine each disturbance factor, analyze the impact of each disturbance factor on the operation of the target microgrid, and construct each on-grid and off-grid disturbance scenario based on the analysis results; S3. Based on the real-time operating data, predict the operational changes of the target microgrid under each of the grid connection and disconnection disturbance scenarios; S4. Extract the DC bus voltage fluctuation of the target microgrid from each of the aforementioned operational changes, and obtain the grid connection / disconnection prediction result based on each of the aforementioned DC bus voltage fluctuations and the corresponding disturbance factor data in the grid connection / disconnection disturbance scenarios. S5. Based on the grid connection and disconnection prediction results, the target operating data range of the target microgrid at the target switching time is obtained by inversion; S6. Based on the target operating data range and the real-time operating data, obtain the target on-grid and off-grid switching control strategy for the target microgrid.

[0023] First, acquire real-time operating data of the target microgrid and determine the target switching time. Analyze the real-time operating data to determine its fluctuation trend; make predictions based on the fluctuation trend to obtain predicted operating data; analyze the predicted operating data based on preset switching conditions to determine the target switching time.

[0024] The target microgrid refers to an independent small power system to be subjected to grid-connected / off-grid switching control. Real-time operating data consists of dynamic electrical parameters such as voltage, current, and power collected from the target microgrid at the current moment. Fluctuation trend is the statistical characteristic analysis result of the direction and rate of change of real-time operating data over a period of time. Predicted operating data is the future electrical quantity values ​​estimated by a prediction algorithm based on the fluctuation trend. Preset switching conditions are pre-defined thresholds or criteria used to determine whether the prerequisites for switching operations are met. The target switching time is the optimal time point for executing grid-connected / off-grid operations, determined by comparing the predicted operating data with the preset switching conditions.

[0025] Data acquisition devices are deployed at key nodes of the target microgrid. These key nodes include common coupling points, which are the connection points between the microgrid and the main grid, used to measure voltage, frequency, phase angle difference, and exchange power on both the grid and microgrid sides. They also include DC bus links, the points where AC and DC energy converge, where voltage fluctuations directly reflect the power balance. Furthermore, they include grid connection points for distributed generation sources, such as the AC output side of photovoltaic inverters and energy storage converters, used to monitor changes in the output of each generation unit. Finally, they include power supply access points for important loads, used to monitor the voltage and current of critical loads, assisting in load management decisions before switching. The data acquisition devices collect electrical parameters such as voltage, current, and power in real time at a frequency of at least once per second, and transmit the data to the central controller via a communication network, forming a real-time operational data stream.

[0026] Next, the sliding window method is used to extract the data sequence of the most recent N time points from the received real-time running data. The least squares method or Kalman filter algorithm is used to fit the change curve of the sequence, and the slope and curvature are calculated from it to determine whether the data is in an upward, downward or oscillating state, thereby determining the fluctuation trend.

[0027] Then, based on the identified fluctuation trend, the corresponding prediction model is selected. If the trend is monotonically rising or falling, linear extrapolation or exponential smoothing is used. If it is a periodic oscillation, Fourier series or autoregressive moving average model is used. Substituting the end data and rate of change of the current window, the predicted running data for several future moments is calculated.

[0028] Finally, the preset switching conditions are converted into specific numerical criteria, such as the voltage being 90% lower than the rated value or the frequency deviation exceeding 0.5 Hz. The predicted operating data at each moment is compared with these criteria one by one. When the predicted value at a certain moment first triggers the criteria or meets the switching safety margin requirements, that moment is determined as the target switching moment.

[0029] Preferably, based on the historical on-grid and off-grid operation data of the target microgrid, each disturbance factor is identified, and the impact of each disturbance factor on the operation of the target microgrid is analyzed. Based on the analysis results, each on-grid and off-grid disturbance scenario is constructed.

[0030] Historical grid-connected and off-grid operation data is a time-series dataset of electrical parameters such as voltage, current, power, and frequency recorded during multiple grid-connected and off-grid switching processes and steady-state operation of the target microgrid. Disturbances are various physical quantities or events that can cause deviations in the operating state of the target microgrid, including specific sources such as fluctuations in renewable energy generation output, high-power load switching, grid-side voltage sags or frequency fluctuations, and energy storage system charging / discharging state transitions. Operational impact refers to a comprehensive description of the direction, magnitude, and recovery characteristics of changes in various electrical quantities within the target microgrid, such as DC bus voltage, AC-side frequency, and power balance, under the individual action of each disturbance factor. Grid-connected and off-grid disturbance scenarios are based on the physical characteristics of each disturbance factor and the analysis results of its impact on microgrid operation. Multiple representative combinations of typical operating conditions are constructed by setting parameters such as the type, occurrence time, intensity, and duration of different disturbance factors. These are used for subsequent simulation testing of the microgrid's switching response performance under different adverse conditions.

[0031] All grid connection / off-grid switching event records and corresponding electrical operation data within the time window are extracted from the historical database of the target microgrid to form a historical grid connection / off-grid operation dataset. Then, for each event record, a mutation detection algorithm, such as the sliding window differential method or wavelet transform method, is used to scan the jump points on the time-series curves of voltage, current, power, and frequency. When the rate of change of electrical quantities at a certain moment exceeds a preset threshold, the event is marked as a potential disturbance, and the steady-state values ​​and transient changes before and after the disturbance are recorded. Next, all detected disturbance events are classified and aggregated, with events having similar electrical characteristics grouped into the same category, such as power surges, power drops, voltage sags, frequency fluctuations, and harmonic injections, each corresponding to a disturbance factor. Subsequently, for each type of disturbance factor, multiple sets of complete response curves for the same type of event are extracted from the historical data. Numerical statistical methods are used to calculate the maximum deviation of the DC bus voltage, the maximum offset of the AC frequency, and the average time required for the system to recover to stability under the influence of the disturbance factor. These are used as quantitative indicators of the impact of the disturbance factor on the microgrid operation. Finally, the intensity range of each disturbance factor is determined based on its physical characteristics. For example, the fluctuation range of photovoltaic output can be set to 10% to 80% of the rated power, and the large load switching amount can be set to 20% to 60% of the total load capacity. Then, different disturbance factors are combined and arranged according to type, intensity, duration, and occurrence time. Multiple combinations covering typical operating conditions such as light load, heavy load, weak grid, and strong grid are selected to construct several grid-connected and off-grid disturbance scenarios. Each scenario is mathematically described as a complete operating condition definition file of the initial operating state superimposed with a specific disturbance time series. Throughout the process, a unified disturbance detection threshold needs to be set, and the classification results need to be manually verified to ensure that the physical meaning is reasonable. At the same time, the total number of scenarios constructed should be controlled within the time range that can be simulated and calculated.

[0032] Specifically, the method for determining each disturbance factor is as follows: based on historical grid connection and disconnection operation data, determine each grid connection and disconnection event; extract the changes in associated electrical parameters of each grid connection and disconnection event from the historical grid connection and disconnection operation data; analyze the changes in each associated electrical parameter to determine each disturbance factor.

[0033] A grid connection / off-grid event refers to the complete operational process and the transition time periods before and after a target microgrid switches from one operating state to another, such as switching from grid-connected operation to off-grid operation or vice versa. Changes in associated electrical parameters refer to the characteristic information of electrical quantities causally related to each grid connection / off-grid event, such as voltage, current, power, and frequency, showing deviations from steady-state values ​​in a time series, including the amplitude, duration, and recovery trajectory of these fluctuations.

[0034] First, all operational data is exported from the historical database of the target microgrid, arranged in chronological order, and all grid connection / off-grid events are identified. The identification method is to scan the status flag bits or switch signals. When the grid connection switch changes from closed to open, it is marked as a grid connection to off-grid event; when it changes from open to closed, it is marked as an off-grid to grid connection event. At the same time, the precise timestamp of each event is recorded.

[0035] Then, for each identified grid connection / disconnection event, time-series electrical parameter data is extracted from historical operational data for a period before and after the event. This data should cover the steady-state phase before the event, the transient phase during the event, and the recovery phase after the event. The changes in related electrical parameters are extracted from this data. Specifically, the voltage amplitude and frequency at the common coupling point, the DC bus voltage, the active and reactive power at each distributed power source grid connection interface point, the charging and discharging power of the energy storage system, and the voltage dips at important load connection points are read. The magnitude, rate of change, and recovery time of these electrical quantities before and after the event are recorded one by one.

[0036] Finally, the changes extracted from all events are analyzed to identify the various disturbance factors. The analysis method involves comparing the magnitude of changes in various electrical parameters before and after each event, identifying the electrical quantity(s) with the largest change and the earliest anomaly in time, and then inferring the cause based on the corresponding physical equipment or external source. For example, if the DC bus voltage drops sharply while the energy storage power simultaneously rises rapidly, the disturbance factor can be identified as the input of a high-power load; if the power at the photovoltaic grid connection interface drops sharply while other parameters are normal, the disturbance factor can be identified as fluctuations in photovoltaic output; if the voltage at the common coupling point drops significantly and the frequency shifts, the disturbance factor can be identified as a grid-side fault. After completing the above attribution analysis for each event, all disturbance factors and their types can be determined. Throughout the process, the length of the time window before and after data extraction must be uniformly set, for example, 5 seconds before the event to 10 seconds after the event, and the attribution results must be cross-validated to ensure consistency.

[0037] Specifically, the method for constructing various grid-connected and off-grid disturbance scenarios is as follows: determine the monotonicity of the impact of each disturbance factor on the target microgrid to obtain the operational impact; analyze the operational impact of each disturbance factor, obtain the value range of each disturbance factor based on the monotonicity of the impact, and obtain the analysis results; construct various grid-connected and off-grid disturbance scenarios based on the analysis results.

[0038] The monotonicity of an impact factor refers to the consistent response direction of key electrical quantities within the target microgrid, such as DC bus voltage or AC frequency, when the intensity of a disturbance factor continuously increases or decreases within its value range. That is, the response always monotonically increases or always monotonically decreases, without any non-monotonic transition characteristics of first increasing and then decreasing or first decreasing and then increasing. Operational impact is a complete description of the microgrid's response characteristics under each disturbance factor based on the monotonicity of the impact factor, including both the response direction and the corresponding relationship between the response amplitude and the disturbance intensity. The value range refers to the reasonable intensity interval defined for each disturbance factor based on the analysis results of the monotonicity of the impact factor. This interval covers all physically feasible values ​​that the disturbance factor may exhibit in the actual operation of the target microgrid; for example, the fluctuation range of photovoltaic output is 10% to 80% of the rated power. The analysis results are a complete data table obtained by integrating the monotonicity of the impact factor of each disturbance factor and its corresponding value range, clarifying the impact law of each disturbance factor on the microgrid within its respective value range. The on-grid and off-grid disturbance scenarios are based on the analysis results. They are constructed by selecting specific values ​​from the range of values ​​of each disturbance factor and combining them, while superimposing the initial operating conditions and time series characteristics to create multiple typical operating condition definition files for simulation testing.

[0039] First, for each disturbance factor identified in the previous step, analyze the monotonicity of its impact on the target microgrid. Specifically, keep the current operating conditions of the microgrid unchanged, and in the simulation model, gradually increase the intensity of the disturbance factor from 0 to its physical upper limit. Record the response values ​​of the DC bus voltage and AC frequency at regular intervals. Then, plot the response curve between the disturbance factor intensity and the key electrical quantity, and observe whether the curve always changes in the same direction. If the key electrical quantity always increases with the increase of the disturbance intensity, it is determined to be monotonically increasing; if it always decreases, it is determined to be monotonically decreasing. Both are monotonicity analysis results, thus revealing the operational impact of the disturbance factor.

[0040] Then, based on the monotonicity analysis results of each disturbance factor, its value range is further determined. Specifically, combining the equipment parameters and actual operating boundary conditions of the target microgrid, for monotonically increasing disturbance factors, the lower limit of its value range is set to 0, and the upper limit is set to the maximum intensity value that the disturbance factor may occur in actual engineering while the microgrid can still maintain stable operation; the same treatment applies to monotonically decreasing disturbance factors. For example, the value range for photovoltaic output fluctuations can be set to 10% to 90% of the rated power, the value range for load switching can be set to 5% to 60% of the total rated capacity of the microgrid, and the value range for grid voltage sag can be set to 10% to 80% of the rated voltage. The name, monotonicity direction, and value range of each disturbance factor are compiled and summarized to form an analysis results table.

[0041] Finally, based on the analysis results, various grid-connected and off-grid disturbance scenarios are constructed. Specifically, for each disturbance factor, a specific value is selected within its range from the analysis results table. Multiple combinations are generated using Latin hypercube sampling or orthogonal experimental design methods to ensure that each combination covers different disturbance intensity levels. Simultaneously, the disturbance occurrence time, disturbance duration, and initial microgrid operating state (e.g., energy storage state of charge and current load rate) are added to each combination. This information is then packaged into scenario definition files in a unified format. Each file fully describes the loading scheme for a specific disturbance sequence under a typical operating condition, ultimately resulting in several grid-connected and off-grid disturbance scenarios covering various conditions such as light load, heavy load, weak grid, and strong grid. Throughout the process, at least five intensity levels must be selected for each disturbance factor to ensure that subsequent simulations fully reflect monotonicity patterns, and the physical rationality of the disturbance parameters in each scenario must be checked.

[0042] Specifically, the method for determining the operational impact is as follows: perform a small-signal disturbance scan for each disturbance factor to obtain the response direction of the target microgrid; determine the impact monotonicity based on the response direction, and determine the operational impact based on the impact monotonicity.

[0043] Small-signal disturbance scanning is a testing method that applies a small, sufficiently small change to a disturbance near the steady-state operating point of a target microgrid, without altering the system's nonlinear characteristics, and observes the system's response. The response direction refers to the direction of deviation of key electrical quantities within the target microgrid, such as DC bus voltage or AC frequency, from their pre-disturbance steady-state values ​​after the small-signal disturbance scan is applied; that is, whether they increase or decrease. The effect of monotonicity refers to the characteristic that the response direction of key electrical quantities remains consistent and does not reverse as the intensity of the disturbance continuously changes throughout its physical range. This characteristic is determined by extrapolating the response direction obtained from the small-signal disturbance scan.

[0044] First, for each disturbance factor identified in the previous step, a small-signal disturbance scan test is performed. Specifically, when the target microgrid is in steady-state operation, a small increment is added to the current value of the disturbance factor in the simulation model. This increment is typically 1% to 5% of the rated or typical value of the disturbance factor. For example, a positive step of 2% of the rated power is applied to the photovoltaic output, and a positive step of 3% of the total rated capacity is applied to the high-power load. Then, the new steady-state value of the DC bus voltage after the disturbance is applied and the transient process ends are recorded. The magnitude of the new steady-state value is compared with the original steady-state value. If the new steady-state value is greater than the original steady-state value, the response direction corresponding to the disturbance factor is determined to be positive, meaning that the increased intensity of the disturbance factor leads to an increase in the DC bus voltage; otherwise, it is determined to be negative.

[0045] Then, the monotonicity of the disturbance factor's influence is determined based on the response direction. Specifically, the response direction obtained from the small-signal disturbance scan is extrapolated to the entire physical value range. If the response direction is positive at the current test point, it is assumed that the disturbance factor's influence on the DC bus voltage is monotonically increasing across the entire value range. If it is negative, it is assumed to be monotonically decreasing. Based on this, the operational impact is determined, that is, it is clear that the disturbance factor will only drive the key electrical quantity to change in one direction during its operation and will not produce a reverse regulation effect.

[0046] Throughout the process, each disturbance factor requires small-signal scanning in at least two directions, one positive and one negative. This involves applying a small positive increment disturbance and a small negative decrement disturbance to the steady-state value, recording the response direction, and verifying whether they are opposite to each other. This confirms the linearization characteristics of the system near the operating point and ensures the reliability of the extrapolated monotonicity conclusions. Simultaneously, the amplitude of the small-signal disturbances must be sufficiently small to avoid triggering microgrid protection actions or causing the system to enter the nonlinear saturation region, ensuring that the scanning results only reflect the local response characteristics near the steady-state operating point.

[0047] Preferably, the operational changes of the target microgrid under each grid connection / disconnection disturbance scenario are predicted based on real-time operational data. This involves acquiring real-time grid operational data of the target power grid; constructing an initial grid connection / disconnection model based on the real-time grid operational data; and applying each grid connection / disconnection disturbance scenario to the initial grid connection / disconnection model to obtain the corresponding operational changes.

[0048] The target grid refers to a large-capacity external power system connected to the target microgrid through a common coupling point, typically serving as the supporting power source for the microgrid's grid-connected operation. Real-time grid operation data refers to electrical parameters reflecting the external grid's state, such as voltage amplitude, frequency, phase angle, and exchange power at the common coupling point, collected from the target grid side at the current moment. The initial grid connection / disconnection model is a mathematical simulation model established using the equivalent circuit method or state-space method, based on real-time grid operation data and the target microgrid's real-time operation data, to describe the interaction between the target microgrid and the target grid at the common coupling point. It includes the equivalent parameters of various distributed power sources, energy storage systems, loads, and line impedances within the microgrid. Grid connection / disconnection disturbance scenarios refer to multiple typical operating condition definition files constructed based on historical data analysis. Each file specifies a disturbance sequence of a particular type, intensity, duration, and occurrence time, as well as the initial operating state of the microgrid. Operational changes refer to the response trajectories of key electrical quantities within the target microgrid on the time axis obtained through simulation calculations after applying a certain grid connection / disconnection disturbance scenario to the initial grid connection / disconnection model. This includes DC bus voltage waveforms, AC frequency fluctuation curves, output adjustment processes of each distributed power source, and power exchange change sequences at the common coupling point.

[0049] First, real-time grid operation data is acquired from the data acquisition terminal on the target grid side, including parameters such as grid voltage amplitude, frequency, phase angle, and grid-side equivalent impedance at the common coupling point. Simultaneously, real-time operation data is acquired from the data acquisition system of the target microgrid, including DC bus voltage, output of each distributed power source, energy storage charging and discharging power, load power consumption, and voltage and current on the microgrid side at the common coupling point.

[0050] Then, the acquired data from these two types are used to construct an initial on-grid and off-grid model. Specifically, the equivalent circuit topology of the target microgrid is established in the simulation platform. The distributed power sources within the microgrid are equivalent to controlled current sources or voltage sources, the energy storage system is equivalent to a bidirectional DC power source and converter series model, the load is equivalent to a constant impedance or power load, and the lines and transformers are equivalent to series impedances. The connection relationship between the common coupling point and the target grid is represented by the Thevenin equivalent circuit. The various electrical parameters acquired in real time are substituted as the initial steady-state operating point of the model, thus forming a numerical simulation model that can reflect the interaction state between the microgrid and the grid at the current moment.

[0051] Finally, each constructed grid-connected / off-grid disturbance scenario is sequentially applied to the initial grid-connected / off-grid model. Specifically, the disturbance sequence from each scenario definition file is loaded into the corresponding location in the model according to its time sequence and intensity value. For example, photovoltaic output fluctuations are loaded into the control terminal of the photovoltaic power source model, load switching is loaded into the power setting terminal of the load model, and grid voltage sags are loaded into the voltage source terminal of the Thevenin equivalent circuit. The simulation is then started and run until the disturbance sequence ends and the system returns to steady state. During the simulation, the time-domain response data of each key electrical quantity is recorded with a fixed step size. This yields the complete operational changes of the target microgrid on the time axis under each disturbance scenario, including the DC bus voltage fluctuation curve, frequency offset trajectory, power output adjustment response of each power source, and power exchange change sequence at the common coupling point. Throughout the process, it is crucial to ensure that the model parameters strictly correspond to the real-time data, the simulation step size is no greater than 1 millisecond to capture transient details, and the simulation results of all scenarios are saved for subsequent analysis.

[0052] Constructing the initial on-grid and off-grid model requires establishing a complete equivalent circuit topology of the target microgrid in the simulation platform. Each distributed power source within the microgrid is equivalent to a controlled current source or voltage source and connected to its inverter control model. The energy storage system is equivalent to a model of a bidirectional DC power source connected in series with a voltage source converter and configured with constant voltage or constant power charging and discharging control strategies. The load is equivalent to a constant impedance or constant power load. Lines and transformers are equivalent to series resistance and inductance parameters. The external grid connection relationship is represented by the Thevenin equivalent circuit at the common coupling point. The voltage source amplitude and phase are set by the real-time operation data of the grid, and the internal resistance is set by the equivalent impedance parameters of the grid side. Finally, the real-time operation data of the target microgrid collected by the central controller, such as the measured value of the DC bus voltage, the current output value of each power source, the current charging and discharging power of the energy storage, and the current power consumption of the load, are used as the initial steady-state operating point of the model, thereby forming a numerical simulation model that can accurately reflect the interaction state between the microgrid and the grid at the current moment.

[0053] Preferably, the DC bus voltage fluctuation of the target microgrid is extracted from each operational change, and the grid connection / disconnection prediction result is obtained based on the DC bus voltage fluctuation and the corresponding disturbance factor data in the grid connection / disconnection disturbance scenarios.

[0054] Operational change status refers to the complete response trajectory of key electrical quantities within the target microgrid on the time axis, obtained through simulation calculations after applying a specific grid-connected / off-grid disturbance scenario to the initial grid-connected / off-grid model. DC bus voltage fluctuation status is time-series data of DC bus voltage changes over time, specifically extracted from the operational change status. It includes characteristic information such as the magnitude of voltage fluctuations, duration of fluctuations, the start time of fluctuations, the maximum extreme point of voltage dips or rises, and the time required for voltage recovery to a steady-state value. Grid-connected / off-grid disturbance scenarios refer to multiple typical operating condition definition files constructed based on historical data analysis. Each file specifies a disturbance sequence of a particular type, intensity, duration, and occurrence time, as well as the initial operating state of the microgrid. Disturbance factor data refers to the specific quantitative parameters of various disturbance sources recorded in each grid-connected / off-grid disturbance scenario, such as the power change of photovoltaic output fluctuations, the power value of load switching, the remaining voltage percentage and duration of grid voltage dips, and the change in energy storage charging and discharging power. The grid connection and disconnection prediction results are comprehensive judgments derived from the correlation between DC bus voltage fluctuations and corresponding disturbance factor data under multiple simulation scenarios, after statistical analysis or learning. They are used to indicate whether the DC bus voltage exceeds the limit when the target microgrid faces various disturbances in the current state and whether the grid connection and disconnection switching can be successfully completed.

[0055] For each grid-connected / off-grid disturbance scenario obtained from the simulation, the DC bus voltage fluctuation is extracted. Specifically, the time-domain waveform data of the DC bus voltage is read from the simulation result file of each scenario. The maximum and minimum values ​​in the waveform are identified, and the deviation between them and the steady-state reference value is calculated. The time from when the voltage starts to deviate from the steady-state value to when it first crosses the preset deviation threshold is recorded as the fluctuation start time. The time from when the voltage starts to deviate to when it returns to the allowable error range of the steady-state value is recorded as the fluctuation duration. At the same time, the maximum drop depth or maximum rise height and its corresponding time point are marked. The above feature parameters are organized to form a DC bus voltage fluctuation description vector for that scenario.

[0056] Then, the DC bus voltage fluctuations of all scenarios are correlated and integrated with the disturbance factor data of the corresponding scenarios. Specifically, a complete sample record containing input and output is established for each scenario. The input part is the disturbance factor data recorded in the scenario definition file, including disturbance type, disturbance intensity, disturbance duration, and disturbance occurrence time. The output part is the feature vector of DC bus voltage fluctuations extracted from the simulation results of that scenario.

[0057] Based on the associated sample data from all scenarios, the grid connection / disconnection prediction results are obtained using either a threshold-based method or a classification / regression method. If the threshold-based method is used, for each set of disturbance factor data, the maximum deviation of the DC bus voltage in that scenario is compared to whether it exceeds a preset safety threshold, such as ±10% of the rated DC bus voltage. Scenarios that do not exceed the threshold are marked as successfully completing the grid connection / disconnection switch, while scenarios that exceed the threshold are marked as potentially failing. The marking results for all scenarios are statistically analyzed to form the prediction conclusion. If the classification / regression method is used, the associated sample data is divided into training and testing sets to train a classification or regression model. This model can automatically output the corresponding voltage fluctuation prediction value and safety risk assessment level based on the input disturbance factor data. The trained model is then used as the final grid connection / disconnection prediction result. Throughout the process, a unified voltage steady-state benchmark value and allowable error range must be specified to ensure consistent fluctuation feature extraction standards across all scenarios.

[0058] Preferably, the target operating data range of the target microgrid at the target switching time is obtained by inversion based on the grid connection / disconnection prediction results. Based on the grid connection / disconnection prediction results, the extreme value of DC bus voltage fluctuation is determined; based on the extreme value of DC bus voltage fluctuation, the target operating data range is obtained by inversion.

[0059] The extreme values ​​of DC bus voltage fluctuations are extracted from the grid connection / disconnection prediction results, representing the maximum positive deviation (maximum rise) and the maximum negative deviation (maximum drop) of the DC bus voltage relative to the steady-state reference value under all disturbance scenarios. Inversion refers to the process of using an established microgrid model and its parameter mapping relationships, given the known output result (the extreme values ​​of DC bus voltage fluctuations), to inversely calculate the input conditions (target operating data) that led to the output result. The target switching time is the optimal time to perform grid connection / disconnection operations, determined by comparing the predicted operating data with preset switching conditions. The target operating data range refers to the reasonable range of values ​​that controllable electrical quantities within the target microgrid, such as energy storage charging and discharging power, distributed power output, and load power consumption, must reach at the target switching time to ensure that the DC bus voltage fluctuation amplitude does not exceed safety limits when performing grid connection / disconnection operations at the target switching time.

[0060] The maximum positive and maximum negative deviations of the DC bus voltage relative to the steady-state reference value under all disturbance scenarios are extracted from the grid connection and disconnection prediction results. The larger of the two absolute values ​​is determined as the extreme value of DC bus voltage fluctuation. This extreme value represents the worst voltage impact that the target microgrid may face under the current operating conditions.

[0061] The extreme value is substituted into the established initial on-grid / off-grid model as a constraint, and the simulated output of the DC bus voltage in the model is set to equal the extreme value. Simultaneously, the parameters related to disturbance factors in the model are fixed as the most severe combination values ​​in each disturbance scenario. Then, the numerical conditions that the controllable input variables in the model should satisfy at the current moment are solved in reverse. These controllable input variables include the charging and discharging power setpoints of the energy storage system, the active and reactive power output values ​​of the distributed generation, and the power consumption values ​​of the adjustable load. During the inversion process, the feasible intervals of each variable need to be defined according to the physical operating boundary conditions of the target microgrid. Within the feasible intervals, all combinations of controllable variables that can ensure the DC bus voltage fluctuation does not exceed the extreme value are solved.

[0062] Finally, the range of controllable variable combinations obtained from the inversion solution is further limited to the time-domain window corresponding to the target switching moment. Specifically, the intersection of the values ​​of all controllable variables in the inversion results at the target switching moment is taken. The minimum and maximum values ​​of each controllable variable are extracted from this intersection to form a continuous numerical interval covering all controllable variables. These intervals are then summarized and defined as specific indicators such as the energy storage output range, distributed power generation output range, and load regulation range at that moment. Ultimately, the target operating data range that the target microgrid should meet at the target switching moment is obtained, serving as a benchmark reference value for subsequent strategy determination. Throughout the process, it is necessary to ensure that the inversion step size is sufficiently fine to capture boundary points, and the solution results are verified through simulation back-substitution to confirm that any value within this range can keep voltage fluctuations within extreme values.

[0063] Finally, based on the target operating data range and real-time operating data, the target grid connection / disconnection switching control strategy for the target microgrid is obtained. It is determined whether the real-time operating data meets the target operating data range; if it does, a first target grid connection / disconnection switching control strategy is generated based on the target switching time; if it does not meet the target operating data range, a second target grid connection / disconnection switching control strategy is generated based on the difference between the real-time operating data and the target operating data range; the target grid connection / disconnection switching control strategy is obtained based on either the first or second target grid connection / disconnection switching control strategy.

[0064] The first target grid-connected / off-grid switching control strategy refers to the set of control instructions that directly execute the grid-connected / off-grid switching operation at the target switching time according to a preset program when the real-time operating data already meets the target operating data range. The difference refers to the deviation between the current value of each controllable electrical quantity in the real-time operating data and the upper and lower boundaries of the corresponding electrical quantity in the target operating data range. The second target grid-connected / off-grid switching control strategy refers to the set of pre-adjustment control instructions formulated based on the magnitude and direction of the difference when the real-time operating data does not meet the target operating data range. This set is used to adjust the output of energy storage, distributed power generation, or load consumption to bring the system state back to the target operating data range. The target grid-connected / off-grid switching control strategy determines the actual set of control instructions to be executed in either the first or second strategy based on the comparison between the real-time operating data and the target operating data range. This guides the microgrid to complete necessary pre-adjustment operations before the target switching time and execute the final switching at the target switching time.

[0065] Each controllable electrical quantity value in the real-time operating data is compared with the target operating data range. Specifically, the current charging and discharging power of the energy storage, the current output value of each distributed power source, and the current load power consumption are compared with the corresponding lower and upper limits in the target operating data range. Only when all controllable quantities are within their respective ranges is the scenario considered satisfactory; if any controllable quantity is below the lower limit or above the upper limit, the scenario is considered unsatisfactory.

[0066] If the target operating data range is met, the first target and off-grid switching control strategy are generated directly according to the preset program. Specifically, the target switching time is used as the execution time point, and a sequence of actions is generated to disconnect the generator-side switch, close the load-side switch, or perform other necessary switching actions at that time. The complete action timing table is then encapsulated into the first control instruction set.

[0067] If the target operating data range is not met, the difference between the real-time operating data and the target operating data range is calculated. Specifically, for each controllable quantity that does not meet the requirements, the deviation between the current value and the corresponding boundary value is calculated. If the current value is lower than the lower limit, the difference is negative and needs to be adjusted upward; if the current value is higher than the upper limit, the difference is positive and needs to be adjusted downward. The differences of each controllable quantity are then summarized into a difference vector.

[0068] Then, a second target is generated based on the difference vector, and an off-grid switching control strategy is implemented. Specifically, corresponding pre-adjustment measures are formulated according to the direction and magnitude of the difference for each controllable quantity. If the energy storage charging and discharging power is insufficient, an instruction to increase the charging and discharging power is sent to the energy storage system. If the distributed power output is excessive, an instruction to reduce the output power is sent to the inverter. If the load power consumption is too low, an instruction to increase consumption is sent to the adjustable load. All pre-adjustment instructions are arranged according to execution priority and time sequence to form a pre-adjustment operation sequence that is executed sequentially before the target switching time. Finally, the off-grid switching operation is executed after the pre-adjustment is completed.

[0069] Finally, it is determined whether the real-time running data originally met the target running data range. If it originally met the range, the first target and off-grid switching control strategy is directly output as the final target and off-grid switching control strategy. If it originally did not meet the range, the generated second target and off-grid switching control strategy is output as the final strategy. At the same time, safety constraint checks are set for the pre-adjustment operations in the second strategy to ensure that all pre-adjustment operations do not exceed the physical allowable range of the equipment.

[0070] The grid-connected / off-grid switching control method of this invention further includes: processing the current real-time operating data of the target microgrid within each determined optimization cycle, updating the target grid-connected / off-grid switching control strategy based on the processing results, and obtaining an updated target grid-connected / off-grid switching control strategy.

[0071] The optimization cycle refers to a pre-set fixed time interval used to periodically trigger the strategy update process, ensuring that the control strategy can adapt to the slow changes in the microgrid's operating conditions. Real-time operating data consists of dynamic electrical parameters such as voltage, current, power, and frequency collected from key nodes of the target microgrid and uploaded to the central controller at the current moment. Updating refers to the process of re-executing the entire control strategy generation process based on the latest real-time operating data processing results at the end of each optimization cycle, replacing the original strategy with the newly generated one. Updating the target grid-connected / off-grid switching control strategy refers to the latest set of control instructions, regenerated after periodic updates, that adapts to the current actual operating state of the microgrid, used to replace the previous version of the strategy to guide subsequent grid-connected / off-grid switching operations.

[0072] First, determine the specific duration of the optimization cycle. This duration can be set according to the operating characteristics of the target microgrid, typically 5 minutes, 15 minutes, or 30 minutes. Then, configure a timer in the central controller to automatically trigger a strategy update process every optimization cycle.

[0073] At the start of each optimization cycle, the central controller reads all accumulated real-time operating data from the data acquisition system, including DC bus voltage, output of each distributed power source, energy storage charging and discharging power, load power consumption, and time-series records of voltage and frequency at the common coupling point. This data is then preprocessed. Specifically, median filtering or moving average filtering algorithms are first used to remove abnormal fluctuations in the data. Then, feature extraction is performed on the filtered data to calculate the average value and slope of each electrical quantity within the optimization cycle, forming a feature vector representing the current operating state.

[0074] Next, the processed feature vector is used as input to re-execute the complete strategy generation process, including re-acquiring real-time grid operation data based on the latest data processing results to update the parameters of the initial grid connection and disconnection model, re-performing simulation predictions under various grid connection and disconnection disturbance scenarios, re-extracting the extreme values ​​of DC bus voltage fluctuations and inverting them to obtain a new target operation data range, and re-comparing the current real-time operation data with the new target operation data range to generate a new set of control commands.

[0075] Finally, the newly generated set of control instructions is used as the updated strategy, replacing the original strategy stored in the central controller. The timestamp and reason for this update are recorded. Simultaneously, the updated strategy is temporarily stored in the instruction pre-execution area, and the switching operation is executed according to the updated strategy when the target switching time arrives. All the above calculation steps must be completed within each optimization cycle; therefore, the optimization cycle duration must be longer than the overall calculation process time. Furthermore, the update results within each optimization cycle must be logged to trace the historical trajectory of strategy changes.

[0076] The following embodiments concretize the grid-connected / off-grid switching control framework abstracted in the above embodiments into an engineering implementation scheme for electric vehicle and grid interaction systems. The above embodiments establish a complete six-step process from real-time data acquisition, disturbance scenario construction, operation prediction, voltage fluctuation extraction, inversion to obtain the target operating data range, to generating a control strategy, and include optimized details such as target switching time determination, disturbance factor identification, small-signal disturbance scanning, initial grid-connected / off-grid model construction, and periodic updates. The following embodiments concretize the disturbance scenarios in the above process into an uncertain switching power trajectory family, the operational changes into the cumulative energy change trajectory obtained by integrating the power imbalance, the DC bus voltage fluctuations into a dynamic energy envelope, i.e., an energy corridor, the target operating data range obtained through inversion into reverse derivation of a feasible initial energy window, the generated control strategy into determining the safety status based on the energy window and initiating pre-adjustment or rescue commands, and the periodic updates into a rolling safety judgment mechanism. The core logic of the two embodiments is completely consistent. Both are to predict the future operating trajectory, construct a dynamic boundary that reflects the energy accumulation effect, back-calculate the current safe operating range, and generate control commands by comparing with the real-time status. The only difference is that the above embodiments use general microgrid terminology to describe the framework, while the following embodiments use the special terminology of electric vehicle and grid interaction system and supplement the two-layer control details of pre-adjustment and rescue. It is a complete expansion and engineering refinement of the above embodiments in a specific application scenario.

[0077] Another embodiment of the present invention provides a safety control method for grid-connected / off-grid switching in electric vehicle-grid interaction systems. Its core innovation lies in upgrading the traditional judgment based on instantaneous power or fixed voltage thresholds to a full-process rolling safety assessment and control based on the dynamic energy window of the DC bus. This method systematically solves the problem of cumulative power imbalance caused by factors such as switching action delay, mode conversion lag, power ramp-up limitations, and load fluctuations during the switching process, thereby effectively preventing DC bus overvoltage or undervoltage and ensuring a smooth transition for the microgrid.

[0078] This invention first establishes a prediction framework covering the entire switching prediction period, encompassing key stages such as the opening or closing of the common coupling point switch, converter control mode transitions, and power recovery. Within this framework, the technical solution characterizes the complex uncertainties of actual operation by generating a family of uncertain switching power trajectories. Specifically, it unifies the power direction definitions for AC and DC buses and constructs multiple possible power imbalance scenarios based on historical prediction residuals, equipment response delays, and actuator physical constraints such as power limits and ramp rates. These scenarios are not isolated instantaneous values ​​but complete power trajectories existing in time series form, reflecting the transmission of cumulative effects between different stages, thus laying the foundation for subsequent evaluation.

[0079] Based on this, this invention proposes a method for constructing a bidirectional cumulative energy envelope. By continuously integrating the power imbalance in each uncertain scenario from the prediction starting point, the trajectory of the cumulative energy change of the DC bus under that scenario is obtained. Subsequently, the minimum and maximum cumulative energy values ​​at each moment are extracted in all scenarios, forming an energy interval band that varies with the prediction time. This envelope is not a fixed upper or lower limit, but a dynamically shrinking or expanding energy corridor. It simultaneously characterizes the maximum energy accumulation risk (overvoltage risk) and the maximum energy release risk (undervoltage risk) that the system may face during the entire switching process, providing a quantitative basis for subsequent feasibility assessment.

[0080] Using this dynamic envelope, embodiments of the present invention further deduce a feasible initial energy window in reverse. Specifically, based on the upper and lower limits of the allowable safe voltage of the DC bus and with a controllable margin, combined with the most severe energy increase and the most severe energy decrease that may occur during the entire prediction period, the range in which the DC bus energy must be located at the start of the switching is deduced to ensure that no limits are exceeded in any uncertain scenario. If the actual initial energy falls within this window, the current state is determined to meet the safe switching conditions; if it falls outside the window, it indicates that there is an energy gap or energy surplus, and a pre-adjustment procedure needs to be initiated.

[0081] For the pre-adjustment stage, this invention does not simply rely on a single converter, but rather performs refined calculations of the joint achievable capability of the bidirectional AC / DC converter and the bidirectional DC / DC converter. It fully considers the response delay, power ramp-up characteristics, and power limits of each of the two actuators, as well as the coupling constraints imposed by the DC bus current limit, battery state of charge, and battery management system permissions when both are adjusted simultaneously, to derive the system's actual usable joint corrected power and joint achievable energy. Based on this, the controller can determine whether, within the available time before the planned switching action, the current energy state can be brought back to the feasible initial window by directionally increasing or decreasing the bus energy. If feasible, the controller generates the optimal power correction command for both converters using a constrained optimization allocation model, completing the pre-adjustment in the shortest time and in the smoothest manner; if infeasible, the planned switching operation is postponed or canceled.

[0082] More importantly, this invention introduces a rolling safety judgment and rescue mechanism after the common coupling point switching action, whether for planned switching or unplanned islanded operation. In each control cycle, the controller recalculates the dynamic energy envelope and feasible window within the remaining time window based on the latest measured data, such as DC bus voltage, port power, local load, battery state of charge, and battery management system status. This results in two key sets: the nominal feasible set represents the initial energy range that can be maintained safely under the current planned power trajectory, and the controllable feasible set represents the initial energy range that can be restored to safety by initiating additional rescue adjustments. Based on the region to which the current measured energy belongs, the system classifies the operating state into three categories: normal safe state (continuing to execute the current plan), recoverable warning state (initiating a directional power rescue command), and unrecoverable state (terminating the switching and performing a safe exit). The rescue command also undergoes rigorous verification through full-process power envelope constraints, joint power constraints, and endpoint operating conditions such as grid readiness and synchronous grid connection requirements, ensuring that the rescue process itself does not trigger new over-limit risks.

[0083] Another embodiment of the present invention provides a grid-connected / off-grid switching control system. For details, please refer to [link to relevant documentation]. Figure 2 , Figure 2 The diagram shown is a flowchart of a grid-connected / off-grid switching control system according to one embodiment of the present invention, including: The acquisition module 11 is used to acquire real-time operating data of the target microgrid and determine the target switching time of the target microgrid; Scenario module 12 is used to determine various disturbance factors based on the historical on-grid and off-grid operation data of the target microgrid, analyze the impact of each disturbance factor on the operation of the target microgrid, and construct various on-grid and off-grid disturbance scenarios based on the analysis results; The change module 13 is used to predict the operational changes of the target microgrid under each grid connection and disconnection disturbance scenario based on real-time operation data; Prediction module 14 is used to extract the DC bus voltage fluctuation of the target microgrid from each operational change, and obtain the grid connection / disconnection prediction result based on each DC bus voltage fluctuation and the corresponding disturbance factor data in the grid connection / disconnection disturbance scenario. Range module 15 is used to invert the target operating data range of the target microgrid at the target switching time based on the grid connection and disconnection prediction results; Control module 16 is used to obtain the target and off-grid switching control strategy of the target microgrid based on the target operating data range and real-time operating data.

[0084] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0085] Accordingly, embodiments of the present invention provide a computer-readable storage medium, the computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform steps in the on-grid / off-grid handover control method of the above embodiments, for example... Figure 1 Steps S1 to S6 as described above.

[0086] This invention first collects real-time operating data of the target microgrid and determines the planned switching time. Simultaneously, it uses historical grid connection and off-grid operating data to identify various disturbance factors and quantify their impact on microgrid operation, thereby constructing a set of grid connection and off-grid disturbance scenarios covering multiple possible operating conditions. Based on this, the scheme uses real-time operating data as the initial state to predict the microgrid's operational trajectory over time under each disturbance scenario, extracts the DC bus voltage fluctuation characteristics from each trajectory, and combines this with the corresponding disturbance factor data to comprehensively derive the grid connection and off-grid prediction results. Subsequently, the scheme uses reverse deduction to solve for the range of DC bus operating data that ensures the microgrid's safe passage through all disturbance scenarios at the target switching time. Finally, it compares the current measured operating data with this target range, makes a decision, and generates a grid connection and off-grid switching control strategy adapted to the current state. The beneficial effects of this scheme are mainly reflected in the following aspects: by constructing disturbance scenarios and predicting the entire process of operation, the control decision-making is transformed from a passive response at a single moment to an active planning for the entire switching period. Furthermore, by using the target operating data range obtained from inversion calculations, a clear quantitative benchmark is provided for the bus energy state at the switching moment. This enables the generated control strategy to make targeted adjustments based on the current actual state of the microgrid, effectively compensate for the cumulative power deviation during the switching process, fundamentally suppress the impact fluctuations in voltage and frequency, and ultimately achieve a smooth transition of the microgrid to on-grid and off-grid modes and significantly enhance the system's operational stability.

[0087] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.

Claims

1. A method for switching control between grid and off-grid systems, characterized in that, include: Acquire real-time operating data of the target microgrid and determine the target switching time of the target microgrid; Based on the historical on-grid and off-grid operation data of the target microgrid, each disturbance factor is identified, and the impact of each disturbance factor on the operation of the target microgrid is analyzed. Based on the analysis results, each on-grid and off-grid disturbance scenario is constructed. Based on the real-time operating data, predict the operational changes of the target microgrid under each of the grid connection and disconnection disturbance scenarios; The DC bus voltage fluctuation of the target microgrid is extracted from each of the aforementioned operational changes, and the grid connection / disconnection prediction results are obtained based on each of the aforementioned DC bus voltage fluctuations and the corresponding disturbance factor data in the grid connection / disconnection disturbance scenarios. Based on the grid connection and disconnection prediction results, the target operating data range of the target microgrid at the target switching time is obtained by inversion; Based on the target operating data range and the real-time operating data, the target on-grid and off-grid switching control strategy of the target microgrid is obtained.

2. The grid-connected / off-grid switching control method as described in claim 1, characterized in that, The process of acquiring real-time operating data of the target microgrid and determining the target switching time of the target microgrid includes: The real-time operating data is analyzed to determine the fluctuation trend of the real-time operating data; Based on the aforementioned fluctuation trend, predictions are made to obtain predicted operational data. The predicted operating data is analyzed based on preset switching conditions to determine the target switching time.

3. The grid-connected / off-grid switching control method as described in claim 1, characterized in that, Based on the acquired historical off-grid operation data of the target microgrid, various disturbance factors are determined, including: Based on the aforementioned historical on- and off-network operation data, each on- and off-network event is determined; Extract the associated electrical parameter changes for each of the historical on-grid and off-grid events from the historical on-grid and off-grid operation data; The changes in each of the associated electrical parameters are analyzed to determine each of the disturbance factors.

4. The grid-connected / off-grid switching control method as described in claim 1, characterized in that, The analysis examines the impact of each disturbance factor on the operation of the target microgrid, and constructs various grid-connected and off-grid disturbance scenarios based on the analysis results, including: The monotonicity of the impact of each of the aforementioned disturbance factors on the target microgrid is determined to obtain the operational impact situation; The operational impact of each of the aforementioned disturbance factors is analyzed, and the value range of each disturbance factor is obtained based on the monotonicity of the impact, thus yielding the analysis results. Based on the analysis results, each of the above-mentioned on-grid and off-grid disturbance scenarios is constructed.

5. The grid-connected / off-grid switching control method as described in claim 4, characterized in that, The process of determining the monotonicity of the impact of each of the disturbance factors on the target microgrid to obtain the operational impact includes: A small-signal perturbation scan is performed on each of the aforementioned perturbation factors to obtain the response direction of the target microgrid; The monotonicity of the influence is determined based on the response direction, and the operational influence is determined based on the monotonicity of the influence.

6. The grid-connected / off-grid switching control method as described in claim 1, characterized in that, The prediction of the operational changes of the target microgrid under each of the grid connection and disconnection disturbance scenarios based on the real-time operational data includes: Obtain real-time power grid operation data of the target power grid; Based on the real-time operation data of the power grid and the real-time operation data, an initial disconnection and disconnection model is constructed. Each of the aforementioned grid connection / disconnection disturbance scenarios is applied to the initial grid connection / disconnection model to obtain the corresponding operational changes.

7. The grid-connected / off-grid switching control method as described in claim 1, characterized in that, The target operating data range of the target microgrid at the target switching time is obtained by inverting the grid connection / disconnection prediction results, including: Based on the grid connection and disconnection prediction results, the extreme values ​​of DC bus voltage fluctuations are determined; The target operating data range is obtained by inversion based on the extreme value of the DC bus voltage fluctuation.

8. The grid-connected / off-grid switching control method as described in claim 1, characterized in that, The target on-grid / off-grid switching control strategy for the target microgrid, based on the target operating data range and the real-time operating data, includes: Determine whether the real-time running data meets the target running data range; If the target operating data range is met, a first target is generated based on the target switching time, and an offline switching control strategy is implemented. If the target operating data range is not met, a second target is generated and an off-grid switching control strategy is implemented based on the difference between the real-time operating data and the target operating data range. The target on-grid and off-grid handover control strategy is obtained based on the first target on-grid and off-grid handover control strategy or the second target on-grid and off-grid handover control strategy.

9. The grid-connected / off-grid switching control method as described in claim 1, characterized in that, After obtaining the target on-grid / off-grid switching control strategy for the target microgrid based on the target operating data range and the real-time operating data, the method further includes: Within each defined optimization cycle, the current real-time operating data of the target microgrid is processed, and the target grid-connected / off-grid switching control strategy is updated based on the processing results to obtain the updated target grid-connected / off-grid switching control strategy.

10. A grid-connected / off-grid switching control system, characterized in that, include: The acquisition module is used to acquire real-time operating data of the target microgrid and determine the target switching time of the target microgrid; The scenario module is used to determine various disturbance factors based on the historical on-grid and off-grid operation data of the target microgrid, analyze the impact of each disturbance factor on the operation of the target microgrid, and construct various on-grid and off-grid disturbance scenarios based on the analysis results. The change module is used to predict the operational changes of the target microgrid under each of the grid connection and disconnection disturbance scenarios based on the real-time operating data; The prediction module is used to extract the DC bus voltage fluctuation of the target microgrid from each of the aforementioned operational changes, and to obtain the grid connection / disconnection prediction result based on each of the aforementioned DC bus voltage fluctuations and the corresponding disturbance factor data in the grid connection / disconnection disturbance scenarios. The range module is used to invert the target operating data range of the target microgrid at the target switching time based on the grid connection and disconnection prediction results; The control module is used to obtain the target on-grid and off-grid switching control strategy of the target microgrid based on the target operating data range and the real-time operating data.