Photovoltaic power prediction method based on capsule neural network hybrid architecture
By using a hybrid capsule neural network architecture that combines multi-scale capsule neural networks and causal inference Transformer, the problem of adapting high-frequency fluctuations and low-frequency trends in photovoltaic power prediction is solved, achieving high-precision and real-time photovoltaic power prediction that can meet the needs of different climate scenarios.
Patent Information
- Application Number
- CN202511832063.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-08
- Publication Date
- 2026-02-17
AI Technical Summary
Existing photovoltaic power prediction methods have shortcomings in terms of high accuracy, real-time performance, and adaptability. Physical modeling relies on detailed parameters and is computationally complex. Data-driven methods are difficult to adapt to both high-frequency fluctuations and low-frequency trends in power sequences. Multimodal feature correlation and time series adaptation are disconnected. Pseudo-correlation feature interference and scenario generalization ability are weak.
A hybrid architecture based on capsule neural networks is adopted, combining multi-scale capsule neural networks (CapsNet) and causal inference Transformer. It captures the spatial correlation features and temporal dynamic features of photovoltaic power through multi-scale convolution and dynamic routing mechanism, and removes spurious correlation features through causal inference Transformer. It also improves prediction accuracy by combining bidirectional collaborative module and scene adaptive weight adjustment module.
It improves the accuracy and adaptability of photovoltaic power prediction, reduces prediction deviations in complex weather scenarios, meets the accuracy and real-time requirements of large-scale grid connection, and enhances data quality and computing efficiency.
Smart Images

Figure CN121543829A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of photovoltaic power prediction technology, and in particular to a photovoltaic power prediction method based on a capsule neural network hybrid architecture. Background Technology
[0002] As the global energy structure transitions towards cleaner and lower-carbon energy, photovoltaic (PV) power generation, as a core component of renewable energy, has seen its installed capacity and grid connection ratio continue to rise. However, PV power generation is affected by multiple coupled factors, exhibiting significant intermittency, volatility, and randomness. This characteristic makes PV grid connection prone to impacting the safe and stable operation of the power system, the formulation of dispatch plans, and the optimization of energy storage configuration. Therefore, high-precision PV power forecasting has become a key requirement for ensuring the grid's absorption capacity.
[0003] Existing photovoltaic power prediction methods fall into two categories: physical modeling and data-driven methods. The physical modeling method establishes a mathematical model based on the physical characteristics of photovoltaic cells and meteorological data. It does not require a large amount of historical data, but it depends on the detailed parameters of photovoltaic power plants. Missing or biased parameters will seriously affect the accuracy. The calculation process of this method is complicated, making it difficult to meet the real-time requirements of ultra-short-term forecasts and poor adaptability to complex meteorological scenarios. Data-driven methods achieve prediction by mining the correlations of multi-source data, which is more flexible and has become the mainstream approach. However, a single model cannot simultaneously adapt to the high-frequency fluctuations and low-frequency trends of power sequences, resulting in incomplete feature capture. Furthermore, there is a disconnect between the spatial correlation of multimodal features and the adaptation to temporal dynamic changes, insufficient model fusion depth, susceptibility to interference from spurious correlation features, and low accuracy of weight calibration. The model's generalization ability is weak, and the prediction performance fluctuates greatly under different climate or seasonal scenarios. Therefore, the current accuracy of data-driven short-term and ultra-short-term power prediction is difficult to meet the needs of large-scale grid connection. Summary of the Invention
[0004] This application provides a photovoltaic power prediction method based on a hybrid architecture of capsule neural networks. It constructs a hybrid architecture based on multi-scale capsule neural network CapsNet and causal inference Transformer to achieve modality adaptation, bidirectional collaboration and adaptive prediction. It solves the problems in the existing technology, such as physical modeling relying on detailed parameters and computational complexity, and data-driven methods having problems such as the separation of multimodal feature correlation and temporal adaptation, inaccurate capture of key local spatiotemporal correlation, spurious correlation interference attention weights and weak scene generalization ability.
[0005] This application provides a photovoltaic power prediction method based on a capsule neural network hybrid architecture, including: (1) Obtain multi-source heterogeneous data of photovoltaic power stations, including historical operation data and meteorological data, and preprocess the multi-source data to obtain standardized data; (2) Construct a prediction model based on a hybrid architecture, and extract spatial correlation features from standardized data through a multi-scale capsule neural network to capture the high-frequency fluctuations and low-frequency trends of photovoltaic power sequences; (3) Attention calibration of spatial correlation features is performed by causal inference Transformer in the prediction model, and temporal dynamic features are extracted by combining causal graph and local-global dual attention mechanism; (4) The extracted spatial correlation features and temporal dynamic features are sent to the bidirectional collaborative module for bidirectional feature interaction and deep fusion to obtain fused features, and preliminary predictions are generated through temporal manifold decoding; (5) Calculate the hybrid loss function based on the preliminary prediction and label information, and perform hierarchical training on the prediction model through the scene adaptive weight adjustment module to obtain the pre-trained prediction model with the best performance; (6) Input the real-time collected photovoltaic power generation multi-source data into the pre-trained prediction model and output the point prediction and interval prediction results of photovoltaic power generation.
[0006] Furthermore, the capsule neural network used in the prediction model overcomes the limitations of traditional convolutional neural networks in processing spatial hierarchical structures and part-whole relationships. A capsule is a collection of neurons whose output is a vector, rather than the scalar output of a traditional neuron. The length of the vector represents the probability of the entity's existence, and the direction of the vector represents the entity's attributes, including position, orientation, and size. In this way, the capsule network can better capture the spatial hierarchical relationships and pose information of objects. Capsule neural networks employ a dynamic routing mechanism. In traditional neural networks, information is passed through fixed connection weights. However, in capsule neural networks, dynamic routing allows lower-level capsules to dynamically adjust the weights of information transmission based on the degree of matching between their outputs and those of higher-level capsules. If the output of a lower-level capsule is highly consistent with the expected input of a higher-level capsule, then the output of the lower-level capsule will be passed more to the higher-level capsule, enabling the capsule neural network to better handle complex spatial relationships and object pose changes. Furthermore, to address the heterogeneity and noise characteristics of multi-source photovoltaic power generation data, data quality is improved through timestamp calibration, accurate filling of missing values, outlier removal, and standardization. Missing values are filled using temporal attention interpolation, which is calculated by weighting the feature similarity of six time steps before and after the missing time step, so that the filled values conform to the temporal trend. The calculation formula is as follows:
[0007] in, Indicates the missing position The fill value, For time steps The original value, The value of is in the range of [-6, 6] and is not 0; For time steps and The similarity is calculated using the following formula:
[0008] in, The time decay coefficient, This represents the numerical difference between two time steps. This represents the standard deviation of all values within the time step range [-6, 6]. The Isolation Forest algorithm is used to identify outliers and replace them with the median value within a sliding window to avoid single outliers interfering with the overall data distribution. Simultaneously, all multi-source heterogeneous photovoltaic power generation data are standardized using Z-score, ensuring a mean of 0 and a standard deviation of 1 for all data. The formula is:
[0009] in, Represents the original data. and These represent the mean and standard deviation of each type of photovoltaic power generation data within the data collection period, respectively. This represents standardized multi-source data.
[0010] Furthermore, the hybrid architecture of the prediction model includes multi-scale CapsNet and causal inference Transformer.
[0011] Furthermore, for the photovoltaic power generation sequence in the photovoltaic power plant operation data, in order to obtain the high and low frequency characteristics in the sequence, multi-scale CapsNet extracts features from it to achieve hierarchical capture of spatial correlation features: First, the standardized photovoltaic power generation sequence is reconstructed into a three-dimensional tensor of "feature-time step-channel" to meet the vector encoding requirements of CapsNet. Then, three sets of one-dimensional convolution kernels with different scales are used, with the scales designed to be 3, 5 and 7 time step sizes, to extract local features at different time granularities in parallel, ensuring comprehensive capture of high-frequency fluctuations and low-frequency trends. Finally, through primary capsule vectorization encoding and high-level capsule dynamic routing mechanism, local features are aggregated into abstract spatial correlation features, and the vector length intuitively reflects the importance of the features. Specifically, primary capsule vectorization encoding compresses the scalar feature map output by convolution into capsule vectors using the Squash function, with the formula as follows:
[0012] in, Indicates the first The activation vector of a primary capsule, For the first The inputs to each primary capsule are provided directly by the outputs of the multi-scale convolutional layers. for The L2 norm; the above formula compresses the vector length to the range [0,1], and the closer the length is to 1, the more significant the feature; The high-level capsule dynamic routing first calculates the prediction vector using the weight matrix:
[0013] in, For the first The first primary capsule for the first The prediction vector of a high-level capsule, For mapping primary capsules To high-rise capsules The weight matrix of the linear layer, , For high-level capsule dimensions, For the primary capsule dimension, the inputs to the higher-level capsules are obtained through weighted aggregation using coupling coefficients:
[0014] in, For the first The input and output of a high-level capsule, This refers to the number of primary capsules; Primary capsules With high-level capsules The coupling coefficient is calculated using the following formula:
[0015] in, and These represent primary capsules. With high-level capsules and high-level capsules The initial coupling coefficient, Indicates the quantity of premium capsules.
[0016] Furthermore, to address the issue of interference from spurious correlation features, a causal inference Transformer is constructed. First, a causal graph model is used to model the true causal relationship between meteorological data and photovoltaic power generation, and core features are selected. Then, the core photovoltaic power generation sequence is split into the original sequence and the reconstructed sequence, and positional codes combining intraday and cross-day / weekly cycles are injected respectively to enhance the capture of temporal patterns. The original sequence position encoding combines the absolute time step with the intraday hourly period, as shown in the following formula:
[0017]
[0018] in, and They are time steps Dimension at location and Location code value, For dimension indexing; It is the Transformer embedding dimension. For time steps The number of hours corresponding to the location. It is a seasonal modulation factor; the reconstructed sequence position encoding combines the segment index and the cross-day week cycle, as shown in the following formula:
[0019]
[0020] in, and These are photovoltaic power reconfiguration sequence segments. Dimension at location and Location code value, Indicates the week number corresponding to the segment; Finally, a local-global dual attention mechanism is adopted, where local attention focuses on high-frequency fluctuations in adjacent time steps, while global attention captures low-frequency trends over long distances. Combined with causal constraints, this achieves precise calibration of attention weights.
[0021] Furthermore, a bidirectional collaborative module of multi-scale CapsNet and causal inference Transformer is constructed. The spatial correlation features extracted by multi-scale CapsNet guide the attention of causal inference Transformer to focus on highly correlated temporal segments. At the same time, the temporal trend features of causal inference Transformer are used to optimize the correlation matrix of multi-scale CapsNet, realizing deep interaction between spatial and temporal knowledge. In the decoding stage, a temporal manifold mapping mechanism is adopted. Core features are locked by anchoring key nodes, and then a precise mapping from discrete nodes to continuous temporal sequences is achieved based on manifold learning, balancing computational efficiency and prediction accuracy.
[0022] Furthermore, the scene adaptive weight adjustment module achieves scene classification based on feature association stability and temporal fluctuation frequency, and dynamically adjusts the fusion weights of the two models. The calculation formula is as follows:
[0023]
[0024] in, and These represent the real-time weights of the multi-scale CapsNet and the causal inference Transformer, respectively. Cloud cover correction factor This is the irradiance fluctuation correction factor; the final output of the prediction model is the predicted photovoltaic power generation value. Represented as:
[0025] in, and These represent the individual predictions from the multi-scale CapsNet and the causal inference Transformer, respectively. The design employs a hierarchical hybrid loss function: L1 loss is used for high-frequency components to enhance noise immunity, while L2 loss is used for low-frequency components to stabilize the trend. Simultaneously, a fusion loss is introduced to ensure overall consistency. The total loss is... The formula is:
[0026] in, For high-frequency component loss, For low-frequency component loss, The fusion loss is calculated using the following formulas:
[0027]
[0028]
[0029] in, and They represent High-frequency components of the predicted and actual photovoltaic power generation at any given time. and They represent Low-frequency components of the predicted and actual photovoltaic power generation at any given time. express Real value of photovoltaic power generation at any time To predict the length of the photovoltaic power generation sequence, an end-to-end optimization is achieved through a hierarchical training strategy of "separate pre-training - freezing the backbone - fine-tuning the fusion layer" to obtain a pre-trained overall detection model.
[0030] The present invention discloses the following technical effects: This invention proposes a photovoltaic power prediction method based on a hybrid capsule neural network architecture. When preprocessing multi-source heterogeneous data from photovoltaic power plants, the mean absolute error of filling missing values using temporal attention interpolation is effectively reduced compared to traditional linear interpolation. The outlier identification accuracy of isolated forests can reach over 95%, effectively improving the quality of input data and laying a reliable foundation for subsequent feature extraction. The prediction model combines multi-scale capsule neural networks and causal inference Transformer structures. Multi-scale convolution and capsule neural network modules are used to achieve hierarchical capture of high- and low-frequency features. Combined with a bidirectional collaborative fusion mechanism, the fusion depth of spatial correlation features and temporal dynamic features is improved. In cloudy and abrupt change scenarios, the feature capture completeness of the photovoltaic power generation sequence is superior to that of a single Transformer model. The causal inference-based attention mechanism in the causal inference Transformer structure eliminates the interference of spurious correlation features, and the weight calibration accuracy is improved compared with the traditional attention mechanism, significantly reducing the prediction deviation of photovoltaic power in complex meteorological scenarios. When training the prediction model, a scenario-adaptive weight adjustment module is adopted to make the prediction accuracy of the model fluctuate less in different seasons and climate scenarios. When outputting the prediction value, a temporal manifold decoding mechanism is adopted, which has strong computational efficiency while ensuring prediction accuracy, and can meet the accuracy and real-time requirements of large-scale grid connection. Attached Figure Description
[0031] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings of the embodiments of the present invention will be briefly described below. Flowcharts are used in this application to illustrate the operations performed by the system according to the embodiments of the present application. It should be understood that the preceding or following operations are not necessarily performed precisely in sequence. Instead, various steps can be processed in reverse order or simultaneously as needed. Furthermore, other operations can be added to these processes, or one or more steps can be removed from these processes.
[0032] Figure 1 This is a flowchart illustrating a photovoltaic power prediction method based on a capsule neural network hybrid architecture, provided in an embodiment of this application. Detailed Implementation
[0033] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application.
[0034] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description of this application will be provided in conjunction with the accompanying drawings. The described embodiments should not be considered as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0035] In the following description, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those explicitly listed, but may include other steps or modules not explicitly listed or inherent to such processes, methods, products, or devices. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only.
[0036] This application provides a photovoltaic power prediction method based on a capsule neural network hybrid architecture, such as... Figure 1 As shown, the method includes: Step S10: Obtain multi-source heterogeneous data from the photovoltaic power station, including historical operation data and meteorological data. Preprocess the multi-source data to obtain standardized data.
[0037] Specifically, step S10 includes the following steps: Step S11: Collect photovoltaic power station operation data and meteorological data: Data collection needs to cover different climate conditions, different seasons and different time periods to ensure the diversity and representativeness of data samples, and lay the data foundation for improving the model's generalization ability. Since the operation data and meteorological data may come from different collection devices, there is a time synchronization deviation, which needs to be calibrated using a timestamp alignment algorithm. Step S12: Missing values in the multi-source data are filled using temporal attention interpolation, and the missing time step is calculated. Eigenvalues at 6 time steps before and after The cosine similarity, weighted filling formula is as follows:
[0038] in, Indicates the missing position The fill value, For time steps The original value, The value of is in the range of [-6, 6] and is not 0; For time steps and The similarity, taking into account time decay and differences in numerical features, is calculated using the following formula:
[0039] in, The time decay factor is set to 5 in this embodiment. This represents the numerical difference between two time steps. This represents the standard deviation of all values within the time step range [-6, 6]. Outlier handling employs the isolated forest algorithm. An isolated forest model is constructed using "meteorological characteristics - photovoltaic power generation" as input. An outlier score threshold is set based on the top 1% quantile in the photovoltaic power generation dataset. Samples identified as outliers are replaced using the median of a sliding window. The window size is dynamically adjusted according to the data sampling frequency. After replacement, the feature correlation between the replaced point and the adjacent normal point is checked, and its matching degree with the irradiance and temperature of the same period is verified. Step S13: Apply Z-score standardization to all multi-source heterogeneous data to make the mean 0 and the standard deviation 1. After standardization, calculate the mean and standard deviation of each feature to verify whether it meets the expected target. If the data of a certain feature exceeds the reasonable range after standardization, backtrack to check whether there are unprocessed outliers in the original data, or whether the standardization method is suitable for the distribution of the feature, and adjust the processing strategy in a timely manner.
[0040] Step S20: Construct a prediction model based on a hybrid architecture, extract spatial correlation features from standardized data through a multi-scale capsule neural network, and capture the high-frequency fluctuations and low-frequency trends of photovoltaic power sequences.
[0041] Specifically, step S20 includes the following steps: Step S21: Reconstruct the preprocessed multi-source heterogeneous data into a three-dimensional tensor of "feature-time step-channel", clarify the meaning and setting basis of each dimension. The feature dimension represents the different modal information of the multi-source data; the time step dimension represents the temporal length within the sample; and the channel dimension corresponds to the number of input multimodal features. Step S22: The scales of the three sets of one-dimensional convolutional kernels in the multi-scale capsule neural network (CapsNet) cover the main fluctuation periods of the photovoltaic power generation sequence. Three time-step small-scale kernels are used to capture high-frequency fluctuations in power caused by instantaneous cloud cover; five time-step mesoscale kernels are used to capture slow fluctuations in irradiance over a short period of time; and seven time-step large-scale kernels are used to capture the low-frequency trend of the overall change in power from low to high and then back to low within the day. The channel parameters of each convolutional kernel are kept consistent with the input feature dimension to ensure that each feature channel can extract local features through convolutional kernels of different scales; the stride of the convolutional operation is set to 1 to ensure that the output temporal length is consistent with the input and to avoid loss of temporal information. The scalar feature map output from the multi-scale convolution is compressed into a capsule vector using the Squash function. The vector length directly reflects the importance of the feature at the current time step: a length close to 1 indicates that the feature has a significant impact on power prediction, while a length close to 0 indicates that the feature has a weak impact. The calculation formula is as follows:
[0042] in, Indicates the first The activation vector of a primary capsule, For the first The inputs to each primary capsule are provided directly by the outputs of the multi-scale convolutional layers. for The L2 norm; the vector length is compressed to [0,1] using the above formula; In step S23, the high-level capsule layer learns the association weights between the primary capsule and the high-level capsule through dynamic routing. The weight matrix adopts the Xavier initialization method to ensure that the weight values after initialization are within a reasonable range, avoiding gradient explosion or vanishing in the early stage of training due to the initial weights being too large or too small. At the same time, regularization constraints are added to the linear layer mapping weight matrix from each primary capsule to the high-level capsule to prevent overfitting. The high-level capsule dynamic routing first calculates the prediction vector using the weight matrix:
[0043] in, For the first The first primary capsule for the first The prediction vector of a high-level capsule, For mapping primary capsules To high-rise capsules The weight matrix of the linear layer, , For high-level capsule dimensions, For the primary capsule dimension, the inputs to the higher-level capsules are obtained through weighted aggregation using coupling coefficients:
[0044] in, For the first The input and output of a high-level capsule, This refers to the number of primary capsules; Primary capsules With high-level capsules The coupling coefficient is obtained by normalization using the Softmax function:
[0045] in, and These represent primary capsules. With high-level capsules and high-level capsules The initial coupling coefficient, Indicates the quantity of advanced capsules; for The activation vector is obtained by applying the Squash function. Calculate the consistency score :
[0046] Update initial coupling coefficients ,in This represents the initial coupling coefficient after the update, and the coupling coefficient obtained after applying the final update after three iterations. The high-level capsule inputs are calculated, and the Squash function is further applied to obtain the high-level capsule output vector. ; Step S24: Reconstruct the high-level capsule vectors of dimension [number of primary capsules × dimension of high-level capsules] along the time dimension into a two-dimensional tensor of dimension [number of time steps × dimension of high-level capsules], thus obtaining the spatial correlation features output by the multi-scale CapsNet. The feature vector at each time step in this tensor encodes the spatial correlation pattern between environmental factors and photovoltaic power at the corresponding time.
[0047] Step S30: Attention calibration of spatial correlation features is performed by the causal inference Transformer in the prediction model, and temporal dynamic features are extracted by combining the causal graph and the local-global dual attention mechanism.
[0048] Specifically, step S30 includes the following steps: Step S31: The causal inference Transformer uses the multimodal features of the input meteorological data as nodes of the causal graph, calculates the causal effect value of each feature on photovoltaic power generation through the Do-Calculus algorithm, quantifies the strength of the causal relationship, screens the core power sequence features with a causal effect value ≥ 0.1, and removes pseudo-correlated features. Step S32: The core photovoltaic power generation sequence is split into an original sequence and a reconstructed sequence. The original sequence is used to capture fine-grained temporal fluctuations, and the reconstructed sequence is used to capture coarse-grained temporal trends. The combination of the two achieves multi-level capture of temporal characteristics. Original sequence Embedded features are obtained by mapping to a high-dimensional space through a linear layer. : ,in, and These represent the weight matrix and bias term of the linear layer, respectively; the reconstructed sequence The embedding vector is obtained through another linear layer mapping. : ,in and These represent the weight matrix and bias term of the linear layer, respectively. Step S33: The positional encoding and feature embedding are added and fused to obtain the dual-path input of the causal inference Transformer. Before fusion, it is ensured that the dimensions of the positional encoding and feature embedding are consistent. The positional encoding process is as follows: The original sequence position encoding combines the absolute time step with the intraday hourly period, as shown in the following formula:
[0049]
[0050] in, and They are time steps Location, dimension and Location code value, For dimension indexing; It is the Transformer embedding dimension. For time steps The number of hours corresponding to the location. It is a seasonal modulation factor, which can be set to [value] in spring and autumn. Summer radiation intensity fluctuates greatly, so location coding weights should be increased. In winter, the daylight hours are short, and the enhanced periodic characteristics can be set to... ; The reconstructed sequence position encoding combines the segment index with the cross-day week period, as shown in the following formula:
[0051]
[0052] in, and These are photovoltaic power reconfiguration sequence segments. Location, dimension and Location code value, Indicates the week number corresponding to the segment; Step S34: For the original sequence features and reconstructed sequence features after location encoding fusion, local attention and global attention are used respectively to extract fine-grained and coarse-grained fluctuation information of photovoltaic power time series: The local attention window covers the high-frequency fluctuations of the original sequence features, capturing short-term correlations between adjacent time steps. Multiple linear layers are applied to the original sequence to map and generate queries. ,key Sum Matrix, combined with window mask to calculate self-attention:
[0053] in, This indicates a multi-head self-attention mechanism. This represents the activation function. For the mask matrix, Represents the dimension of sequence features. This represents the matrix transpose operation; after the attention calculation process, it outputs local attention features. When generating the window mask matrix, only the correlation weights of short-term time steps within the window are retained, while the weights of time steps outside the window are set to negative infinity. The weights are close to 0, ensuring that local attention focuses only on the time steps within the window, avoiding invalid associations across windows; Global attention is used to process reconstructed sequence features. Each segment is treated as an attention unit, capturing long-range associations between different segments and generating a query, key, and value matrix. The weights are calculated using the self-attention calculation formula mentioned above combined with a temporal mask, and the global attention features are output. The global attention features are extended to the original sequence length through linear interpolation, and the interpolated features are... and Fusion yields the total attention feature. .
[0054] Step S35: The causal inference Transformer adopts a structure of "global-local attention + residual normalization + feedforward layer + residual normalization". Each layer introduces residual connections, directly adding the input to the output. The feedforward layer adopts the feature dimension transformation method with an inverted bottleneck and the activation function is the tanh function. The nonlinear expressive ability of the model is enhanced by expanding the dimension, and the number of parameters and computation are reduced by compressing the dimension. The expansion and compression factors are set to 4 and 1 / 4, respectively, to avoid excessive expansion that would cause a surge in model complexity.
[0055] Step S40: The extracted spatial correlation features and temporal dynamic features are sent to the bidirectional collaborative module for bidirectional feature interaction and deep fusion to obtain fused features, and a preliminary prediction is generated through temporal manifold decoding.
[0056] Specifically, step S40 includes the following steps: Step S41: Extract the feature attention vector from the spatial association features output by the multi-scale CapsNet. Compress the dimension of the spatial association features from two dimensions to one dimension through global average pooling to obtain the attention value at each time step. Multiply the feature attention vector with the local and global attention weights of the causal inference Transformer element by element to enhance the attention weights of high attention time steps and weaken the weights of low attention time steps, focusing on highly associated time segments and improving the accuracy of the attention mechanism. Temporal trend vectors are extracted from the temporal trend features output by the causal inference Transformer. Temporal average pooling is used to compress the features into a one-dimensional temporal trend vector, which is then input into the dynamic routing layer of the multi-scale CapsNet. The matching degree between the temporal trend and the association matrix of the primary capsule and the high-level capsule is calculated by vector dot product. The weights of the association matrix are adjusted according to the matching degree, with the weights of high matching degrees increasing and the weights of low matching degrees decreasing, thereby realizing the dynamic optimization of the association matrix and enhancing the synergy between spatial association features and temporal trend features. Step S42: The K-means algorithm is used to cluster the temporal features of the fused features into 8 key nodes. After clustering, the matching degree between each cluster center and the turning point of the actual photovoltaic power generation change is calculated, and the cluster centers with high matching degree are selected as key nodes. When constructing the manifold space based on the Isomap algorithm, the number of nearest neighbors is set to 10. The 8 discrete key nodes are used as anchor points of the manifold space. The continuous feature values between the anchor points are calculated by radial basis function (RBF) interpolation, and then input into a 1-layer LSTM (64 hidden units, tanh activation function) to decode into a preliminary prediction sequence with the same length as the input time step.
[0057] Step S50: Calculate the hybrid loss function based on the preliminary prediction and label information, and perform hierarchical training on the prediction model through the scene adaptive weight adjustment module to obtain the pre-trained prediction model with the best performance.
[0058] Specifically, step S50 includes the following steps: Step S51, the scene adaptive weight adjustment module, achieves scene classification based on feature association stability and temporal fluctuation frequency, and dynamically adjusts the fusion weights of the two models. The calculation formula is as follows:
[0059]
[0060] in, and These represent the real-time weights of the multi-scale CapsNet and the causal inference Transformer modules, respectively. Cloud cover correction factor This is the irradiance fluctuation correction factor; the final output of the prediction model is the predicted photovoltaic power generation value. Represented as:
[0061] in, and These represent the individual predictions from the multi-scale CapsNet and the causal inference Transformer modules, respectively. Step S52, design a hierarchical hybrid loss function: high-frequency components use L1 loss to enhance noise immunity, low-frequency components use L2 loss to stabilize trends, and a fusion loss is introduced to ensure overall consistency. The total loss is... The formula is:
[0062] in, For high-frequency component loss, For low-frequency component loss, The fusion loss is calculated using the following formulas:
[0063]
[0064]
[0065] in, and They represent High-frequency components of the predicted and actual photovoltaic power generation at any given time. and They represent Low-frequency components of the predicted and actual photovoltaic power generation at any given time. express Real value of photovoltaic power generation at any time To predict the length of photovoltaic power generation sequence, an end-to-end optimization is achieved through a hierarchical training strategy of "separate pre-training - freezing the backbone - fine-tuning the fusion layer".
[0066] Step S53: Train the prediction model using a hierarchical training mechanism to achieve end-to-end optimization. Train the multi-scale CapsNet and causal inference Transformer in the hybrid architecture separately for 50 iterations with a learning rate of 0.001. Freeze the backbone network parameters and train the collaborative fusion and weight adjustment module for 30 iterations with a learning rate of 0.0001. The optimizer is Adam, and an early stopping strategy is adopted. If the mean absolute error index of the validation set does not decrease for 5 consecutive iterations, the training stops. Save the optimal model parameters at this time as the pre-trained prediction model.
[0067] Step S60: Input the real-time collected multi-source photovoltaic power generation data into the pre-trained prediction model and output the point prediction and interval prediction results of photovoltaic power generation.
[0068] In this embodiment, a pre-trained prediction model is applied to process real-time collected multi-source photovoltaic power generation data and evaluate the prediction results. The specific steps are as follows: The pre-trained prediction model is integrated into the system to ensure that it can receive real-time data and output prediction results. The prediction results are compared with the actual power generation, and the prediction effect is evaluated using statistical indicators such as mean square error, mean absolute error, root mean square error, and mean absolute percentage error. Based on the evaluation results, the model is further optimized and adjusted to improve its performance in practical applications.
[0069] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application. In some cases, the actions or steps described in this application can be performed in a different order than that shown in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
Claims
1. A photovoltaic power prediction method based on a capsule neural network hybrid architecture, characterized in that, The method includes: (1) Obtain multi-source heterogeneous data of photovoltaic power stations, including historical operation data and meteorological data, and preprocess the multi-source data to obtain standardized data; (2) Construct a prediction model based on a hybrid architecture, and extract spatial correlation features from standardized data through a multi-scale capsule neural network to capture the high-frequency fluctuations and low-frequency trends of photovoltaic power sequences; (3) Attention calibration of spatial correlation features is performed by causal inference Transformer in the prediction model, and temporal dynamic features are extracted by combining causal graph and local-global dual attention mechanism; (4) The extracted spatial correlation features and temporal dynamic features are sent to the bidirectional collaborative module for bidirectional feature interaction and deep fusion to obtain fused features, and preliminary predictions are generated through temporal manifold decoding; (5) Calculate the hybrid loss function based on the preliminary prediction and label information, and perform hierarchical training on the prediction model through the scene adaptive weight adjustment module to obtain the best-performing pre-trained prediction model; (6) Input the real-time collected photovoltaic power generation multi-source data into the pre-trained prediction model and output the point prediction and interval prediction results of photovoltaic power generation.
2. The photovoltaic power prediction method based on a capsule neural network hybrid architecture as described in claim 1, characterized in that, In step (1), preprocessing includes timestamp calibration, missing value filling, outlier handling, and standardization.
3. The photovoltaic power prediction method based on a capsule neural network hybrid architecture as described in claim 2, characterized in that, The missing value imputation uses a temporal attention interpolation method, which is calculated based on the feature similarity of 6 time steps before and after the missing time step, so that the imputed value conforms to the temporal trend. The calculation formula is as follows: in, Indicates missing position The fill value, For time step The original value, The value of is in the range of [-6, 6] and is not 0; For time step and The similarity is calculated using the following formula: in, The time decay coefficient, This represents the numerical difference between two time steps. This represents the standard deviation of all values within the time step range [-6, 6].
4. The photovoltaic power prediction method based on a capsule neural network hybrid architecture as described in claim 1, characterized in that, In step (2), the hybrid architecture includes a multi-scale capsule neural network CapsNet and a causal inference Transformer. The multi-scale CapsNet uses three sets of one-dimensional convolutional kernels of different scales, with the scales designed to be 3, 5 and 7 time steps respectively, to extract local features of different time granularities in parallel, and comprehensively capture high-frequency fluctuations and low-frequency trends. By using vectorized encoding of primary capsules and dynamic routing mechanism of higher-level capsules, local features are aggregated into abstract spatial correlation features, and the vector length reflects the importance of the features.
5. The photovoltaic power prediction method based on a capsule neural network hybrid architecture as described in claim 4, characterized in that, The primary capsule vectorization encoding uses the Squash function to compress the scalar feature map output by convolution into capsule vectors, as shown in the formula: in, Indicates the first The activation vector of a primary capsule, For the first The inputs and, of the initial capsules, for The L2 norm; the above formula compresses the vector length to between [0,1], and the closer the length is to 1, the more significant the feature.
6. The photovoltaic power prediction method based on a capsule neural network hybrid architecture as described in claim 4, characterized in that, The high-level capsule dynamic routing first calculates the prediction vector using a weight matrix: in, Indicates the first The activation vector of a primary capsule, For the first The first primary capsule for the first The prediction vector of a high-level capsule, For mapping primary capsules To high-rise capsules The weight matrix of the linear layer, , For high-level capsule dimensions, For the primary capsule dimension, the inputs to the higher-level capsules are obtained through weighted aggregation using coupling coefficients: in, For the first The input and output of a high-level capsule, This refers to the number of primary capsules; Primary capsules With high-level capsules The coupling coefficient is calculated using the following formula: in, and These represent primary capsules. With high-level capsules and high-level capsules The initial coupling coefficient, Indicates the quantity of premium capsules.
7. The photovoltaic power prediction method based on a capsule neural network hybrid architecture as described in claim 1, characterized in that, In step (3), the causal inference Transformer first models the true causal relationship between meteorological data and photovoltaic power generation through causal graph modeling and filters core features; then it splits the core photovoltaic power generation sequence into the original sequence and the reconstructed sequence, injects position codes that combine intraday cycles and cross-day week cycles, calculates local attention and global attention, and captures the dynamic patterns of different granularities of time series features.
8. The photovoltaic power prediction method based on a capsule neural network hybrid architecture as described in claim 7, characterized in that, The positional encoding of the original sequence combines the absolute time step with the intraday hourly cycle: in, and They are time steps Dimension at location and Location code value, For dimension indexing; It is the Transformer embedding dimension. For time step The number of hours corresponding to the location. It is a seasonal modulation factor, set to [value] in spring and autumn. Summer radiation intensity fluctuates greatly, so location coding weights should be increased. Winter has short daylight hours, so the enhanced periodic characteristics are set as follows: ; The positional encoding of the reconstructed sequence combines the fragment index with the cross-day week period, as shown in the following formula: in, and These are photovoltaic power reconfiguration sequence segments. Dimension at location and Location code value, This indicates the week number corresponding to the segment.
9. The photovoltaic power prediction method based on a capsule neural network hybrid architecture as described in claim 1, characterized in that, In step (4), a bidirectional collaborative module of multi-scale CapsNet and causal inference Transformer is constructed. The spatial correlation features extracted by multi-scale CapsNet guide the attention of causal inference Transformer to focus on highly correlated temporal segments. At the same time, the temporal trend features of causal inference Transformer are used to optimize the correlation matrix of multi-scale CapsNet, so as to realize the deep interaction of spatial-temporal knowledge. The decoding stage employs a temporal manifold mapping mechanism, which anchors core features through key nodes and then achieves accurate mapping from discrete nodes to continuous temporal sequences based on manifold learning.
10. The photovoltaic power prediction method based on a capsule neural network hybrid architecture as described in claim 1, characterized in that, In step (5), the scene adaptive weight adjustment module classifies the scene based on feature association stability and temporal fluctuation frequency, and dynamically adjusts the fusion weight of the two models. The calculation formula is as follows: in, and These represent the real-time weights of the multi-scale CapsNet and the causal inference Transformer, respectively. Cloud cover correction factor This is the irradiance fluctuation correction factor; the final output of the prediction model is the predicted photovoltaic power generation value. Represented as: in, and These represent the individual predictions from the multi-scale CapsNet and the causal inference Transformer, respectively.