Photovoltaic power generation power edge prediction method

By using random forest feature selection and a BiTCN-BiGRU hybrid model, the problems of high complexity and low accuracy caused by high-dimensional input in photovoltaic power generation prediction are solved, and efficient and real-time photovoltaic power generation prediction is achieved.

CN121546545APending Publication Date: 2026-02-17SHENZHEN KAIFA TECH (CHENGDU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511647755.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-11
Publication Date
2026-02-17

AI Technical Summary

Technical Problem

Existing short-term photovoltaic power generation forecasting methods suffer from high model complexity, low prediction accuracy, and weak generalization ability when dealing with high-dimensional meteorological characteristics, making it difficult to meet the needs of grid dispatching and energy storage system optimization control.

Method used

A hybrid model of random forest feature selection and bidirectional temporal convolutional network-bidirectional gated recurrent unit (BiTCN-BiGRU) is adopted. Key features are extracted by combining random forest method and trained by BiTCN-BiGRU hybrid neural network architecture. After pruning and optimization, it is converted into RKNN format and deployed on edge energy management unit for hardware acceleration.

Benefits of technology

It achieves high-precision, low-latency photovoltaic power generation prediction, improves the model's generalization ability and prediction accuracy, and meets the real-time requirements of edge computing scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121546545A_ABST
    Figure CN121546545A_ABST
Patent Text Reader

Abstract

The invention discloses a photovoltaic power generation power edge prediction method, and the method comprises the steps: firstly collecting photovoltaic output power and multi-dimensional meteorological data, and constructing a training set and a test set after normalization; then, key features are extracted by adopting a random forest method based on the training set, and a prediction model is built and trained by utilizing a BiTCN-BiGRU hybrid neural network architecture; performing pruning optimization on the trained model, converting the model into an RKNN format, performing quantification processing and performance evaluation on the model, and performing further optimization according to an evaluation result to obtain a lightweight model; and finally, the lightweight model is deployed in an edge energy management unit, hardware acceleration is performed by means of a neural network processing unit, and millisecond-level online reasoning and real-time prediction of the photovoltaic power generation power are realized. Through fusion of feature selection and a bidirectional time sequence convolution-recurrent neural network, the limitation of a traditional method in processing high-dimensional features is effectively overcome, the prediction precision and generalization ability are improved, and efficient and low-delay power prediction is realized through edge side deployment.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of intelligent energy storage, in particular to a photovoltaic power edge prediction method. BACKGROUND

[0002] Under the impetus of the double carbon strategy, the clean energy industry represented by photovoltaics has developed rapidly. However, photovoltaic power output is highly dependent on meteorological factors such as light, temperature, and cloud cover, and has significant intermittency, volatility, and randomness, posing a serious challenge to the safe and stable operation of the power system and real-time power balance. Energy storage devices can effectively improve the dispatchability and economy of photovoltaic storage systems by shaving the peak and filling the valley of photovoltaic output. Therefore, high-precision photovoltaic power prediction is not only the basis for scientific decision-making by power grid dispatching departments, but also a key basis for the development and selection of optimal control strategies and operating modes for energy storage systems.

[0003] Currently, photovoltaic power short-term prediction methods can be divided into two categories: physical prediction methods and statistical prediction methods. Both methods usually take numerical weather prediction data as the basis for input. Among them, the statistical prediction method does not require specific physical parameters of photovoltaic components and has wider applicability, and has become the mainstream of research and application. This method establishes a mapping relationship between NWP data and historical power data through machine learning or deep learning models. However, in order to improve prediction accuracy, existing statistical prediction methods tend to introduce multi-dimensional NWP feature variables as model inputs. This results in a sharp increase in the dimensionality of the input variables, which on the one hand significantly increases the complexity and computational burden of the model, and on the other hand can cause dimensionality disaster, making model training difficult and increasing the risk of overfitting, ultimately leading to a decrease in prediction accuracy and a decrease in generalization ability of the model on unknown data.

[0004] Therefore, in view of the above-mentioned defects of existing statistical prediction methods in dealing with high-dimensional NWP features, there is an urgent need in the art to develop a photovoltaic power short-term prediction method that can effectively reduce feature dimensionality, reduce model complexity, and simultaneously have high prediction accuracy and strong generalization ability. SUMMARY

[0005] The purpose of the present application is to overcome the existing technical defects and provide a photovoltaic power edge prediction method, which solves the technical problems of high model complexity, low prediction accuracy, and weak generalization ability caused by high-dimensional input features in photovoltaic power prediction through the technical means of fusing random forest feature selection and a bidirectional time convolution network-bidirectional gated recurrent unit (BiTCN-BiGRU) hybrid model.

[0006] The purpose of the present application is achieved by the following technical solutions: In a first aspect, the present application proposes a photovoltaic power edge prediction method, comprising: Collecting photovoltaic module output power and corresponding multi-dimensional meteorological feature data, normalizing the original data, and dividing it into a training set and a test set to construct a local photovoltaic power generation prediction dataset; Based on the training set, key features are extracted from the multi-dimensional meteorological feature data using the random forest method, and a prediction model is built using the BiTCN-BiGRU hybrid neural network architecture based on the key features. The prediction model is trained using the training set, and its performance is verified on the test set. The optimal weight file is saved to obtain the final trained prediction model; The trained prediction model is pruned and optimized, and the converted model is converted into RKNN format to adapt to the edge embedded hardware platform with a neural network processing unit; The converted model is quantized and evaluated using the RKNN-Toolkit2 tool chain, and the evaluation results are obtained. The model structure and parameters are adjusted and optimized to obtain a lightweight model based on the evaluation results. The evaluation results include accuracy, inference speed, and memory usage key performance indicators; The lightweight model is deployed on the edge energy management unit, and the neural network processing unit is used to accelerate the lightweight model, achieving millisecond-level online inference and real-time prediction result output of photovoltaic power generation.

[0007] In one possible embodiment, the step of normalizing the original data includes: Detecting missing or abnormal data and filling it with the average value of the previous and next week's data; Processing the data through a normalization formula, which is: wherein is the normalized data, is the initial data, is the minimum value of the feature, is the maximum value of the feature.

[0008] In one possible embodiment, the step of extracting key features from multi-dimensional meteorological feature data based on the training set using the random forest method includes: Obtaining key features from the initial feature set through an iterative feature selection process, wherein each iteration includes: Building multiple decision trees based on the Bootstrap sample of the training set to form a random forest; For each decision tree, calculating the feature importance measure using the corresponding out-of-bag data; According to the feature importance measure calculated by all decision trees, sorting the features and removing features that do not meet the requirements to form a new feature subset for the next iteration; When the number of features in the new feature subset reaches the preset target number, the iteration is terminated, and the key features are obtained.

[0009] In a possible embodiment, the BiTCN-BiGRU hybrid neural network architecture includes a TCN module, a GRU module, a spatial feature fusion layer, and a temporal feature fusion layer, the TCN module includes a forward TCN module and a reverse TCN module, and the GRU module includes a forward GRU module and a reverse GRU module.

[0010] In a possible embodiment, the forward TCN module and the reverse TCN module both adopt a temporal convolution structure fused by a causal convolution layer and a dilated convolution layer. The causal convolution layer is used to ensure that the output of the current time step depends on the input of the historical time step. The dilated convolution layer is used to expand the receptive field through a dilated rate to capture multi-scale temporal features.

[0011] In a possible embodiment, the spatial feature fusion layer is configured to receive and fuse the temporal features output by the forward TCN module and the reverse TCN module, generate a feature representation through cross-channel interaction, and output to the GRU module. The GRU module is configured to extract forward and backward temporal dependencies from the unified feature representation. The temporal feature fusion layer is configured to fuse the output of the forward GRU module and the output of the reverse GRU module to generate a final photovoltaic power generation power prediction value.

[0012] In a possible embodiment, the output of the forward GRU module and the output of the reverse GRU module are respectively: ; wherein, is the positive-order GRU model output at the t th time point; is the negative-order GRU model output at the t th time point; is the positive-order GRU model output at the t th time point; is the negative-order GRU model output at the t th time point; and are input weight matrices of the positive and negative GRU models; is the output weight matrix at the t th time point; is the output weight matrix at the t th time point; is the output weight matrix at the t th time point; is the output weight matrix at the t th time point; and are output weight matrices of the positive and negative order GRU models, is a sigmoid function, is a hidden layer output, is an input, is the positive-order GRU model output at the t th time point, is the negative-order GRU model output at the t th time point, is the positive-order GRU model output at the t th time point, The time negative sequence GRU model output.

[0013] In a possible embodiment, the BiTCN-BiGRU hybrid neural network architecture further comprises a multi-head self-attention layer, configured to: The single-head attention output is calculated for each attention head respectively: The outputs of the plurality of attention heads are spliced to obtain a spliced result. The spliced result is linearly transformed to obtain a final multi-head self-attention output.

[0014] In a possible embodiment, the evaluation index for measuring the performance of the prediction model comprises: root mean square error, mean absolute error, and coefficient of determination.

[0015] In a possible embodiment, the converted model is quantized and evaluated by using an RKNN-Toolkit2 tool chain to obtain an evaluation result, and the light-weight model is obtained by adjusting and optimizing the model structure and parameters according to the evaluation result, comprising: An RKNNLite object is created; A load_rknn interface is called to import an RKNN model corresponding to the hardware platform; An init_runtime interface is called to initialize a runtime environment; An inference interface is called to perform inference on input data, and inference results are obtained and processed; After the inference is completed, a release interface is called to release the RKNNLite object; Based on the inference results, the accuracy, inference speed, and memory occupation key indicators of the model are evaluated, and the model is optimized to obtain a light-weight model according to the evaluation results.

[0016] The above main scheme of the present application and each further selection scheme thereof can be freely combined to form multiple schemes, all of which are the schemes that can be adopted and claimed by the present application; and the present application can also be freely combined between (each non-conflict selection) selections and other selections. Those skilled in the art can understand that there are many combinations according to the prior art and common knowledge after understanding the schemes of the present application, and all of them are the technical schemes claimed by the present application, which will not be enumerated here.

[0017] This application discloses a method for edge prediction of photovoltaic power generation. First, photovoltaic output power and multi-dimensional meteorological data are collected and normalized to construct training and testing sets. Then, based on the training set, key features are extracted using a random forest method, and a prediction model is built and trained using a BiTCN-BiGRU hybrid neural network architecture. The trained model is pruned and optimized, converted to RKNN format, quantized, and its performance evaluated. Based on the evaluation results, a lightweight model is further optimized. Finally, this lightweight model is deployed on an edge energy management unit, with hardware acceleration achieved through a neural network processing unit, enabling millisecond-level online inference and real-time prediction of photovoltaic power generation. By fusing feature selection and bidirectional temporal convolutional-recurrent neural networks, the limitations of traditional methods in handling high-dimensional features are effectively overcome, improving prediction accuracy and generalization ability. Simultaneously, efficient and low-latency power prediction is achieved through edge-side deployment. Attached Figure Description

[0018] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 A schematic flowchart of a photovoltaic power generation edge prediction method proposed in an embodiment of this application is shown.

[0020] Figure 2 A schematic diagram of the BiTCN-BiGRU hybrid neural network architecture proposed in an embodiment of this application is shown.

[0021] Figure 3 A schematic diagram of the core building blocks of the Temporal Convolutional Network (TCN) proposed in this application embodiment is shown.

[0022] Figure 4 A schematic diagram illustrating the working mechanism of the Bidirectional Gated Cyclic Unit (BiGRU) module proposed in an embodiment of this application is shown.

[0023] Figure 5 A diagram of the multi-head attention structure proposed in an embodiment of this application is shown.

[0024] Figure 6 A diagram illustrating the model conversion process proposed in an embodiment of this application is shown.

[0025] Figure 7 A flowchart illustrating the entire process of edge prediction of photovoltaic power generation proposed in an embodiment of this application is shown. Detailed Implementation

[0026] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be noted that, unless otherwise specified, the following embodiments and features in the embodiments can be combined with each other.

[0027] Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0028] In existing technologies, short-term photovoltaic (PV) power generation forecasting is mainly divided into physical forecasting methods and statistical forecasting methods. Both are based on numerical weather prediction (NWP). The latter has the advantage of not requiring PV module parameters, making it more suitable for predicting PV power. However, when using multi-feature NWP data as model input, the high dimensionality of the input variables not only increases model complexity but may also cause problems such as the curse of dimensionality and overfitting, leading to decreased prediction accuracy and weakened generalization ability.

[0029] Therefore, in order to solve the above-mentioned technical problems, this application proposes a photovoltaic power generation edge prediction method. By integrating the random forest (RF) feature selection and the bidirectional temporal convolutional network-bidirectional gated recurrent unit (BiTCN-BiGRU) hybrid model, it solves the technical problems of high model complexity, low prediction accuracy and weak generalization ability caused by high-dimensional input features in photovoltaic power generation prediction.

[0030] Please refer to Figure 1 , Figure 1 This paper presents a flowchart illustrating a photovoltaic power generation edge prediction method according to an embodiment of this application. The method includes the following steps: Step S1: Collect photovoltaic module output power and corresponding multi-dimensional meteorological feature data, normalize the raw data, and divide it into training set and test set to construct a local photovoltaic power generation prediction dataset.

[0031] The actual output power of photovoltaic modules and corresponding multi-dimensional meteorological characteristic data are collected. These characteristics typically include multiple key meteorological variables such as temperature, air pressure, and humidity. Next, the acquired raw data undergoes preprocessing, primarily including denoising to eliminate outliers and random interference, normalizing various features to eliminate the influence of different units on model training, and ensuring that all features are aligned over time. Finally, the processed dataset is divided into training and test sets in a 7:3 ratio.

[0032] The steps for normalizing the raw data include: Detect missing or outlier data and fill in the missing or outlier data with the average of the data from the week before and after the missing or outlier data; The data is processed using a normalization formula, which is: ,in For the normalized data, For initial data, The minimum value of the characteristic. This represents the maximum value of the characteristic.

[0033] First, missing value detection was performed on the raw photovoltaic meteorological and power data. For any detected missing or outlier data points, the arithmetic mean of the data from the same period one week before and after that point was used for filling. This filling method fully considers the inherent daily and weekly periodic variations in photovoltaic power generation, and compared to traditional interpolation methods, it better reflects the actual power generation characteristics, thus ensuring the rationality and effectiveness of the filled data. Second, after completing the missing value filling, to avoid interference with model training due to differences in the units of measurement between different meteorological characteristics, the min-max normalization method was used to standardize all the data.

[0034] Step S2: Based on the training set, use the random forest method to extract key features from multi-dimensional meteorological feature data. Based on the key features, use the BiTCN-BiGRU hybrid neural network architecture to build a prediction model. Use the training set to train the prediction model and verify its performance on the test set. Save the optimal weight file to obtain the final trained prediction model.

[0035] First, based on the training set, a random forest algorithm is used to evaluate the importance of each feature from multi-dimensional meteorological feature data including temperature, air pressure, and humidity, and accordingly selects the key feature subset that has the greatest impact on photovoltaic power generation prediction. This process effectively reduces the dimensionality and redundancy of the input data, while enhancing the representational ability of the features and the interpretability of the model. Based on the selected key features, a BiTCN-BiGRU hybrid neural network prediction model combining a bidirectional temporal convolutional network and a bidirectional gated recurrent unit is constructed. Next, the prediction model is trained in a supervised manner using the training set, and its prediction performance is verified using the test set. During the iteration process, the model weight file with the optimal verification performance index is saved, and finally, a photovoltaic power generation prediction model with high accuracy and strong generalization ability is obtained.

[0036] The steps for extracting key features from multi-dimensional meteorological feature data using the random forest method based on the training set include: Key features are obtained from the initial feature set through an iterative feature selection process, where each iteration includes: Multiple decision trees are constructed based on the Bootstrap samples in the training set to form a random forest; For each decision tree, the feature importance metric is calculated using the corresponding out-of-bag data; Based on the feature importance metrics calculated from all decision trees, the features are sorted and features that do not meet the requirements are removed, forming a new feature subset for the next iteration; The iteration terminates when the number of features in the new feature subset reaches the preset target number, and the key features are obtained.

[0037] This selection process uses the training set as a basis, constructing K bootstrap sample sets through Bootstrap resampling technology, and corresponding to the training set. A random forest is formed from several decision trees; for each decision tree, feature importance is measured using its out-of-bag (OOB) data—first, the first error of the OOB data in the undisturbed state is calculated. Then, noise interference was randomly added to all samples of the OOB data, and the second error was calculated. By quantizing the absolute difference of the error before and after noise interference To accurately assess the marginal contribution of each feature to the prediction results, and finally... The formula yields feature importance scores, which are then sorted in descending order. As a measure of feature importance, To account for data errors caused by added noise interference, This represents the data error without added noise.

[0038] Based on a preset elimination ratio, features with lower importance scores are eliminated round by round to form a new subset of features. The iterative process of building a decision tree, calculating OOB error, noise interference, assessing importance, and sorting and eliminating features is repeated until the number of remaining features reaches the preset target number m, at which point the screening ends. This effectively extracts the most representative key feature subset for photovoltaic power generation prediction, significantly reduces input redundancy, and enhances the interpretability and generalization performance of the model.

[0039] Figure 2 The diagram illustrates the BiTCN-BiGRU hybrid neural network architecture proposed in this application. It receives multivariate input and feeds it into two parallel branches, a forward TCN and a backward TCN, for temporal feature extraction. Each TCN branch consists of causal convolutional layers and dilated convolutional layers, and is stabilized and its performance improved through residual connections and normalization layers. Subsequently, the features output from the two TCN branches are integrated into a spatial feature fusion layer to form a unified feature representation. This fused feature is then fed into a bidirectional GRU module to capture forward and backward temporal dependencies, respectively. The outputs of the two GRU branches are then aggregated by the temporal feature fusion layer. Finally, the fused temporal features are further refined through a multi-head attention layer to extract key information, and the final output layer generates the predicted value.

[0040] The BiTCN-BiGRU hybrid neural network architecture includes a TCN module, a GRU module, a spatial feature fusion layer, and a temporal feature fusion layer. The TCN module includes a forward TCN module and a reverse TCN module, and the GRU module includes a forward GRU module and a reverse GRU module.

[0041] Both the forward TCN module and the reverse TCN module adopt a temporal convolutional structure that combines causal convolutional layers and dilated convolutional layers; Causal convolutional layers are used to ensure that the output of the current time step depends on the input of the previous time steps; Hollow convolutional layers are used to expand the receptive field by increasing the porosity, thereby capturing multi-scale temporal features.

[0042] In photovoltaic (PV) power generation prediction, Temporal Convolutional Networks (TCNs) employ two main mechanisms: Causal Convolutional Layers and Dilated Convolutional Layers. Causal Convolutions strictly adhere to temporal causality, ensuring that predictions at the current time step rely solely on historical data (such as historical values ​​of various features like temperature, air pressure, and humidity), preventing future information leakage and making them suitable for real-time prediction and fault warning. Dilated Convolutions, on the other hand, expand the receptive field through exponentially increasing void ratios (e.g., 1, 2, 4…), efficiently capturing multi-scale features ranging from short-term fluctuations (such as sudden power drops caused by cloud cover) to long-term trends (such as slow changes in power generation capacity due to seasonal variations). The fusion of these two convolutional mechanisms gives TCNs both rigor and flexibility in temporal modeling, significantly improving the accuracy and reliability of PV power generation prediction.

[0043] Figure 3 The diagram illustrates the core building block of the Temporal Convolutional Network (TCN) proposed in this application, which is a residual block structure. The input first passes through a causal convolutional layer to ensure that the output depends only on the current and historical inputs, strictly adhering to temporal causality. The convolution result is then processed sequentially through batch normalization, ReLU activation, and Dropout to accelerate training convergence, introduce nonlinearity, and prevent overfitting. The processed data then enters a dilated convolutional layer, which expands the receptive field by increasing the dilation rate to capture longer-term temporal dependencies. Similarly, the output of the dilated convolution also undergoes batch normalization, ReLU activation, and Dropout. Simultaneously, the original input passes through a separate 1x1 convolutional layer. This operation aims to adjust the dimension of the input so that it can be added to the main path output after the aforementioned complex transformation. Finally, the input processed by the 1x1 convolution is added to the main path output to form a residual connection, and the result is used as the output of this residual block.

[0044] The spatial feature fusion layer is used to receive and fuse the temporal features output by the forward TCN module and the reverse TCN module, generate feature representations through cross-channel interaction, and output them to the GRU module. The GRU module is used to extract forward and backward temporal dependencies from a unified feature representation, respectively. The time-series feature fusion layer is used to fuse the outputs of the forward GRU module and the reverse GRU module to generate the final photovoltaic power generation prediction value.

[0045] The spatial feature fusion layer receives and fuses the temporal features output from the forward TCN module and the reverse TCN module. The forward TCN module strictly ensures temporal causality and avoids future information leakage through causal convolution, while the reverse TCN module provides temporal pattern mining from a reverse perspective. The two are integrated through cross-channel interaction into a unified feature representation that is richer in information and more robust, providing optimized input for the subsequent deep temporal modeling of the GRU module. The GRU module further extracts forward and backward temporal dependencies from this unified feature representation. The forward GRU captures historical evolution patterns, while the reverse GRU captures future contextual information, thus fully exploiting the bidirectional dependency characteristics of the time series. Finally, the temporal feature fusion layer effectively coordinates and fuses the outputs of the forward and reverse GRU modules to generate a unified temporal representation that can reflect both historical evolution patterns and predict future trends. Based on this representation, the final photovoltaic power generation prediction value is output. Through the dual-layer fusion mechanism of spatial feature fusion and temporal feature fusion, the model can comprehensively integrate the local fine pattern of causal convolution, the global macro trend of dilated convolution, and the complementary temporal information of bidirectional GRU, which significantly improves the modeling ability and prediction accuracy of complex temporal dynamics.

[0046] The outputs of the forward GRU module and the reverse GRU module are as follows: ; in, for Output of the time-order GRU model; for Output of the time-order negative GRU model; and Input the weight matrix into the positive and negative GRU models; for Output the weight matrix at each time step; for Output the weight matrix at each time step; and Output the weight matrix for the positive and negative order GRU model. For the sigmoid function, For output of the hidden layer, For input, for Time-order GRU model output. for Output of the time-ordered negative GRU model.

[0047] Furthermore, GRU has advantages such as simple structure and fewer network parameters, but it does not consider the impact of bidirectional time series on the prediction results, and it is prone to forgetting important time series information when processing long sequences. Its model parameter calculation expression is: .

[0048] in, To reset the door, i.e. Input of time Compared to the previous hidden layer and output Impact on candidate states; To update the gate, i.e., the output of the hidden layer at the previous time step. right Time Hidden Layer Output The magnitude of the impact; This is the candidate hidden state; Output for hidden layer; It is the sigmoid function; It is the hyperbolic tangent activation function; , , The weight matrix for resetting the gate, updating the gate, and the candidate hidden state.

[0049] BiGRU overcomes the limitations of GRU's unidirectional learning. Its hidden layer is composed of GRU combined with forward and backward propagation directions, which can fully exploit the time-series characteristics of photovoltaic power, improving data utilization and model prediction accuracy. ,in for Output of the time-order GRU model; for Output of the time-order negative GRU model; and Input the weight matrix into the positive and negative GRU models; for Output the weight matrix at each time step; for Output the weight matrix at each time step; and Output the weight matrix for the positive and negative order GRU model.

[0050] Figure 4 The diagram illustrates the working mechanism of the Bidirectional Gated Recurrent Unit (BiGRU) module proposed in this embodiment. The input sequence is simultaneously fed into a forward GRU and a reverse GRU. At each time step (t1, t2, t3, t4), the two GRU networks calculate the hidden states representing information in different temporal directions, i.e., the forward hidden states. and reverse hidden state Subsequently, for each time step, the forward and backward hidden states at that moment are further fused (e.g., through concatenation or weighted summation) to generate a final composite hidden state. This integrated state contains contextual information from both the forward and backward directions of the sequence, thus providing the model with a more comprehensive and richer representation of temporal features.

[0051] The BiTCN-BiGRU hybrid neural network architecture also includes a multi-head self-attention layer for: Calculate the single-head attention output for each attention head separately: The outputs of multiple attention heads are concatenated to obtain the concatenated result; The splicing results are linearly transformed to obtain the final multi-head self-attention output.

[0052] Multi-head self-attention mechanisms excel at capturing long-term dependencies in time-series data. For photovoltaic (PV) power generation forecasting, there is a complex nonlinear dynamic relationship between power generation cycles and weather changes. Multi-head self-attention mechanisms can flexibly focus on features across different time periods, helping models identify the main meteorological and spatiotemporal factors affecting PV power output characteristics. Each attention head can focus on sequence features from different angles, thus enabling parallel capture of multi-level variation patterns at different time scales in power data.

[0053] Single-head attention captures the dependencies in an input sequence by dynamically assigning weights at different time steps based on the interactions between queries, keys, and values. Its core computational process is as follows: ,in, Represents the query matrix. Represents the key matrix. Represents a value matrix, Indicates dimension.

[0054] Multi-head attention builds upon single-head attention by maintaining a separate Q / K / V weight matrix for each head, thus generating different Q / K / V matrices. Figure 5 The diagram illustrates a multi-head attention structure proposed in an embodiment of this application, where different Z matrices are obtained by performing the same self-attention calculation. These Z matrices are then concatenated and multiplied by a weight matrix to obtain the output.

[0055] Evaluation metrics for predictive models include: root mean square error, mean absolute error, and coefficient of determination.

[0056] By inputting data into the network, training and testing for 200 epochs, the best-performing model weight file is saved.

[0057] The following evaluation metrics are used to measure model performance: Root Mean Squared Error (RMSE): This reflects the deviation between the model's predicted values ​​and the actual values, and is more sensitive to larger errors. Mean Absolute Error (MAE): Describes the average absolute difference between model predictions and actual values, suitable for measuring the overall stability of the error. Coefficient of determination This reflects the magnitude of the difference (residual) between the model's predicted values ​​and the actual values ​​relative to the variation in the data itself. ),in, and It reflects the magnitude of the actual prediction error and the degree of sample dispersion; the smaller the value, the better the prediction effect. The value is within [0, 1], and the closer it is to 1, the higher the prediction accuracy; Indicates the data sample size; This is a predicted value; The actual value; This is the true average value.

[0058] Step S3: Prune and optimize the trained prediction model, and convert it to RKNN format to obtain the converted model, so as to adapt it to the edge embedded hardware platform equipped with neural network processing unit. The trained prediction model is optimized through structured pruning. By removing redundant connection channels and unnecessary output nodes, the model size is compressed and the number of parameters is reduced while maintaining the core prediction capability. Then, the pruned and optimized model and its weight file are converted into the RKNN format, which is dedicated to edge computing platforms. This results in a converted model that can run efficiently on embedded neural network processing units, thus achieving compatibility with edge embedded hardware platforms equipped with NPUs.

[0059] Step S4: Use the RKNN-Toolkit2 toolchain to quantize and evaluate the transformed model to obtain the evaluation results. Adjust and optimize the model structure and parameters based on the evaluation results to obtain a lightweight model. The evaluation results include key performance indicators such as accuracy, inference speed, and memory usage. The transformed model is quantized using the RKNN-Toolkit2 toolchain, converting model parameters from floating-point to low-precision integers to further compress the model size and improve inference efficiency. Simultaneously, a comprehensive performance evaluation is performed on the quantized model, yielding key performance indicators including prediction accuracy, inference latency, and memory usage. Based on these evaluation results, the model is further optimized by adjusting model structure parameters or performing pruning and quantization operations, ultimately resulting in a lightweight prediction model with better inference efficiency and lower resource consumption while maintaining acceptable accuracy.

[0060] The steps for quantizing and evaluating the transformed model using the RKNN-Toolkit2 toolchain, obtaining evaluation results, and adjusting and optimizing the model structure and parameters based on the evaluation results to obtain a lightweight model include: Create an RKNNLite object; Call the load_rknn interface to import the RKNN model corresponding to the hardware platform; Call the init_runtime interface to initialize the runtime environment; Call the inference interface to perform inference on the input data, obtain and process the inference results; After inference is complete, call the release interface to release the RKNNLite object; Based on the inference results, the model's accuracy, inference speed, and memory usage are evaluated as key indicators. The model is then optimized based on the evaluation results to obtain a lightweight model.

[0061] Figure 6 The diagram illustrates the model conversion process proposed in this application. It describes the construction of an edge inference environment using the RKNN-Toolkit2 toolchain and its lightweight runtime library RKNN-Toolkit-Lite2. The process involves creating an RKNNLite object, importing an RKNN model file compatible with the hardware platform (e.g., rk356x / rk3588) via the load_rknn interface, initializing the runtime environment via the init_runtime interface, performing online inference on the input meteorological and power data to obtain prediction results via the inference interface, and releasing the RKNNLite object via the release interface after inference. This completes the efficient deployment of the BiTCN-BiGRU model at the edge. Based on the inference results, the model's key performance indicators in terms of accuracy, inference speed, and memory usage are further evaluated. The model structure and parameters are iteratively optimized and quantized based on the evaluation results, ultimately obtaining a lightweight model adapted for Neural Processing Unit (NPU) acceleration, ensuring millisecond-level real-time prediction and high-frequency output at the edge energy management unit (EMU).

[0062] Step S5: Deploy the lightweight model on the edge energy management unit, and accelerate the lightweight model through the neural network processing unit to achieve millisecond-level online inference and real-time prediction results output for photovoltaic power generation.

[0063] The lightweight model, after pruning optimization and format conversion, is deployed on the edge energy management unit (EMU). The neural network processing unit (NPU) on the edge device accelerates the lightweight model with dedicated hardware, thereby reducing the model inference latency to the millisecond level. This enables online real-time inference and high-frequency prediction output of photovoltaic power generation, meeting the stringent requirements of edge computing scenarios for prediction timeliness and resource efficiency.

[0064] Figure 7 This paper illustrates the complete flowchart of the photovoltaic power generation edge prediction process proposed in this embodiment. Seven types of meteorological data, both historical and real-time, undergo unified random forest data preprocessing. The preprocessed data is then divided into training and testing sets, and the model building and training phase begins. The BiTCN-BiGRU prediction model is built, initialized, and iteratively trained using the training set until convergence. After completion, the model's performance is tested using the testing set and evaluated according to prediction evaluation metrics. Finally, the model weights that meet the performance requirements are saved. This completes the offline training phase. To adapt to edge computing resources, the saved model weights are pruned and optimized to compress their size and converted to a format specific to edge hardware. The converted model is deployed to the edge, and after initializing the runtime environment, it can receive real-time meteorological data and perform efficient inference using the optimized model, ultimately achieving millisecond-level real-time prediction of photovoltaic power generation.

[0065] Compared with the prior art, the embodiments of this application have the following beneficial effects: First, missing values ​​are filled by averaging the data from the previous and following week, which fully preserves the daily and weekly cycle characteristics of photovoltaic power generation and improves data integrity; min-max normalization eliminates the dimensional differences of multi-source meteorological data and enhances the numerical stability and convergence efficiency of model training.

[0066] Second, the OOB error evaluation mechanism based on random forest adaptively selects key meteorological features, effectively reducing the input dimensionality and alleviating the problems of dimensionality curse and overfitting; the iterative feature removal strategy ensures that the most representative feature subset is retained, significantly improving the interpretability and generalization ability of the model.

[0067] Third, the BiTCN module integrates causal convolution and dilated convolution, which not only ensures temporal causality but also efficiently captures multi-scale spatiotemporal features from short-term fluctuations to long-term trends; the BiGRU bidirectional structure fully explores historical and future contextual information, overcomes the long-range dependency forgetting defect of unidirectional RNN, and improves the depth of temporal modeling.

[0068] Fourth, the multi-head self-attention mechanism dynamically focuses on key meteorological factors at different time steps, enhancing the ability to accurately capture long-term dependencies; the parallel multi-scale feature attention mechanism significantly improves the model's flexibility in modeling complex nonlinear meteorological-power dynamic correlations.

[0069] Fifth, model pruning and RKNN format conversion effectively compress the model size and adapt to the NPU hardware architecture, significantly reducing memory usage and computational load at the edge; dedicated NPU hardware acceleration enables millisecond-level online inference, meeting the stringent timeliness requirements of the edge energy management unit for high-frequency real-time prediction output.

[0070] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A method for predicting the edge power output of photovoltaic power generation, characterized in that, include: Data on photovoltaic module output power and corresponding multi-dimensional meteorological characteristics were collected. The raw data were normalized and divided into training and testing sets to construct a local photovoltaic power generation prediction dataset. Based on the training set, the random forest method is used to extract key features from multi-dimensional meteorological feature data. Based on the key features, a prediction model is built using a BiTCN-BiGRU hybrid neural network architecture. The prediction model is trained using the training set, and its performance is verified on the test set. The optimal weight file is saved to obtain the final trained prediction model. The trained prediction model is pruned and optimized, and then converted into RKNN format to obtain the converted model, which is adapted to the edge embedded hardware platform equipped with a neural network processing unit. The transformed model was quantized and evaluated using the RKNN-Toolkit2 toolchain to obtain evaluation results. Based on the evaluation results, the model structure and parameters were adjusted and optimized to obtain a lightweight model. The evaluation results include key performance indicators such as accuracy, inference speed, and memory usage. The lightweight model is deployed on the edge energy management unit, and hardware acceleration of the lightweight model is achieved through the neural network processing unit, enabling millisecond-level online inference and real-time prediction output of photovoltaic power generation.

2. The photovoltaic power generation edge prediction method as described in claim 1, characterized in that, The steps for normalizing the raw data include: Detect missing or outlier data and fill in the missing or outlier data with the average of the data from the week before and after the missing or outlier data; The data is processed using a normalization formula, which is: ,in For the normalized data, For initial data, The minimum value of the characteristic. This represents the maximum value of the characteristic.

3. The photovoltaic power generation edge prediction method as described in claim 1, characterized in that, The steps for extracting key features from multi-dimensional meteorological feature data using the random forest method based on the training set include: Key features are obtained from the initial feature set through an iterative feature selection process, where each iteration includes: Multiple decision trees are constructed based on the Bootstrap samples in the training set to form a random forest; For each decision tree, the feature importance metric is calculated using the corresponding out-of-bag data; Based on the feature importance metrics calculated from all decision trees, the features are sorted and features that do not meet the requirements are removed, forming a new feature subset for the next iteration; The iteration terminates when the number of features in the new feature subset reaches the preset target number, and the key features are obtained.

4. The photovoltaic power generation edge prediction method as described in claim 1, characterized in that, Bi The TCN-BiGRU hybrid neural network architecture includes a TCN module, a GRU module, a spatial feature fusion layer, and a temporal feature fusion layer. The TCN module includes a forward TCN module and a reverse TCN module, and the GRU module includes a forward GRU module and a reverse GRU module.

5. The photovoltaic power generation edge prediction method as described in claim 4, characterized in that, Both the forward TCN module and the reverse TCN module adopt a temporal convolutional structure that combines causal convolutional layers and dilated convolutional layers; Causal convolutional layers are used to ensure that the output of the current time step depends on the input of the previous time steps; Hollow convolutional layers are used to expand the receptive field by increasing the porosity, thereby capturing multi-scale temporal features.

6. The photovoltaic power generation edge prediction method as described in claim 5, characterized in that, The spatial feature fusion layer is used to receive and fuse the temporal features output by the forward TCN module and the reverse TCN module, generate feature representations through cross-channel interaction, and output them to the GRU module. The GRU module is used to extract forward and backward temporal dependencies from a unified feature representation, respectively. The time-series feature fusion layer is used to fuse the outputs of the forward GRU module and the reverse GRU module to generate the final photovoltaic power generation prediction value.

7. The photovoltaic power generation edge prediction method as described in claim 6, characterized in that, The outputs of the forward GRU module and the reverse GRU module are as follows: ; in, for Output of the time-order GRU model; for Output of the time-order negative GRU model; and Input the weight matrix into the positive and negative GRU models; for Output the weight matrix at each time step; for Output the weight matrix at each time step; and Output the weight matrix for the positive and negative order GRU model. For the sigmoid function, For output of the hidden layer, For input, for Time-order GRU model output. for Output of the time-ordered negative GRU model.

8. The photovoltaic power generation edge prediction method as described in claim 1, characterized in that, Bi The TCN-BiGRU hybrid neural network architecture also includes a multi-head self-attention layer for: Calculate the single-head attention output for each attention head separately: The outputs of multiple attention heads are concatenated to obtain the concatenated result; The splicing results are linearly transformed to obtain the final multi-head self-attention output.

9. The photovoltaic power generation edge prediction method as described in claim 1, characterized in that, Evaluation metrics for predictive models include: root mean square error, mean absolute error, and coefficient of determination.

10. The photovoltaic power generation edge prediction method as described in claim 1, characterized in that, The steps for quantizing and evaluating the transformed model using the RKNN-Toolkit2 toolchain, obtaining evaluation results, and adjusting and optimizing the model structure and parameters based on the evaluation results to obtain a lightweight model include: Create an RKNNLite object; Call the load_rknn interface to import the RKNN model corresponding to the hardware platform; Call the init_runtime interface to initialize the runtime environment; Call the inference interface to perform inference on the input data, obtain and process the inference results; After inference is complete, call the release interface to release the RKNNLite object; Based on the inference results, the model's accuracy, inference speed, and memory usage are evaluated as key indicators. The model is then optimized based on the evaluation results to obtain a lightweight model.