Anti-inrush control method for photovoltaic grid-connected system based on load mutation prediction

By using a load mutation prediction-based anti-reverse current control method for photovoltaic grid-connected systems, a time-series convolutional network model is employed to predict load mutation risk and power changes, dynamically adjust the reverse current detection threshold and energy storage system output, solve the reverse current problem caused by load mutation, and improve system stability and energy utilization efficiency.

CN122159182APending Publication Date: 2026-06-05CHINA ENERGY LIANJIAN (GUANGDONG) ENERGY DEV CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA ENERGY LIANJIAN (GUANGDONG) ENERGY DEV CO LTD
Filing Date
2026-01-30
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing grid-connected photovoltaic systems are unable to predict and respond in a timely manner when load changes occur, leading to frequent reverse current phenomena that affect grid stability and energy utilization efficiency.

Method used

A reverse current control method for photovoltaic grid-connected systems based on load mutation prediction is adopted. By collecting multivariate data in real time, cleaning and standardizing it, a sample sequence is generated using the sliding window method and input into a pre-trained temporal convolutional network model based on attention mechanism. This method predicts the risk of load mutation and future load power, dynamically adjusts the reverse current detection threshold and power adjustment amount, and coordinates the output of the energy storage system and photovoltaic inverter.

Benefits of technology

It effectively reduces the occurrence of backflow, improves the operational stability and grid friendliness of the photovoltaic grid-connected system, optimizes energy utilization, reduces the waste of photovoltaic power generation, has strong adaptability, and reduces the impact on the power grid.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122159182A_ABST
    Figure CN122159182A_ABST
Patent Text Reader

Abstract

The application provides a photovoltaic grid-connected system anti-reverse flow control method based on load mutation prediction, and relates to the technical field of distributed power generation and smart grid control, and the method comprises the following steps: step 1, collecting multi-element data of a photovoltaic grid-connected system in real time, and performing cleaning, alignment and standardization processing on the multi-element data to form a standardized feature vector; step 2, using a sliding window method to extract a multi-element time sequence segment of a historical time period from the standardized feature vector to generate a sample sequence; and step 3, inputting the sample sequence into a pre-trained time series convolution network model based on an attention mechanism to obtain a load mutation risk probability and a load power prediction value at a future time point. The application realizes the foresight and smoothness of anti-reverse flow by means of load mutation prediction, dynamic adjustment of a reverse flow detection threshold and collaborative control of energy storage and a photovoltaic inverter, reduces the occurrence of reverse flow and the impact on the power grid, maximizes the utilization rate of photovoltaic power generation, and adapts to long-term changes in load characteristics.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of distributed generation and smart grid control technology, and in particular to a method for preventing backflow in photovoltaic grid-connected systems based on load mutation prediction. Background Technology

[0002] As the penetration rate of distributed photovoltaic (PV) power generation systems in distribution networks continues to increase, the intermittency and volatility of PV power generation pose new challenges to the stable operation of the power grid. When PV power generation exceeds the local load's power consumption for a short period, a "backflow" phenomenon may occur, where excess power is injected back into the upstream power grid. This phenomenon can lead to potential safety and operational problems such as distribution network voltage fluctuations, increased line loads, and malfunctions of relay protection devices. Therefore, effectively managing the power flow at the grid connection point and preventing backflow has become one of the key issues in the operation and control of PV grid-connected systems. Among existing anti-backflow solutions, software-based anti-backflow control methods are widely used. This method typically sets a fixed backflow detection threshold and adjustment hysteresis. By coordinating the charging and discharging of the energy storage system and adjusting the output of the PV inverter, it attempts to maintain the grid connection point power within a range close to zero without backflow. Compared to a simple backflow shutdown scheme, this method can reduce the waste of PV power generation to a certain extent and achieve more sustainable energy utilization.

[0003] However, in actual operation, especially in scenarios where load power may change suddenly, such regulation strategies based on fixed thresholds and real-time feedback may exhibit certain limitations. For example, in industrial parks, when large equipment shuts down in a planned or unplanned manner, the load power may drop sharply within seconds to minutes. If photovoltaic power generation is not adjusted in time, it is very easy to generate short-term power surplus and trigger reverse flow. Since existing software strategies mainly rely on the current power measurement value and fixed threshold for lagging regulation, they cannot predict before the load change occurs, resulting in the regulation response not keeping up with the power change rate, and reverse flow may still occur. Even if a hysteresis mechanism is set to alleviate frequent actions, its adaptability under sudden load changes is still limited, mostly resulting in high reverse flow peaks and an uneven regulation process, causing impact on the local power grid. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to provide a reverse current control method for photovoltaic grid-connected systems based on load change prediction, which reduces the impact on the power grid and improves the stability of photovoltaic grid-connected system operation.

[0005] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows: A method for preventing backflow in photovoltaic grid-connected systems based on load mutation prediction, the method comprising: Step 1: Collect multi-dimensional data from the photovoltaic grid-connected system in real time, and clean, align, and standardize the multi-dimensional data to form a standardized feature vector; Step 2: Use the sliding window method to extract multivariate time series segments of historical time periods from the standardized feature vectors to generate sample sequences; Step 3: Input the sample sequence into a pre-trained temporal convolutional network model based on the attention mechanism to obtain the probability of load mutation risk and the predicted load power at future time points. Step 4: Preset multiple risk probability intervals and set a backflow detection threshold for each interval; determine the corresponding backflow detection threshold based on the interval in which the load mutation risk probability is located. Step 5: Calculate the predicted power reverse current difference based on the current photovoltaic output and load power prediction values; compare the predicted power reverse current difference with the corresponding reverse current detection threshold to obtain the comparison result; and calculate the power adjustment amount using the triangle area algorithm based on the comparison result and the preset time window. Step 6: Based on the power adjustment amount and the state of charge of the energy storage system, coordinate and control the output power of the energy storage system and the photovoltaic inverter.

[0006] The above-described solution of the present invention has at least the following beneficial effects: By using a load mutation prediction model to identify the risk of sudden load power drops in advance, the post-event response control mode is upgraded to an intelligent mode that combines pre-event prevention and rapid in-event response, reducing the occurrence of backflow from the source and effectively avoiding the safety hazards of distribution networks caused by backflow. Based on the prediction results and dynamically adjusted backflow detection thresholds, the system coordinates the energy storage system and photovoltaic inverters to perform gradual power adjustments, avoiding problems such as sudden power drops and violent switching actions, reducing the impact on the grid, and improving the stability and grid friendliness of the photovoltaic grid-connected system. By accurately predicting load power changes and quantifying excess energy, the system prioritizes the use of energy storage systems to absorb excess power, and only moderately restricts the output of photovoltaic inverters when energy storage capacity is insufficient. This effectively prevents backflow while maximizing the effective utilization of photovoltaic power generation, reducing the waste of photovoltaic power generation, and balancing the effect of backflow prevention with the economy of energy utilization. The core prediction model adopts a deep learning architecture, which can continuously learn new characteristics such as the power consumption patterns and load change patterns of the photovoltaic grid-connected system, and adapt to long-term changes in load characteristics without the need for frequent manual adjustment of control parameters, making it more adaptable. Attached Figure Description

[0007] Figure 1 This is a flowchart illustrating the anti-backflow control method for photovoltaic grid-connected systems based on load mutation prediction, provided in an embodiment of the present invention.

[0008] Figure 2This is a flowchart illustrating step 4 provided in an embodiment of the present invention. Detailed Implementation

[0009] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0010] like Figure 1 As shown, embodiments of the present invention propose a reverse current prevention control method for photovoltaic grid-connected systems based on load mutation prediction. The method includes the following steps: Step 1: Collect multi-dimensional data from the photovoltaic grid-connected system in real time, and clean, align, and standardize the multi-dimensional data to form a standardized feature vector; Step 2: Use the sliding window method to extract multivariate time series segments of historical time periods from the standardized feature vectors to generate sample sequences; Step 3: Input the sample sequence into a pre-trained temporal convolutional network model based on the attention mechanism to obtain the probability of load mutation risk and the predicted load power at future time points. Step 4: Preset multiple risk probability intervals and set a backflow detection threshold for each interval; determine the corresponding backflow detection threshold based on the interval in which the load mutation risk probability is located. Step 5: Calculate the predicted power reverse current difference based on the current photovoltaic output and load power prediction values; compare the predicted power reverse current difference with the corresponding reverse current detection threshold to obtain the comparison result; and calculate the power adjustment amount using the triangle area algorithm based on the comparison result and the preset time window. Step 6: Based on the power adjustment amount and the state of charge of the energy storage system, coordinate and control the output power of the energy storage system and the photovoltaic inverter.

[0011] In this embodiment of the invention, the risk of a sudden drop in future load power is identified in advance by a load mutation prediction model, upgrading the post-event response control mode to an intelligent mode that combines pre-event prevention and rapid in-event response. This reduces the occurrence of backflow from the source and effectively avoids the safety hazards of the distribution network caused by backflow. Based on the prediction results and dynamically adjusted backflow detection thresholds, the energy storage system and photovoltaic inverter are coordinated to perform gradual power adjustment, avoiding problems such as sudden power drops and violent switching actions, reducing the impact on the grid, and improving the stability and grid friendliness of the photovoltaic grid-connected system. By accurately predicting load power changes and quantifying excess energy, the energy storage system is prioritized to absorb excess power, and the output of the photovoltaic inverter is moderately limited only when the energy storage capacity is insufficient. This effectively prevents backflow while maximizing the effective utilization of photovoltaic power generation, reducing the waste of photovoltaic power generation, and balancing the anti-backflow effect with the economic efficiency of energy utilization. The core prediction model adopts a deep learning architecture, which can continuously learn new characteristics such as the power consumption patterns and load change patterns of the photovoltaic grid-connected system, and adapt to long-term changes in load characteristics without the need for frequent manual adjustment of control parameters, thus improving adaptability.

[0012] In a preferred embodiment of the present invention, step 1 involves real-time acquisition of multi-dimensional data from the photovoltaic grid-connected system, followed by cleaning, alignment, and standardization of the multi-dimensional data to form a standardized feature vector. The multi-dimensional data includes grid-connected power, load power, photovoltaic output, energy storage system state of charge, timestamps, and time characteristics. Specifically, this includes: first, activating a customized embedded acquisition device. This device is a dedicated hardware device designed specifically for real-time acquisition of multi-dimensional data from a photovoltaic grid-connected system. It integrates a data acquisition module, a communication module, a storage module, and a timing synchronization module, enabling precise adaptation to power sensors and state of charge monitoring sensors within the photovoltaic grid-connected system. It features various data acquisition interfaces, including those for grid-connected power, load power, and photovoltaic output, enabling precise connection to diverse data acquisition needs. It also boasts stable real-time data transmission capabilities and short-term data storage functions. It can capture diverse data from the photovoltaic grid-connected system in real time according to a preset acquisition frequency, ensuring the continuity and timeliness of data acquisition. The acquired data specifically covers grid-connected power, load power, photovoltaic output, energy storage system state of charge, timestamps, and time characteristics. The time characteristics explicitly include whether it is a holiday, lunch break, or mealtime, comprehensively covering the core data dimensions required for subsequent model analysis.

[0013] After data collection is completed, the data cleaning process begins immediately to remove invalid information and fill in missing content. Each piece of collected data is checked individually, and abnormal data is filtered out using pre-defined rationality judgment rules. These rules have two aspects: First, based on the design parameters of the photovoltaic grid-connected system, the rated operating range of the equipment, and historical normal operating data, clear normal value ranges are set for grid-connected power, load power, photovoltaic output, and the state of charge of the energy storage system. Specifically, the normal value range for grid-connected power is 0 to 1.2 times the maximum designed grid-connected power; the normal value range for load power is 0 to 1.2 times the maximum designed load power; the normal value range for photovoltaic output is 0 to 1.1 times the rated output of the photovoltaic modules; and the normal value range for the state of charge of the energy storage system is 0.05 to 0.95. Data exceeding these corresponding ranges is considered abnormal. Second, data logical consistency is verified. According to the energy balance principle of the photovoltaic grid-connected system, the grid-connected power should be consistent with the photovoltaic output, load power, and the charging and discharging of the energy storage system. The power difference (including normal system losses) is kept reasonably matched. The preset logical allowable range is that the absolute value of the difference does not exceed 0.05 times the sum of the photovoltaic output and the load power. If the deviation exceeds this range, or if there is a contradiction between the time characteristics and the timestamp (such as a conflict between the non-holiday identifier and the holiday timestamp), it is judged as logically contradictory data. Through the above rules, abnormal data that exceeds the normal value range or is logically contradictory due to factors such as equipment failure, communication link interference, and sensor anomalies are filtered out and removed from the dataset. For missing values ​​that occur during the data acquisition process due to brief communication interruptions, instantaneous equipment failures, etc., linear interpolation is used to fill them. The specific operation method is to locate the position of the missing value in the time series, find the two adjacent valid data before and after the missing value, calculate the arithmetic mean of the two valid data, and use the obtained average as the supplementary data for the missing value, thereby ensuring the integrity of the entire dataset and the continuity of the time series, and avoiding the impact of data breakpoints on subsequent processing.

[0014] After data cleaning, data alignment is performed to ensure consistency across different data types in terms of time. Using the collected timestamps as a unified benchmark, different types of data, such as grid-connected power, load power, photovoltaic output, energy storage system state of charge, and time characteristics, are categorized, collected, and matched according to their respective timestamps. For each timestamp, the completeness of each data type is verified. If any data type is missing at a particular timestamp (except for cases where it has been supplemented during the cleaning process), the data collection record for that data is checked again to ensure that all data types at the same timestamp, including grid-connected power, load power, photovoltaic output, energy storage system state of charge, and time characteristics, correspond precisely. This completely avoids time-series errors caused by asynchronous data types and ensures the accuracy of subsequent processing. The accuracy of the calculation and model input is analyzed; after data alignment, standardization is performed to eliminate interference caused by differences in units and large ranges of numerical values ​​between different data types; the Z-score normalization method is used to transform each data item separately. The specific process is as follows: for each type of data (such as grid connection point power, load power, etc.), the arithmetic mean of all valid data in the data type is first calculated, and then the standard deviation of the data type is calculated; then, for each data point in the data type, the arithmetic mean of the data type is subtracted from the original data value of the data point to obtain a difference, and then the difference is divided by the standard deviation of the data type to finally obtain the standardized data value of the data point. Through this process, all types of data are transformed to a uniform numerical scale range.

[0015] After the above-mentioned data cleaning, alignment, and standardization process, the data are organized and combined in an orderly manner according to the preset feature dimensions. The preset feature dimensions are clearly defined as six core dimensions, corresponding to the grid connection point power dimension, load power dimension, photovoltaic output dimension, energy storage system state of charge dimension, timestamp dimension, and time feature dimension, respectively. The order of each dimension is fixed, thus forming a standardized feature vector with a unified structure and standardized format. Each standardized feature vector fully contains all the multi-dimensional data information such as the processed grid connection point power, load power, photovoltaic output, energy storage system state of charge, timestamp, and time feature under the corresponding timestamp. Each data information corresponds to a feature dimension, ensuring the structure and consistency of the feature vector.

[0016] This embodiment, through comprehensive collection and standardized cleaning, alignment, and standardization of multi-source data, ensures the integrity, consistency, and standardization of the data input to the subsequent prediction model. It effectively eliminates interfering data and abnormal information, avoiding the impact of data deviation on the model prediction results. This provides reliable data support for the accurate calculation of load mutation risk probability and future load power prediction values, thereby laying a solid foundation for the effective implementation of the entire anti-reverse current control strategy. It ensures that subsequent power adjustment and equipment coordination control can be carried out based on accurate data, improving the overall reliability and effectiveness of anti-reverse current control in photovoltaic grid-connected systems.

[0017] In a preferred embodiment of the present invention, step 2 includes: Step 200 involves arranging the standardized feature vectors according to their corresponding timestamps and setting a fixed historical sequence length to define the length of the historical time period covered by each sample sequence. Specifically, this includes: firstly, arranging all the standardized feature vectors after cleaning, alignment, and standardization in order from earliest to latest according to their corresponding timestamps to ensure that all feature vectors form a continuous sequence in the time dimension; then setting a fixed historical sequence length, which is calculated based on the specific time period requirements and data collection frequency. For example, if each sample sequence is preset to cover the historical data of the past 2 hours, and the data collection frequency is once every 5 minutes, then the historical sequence length is 2 hours × 60 minutes ÷ 5 minutes, which calculates to 24 data points. This value is the number of standardized feature vectors contained in each sample sequence, thereby clarifying the specific length of the historical time period covered by each sample sequence.

[0018] Step 201: Using the length of the historical sequence as the width of the sliding window, slide the window sequentially along the time axis according to the set step size. Specifically, this includes: using the length of the historical sequence determined in step 200 as the fixed width of the sliding window, and setting a reasonable sliding step size. The step size setting needs to take into account both the representativeness of the samples and the data utilization efficiency. Usually, the step size is set to the time interval corresponding to one data point, that is, consistent with the data acquisition frequency. Then, using the time axis as the reference, starting from the starting position of the arranged standardized feature vector sequence, slide the window step by step along the time axis from early to late according to the set step size. The distance of each slide strictly follows the set step size to ensure the regularity and continuity of the window sliding process.

[0019] Step 202: After each slide, extract all standardized feature vectors arranged in chronological order within the current window to form a sample sequence. Each sample sequence represents a multivariate time series segment within a historical sequence length period from the current sampling time. Specifically, after each window slide, immediately extract all standardized feature vectors arranged in chronological order within the current window range. Integrate these feature vectors according to their original chronological order and preset feature dimensions (grid-connected power dimension, load power dimension, photovoltaic output dimension, energy storage system state of charge dimension, timestamp dimension, and time feature dimension) to form a complete sample sequence. Each sample sequence corresponds to a specific time range, that is, the time period corresponding to the historical sequence length set in step 200 from the sampling time corresponding to the current window. It fully includes the multivariate operation data of the photovoltaic grid-connected system within this time period, forming a multivariate time series segment that can reflect the changes in the system's operating status within this historical time period.

[0020] This embodiment ensures the uniformity and standardization of the historical time periods covered by each sample sequence by arranging standardized feature vectors in an orderly manner according to timestamps and setting a fixed historical sequence length. The application of the sliding window method can fully explore the temporal features in historical data, generate sufficient and representative sample sequences, and comprehensively capture the changing patterns of the operating status of the photovoltaic grid-connected system at different historical stages. Each sample sequence completely retains the multivariate data information within the corresponding historical time period, ensuring that the model can fully learn the correlation between load power changes and other system operating parameters, and guaranteeing the effective implementation of the anti-reverse current control strategy.

[0021] In a preferred embodiment of the present invention, step 3 includes: The temporal convolutional network model consists of a temporal convolutional layer, an attention layer, and an output layer. The temporal convolutional layer extracts local features and dependencies at different time scales from the input sample sequence. The attention layer uses a multi-head self-attention mechanism to process the features output by the temporal convolutional layer, learning the importance weights of features at different time points in the sample sequence for prediction and capturing long-term periodic dependencies. The output layer performs global average pooling on the feature sequence processed by the attention layer, averaging the values ​​of each feature dimension across all time steps to obtain a global feature vector. This global feature vector is then input into a fully connected layer for processing. The output of the fully connected layer is processed by an activation function to ultimately generate the probability of load mutation risk and the predicted load power at future time points, specifically including: First, we construct a temporal convolutional network model, which consists of a temporal convolutional layer, an attention layer, and an output layer connected sequentially. The details of each layer's construction and the overall training process are as follows: When constructing temporal convolutional layers, each layer consists of multiple dilated causal convolutional layers stacked from top to bottom. The preset stack size is 4 layers, with each layer having a fixed kernel size of 3. The dilation coefficients are set sequentially from the first layer to 1, 2, 4, and 8, gradually increasing with the number of layers. This expands the receptive field of the model without increasing computational cost. In each dilated causal convolutional layer, the weight parameters of the convolution kernel are initialized to random values ​​within the range of [-0.01, 0.01], and the bias term is initialized to 0. The convolution process follows the causal convolution rule, that is, it only uses the features of the current time step and previous time steps for calculation, avoiding the leakage of future information. In specific calculations... Each element of the input sequence is multiplied by the corresponding weight of the convolution kernel, and all the multiplication results are added together. Finally, the bias term of the convolutional layer is added to obtain the feature value after convolution at that position. After stacking four dilated causal convolutional layers, the first layer extracts short-term local features and immediate dependencies (such as the correlation of power changes within adjacent 5 minutes) at adjacent time steps through the effect of different dilation coefficients. Subsequent layers gradually capture medium-term and long-term local features and lag dependencies (such as the correlation of power fluctuations within 1 hour and 2 hours) at longer time intervals. Finally, local features at different time scales and the temporal dependencies between these features are comprehensively extracted from the input sequence.

[0022] During the construction of the attention layer, a multi-head self-attention mechanism is adopted. First, the number of attention heads is preset to 8. Each feature vector in the feature sequence output by the temporal convolutional layer is linearly transformed by three independent weight matrices (the weights are initialized with random values ​​in the range [-0.01, 0.01]). The specific process of linear transformation is as follows: the value of each dimension of each feature vector is multiplied one by one by the elements in the corresponding weight matrix, and then all the multiplication results are added to obtain the transformed vector. Through the separate processing of the three different weight matrices, the corresponding query vector, key vector, and value vector are generated sequentially. Then, these three sets of vectors are evenly divided into 8 sub-vectors according to the preset 8 attention heads, with each sub-vector corresponding to one attention head. For each attention head, the dot product of the query sub-vector and all key sub-vectors (i.e., the sum of the multiplication of the corresponding dimension values) is calculated to obtain a similarity score. The higher the similarity score, the stronger the correlation between the query vector and the feature corresponding to the key vector. Then, each similarity score is divided by the square root of the key vector dimension for normalization to avoid excessively large scores affecting subsequent soft mode. The ax function output tends to extremes; then the normalized similarity score is input into the softmax function, which converts it into weight values ​​that sum to 1. The magnitude of this weight value directly reflects the importance. The larger the weight value, the more significant the influence of the corresponding key vector feature on the current query vector feature, and vice versa. This clearly reflects the importance of the feature corresponding to each key vector to the feature corresponding to the current query vector. Then, these weight values ​​are multiplied by the corresponding sub-vectors (each dimension value is multiplied by the weight value), and all the results are added together to obtain the output of a single attention head. Finally, the outputs of the 8 attention heads are concatenated according to the feature dimensions, and then integrated through a linear transformation weight matrix initialized with random values ​​in the range [-0.01, 0.01] (the concatenated vector is multiplied by the elements of the weight matrix one by one and then summed) to obtain the final output of the attention layer. This achieves accurate learning of the importance of features at different time points and captures the long-term periodic dependence of the load changes of the photovoltaic grid-connected system (such as the correlation of load change patterns at fixed times every day and specific dates every week).

[0023] When constructing the output layer, the output layer includes a global average pooling module and a fully connected layer. The global average pooling module is used to integrate the feature sequences output by the attention layer, and the fully connected layer is used to convert the integrated features into the target output. The fully connected layer has a preset number of 64 neurons, and each neuron corresponds to a weight parameter and a bias term. The weight parameter is initialized to a random value in the range of [-0.01, 0.01], and the bias term is initialized to 0. At the same time, in order to adapt to different output targets, the output layer is configured with two activation functions: a sigmoid activation function used to generate the probability of load mutation risk, and a linear activation function used to generate the predicted load power value at future time points.

[0024] After the model is built, model training is conducted to optimize parameters and ensure prediction accuracy. First, the sample sequences previously generated using the sliding window method are divided into training, validation, and test sets in a predetermined ratio of 7:2:1 (70% training set, 20% validation set, and 10% test set). The training set is used for model parameter learning, the validation set is used to monitor model performance during training, and the test set is used to finally evaluate the model's generalization ability. During training, weighted binary cross-entropy is used as the loss function to address the impact of load mutation events (minority class) on normal operation in the training data. The problem of imbalanced event (majority class) numbers is addressed by setting the minority class sample weight to 5. The loss value of a single sample is calculated as follows: multiply the sample's label value (1 indicates load mutation, 0 indicates normal operation) by the preset minority class sample weight of 5, and then multiply it by the logarithm of the sample's predicted value to obtain the first part of the result; subtract the sample's label value from 1, and then multiply it by the logarithm of the sample's predicted value from 1 to obtain the second part of the result; add the two parts of the result and take the negative value, which is the loss value of a single sample. The average of the loss values ​​of all training samples is used to obtain the overall loss value during the training process.

[0025] The Adam optimizer is used to optimize the model parameters with a preset initial learning rate of 0.001. The gradient of the loss function with respect to all weight parameters and bias terms in the temporal convolutional layer, attention layer, and output layer is calculated using the backpropagation algorithm. Based on the gradient direction and the preset initial learning rate, the values ​​of each parameter are gradually adjusted to minimize the overall loss. During training, the model performance is monitored in real time using a validation set. The area under the AUC-ROC curve is used as the core evaluation metric. The preset early stopping mechanism is triggered after 5 consecutive training epochs. When the AUC-ROC value on the validation set no longer increases for 5 consecutive training epochs and the loss value no longer decreases, the early stopping mechanism is triggered to stop training and avoid overfitting. Finally, the model parameters with the best performance on the validation set at this point are saved to obtain the trained temporal convolutional network model.

[0026] The generated sample sequences are input into the trained temporal convolutional network model for feature processing and prediction. The sample sequences first enter the temporal convolutional layer, then undergo processing through four dilated causal convolutional layers. Each layer calculates using a preset kernel size of 3 and corresponding dilation coefficients (1, 2, 4, 8). The first layer captures short-term temporal dependencies and immediate local features. Subsequent layers progressively mine medium- and long-term temporal dependencies and associated local features, ultimately extracting local features at different time scales in the sample sequences, as well as the temporal dependencies between these local features, forming a preliminary feature sequence. The feature sequence output from the temporal convolutional layer enters the attention layer. Through a series of calculations using an 8-head self-attention mechanism, three types of vectors are first generated through linear transformation and the attention heads are split. By calculating similarity through dot product and normalizing weight values, features are weighted and integrated based on these weight values. This accurately learns the importance weights of features at different time points in the sample sequence for the prediction task. At the same time, it deeply captures the long-term periodic dependence of load changes in the photovoltaic grid-connected system. After weighted optimization of the feature sequence, a more targeted feature sequence is output. The feature sequence output from the attention layer enters the output layer and is first processed by the global average pooling module. For each feature dimension, the feature values ​​of all time steps in that dimension are collected. These feature values ​​are added together and divided by the total number of time steps in that dimension to obtain the average feature value of that feature dimension. The average feature values ​​of all feature dimensions are combined in order to form a global feature vector, which comprehensively reflects the overall feature information of the entire sample sequence.

[0027] Subsequently, the global feature vector is input to the fully connected layer. Matrix multiplication is performed between the weight matrix of the fully connected layer and the global feature vector (each dimension of the global feature vector is multiplied by the corresponding element of the weight matrix and then summed). The bias term of the fully connected layer is then added to obtain the intermediate output. Different activation functions are used for different output targets. When generating the load mutation risk probability, the Sigmoid activation function is used to map the intermediate output to a value range of 0 to 1. This value represents the load mutation risk probability, indicating the likelihood of a sudden drop in load power in the short term. When generating the load power prediction value for a future time point, a linear activation function is used, directly outputting the intermediate output as the load power prediction value. This result directly reflects the load power level at the preset future time point, clearly indicating the specific situation of the load power at that time point.

[0028] This embodiment first constructs and trains a temporal convolutional network model to ensure that the model has stable and reliable feature extraction and prediction capabilities. The temporal convolutional layer can effectively capture local features and dependencies at different time scales in the sample sequence, while the attention layer can accurately identify the importance of features at different time points and capture the long-term periodic patterns of load changes, allowing the model to have a more comprehensive and in-depth understanding of the load operating status. The output layer, through scientific feature integration and activation processing, can generate accurate load mutation risk probabilities and future load power predictions, improving the foresight and accuracy of anti-backflow control from the source. The targeted loss function and optimization strategy used in the model training process effectively solves the data imbalance problem, improves the model's generalization ability and stability, and enables it to adapt to the complex operating scenarios of photovoltaic grid-connected systems, providing solid support for the effective implementation of anti-backflow control strategies and reducing the risk of backflow caused by inaccurate predictions.

[0029] In another preferred embodiment of the present invention, step 4 includes: Step 400: Divide the range of risk probabilities into three continuous and non-overlapping risk probability intervals: a low-risk interval, a medium-risk interval, and a high-risk interval. The upper limit of the low-risk interval is less than a first preset risk threshold; the lower limit of the medium-risk interval is equal to the first preset risk threshold, and its upper limit is less than a second preset risk threshold; the lower limit of the high-risk interval is equal to the second preset risk threshold. The first and second preset risk thresholds are pre-set values, with the second preset risk threshold being greater than the first preset risk threshold. Specifically, this includes: first, defining the range of load mutation risk probability as 0 to 1; and then dividing the range into three continuous and non-overlapping risk probability intervals. The risk ranges are divided into low-risk, medium-risk, and high-risk ranges. A first preset risk threshold of 0.3 and a second preset risk threshold of 0.7 are pre-set. These values ​​are determined based on statistical analysis of actual load operation scenarios of photovoltaic grid-connected systems. Specifically, by collecting over one year of historical operating data from photovoltaic grid-connected systems in different application scenarios (such as industrial plants, commercial buildings, and residential areas), risk probability samples corresponding to load mutation events are selected. Tens of thousands of valid samples are compiled. First, all valid samples are sorted from low to high risk probability values. Then, the sorted samples are evenly divided into 10 intervals based on the risk probability range of 0 to 1 (each interval's value...). The range is 0.1, i.e., 0 to 0.1, 0.1 to 0.2, 0.2 to 0.3...0.9 to 1.0; for each interval, the actual number of load mutations within that interval is counted, the proportion of occurrences to the total sample size is calculated, and the power drop magnitude of each mutation event is recorded; then, the mean mutation frequency (the ratio of the number of mutations in that interval to the total sample size in that interval) and the mean power drop magnitude (the arithmetic mean of the power drop magnitudes of all mutation events in that interval) are calculated for each interval. A trend curve is plotted with the median risk probability of each interval on the x-axis and the mean mutation frequency and mean power drop magnitude on the y-axis, respectively. By observing the changing trends of the curves, a clear correlation was identified: when the median risk probability gradually increased from 0 to 0.3, the average frequency of sudden changes remained at an extremely low level without significant increase, and the average power drop was consistently below 10% of the system's maximum designed load power. When the median risk probability increased from 0.3 to 0.7, the average frequency of sudden changes showed a steady upward trend, and the average power drop simultaneously increased to the range of 10% to 30% of the system's maximum designed load power. When the median risk probability exceeded 0.7, the average frequency of sudden changes showed a steep upward trend, and the average power drop rapidly exceeded 30% and climbed to even higher levels. The above analysis revealed that when the risk probability was below 0...When the probability of load mutation is 3, the actual frequency of such events is extremely low, and the power drop is less than 10% of the system's maximum designed load power. The impact on the photovoltaic grid-connected system and the upstream grid is negligible, and there is no need to excessively increase prevention and control measures. When the probability of risk is between 0.3 and 0.7, the frequency of load mutations is moderate, with the power drop concentrated between 10% and 30% of the system's maximum designed load power, falling within the normal range. Moderately increasing prevention and control measures is necessary to avoid backflow. When the probability of risk is higher than 0.7, the frequency of load mutations increases significantly, and over 80% of the power drops exceed 30% of the system's maximum designed load power, with some even exceeding 50%, which can easily trigger severe backflow. This poses a significant challenge to the stable operation of the power grid, necessitating strengthened prevention and control measures. Therefore, a second preset risk threshold is determined to be higher than the first preset risk threshold. The specific division rules are as follows: the low-risk interval starts at 0 and ends at an upper limit of 0.3, which is equal to the first preset risk threshold; the medium-risk interval has a lower limit equal to the first preset risk threshold of 0.3 and an upper limit equal to the second preset risk threshold of 0.7; the high-risk interval has a lower limit equal to the second preset risk threshold of 0.7 and an upper limit ending at 1. This ensures that the three intervals completely cover the entire value range from 0 to 1, with no overlap or omissions between intervals.

[0030] Step 401: Configure a first reverse current detection threshold for the low-risk zone, a second reverse current detection threshold for the medium-risk zone, and a third reverse current detection threshold for the high-risk zone; wherein the value of the second reverse current detection threshold is greater than the first reverse current detection threshold, and the value of the third reverse current detection threshold is greater than the second reverse current detection threshold; the configuration of the reverse current detection threshold is positively correlated with the risk level represented by the risk probability zone, specifically including: configuring corresponding reverse current detection thresholds for the three risk probability zones respectively; configuring a first reverse current detection threshold for the low-risk zone, with a value of 10% of the system's maximum designed grid-connected power; configuring a second reverse current detection threshold for the medium-risk zone, with a value of 25% of the system's maximum designed grid-connected power; and configuring a third reverse current detection threshold for the high-risk zone, with a value of 40% of the system's maximum designed grid-connected power. The value is determined based on the balance between system safety requirements and energy utilization efficiency. In low-risk scenarios, the probability of load mutation is low, and a lower threshold can maximize the preservation of photovoltaic power generation while ensuring no backflow. In medium-risk scenarios, the threshold needs to be appropriately increased to cope with potential power drops, while avoiding excessively high thresholds that lead to energy waste. In high-risk scenarios, the threshold needs to be significantly increased to reserve sufficient power adjustment space in advance and effectively resist backflow caused by large load mutations. Therefore, the configuration follows the principle that the backflow detection threshold is positively correlated with the risk level represented by the risk probability interval. That is, the higher the risk level, the larger the corresponding backflow detection threshold. The value of the second backflow detection threshold is greater than the first backflow detection threshold, and the value of the third backflow detection threshold is greater than the second backflow detection threshold. Through differentiated configuration of the threshold, precise adaptation to different risk levels can be achieved.

[0031] Step 402 involves comparing the load mutation risk probability with multiple risk probability intervals to determine which specific risk probability interval the load mutation risk probability falls into. Specifically, this includes obtaining the load mutation risk probability output by the attention-based temporal convolutional network model, and comparing this probability with a first preset risk threshold of 0.3 and a second preset risk threshold of 0.7 to determine the specific risk probability interval it falls into. If the load mutation risk probability is less than the first preset risk threshold of 0.3, it is determined to fall into the low-risk interval; if the load mutation risk probability is greater than or equal to the first preset risk threshold of 0.3 and less than the second preset risk threshold of 0.7, it is determined to fall into the medium-risk interval; and if the load mutation risk probability is greater than or equal to the second preset risk threshold of 0.7, it is determined to fall into the high-risk interval.

[0032] Step 403: Select the reverse current detection threshold corresponding to the risk probability interval into which the load mutation risk probability falls, as the reverse current detection threshold used in the current control cycle. Specifically, this includes: based on the judgment result of step 402, finding the reverse current detection threshold corresponding to the risk probability interval; if the load mutation risk probability is determined to fall into the low-risk interval, then select the first reverse current detection threshold (10% of the system's maximum grid-connected power) as the reverse current detection threshold used in the current control cycle; if it is determined to fall into the medium-risk interval, then select the second reverse current detection threshold (25% of the system's maximum grid-connected power) as the reverse current detection threshold for the current control cycle; if it is determined to fall into the high-risk interval, then select the third reverse current detection threshold (40% of the system's maximum grid-connected power) as the reverse current detection threshold for the current control cycle, ensuring that the reverse current detection threshold of the current control cycle accurately matches the actual load mutation risk level.

[0033] This embodiment, by clearly defining the specific method of uniformly dividing the samples and the method of determining the correlation rules, makes the statistical analysis process fully operable and reproducible. Different risk intervals correspond to differentiated backflow detection thresholds, achieving a precise match between risk level and prevention and control intensity. The higher the risk, the stricter the prevention and control. This not only effectively resists different levels of load mutation risk, but also takes into account energy utilization efficiency in low-risk scenarios, avoiding the limitations of fixed thresholds. The dynamically adjusted backflow detection threshold can adapt to different levels of load mutation risk in advance, further improving the foresight, pertinence, and effectiveness of backflow prevention control, reducing the occurrence of backflow phenomena and the impact on the power grid.

[0034] In a preferred embodiment of the present invention, step 5 includes: Step 500: Subtract the current photovoltaic output from the predicted load power at future time points to obtain the predicted power reversal difference at future time points. Specifically, this involves: first, acquiring the actual monitored photovoltaic output value within the current control cycle using a customized embedded acquisition device. This value has undergone prior data cleaning, alignment, and standardization to ensure it is free of abnormal data and logical inconsistencies, and is considered real-time valid data. Simultaneously, extracting the predicted load power value for the next 10 minutes from the output of an attention-based temporal convolutional network model. This 10-minute time interval is consistent with the prediction time domain set during model training, ensuring a precise correspondence between the two in the time dimension. The data dimensions and units of the actual monitored photovoltaic output and the predicted load power are verified first to ensure that they are both in kilowatts to avoid calculation errors due to inconsistent units. Then, numerical calculations are performed by subtracting the predicted load power value for the next 10 minutes from the current actual monitored photovoltaic output to obtain the predicted power reverse flow difference for the next 10 minutes. When the difference is positive, it indicates that the photovoltaic output will be greater than the load power consumption in the next 10 minutes, and there is a risk of excess power being transmitted back to the grid. When the difference is negative or zero, it indicates that the photovoltaic output can be completely consumed by the load in the next 10 minutes, or even that the load demand is greater than the photovoltaic output, and there is no risk of reverse flow.

[0035] Step 501: Compare the predicted power reverse current difference with the reverse current detection threshold. If the predicted power reverse current difference is greater than the reverse current detection threshold, a virtual power excess triangle is constructed by using a preset time window as the base time length of a triangle and the difference between the predicted power reverse current difference and the reverse current detection threshold as the height of the triangle at a future time point. Specifically, this involves directly comparing the predicted power reverse current difference calculated in step 500 for the next 10 minutes with the reverse current detection threshold used in the current control cycle determined in step 403. If the predicted power reverse current difference is greater than the reverse current detection threshold, it indicates that the excess power within the preset time window has exceeded the safe control range, and the reverse current risk must be eliminated through active power adjustment. At this time, the virtual power excess triangle construction process is initiated. The preset time window duration is set to 20 minutes based on the power response speed of the photovoltaic grid-connected system (usually 3 to 8 minutes), the charging and discharging response delay of the energy storage system (usually 1 to 3 minutes), and the load change characteristics (the stable duration after a sudden load change is usually more than 15 minutes). This duration allows for equipment response preparation time. This method not only fully covers the duration of excess power after a single load surge, ensuring that the energy storage system and photovoltaic inverter can smoothly complete power adjustment, but also maintains a data acquisition cycle that is an integer multiple of 4 times the 5-minute cycle, facilitating data synchronization and control command execution. A preset time window of 20 minutes is used as the base length of the virtual excess power triangle, converted to one-third of an hour. The start time of the base is the end of the current control cycle, and the end time is 20 minutes after the end of the current control cycle, forming a continuous time span. The predicted power... The calculated result of subtracting the reverse flow detection threshold from the flow difference value is used as the height of the triangle corresponding to the next 10-minute time point. This height directly represents the excess power value that needs to be processed, with the unit uniformly set to kilowatts. The starting point of the height is aligned with the power value corresponding to the reverse flow detection threshold, and the ending point is aligned with the power value corresponding to the predicted power reverse flow difference value. Through the two core parameters of the base time length and height, a virtual power excess triangle is constructed with time as the horizontal axis and power as the vertical axis. The area of ​​this triangle can intuitively quantify the total amount of excess energy within the preset time window of the next 20 minutes.

[0036] Step 502: Calculate the area of ​​the power surplus triangle. This area represents the total excess energy that needs to be processed within a preset time window. Specifically, this involves accurately calculating the area of ​​the power surplus triangle using the triangle area calculation formula. The specific calculation process is as follows: First, multiply the time length of the base of the triangle (1 / 3 hour) by the height (kilowatts) to obtain the product of power and time (unit: kilowatts). (hours), then divide the product by 2, and the final value is the area of ​​the power surplus triangle, in kilowatt-hours. This area value is a precise quantification of the total excess energy that needs to be processed within the preset time window of the next 20 minutes. It clearly and intuitively reflects the total amount of energy that the energy storage system and photovoltaic inverter need to digest together in order to completely eliminate the risk of backflow.

[0037] Step 503: Based on the total excess energy and the duration of the preset time window, calculate the average power value that needs to be adjusted within the preset time window. Use the average power value as the power adjustment amount. Specifically, based on the total excess energy calculated in step 502 and the preset time window duration of 20 minutes, further calculate the average power value that needs to be adjusted within the preset time window. The specific calculation process is as follows: use the total excess energy (unit: kilowatt-hour) as the dividend and the duration of the preset time window (1 / 3 hour) as the divisor to perform a division operation. The result is the average power adjustment value within the preset time window. This average power adjustment value is directly determined as the power adjustment amount for the current control cycle. This adjustment amount clarifies the power scale that the energy storage system and the photovoltaic inverter need to coordinate and adjust. It provides a clear and accurate power adjustment basis for subsequent control actions that prioritize the energy storage system to absorb excess power and limit the output of the photovoltaic inverter when insufficient.

[0038] This embodiment accurately calculates and predicts the power reverse current difference, clarifying the severity of future reverse current risks and providing a quantitative basis for power adjustment. It employs a triangle area algorithm to transform the dynamic power surplus process into a calculable total energy amount, achieving precise quantification of future surplus energy and avoiding under- or over-adjustment issues caused by estimation errors during power adjustment. The power adjustment amount calculated based on the total surplus energy and time window is scientifically reasonable, ensuring that the adjustment actions of the energy storage system and photovoltaic inverter can accurately match the surplus energy demand. This effectively eliminates reverse current risks, minimizes the waste of photovoltaic power generation, ensures the smoothness of the power adjustment process, and reduces the impact on the power grid.

[0039] In a preferred embodiment of the present invention, step 6 includes: Based on the power adjustment amount and the state of charge of the energy storage system, it is determined whether the adjustability of the energy storage system is sufficient to absorb the excess power corresponding to the power adjustment amount. If the adjustability of the energy storage system is sufficient, a control command is sent to the energy storage inverter to prioritize adjusting the output power of the energy storage system or switching to charging mode to absorb the excess power. If the adjustability of the energy storage system is insufficient, a control command is sent to the photovoltaic inverter to limit the output power of the photovoltaic inverter to a safe level to prevent power reverse flow. Specifically, this includes: First, the power adjustment amount for the current control cycle is obtained. This value is the average power adjustment value calculated in step 503, representing the scale of excess power that needs to be digested collaboratively. Simultaneously, the current state of charge (SOC) of the energy storage system is acquired through an embedded acquisition device. This value, after prior data cleaning and processing, is real-time and valid, with a range between 0.05 and 0.95. The adjustable capacity of the energy storage system is then calculated. Specifically, the rated capacity of the energy storage system is determined, set at 100 kWh (this value is based on the installed capacity of the photovoltaic grid-connected system, the daily load fluctuation range, and the cost-effectiveness of the energy storage system configuration, and is suitable for most small and medium-sized photovoltaic grid-connected scenarios). The rated capacity of 100 kWh is multiplied by (1 minus the current SOC) to obtain the maximum remaining energy that the energy storage system can absorb, in kWh. This maximum remaining energy is then divided by the duration of a preset time window (20 minutes, equivalent to 1 / 3 hour) to obtain the maximum power that the energy storage system can absorb per unit time. This value is the upper limit of the adjustable capacity of the energy storage system, in kilowatts.

[0040] The power adjustment amount is compared with the upper limit of the adjustable capacity of the energy storage system. If the power adjustment amount is less than or equal to the upper limit of the adjustable capacity of the energy storage system, it indicates that the adjustable capacity of the energy storage system is sufficient to independently absorb all excess power. At this time, a control command is sent to the energy storage converter to precisely adjust the output power according to the current operating mode of the energy storage system. If the energy storage system is in discharge mode and the current discharge power is greater than or equal to the power adjustment amount, the discharge power is reduced, and the reduction is strictly equal to the power adjustment amount. After adjustment, the discharge power of the energy storage system is the original discharge power minus the power adjustment amount. If the energy storage system is in discharge mode but the current discharge power is less than the power adjustment amount, the discharge power is first reduced to 0, and then switched to charging mode. The charging power is set to the difference between the power adjustment amount and the original discharge power to ensure absorption of all excess power. If the energy storage system is in standby mode, it is directly switched to charging mode, and the charging power is set to the power adjustment amount. Through the above targeted adjustment actions, the excess power is fully absorbed, and backflow is avoided from the source.

[0041] If the power adjustment exceeds the adjustable capacity limit of the energy storage system, it indicates that the adjustable capacity of the energy storage system is insufficient and cannot independently absorb all the excess power. In this case, a control command is first sent to the energy storage inverter, instructing the energy storage system to absorb the excess power at the power corresponding to the adjustable capacity limit. If the energy storage system is currently in discharge mode, the discharge power is first reduced to 0, and then switched to charging mode at the power corresponding to the adjustable capacity limit. If it is in standby mode, the charging mode is directly started at the upper limit power. Then, the remaining excess power to be processed is calculated, specifically by subtracting the adjustable capacity limit of the energy storage system from the power adjustment to obtain the power value that the photovoltaic inverter needs to limit. Next, the actual output power of the photovoltaic inverter is obtained through data acquisition equipment, and a control command is sent to the photovoltaic inverter to subtract the power value that needs to be limited from its current output power, limiting the output power of the photovoltaic inverter to the safe level corresponding to the calculated result (ensuring that the output power after limitation is non-negative). Through the coordinated action of the energy storage system and the photovoltaic inverter, all excess power is completely absorbed, ensuring that no power flows back to the grid.

[0042] This embodiment achieves coordinated and optimized scheduling of the energy storage system and photovoltaic inverter by calculating the adjustability of the energy storage system and combining it with power adjustment for hierarchical control. It prioritizes the use of the energy storage system to absorb excess power, which not only leverages the advantages of fast response and smooth adjustment of energy storage, but also reduces the waste of power generation caused by photovoltaic output limitation, thus balancing the anti-reverse current effect and energy utilization efficiency. When the energy storage capacity is insufficient, the output of the photovoltaic inverter is specifically limited to ensure that the excess power is completely absorbed and the reverse current path is completely blocked at the execution level. The entire control process is smooth and avoids the impact of drastic power fluctuations on the power grid. At the same time, it adapts to different energy storage status scenarios, improving the flexibility and reliability of anti-reverse current control.

[0043] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for preventing reverse current flow in a photovoltaic grid-connected system based on load mutation prediction, characterized in that, The method includes: Step 1: Collect multi-dimensional data from the photovoltaic grid-connected system in real time, and clean, align, and standardize the multi-dimensional data to form a standardized feature vector; Step 2: Use the sliding window method to extract multivariate time series segments of historical time periods from the standardized feature vectors to generate sample sequences; Step 3: Input the sample sequence into a pre-trained temporal convolutional network model based on the attention mechanism to obtain the probability of load mutation risk and the predicted load power at future time points. Step 4: Preset multiple risk probability intervals and set a backflow detection threshold for each interval; determine the corresponding backflow detection threshold based on the interval in which the load mutation risk probability is located. Step 5: Calculate the predicted power reverse current difference based on the current photovoltaic output and load power prediction values; compare the predicted power reverse current difference with the corresponding reverse current detection threshold to obtain the comparison result; and calculate the power adjustment amount using the triangle area algorithm based on the comparison result and the preset time window. Step 6: Based on the power adjustment amount and the state of charge of the energy storage system, coordinate and control the output power of the energy storage system and the photovoltaic inverter.

2. The method for anti-reverse current control of photovoltaic grid-connected systems based on load mutation prediction according to claim 1, characterized in that, The multi-source data includes grid connection power, load power, photovoltaic output, energy storage system state of charge, timestamp, and time characteristics.

3. The method for anti-reverse current control of photovoltaic grid-connected systems based on load mutation prediction according to claim 2, characterized in that, Step 2 includes: The standardized feature vectors are arranged in the order of their corresponding timestamps, and a fixed historical sequence length is set to define the length of the historical time period covered by each sample sequence. The width of the sliding window is used as the length of the historical sequence, and the window slides sequentially along the time axis according to the set step size; After each slide, all standardized feature vectors arranged in chronological order within the current window are extracted to form a sample sequence. Each sample sequence represents a multivariate time series segment within a historical sequence length period traversed backward from the current sampling time.

4. The method for anti-reverse current control of photovoltaic grid-connected systems based on load mutation prediction according to claim 3, characterized in that, Step 3 includes: The temporal convolutional network model consists of a temporal convolutional layer, an attention layer, and an output layer. The temporal convolutional layer is used to extract local features and dependencies at different time scales from the input sample sequence. The attention layer uses a multi-head self-attention mechanism to process the features output by the temporal convolutional layer to learn the importance weights of features at different time points in the sample sequence for prediction and to capture long-term periodic dependencies. The output layer performs global average pooling and fully connected processing on the features processed by the attention layer, and finally outputs the probability of load mutation risk and the predicted load power value at future time points.

5. The method for anti-reverse current control of photovoltaic grid-connected systems based on load mutation prediction according to claim 4, characterized in that, The output layer performs global average pooling and fully connected processing on the features processed by the attention layer, ultimately outputting the probability of load mutation risk and the predicted load power at future time points, including: The output layer performs global average pooling on the feature sequence processed by the attention layer, averaging the values ​​of each feature dimension at all time steps to obtain a global feature vector. The global feature vector is input into a fully connected layer for processing. The output of the fully connected layer is processed by an activation function to finally generate the load mutation risk probability and the load power prediction value at future time points.

6. The method for anti-reverse current control of photovoltaic grid-connected systems based on load mutation prediction according to claim 5, characterized in that, Step 4 includes: Multiple consecutive and non-overlapping risk probability intervals are predefined, and a pre-set backflow detection threshold is configured for each risk probability interval. The high or low configuration of the backflow detection threshold is positively correlated with the risk level represented by the risk probability interval. The probability of load mutation risk is compared with multiple risk probability intervals to determine whether the probability of load mutation risk falls into the corresponding specific risk probability interval. Select the backflow detection threshold corresponding to the risk probability range into which the load mutation risk probability falls, and use it as the backflow detection threshold used in the current control cycle.

7. The method for anti-reverse current control of photovoltaic grid-connected systems based on load mutation prediction according to claim 6, characterized in that, Multiple consecutive and non-overlapping risk probability intervals are predefined, and a pre-set backflow detection threshold is configured for each risk probability interval, including: The range of risk probability values ​​is divided into three continuous and non-overlapping risk probability intervals: a low-risk interval, a medium-risk interval, and a high-risk interval. The upper limit of the low-risk interval is less than the first preset risk threshold, the lower limit of the medium-risk interval is equal to the first preset risk threshold and its upper limit is less than the second preset risk threshold, and the lower limit of the high-risk interval is equal to the second preset risk threshold. The first preset risk threshold and the second preset risk threshold are preset values, and the second preset risk threshold is greater than the first preset risk threshold. A first backflow detection threshold is configured for the low-risk range, a second backflow detection threshold is configured for the medium-risk range, and a third backflow detection threshold is configured for the high-risk range; wherein, the value of the second backflow detection threshold is greater than the first backflow detection threshold, and the value of the third backflow detection threshold is greater than the second backflow detection threshold.

8. The method for anti-reverse current control of photovoltaic grid-connected systems based on load mutation prediction according to claim 7, characterized in that, Step 5 includes: Subtract the current photovoltaic output from the predicted load power at a future time point to obtain the predicted power reverse flow difference at the future time point; The predicted power reverse current difference is compared with the reverse current detection threshold. If the predicted power reverse current difference is greater than the reverse current detection threshold, a virtual power excess triangle is constructed by using a preset time window as the base time length of the triangle and the difference between the predicted power reverse current difference and the reverse current detection threshold as the height of the triangle at a future time point. Calculate the area of ​​the power surplus triangle, which represents the total excess energy that needs to be processed within a preset time window; Based on the total excess energy and the duration of the preset time window, calculate the average power value that needs to be adjusted within the preset time window, and use the average power value as the power adjustment amount.

9. The method for anti-reverse current control of photovoltaic grid-connected systems based on load mutation prediction according to claim 8, characterized in that, Step 6 includes: Based on the power adjustment amount and the state of charge of the energy storage system, it is determined whether the adjustability of the energy storage system is sufficient to absorb the excess power corresponding to the power adjustment amount. If the adjustability of the energy storage system is sufficient, a control command is sent to the energy storage inverter to prioritize adjusting the output power of the energy storage system or switching to charging mode to absorb the excess power. If the adjustability of the energy storage system is insufficient, a control command is sent to the photovoltaic inverter to limit the output power of the photovoltaic inverter to a safe level to prevent power backflow.