A method, system, equipment and medium for detecting abnormal output of a photovoltaic system
By constructing an RI-SNN model, combining a two-layer vectorized learnable spiking neuron and multi-scale temporal sensing attention, the problems of difficult multi-scale fault feature extraction and low training efficiency in existing photovoltaic anomaly detection are solved, realizing high-precision, real-time photovoltaic system output anomaly detection, which is suitable for online monitoring of photovoltaic power plants.
Patent Information
- Application Number
- CN202611584998.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-14
- Publication Date
- 2026-11-10
AI Technical Summary
Existing photovoltaic anomaly detection methods based on spiking neural networks suffer from difficulties in extracting multi-scale fault features, low training efficiency for long-term tasks, and forgetting of deep network features, making it difficult to meet the requirements of photovoltaic anomaly detection for high accuracy, real-time performance, and adaptability to multiple types of faults.
An improved residual spiking neural network (RI-SNN) model is adopted, which combines two-layer vectorized learnable spiking neurons, multi-scale temporal awareness attention and global residual skip connections to construct an RI-SNN model. Multi-scale local features and global temporal dependencies of photovoltaic systems are extracted through multi-scale convolution and self-attention mechanism, and anomaly detection is achieved through global residual skip connections and multilayer perceptron classifier.
It significantly improves the accuracy and efficiency of photovoltaic system output anomaly detection, can detect multiple types of faults in real time, reduces computing overhead, is suitable for online monitoring and early warning of photovoltaic power plants, and reduces operation and maintenance costs.
Smart Images

Figure CN123069128A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of industrial anomaly detection technology, and more specifically relates to a method, system, equipment and medium for detecting anomalies in photovoltaic system output. Background Technology
[0002] As a crucial component of renewable energy, photovoltaic (PV) power generation plays an increasingly vital role in the global energy structure transformation. With the continuous growth of PV installed capacity, the operational safety and stability of PV systems have attracted widespread attention. PV power plants are typically deployed in complex outdoor environments, making them susceptible to factors such as temperature variations, irradiance fluctuations, and shading. Furthermore, PV modules age and degrade over time, leading to various types of failures. These failures not only reduce power generation efficiency but can also trigger electrical safety accidents, posing a serious threat to the stable operation of the power grid. Therefore, developing efficient and accurate methods for detecting anomalies in PV systems has significant theoretical and engineering value.
[0003] Currently, mainstream automatic detection methods for photovoltaic (PV) anomalies include detection models driven by electrical time-series data and infrared thermal imaging detection technology driven by visual image data. While image-based anomaly detection algorithms can effectively identify physical defects at the component level, they require high-performance detection equipment, making them difficult to deploy and implement in large-scale PV power plants for real-time monitoring. Furthermore, they have limitations in handling multi-fault coupling and complex environmental conditions. With the development of artificial intelligence and neural network algorithms, time-series data-driven methods based on electrical parameters remain a research hotspot in the field of PV anomaly detection due to their advantages in real-time performance, automation, and low maintenance costs. Spiking neural networks (SNNs), as third-generation neural networks, have attracted widespread attention due to their event-driven characteristics and low power consumption, making them particularly suitable for deployment on edge computing devices for real-time monitoring. However, existing SNN models still have several shortcomings in PV anomaly detection applications, specifically in the following aspects: First, existing methods mostly employ shallow network structures and local unsupervised learning rules, resulting in weaker global optimization capabilities compared to end-to-end supervised learning based on backpropagation. Furthermore, increasing network depth or time step size to capture long-term temporal dependencies leads to a deeper computational graph and a significant decrease in training speed in traditional iterative neuron models. Second, existing methods primarily capture temporal dependencies implicitly through membrane potential decay and recurrent connections, lacking explicitly designed multi-scale feature extraction mechanisms, making it difficult to capture multi-scale anomaly patterns such as rapid transient faults and long-term degradation trends in photovoltaic systems in parallel. Third, shallow architectures limit their ability to represent complex faults. Attempting to increase network depth faces inherent gradient degradation problems in spiking neural networks and the easy loss of original features in deep networks. Existing technologies do not provide effective solutions to address the aforementioned difficulties in training deep networks.
[0004] In summary, existing photovoltaic anomaly detection methods based on spiking neural networks generally suffer from drawbacks such as difficulty in extracting multi-scale fault features, low training efficiency for long-term tasks, and forgetting of deep network features, making it difficult to simultaneously meet the requirements of photovoltaic anomaly detection for high accuracy, real-time performance, and adaptability to multiple types of faults. Summary of the Invention
[0005] To address the above problems, the present invention aims to provide a method, system, device, and medium for detecting abnormal output of photovoltaic systems. It combines bionics to design a residual improved spiking neural network model. Through the fusion architecture of two-layer vectorized learnable spiking neurons, multi-scale temporal sensing attention, and global residual jump connections, it significantly improves the detection accuracy of multiple types of faults and the applicability of edge deployment in complex operating environments.
[0006] To achieve the above objectives, the present invention employs the following technical solution: In a first aspect, embodiments of this application provide a method for detecting abnormal output of a photovoltaic system. The method employs an RI-SNN model constructed based on a residual improved spiking neural network. The RI-SNN model includes a two-layer vectorized learnable spiking neuron, a multi-scale temporal-aware attention module, and a global residual skip connection and MLP classifier module. The method includes the following steps: S1: Obtain multivariate raw operating data of the photovoltaic system, including DC voltage, irradiance and module temperature; construct various derived features based on the multivariate raw operating data; combine the multivariate raw operating data and derived features into a multidimensional feature vector, and after standardization, form the input sequence tensor. S2: Input the input sequence tensor into the first layer of the two-layer vectorized learnable spiking neurons, perform spatial linear mapping and pulse dynamics transformation based on learnable decay rate and learnable reset scale on the input sequence tensor to generate a pulse tensor; input the pulse tensor into the second layer of the two-layer vectorized learnable spiking neurons, perform spatial linear mapping and pulse dynamics transformation based on learnable decay rate and learnable reset scale on the pulse tensor to generate a membrane potential tensor; S3: Input the membrane potential tensor into the multi-scale convolutional branch of the multi-scale temporal awareness attention module; use the multi-scale convolutional branch to extract multi-scale local features through convolution operations at multiple different scales, and use an attention mechanism to dynamically weight and fuse the features at each scale to obtain multi-scale features; use the multi-head self-attention branch to extract the global temporal dependencies of the membrane potential tensor through a self-attention mechanism, and aggregate the time dimension to obtain global attention features; fuse the multi-scale features with the global attention features to obtain temporal features; S4: Input the input sequence tensor and temporal features into the global residual skip connection and MLP classifier module; perform aggregation operation on the input sequence tensor in the time dimension to obtain the overall statistical features, and map them into residual features through a linear projection layer; add the temporal features and residual features element by element to obtain the fused features; input the fused features into the multilayer perceptron classifier, and calculate the anomaly probability through the flexible maximum function; S5: Compare the abnormal probability with the preset optimal threshold; if the abnormal probability is greater than or equal to the optimal threshold, the current photovoltaic system output is determined to be abnormal; otherwise, it is determined to be normal.
[0007] In an optional implementation, step S1 includes: To obtain the DC voltage, irradiance, and module temperature of the photovoltaic system; Five derived characteristics were calculated based on DC voltage, irradiance, and component temperature, including voltage to irradiance ratio, voltage change rate, irradiance change rate, equivalent power, and temperature to irradiance ratio. Voltage to irradiance ratio The calculation formula is:
[0008] in, DC voltage Irradiance; The formula for calculating the rate of change of voltage ΔV is:
[0009] in, For the current time step DC voltage, This represents the DC voltage of the previous time step; Irradiance variation rate The calculation formula is:
[0010] in, For the current time step Irradiance, The irradiance at the previous time step; equivalent power The calculation formula is:
[0011] in, DC voltage Irradiance; Temperature to irradiance ratio The calculation formula is:
[0012] in, For component temperature, Irradiance; The DC voltage, irradiance, component temperature, and the five derived features are combined into an eight-dimensional feature vector, and Z-score normalization is used to normalize each feature vector. The standardized eight-dimensional feature vectors are arranged in chronological order to form a structure of length [length missing]. input sequence tensor ,in The number of time steps for the input sequence.
[0013] In an optional implementation, step S2 includes: The input sequence tensor The input is fed into the first layer of vectorized learnable spiking neurons, which then perform the following operations: Using formula Perform a one-time spatial linear mapping; where, , For batch size, The original feature dimension; For learnable weight matrix, For the hidden layer dimension; A learnable bias vector; At each time step According to the formula The membrane potential is updated according to a weighted average; where... For the first Membrane potential at time step To learn the membrane potential decay rate, Represents the Hadama product. For input tensors At time step Slices; Using differentiable substitution activation functions Calculate the pulse firing probability at the current time step, denoted as the output pulse intensity at the current time step; where, For the Sigmoid function, Set the firing threshold for neurons. It is a smoothing factor; An adaptive soft reset mechanism is adopted, based on the output pulse of the current time step. Update the membrane potential to prepare for the next time step; the specific formula is as follows:
[0014] in, It is a learnable reset scale vector; The output pulse obtained by calculating all time steps Stacked along the time dimension, they form the pulse tensor of the first layer's output, denoted as... ; The pulse tensor of the first layer output A Dropout regularization with a dropout rate of 0.3 is applied to randomly discard the spike outputs of some neurons to prevent the model from overfitting. The regularized pulse tensor As input, it is fed into the second layer of vectorized learnable spiking neurons to perform the following operations: Using formula Perform a one-time spatial linear mapping; where, This is the learnable weight matrix for the second layer. This is the learnable bias vector for the second layer; At each time step According to the formula The membrane potential is updated according to a weighted average; where... The learnable membrane potential decay rate of the second layer; Using differentiable substitution activation functions Calculate the pulse firing probability at the current time step: An adaptive soft reset mechanism is adopted, based on the pulse of the current time step. The membrane potential is updated via soft reset, using the following formula:
[0015] in, This is the learnable reset scale vector for the second layer; Membrane potential after soft reset of all time steps Stacked along the time dimension, they form the membrane potential tensor of the second layer output, denoted as . After applying Dropout regularization with a drop rate of 0.3, proceed to the next step.
[0016] In an optional implementation, step S3 includes: The regularized membrane potential tensor Simultaneously, the data is fed into parallel multi-scale convolutional branches and multi-head self-attention branches: The following processing flow is executed through multi-scale convolutional branches: One-dimensional depthwise convolutions with four different kernel sizes are used in parallel to extract multi-scale local features. The set of kernel sizes is as follows: For each convolution kernel size The extracted feature maps are sequentially activated by ReLU and then subjected to global average pooling to obtain feature vectors at various scales:
[0017] in, Let the membrane potential tensor be... This represents the membrane potential tensor. Maintain batch dimension Unchanged, time dimension With feature dimension The tensor after axis swapping is transformed into the following shape: ; For depthwise convolution, the number of groups is equal to ; For global average pooling; The four scale feature vectors are concatenated along the feature dimensions and then sequentially fed into the attention scoring network: first through a fully connected layer. After ReLU activation, it passes through a Dropout layer (dropout probability 0.1), and then through a fully connected layer. Finally, the dynamic weights for each scale are obtained by Softmax normalization. The specific formula is as follows:
[0018] The multi-scale features are obtained by summing the features at each scale according to dynamic weights using the following formula. :
[0019] The following processing flow is executed through a multi-head self-attention branch: The membrane potential tensor As the query, key, and value inputs, a multi-head self-attention module is used to obtain the attention-weighted feature tensor. :
[0020] Use the following formula for the feature tensor Global attention features are obtained by performing average pooling over the time dimension. :
[0021] in, This indicates that the attention output tensor is at a fixed time step. Slices; Using formula Calculate the time series characteristics .
[0022] In an optional implementation, step S4 includes: The input sequence tensor is expressed by the following formula. Mean pooling is performed along the time dimension to obtain the overall statistical features, which are then mapped to residual features through a learnable linear projection layer. :
[0023] in, The learnable weight matrix has dimensions of . ; Fixed time steps for the input sequence tensor Slices; A learnable bias vector; The time series features With the residual features Element-by-element addition yields the fusion feature :
[0024] The fused features are input into a multilayer perceptron classifier, which contains two fully connected layers. The first layer transforms the input into a 64-dimensional hidden representation and applies a ReLU activation function and a Dropout regularization with a dropout rate of 0.15. The second layer maps the hidden representation into a two-dimensional vector. The anomaly probability is calculated using the following Softmax function. :
[0025] in, and These are the unnormalized scores for the normal class and the abnormal class, respectively.
[0026] In one optional implementation, the process of presetting the optimal threshold is as follows: The preset validation set is input into the RI-SNN model to calculate the anomaly probability corresponding to each validation set sample, denoted as the i-th. The probability of anomalies in each validation set sample is ; Within the threshold search range of 0.2 to 0.8, multiple candidate thresholds are set with a step size of 0.05; for each candidate threshold, the anomaly probability of the validation set samples is calculated. Compare with the candidate threshold: If If the value is greater than or equal to the candidate threshold, it is predicted as an abnormal class; otherwise, it is predicted as a normal class. The corresponding F1 score is calculated based on the prediction result and the true label. Select the candidate threshold that maximizes the F1 score as the optimal threshold; When multiple candidate thresholds achieve the same maximum F1 score, the smallest threshold with the highest recall rate is selected as the optimal threshold.
[0027] In one optional implementation, the training process of the RI-SNN model is as follows: Using the focus loss function As the optimization objective; among which The total number of samples, This represents the true category of the sample and takes the value of either the normal class or the abnormal class. Category weight factor when it is an exception class When the true category When it is a normal class , For the model to predict the first Each sample belongs to the true category. The probability, The modulation coefficient; The gradient vector of all parameters is obtained through backpropagation. Then, perform gradient norm clipping. ,in Gradient vector The Euclidean norm, This is the clipping threshold; A hierarchical differentiated learning rate strategy is adopted to incorporate the learnable membrane potential decay rate from the pulse dynamics parameters. and learnable reset scale vector The learning rate is set to The learning rate for other parameters is set to The initial learning rate Stratified attenuation factor ; Employing a preheated cosine annealing learning rate scheduling strategy, the learning rate for the impulse dynamics parameter is set from [value missing] in the first 10 training epochs. linear growth to For other parameters, the learning rate is from linear growth to After this, the learning rate for all parameters decays according to a cosine function to 0. ; The AdamW optimizer is used to update the model parameters based on the current learning rate in each training epoch, and the pulse dynamics parameter is set to the weight decay coefficient. Set the weight decay coefficient of other parameters to .
[0028] Secondly, embodiments of this application also provide a photovoltaic system output anomaly detection system, including: The input sequence construction module is used to obtain multivariate raw operating data of the photovoltaic system, including DC voltage, irradiance and module temperature; construct various derived features based on the multivariate raw operating data; combine the multivariate raw operating data and derived features into a multidimensional feature vector, and after standardization, form the input sequence tensor. The pulse feature extraction module is used to input the input sequence tensor into the first layer of the two-layer vectorized learnable spiking neurons, perform spatial linear mapping and pulse dynamics transformation based on learnable decay rate and learnable reset scale on the input sequence tensor to generate a pulse tensor; and input the pulse tensor into the second layer of the two-layer vectorized learnable spiking neurons, perform spatial linear mapping and pulse dynamics transformation based on learnable decay rate and learnable reset scale on the pulse tensor to generate a membrane potential tensor. The temporal feature enhancement module is used to input the membrane potential tensor into the multi-scale convolutional branch of the multi-scale temporal awareness attention module. The multi-scale convolutional branch extracts multi-scale local features through convolution operations at multiple different scales, and uses an attention mechanism to dynamically weight and fuse these features to obtain multi-scale features. A multi-head self-attention branch extracts the global temporal dependencies of the membrane potential tensor through a self-attention mechanism, and aggregates the temporal dimension to obtain global attention features. Finally, the multi-scale features are fused with the global attention features to obtain the temporal features. The residual fusion classification module is used to input the input sequence tensor and temporal features into the global residual skip connection and MLP classifier module; it performs aggregation operation on the input sequence tensor in the time dimension to obtain the overall statistical features, and maps them to residual features through a linear projection layer; it adds the temporal features and residual features element by element to obtain the fused features; it inputs the fused features into the multilayer perceptron classifier, and calculates the anomaly probability through a flexible maximum function; The anomaly detection module is used to compare the anomaly probability with a preset optimal threshold; if the anomaly probability is greater than or equal to the optimal threshold, the current photovoltaic system output is determined to be abnormal; otherwise, it is determined to be normal.
[0029] Thirdly, embodiments of this application also provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the photovoltaic system output anomaly detection method as described in any of the above.
[0030] Fourthly, embodiments of this application also provide a storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the photovoltaic system output anomaly detection method as described in any of the above claims.
[0031] As can be seen from the above technical solutions, the present invention has the following advantages: The core of the photovoltaic system output anomaly detection method provided in this application lies in constructing a Residual Improved Spike Neural Network (RI-SNN) model. This model includes a two-layer Vectorized Learnable Spike Neuron (V-LIF), a Multi-Scale Temporal Aware Attention Module (MS-PTA), a global residual skip connection, and an MLP classifier module. First, the method transforms the input photovoltaic time-series data into spike features through the two-layer V-LIF module, decoupling temporal dynamics and spatial mapping using a one-time spatial linear mapping, significantly reducing the computational burden of time-step iteration in traditional spiking neural networks. Then, the multi-scale convolutional branch and multi-head self-attention branch in the MS-PTA module extract and fuse local features and global temporal dependencies at different time scales in parallel, achieving a joint representation of rapid transient faults and long-term degradation trends. Finally, the global residual skip connection directly transmits the overall statistical features of the original input to the classifier, fusing them with the time-series features after deep mining, effectively avoiding feature loss and gradient degradation in deep networks. Therefore, this application simultaneously solves three major technical problems of low training efficiency, insufficient multi-scale fault characterization capability, and difficulty in training deep networks in the prior art. It achieves high-precision, high-efficiency, end-to-end real-time detection of abnormal output of photovoltaic systems, and has good class imbalance handling capability and low computational overhead advantages, making it suitable for online monitoring and early warning of photovoltaic power plants.
[0032] The V-LIF neuron proposed in this application decouples spatiotemporal features through vectorized computation, achieving one-time parallel mapping of the entire sequence, resulting in training efficiency far exceeding that of the time-step iterative LIF model in VSNN. More importantly, V-LIF introduces learnable membrane potential decay rate and reset scale, and combines backpropagation for end-to-end supervised learning. While preserving biological interpretability, it significantly improves the training efficiency and representation ability of spiking neural networks in long-term tasks. Compared to the local, unsupervised STDP rule used by VSNN, it has stronger fitting ability and detection accuracy for complex tasks such as detecting various photovoltaic faults.
[0033] This application's original MS-PTA module extracts local temporal features at different time scales, including transient, gradual, and long-term degradation, through multiple sets of deep convolutions with different receptive fields. Simultaneously, it achieves dynamic fusion of multi-scale features through adaptive weight learning and captures global long-range features using a multi-head self-attention mechanism. This solves the problem of traditional models' inability to adapt to the diverse fault characteristics in photovoltaic data, significantly improving the ability to capture weak anomalies. In contrast, VSNN relies solely on the internal dynamics of neurons to implicitly capture temporal dependencies, making it significantly insufficient in handling the complex multi-scale anomaly patterns of photovoltaic systems.
[0034] This application addresses the pain points of traditional deep SNNs, such as gradient degradation, poor end-to-end training stability, and easy loss of weak industrial anomalies. It constructs a lightweight two-layer V-LIF backbone architecture and integrates a global residual skip connection complementary mechanism to alleviate gradient degradation and achieve end-to-end reuse of original effective features. Coupled with training optimization using a focus loss function, gradient pruning, and hierarchical differentiated learning rate strategies, it significantly improves the training stability, convergence efficiency, and weak anomaly detection capability of spiking networks. VSNN, as a shallow network, neither addresses nor provides solutions to these problems.
[0035] The RI-SNN model of this application achieves higher detection accuracy and lower false alarm rate than VSNN while maintaining the low power consumption characteristics of SNN. The model not only outputs probabilities but also includes an adaptive optimal decision threshold search module. This has significant practical implications for reducing unnecessary on-site inspections by photovoltaic power plant maintenance personnel and saving maintenance costs. Furthermore, the total number of parameters in the RI-SNN model of this invention has an order-of-magnitude advantage compared to mainstream deep learning models. The lightweight architecture not only reduces the model's storage overhead but also reduces the computational load during inference, allowing it to run directly on existing edge gateways or embedded controllers in photovoltaic power plants without relying on high-performance servers, effectively reducing system deployment and maintenance costs. Attached Figure Description
[0036] To more clearly illustrate the technical solution of the present invention, the accompanying drawings used in the description will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0037] Figure 1 This is a schematic diagram of the overall architecture of the RI-SNN model provided in this application.
[0038] Figure 2 A flowchart illustrating the photovoltaic system output anomaly detection method provided in this application.
[0039] Figure 3 A schematic diagram of the structure of the two-layer vectorized learnable spiking neuron provided in this application.
[0040] Figure 4 A schematic diagram of the structure of the multi-scale temporal awareness attention module provided in this application.
[0041] Figure 5 A schematic diagram of the photovoltaic system output anomaly detection system provided in this application.
[0042] Figure 6 A schematic diagram of the structure of the electronic device provided in this application. Detailed Implementation
[0043] The various embodiments of this disclosure will be described more fully in the detailed steps of the photovoltaic system output anomaly detection method described below. This disclosure may have various embodiments, and adjustments and changes may be made therein. However, it should be understood that there is no intention to limit the various embodiments of this disclosure to the specific embodiments disclosed herein, but rather this disclosure should be understood to cover all adjustments, equivalents, and / or alternatives falling within the spirit and scope of the various embodiments of this disclosure.
[0044] In the following, the terms “comprising” or “may include”, which may be used in various embodiments of this disclosure, indicate the presence of the disclosed functions, operations, or elements, and do not limit the addition of one or more functions, operations, or elements. Furthermore, as used in various embodiments of this disclosure, the terms “comprising,” “having,” and their cognates are intended only to indicate a particular feature, number, step, operation, element, component, or combination of the foregoing, and should not be construed as primarily excluding the presence of one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing, or the possibility of adding one or more combinations of the foregoing.
[0045] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0046] This embodiment discloses a method for detecting power output anomalies in photovoltaic systems. Addressing the difficulties in extracting multi-scale fault features in photovoltaic systems and the low training efficiency of traditional spiking neural networks (SNNs) in long-term tasks, this method employs an RI-SNN model based on a residual improved spiking neural network, such as... Figure 1 As shown, the RI-SNN model mainly consists of three core modules: a two-layer vectorized learnable spiking neuron (V-LIF), a multi-scale temporal-aware attention module (MS-PTA), and a global residual skip connection and MLP classifier module.
[0047] During the model's operation, the input multivariate original photovoltaic time series is first processed by a lightweight two-layer V-LIF module to extract pulse features. Subsequently, the output membrane potential sequence is input into the MS-PTA module, which captures fault modes in different time dimensions through multi-scale convolution and multi-head self-attention mechanisms, outputting the deep-mined time series features. Finally, the original input photovoltaic time series features are fused with the deep-mined time series features via a global residual jump connection and input into an MLP classifier, ultimately outputting the photovoltaic power output anomaly detection probability.
[0048] Based on the above RI-SNN model, such as Figure 2 The photovoltaic system output anomaly detection method disclosed in this embodiment specifically includes the following steps: S1: Obtain multivariate raw operating data of the photovoltaic system, including DC voltage, irradiance and module temperature; construct various derived features based on the multivariate raw operating data; combine the multivariate raw operating data and derived features into a multidimensional feature vector, and after standardization, form the input sequence tensor.
[0049] In this specific implementation, multivariate raw operating data is first acquired from the photovoltaic power station data acquisition and monitoring system. The data acquisition frequency is once every 5 minutes, and the acquired raw variables include DC voltage. Irradiance and component temperature To improve the model's ability to represent abnormal states, this embodiment constructs five types of derived features based on the original variables mentioned above, as follows: The first type of derived characteristic is the voltage-to-irradiance ratio, which is calculated using the following formula:
[0050] Among them, in the denominator To smooth out the terms and prevent division by zero. This feature reflects the instantaneous load characteristics of the photovoltaic array; its ratio increases under low light conditions, effectively amplifying anomalous features.
[0051] The second type of derived characteristic is the rate of voltage change, calculated using the following formula:
[0052] in This indicates the current time step. The voltage change rate is used to capture dynamic voltage fluctuations and is sensitive to rapid transient faults.
[0053] The third type of derived characteristic is the rate of change of irradiance, calculated using the following formula:
[0054] Irradiance variation rate can help identify anomalies caused by sudden environmental changes.
[0055] The fourth type of derived characteristic is equivalent power, calculated using the following formula:
[0056] This feature characterizes the real-time output of the photovoltaic string; under fault conditions, the equivalent power output often deviates from the normal range.
[0057] The fifth derivative characteristic is the ratio of temperature to irradiance, calculated using the following formula:
[0058] The temperature-to-irradiance ratio is used to describe the coupling relationship between component temperature and irradiance. This ratio changes significantly during abnormal temperature rises or sudden irradiance changes.
[0059] The three original variables and five derived features are combined to form an eight-dimensional feature vector. Due to the significant differences in the dimensions of the physical quantities, this embodiment uses Z-score standardization to process each feature dimension independently. The standardization formula is:
[0060] in These are the original eigenvalues. and These are the mean and standard deviation of the feature on the training set, respectively. The validation and test sets undergo the same transformation using the statistics from the training set to ensure consistent data distribution. After standardization, the continuous values are arranged in chronological order. The feature vectors from each time step are concatenated to form a sample, creating the input sequence tensor. .
[0061] S2: Input the input sequence tensor into the first layer of the two-layer vectorized learnable spiking neurons. Perform spatial linear mapping and pulse dynamics transformation based on learnable decay rate and learnable reset scale on the input sequence tensor to generate a pulse tensor. Apply Dropout regularization to the pulse tensor and input it into the second layer of the two-layer vectorized learnable spiking neurons. Perform spatial linear mapping and pulse dynamics transformation based on learnable decay rate and learnable reset scale on the pulse tensor to generate a membrane potential tensor and apply Dropout regularization.
[0062] In this specific implementation, this step transforms the input sequence tensor into a membrane potential tensor through two layers of vectorized learnable spiking neurons. The specific process is as follows: First, the first layer of V-LIF processing is performed. This embodiment will use a dimension of... input sequence tensor The input is fed into the first layer of V-LIF neurons. Unlike traditional LIF neurons that repeatedly perform linear transformations at each time step, this embodiment employs a vectorized design: outside the time step loop, a spatial linear mapping is completed through a single matrix multiplication, i.e., the following calculation is performed:
[0063] in, The learnable weight matrix has dimensions of . , In this embodiment, it is set to ; Let be a learnable bias vector with dimension . This operation allows all time steps to share the same linear transformation parameters, significantly reducing the computational load.
[0064] Subsequently, at each time step The membrane potential is updated using a weighted average method. The formula is:
[0065] in For the first The membrane potential vector at the time step, For learnable decay rate vectors, This represents the Hadama product. Constrained by the Sigmoid function arrive Between, the initial value is set to This update equation reflects a smooth integration of historical information with the current input, preventing gradient explosion over long time series.
[0066] In obtaining Then, the pulse firing probability is calculated using a differentiable substitution activation function, as shown in the formula:
[0067] in For the Sigmoid function, The threshold for issuance, As a smoothing factor, in this embodiment The typical value is 0.5. A typical value for is 10. The derivative of this activation function, acting as a substitute gradient, enables the originally non-differentiable pulse firing process to backpropagate.
[0068] To further optimize pulse dynamics, this embodiment employs an adaptive soft-reset mechanism. After pulse delivery, the membrane potential is adjusted according to... Learnable reset scale vector And updates are performed on portions exceeding the threshold, using the following formula:
[0069] Each component is initialized to It adaptively adjusts during training. Compared to traditional hard reset, this mechanism retains some over-threshold information, enhancing the model's representational ability.
[0070] After completing the loop for all time steps, output pulses for each time step are... Stacked along the time dimension, forming the pulse tensor of the first layer output. , dimension .
[0071] The pulse tensor of the first layer output A Dropout regularization with a dropout rate of 0.3 is applied to randomly discard the spike outputs of some neurons to prevent the model from overfitting. Furthermore, the second layer V-LIF is regularized. As input, perform the same operations as in the first layer.
[0072] First, perform a one-time linear mapping:
[0073] in Dimensions , In this embodiment, it is set to ; Dimensions Then loop through each time step, following... Update membrane potential, where Initial value set to Using the formula Calculate the pulse firing probability and use the formula Perform a soft reset.
[0074] Unlike the first layer, the second layer does not ultimately output pulse stacking, but instead outputs the membrane potential after soft reset at each time step. The membrane potential tensor formed by time stacking , dimension The membrane potential tensor retains rich temporal dynamic information, and after applying Dropout regularization with a dropout rate of 0.3, it is available for further processing by subsequent modules.
[0075] S3: Input the regularized membrane potential tensor into the multi-scale convolution branch of the multi-scale temporal awareness attention module; use the multi-scale convolution branch to extract multi-scale local features through multiple convolution operations at different scales, and use an attention mechanism to dynamically weight and fuse the features at each scale to obtain multi-scale features; use the multi-head self-attention branch to extract the global temporal dependency of the membrane potential tensor through a self-attention mechanism, and aggregate the time dimension to obtain global attention features; fuse the multi-scale features with the global attention features to obtain temporal features.
[0076] In a specific implementation, this step utilizes a multi-scale temporal-aware attention module (MS-PTA) to analyze the membrane potential tensor. Perform deep feature enhancement.
[0077] First, Simultaneously, two parallel branches are fed in: a multi-scale convolution branch and a multi-head self-attention branch.
[0078] The design goal of multi-scale convolutional branches is to extract local fault modes at different time scales. This embodiment uses one-dimensional depthwise convolution with four kernel sizes: The specific steps are as follows: First, put Transposing the time dimension and feature dimension yields a shape of tensor Then for each core size Perform depthwise convolution The number of groups equals Each convolutional kernel operates on only a single feature channel. After convolution, a ReLU activation function is applied, followed by global average pooling (GAP) to average the values over time, yielding feature vectors at each scale. Dimensions The four feature vectors are concatenated along their feature dimensions to obtain... The vector.
[0079] Next, the concatenated vector is fed into the attention scoring network. The network contains a first fully connected layer. ReLU activation, Dropout layer, second fully connected layer Finally, the dynamic weights for each scale are obtained by Softmax normalization. The formula is:
[0080] This process satisfies and These weights reflect the degree to which the current input sample depends on different time scales. Ultimately, the multi-scale features are:
[0081] The dimension of multi-scale features is This feature preserves multi-scale information and achieves adaptive fusion through dynamic weights.
[0082] Parallel-running multi-head self-attention branches are used to capture global temporal dependencies. This embodiment uses the membrane potential tensor... The multi-head self-attention module is directly used as the query, key, and value input, i.e.:
[0083] Among them, the number of long positions is set to The dimensions of each head are Self-attention mechanisms can model the dependencies between any two time steps, compensating for the limited receptive field of convolution operations. Output tensor The dimension is the same as the input, which is... .
[0084] Subsequently, average pooling is performed along the time dimension to obtain global attention features:
[0085] in This indicates that the attention output tensor is at a fixed time step. The slice, with dimensions of This feature compresses global long-range dependency information.
[0086] Finally, the multi-scale features are added to the global attention features to obtain the temporal features:
[0087] The dimension of time series features is This fusion feature simultaneously incorporates local multi-scale patterns and global temporal correlations, providing rich discriminative information for subsequent classification.
[0088] S4: Input the input sequence tensor and temporal features into the global residual skip connection and MLP classifier module; perform aggregation operation on the input sequence tensor in the time dimension to obtain the overall statistical features, and map them into residual features through a linear projection layer; add the temporal features and residual features element by element to obtain the fused features; input the fused features into the multilayer perceptron classifier, and calculate the anomaly probability through the flexible maximum function.
[0089] In a specific implementation, this step completes the final feature fusion and anomaly probability calculation through global residual skip connections and an MLP classifier.
[0090] First, construct the residual path: for the original input sequence tensor... Mean pooling is performed along the time dimension to obtain overall statistical features. This operation extracts global electrical statistics of the sequence, such as average voltage and average irradiance. These are then mapped to the hidden space through a learnable linear projection layer to obtain residual features.
[0091] in The learnable weight matrix has dimensions of . , Fixed time steps for the input sequence tensor slices, This is a learnable bias vector. Residual features. The dimension is , and time series characteristics The dimensions are consistent.
[0092] Furthermore, the time series characteristics With residual characteristics By adding elements one by one, we obtain the fusion feature:
[0093] This operation directly injects the core statistical information of the original input into the classification decision layer, avoiding feature forgetting in deep pulse coding, and also provides a shortcut for gradient propagation across layers, alleviating the gradient degradation problem.
[0094] Subsequently, the fused features are input into the MLP classifier. The classifier in this embodiment contains two fully connected layers. The first layer will... (dimension) ) mapped to The dimensional hidden representation is applied, and a ReLU activation function and a dropout rate are applied. Dropout regularization is used to prevent overfitting. The second layer will... 3D hidden representation is mapped to a 2D vector These correspond to the unnormalized scores (log odds) of the normal and abnormal classes, respectively. Finally, the Softmax function is used to... Convert to anomaly probability:
[0095] The probability value is between arrive The value between 1 and 2 indicates the confidence level that the current sample belongs to the anomaly class.
[0096] S5: Compare the abnormal probability with the preset optimal threshold; if the abnormal probability is greater than or equal to the optimal threshold, the current photovoltaic system output is determined to be abnormal; otherwise, it is determined to be normal.
[0097] In this specific implementation, this step utilizes a pre-determined optimal threshold for anomaly detection. The process for obtaining the optimal threshold is as follows: First, input the validation set samples into the trained RI-SNN model, and calculate the anomaly probability of each sample according to steps S1 to S4. , Representing the The probability of each sample. The validation set in this embodiment includes... There are [number] samples, of which the ratio of normal samples to abnormal samples is approximately [percentage]. .
[0098] Then, within the threshold search range Inside, with Set step size There are 10 candidate thresholds. For each candidate threshold... The anomaly probability of the validation set samples and Comparison: If If the result is positive, the sample is predicted as an anomaly; otherwise, it is predicted as a normal sample. The F1 score for each candidate threshold is calculated based on the prediction results and the true label. The candidate threshold that maximizes the F1 score on the validation set is selected as the optimal threshold. If multiple candidate thresholds achieve the same maximum F1 score, the threshold with the highest recall is selected as the optimal threshold to prioritize the capture of anomaly samples.
[0099] In the actual testing phase, for the photovoltaic time series sample to be tested, steps S1 to S4 are executed sequentially to obtain the anomaly probability. Then With the optimal threshold Comparison: If If the output of the photovoltaic system is abnormal, it is determined to be normal; otherwise, it is determined to be normal.
[0100] In this embodiment, firstly, a two-layer vectorized learnable spiking neuron is used to perform a one-time spatial linear mapping of the input sequence tensor, avoiding the training and inference efficiency bottleneck caused by the iterative calculation step-by-step in traditional spiking neural networks. Secondly, the multi-scale convolutional branch and multi-head self-attention branch in the multi-scale temporal awareness attention module are used in parallel to extract and dynamically fuse local multi-scale features and global temporal dependencies, enabling the model to simultaneously and keenly capture rapid transient faults and long-term degradation trends. Thirdly, the overall statistical features of the original input are directly fused with the time-series features after deep mining through global residual skip connections, effectively solving the problems of feature forgetting and gradient degradation in deep spiking networks. Finally, the anomaly probability is binarized based on the optimal threshold determined by validation set search, achieving high-precision detection without complex post-processing. Therefore, this method achieves a comprehensive advantage in photovoltaic system output anomaly detection, including high detection accuracy, high training and inference efficiency, strong adaptability to multi-scale faults, and good model stability, making it fully applicable to real-time online monitoring scenarios of photovoltaic power plants.
[0101] In one embodiment of the present invention, before the RI-SNN model is put into actual detection, it needs to be trained end-to-end using labeled historical data. The specific training process is as follows: First, a training dataset is constructed. Time-series samples containing normal and abnormal states are collected from historical operating data of photovoltaic power plants. Each sample is processed in step S1 to obtain the input sequence tensor. and label the corresponding real category. ( This indicates that it is normal. (Indicating anomalies). Since the proportion of anomalous samples in photovoltaic systems is relatively low, this embodiment employs a class-imbalanced sampling strategy to ensure that the ratio of normal samples to anomalous samples in each training batch is approximately [missing information]. .
[0102] This embodiment uses a focus loss function as the optimization objective to alleviate class imbalance and focus on difficult-to-classify outlier samples. The formula for calculating the focus loss function is:
[0103] in This represents the total number of samples in the current batch. (Parameter) This represents the true class of the sample. When the true class is an outlier, the class weight factor... Set as When the true category is the normal category, Set as This value makes the model pay more attention to rare but important outlier samples. For the model to predict the first Each sample belongs to the true category. The probability is given by the Softmax result output in step S4. The modulation coefficient is set to [value] in this embodiment. This is used to reduce the loss contribution of easily classified samples, making the training process more focused on those difficult-to-classify samples with lower prediction probabilities.
[0104] During training, all training batches are processed sequentially in each training epoch. For each batch, forward computation steps S1 to S4 are performed sequentially to obtain the anomaly probability of each sample and calculate the focus loss. Then, the gradient of the loss function with respect to all learnable parameters is calculated through backpropagation, yielding the gradient vector. To stabilize training and prevent gradient explosion, this embodiment performs gradient norm clipping, with the following formula:
[0105] in Gradient vector The Euclidean norm, Set the cropping threshold to [value]. This operation restricts the gradient norm to [value missing]. Within a certain range, avoid excessively large step sizes for single-step updates.
[0106] This embodiment employs a hierarchical differentiated learning rate strategy, setting different learning rates for different parameter groups. Specifically, the learning rate is set for the pulse dynamics parameter (i.e., the learnable membrane potential decay rate in each V-LIF layer). and learnable reset scale vector The learning rate is set to ,in Let the initial learning rate be set to 1. , Let the stratified attenuation factor be set to 1. Therefore Other parameters (including the weight matrix of the spatial linear mapping) Bias Attention scoring network parameters in the MS-PTA module The projection matrix of the residual connection and bias The learning rate of (and the fully connected layer parameters of the MLP classifier) is set to This differentiated setting stems from the fact that V-LIF dynamic parameters are highly sensitive to the learning step size. A smaller learning rate ensures a smooth evolution of pulse firing behavior and avoids violent oscillations in membrane potential updates.
[0107] This embodiment uses the AdamW optimizer for parameter updates and applies different weight decay coefficients to different parameter groups. For the pulse dynamics parameters ( and Set the weight decay coefficient to To enhance the regularization effect and prevent overfitting; the weight decay coefficient for other parameters is set to [value missing]. This prevents overfitting while preserving sufficient model expressive power.
[0108] The learning rate scheduling employs a pre-warmed cosine annealing strategy, which applies to all parameter sets. In the preceding... In each training round, a warm-up phase is performed: for the pulse dynamics parameters, the learning rate is from... linear growth to For other parameters, the learning rate is from... linear growth to The warm-up phase helps stabilize the initial training and avoids excessively large gradient updates in the early stages. After the warm-up, the learning rate decays according to a cosine function:
[0109] in The preset learning rate for each parameter group (pulse dynamics parameter is...) Other parameters are ), Set as After about After several rounds of cosine decay, the learning rate gradually decreases to near... .
[0110] After each training epoch, the model's F1 score is evaluated on the validation set. This embodiment employs an early stopping mechanism: if the validation set F1 score is continuously... If no improvement is achieved after a certain number of rounds, training is terminated early, and the optimal model parameters are saved. After training is complete, the optimal threshold is searched on the validation set using the method described in step S5. This is used for subsequent anomaly detection decisions.
[0111] Through the above training process, the RI-SNN model can learn the nonlinear mapping from photovoltaic time series data to anomaly probability end-to-end. At the same time, it overcomes the problems of low training efficiency, insufficient multi-scale feature representation, and gradient degradation of deep networks in traditional spiking neural networks, and finally achieves high-precision photovoltaic power output anomaly detection.
[0112] Furthermore, as a refinement and extension of the specific implementation of the above embodiments, in order to fully illustrate the specific implementation process of this embodiment, another photovoltaic system output anomaly detection method based on residual improved spiking neural network is provided, the specific process of which is as follows: 1. Data preprocessing and feature engineering: This step aims to provide the model with physically meaningful input features. For the collected raw photovoltaic operating data (including at least voltage, irradiance, module temperature, etc.), in addition to directly using the raw values, five types of derived features, including but not limited to those shown in Table 1 below, are constructed to enhance the ability to characterize faults: voltage to irradiance ratio, voltage change rate, irradiance change rate, equivalent power, and temperature to irradiance ratio, etc.
[0113] Table 1: Description of Derivative Features
[0114] The aforementioned derived features, along with the DC voltage, irradiance, and module temperature characteristics of the photovoltaic string, constitute an eight-dimensional feature set, serving as the feature dimension of the model input tensor. Due to the significant differences in the dimensions of these physical quantities, to accelerate model convergence and prevent bias caused by uneven feature scales, all dimensional features, including both original and constructed features, are first standardized using Z-scores to obtain standardized feature values. The expression is as follows:
[0115] in, These are the original eigenvalues; and These are the mean and standard deviation of the feature on the training set, respectively. The validation and test sets are transformed using the same statistics as the training set to ensure the consistency of the data distribution.
[0116] After Z-score standardization, all features are arranged in chronological order to form a sequence of length T samples, which serve as the input tensor of the model. Its dimensions are .in, This is the batch size, which is the number of independent sequence samples processed in parallel in a single iteration; The length of the input sequence is the number of time steps it contains, and the corresponding time window size is... The product of the sampling interval; The dimension of the input features is the number of features contained in each time step.
[0117] The aforementioned eight-dimensional features and their Z-score standardization are merely specific embodiments. The number of feature dimensions, the specific form of the derived formula (e.g., whether to add a smoothing term of 0.1), and the normalization method can be increased, decreased, or replaced according to the actual sensor configuration of the photovoltaic power station. Furthermore, in the specific embodiments of this invention, =512, T=40, =8, but the present invention is not limited thereto.
[0118] 2. The input sequence tensor is transformed into a membrane potential tensor using a two-layer vectorized learnable spiking neuron (V-LIF).
[0119] Two-layer vectorized learnable spiking neurons form the backbone of the model, used to process preprocessed temporal data. The sequence is encoded as a pulse sequence and primary features are extracted. Traditional LIF neurons, when processing time-series sequences, require repeated linear matrix multiplication and membrane potential updates at each time step, resulting in a deep computational graph and slow training. To improve computational efficiency and better adapt to photovoltaic anomaly detection deployment scenarios, this invention designs a lightweight two-layer V-LIF backbone architecture, such as... Figure 3 As shown, each layer consists of vectorized spiking neurons. Spatial feature mapping is decoupled from temporal dynamics through a one-time linear mapping. Incorporating bionics, learnable decay rates and reset scales are introduced, enabling neurons to adaptively optimize according to data distribution. While preserving biological interpretability, the number of parameters is small, which can significantly improve the training efficiency and representation ability of spiking neural networks in long-term tasks.
[0120] Specifically, to address the problem of repetitive computation in traditional spiking neurons at each time step, vectorized V-LIF first modulates the original temporal data tensor outside the time step loop. Perform a spatial linear mapping to obtain the input tensor. This method performs linear mapping for all time steps in one step, significantly improving inference and training speed. The mathematical expression is as follows:
[0121] in, It is a three-dimensional tensor input to the original photovoltaic time-series data. For batch size, For sequence length, The original feature dimension; For a learnable weight matrix, the dimension is... For hidden layer dimensions, V-LIF has 128 for the first layer and 64 for the second layer; For learnable bias vectors, dimension Addition transmits data via a broadcast mechanism. It is automatically expanded into a tensor implementation.
[0122] At the time-dynamic level, the membrane potential of V-LIF The update equation uses a weighted average form, and its expression is as follows:
[0123] in, To achieve an adaptive membrane potential decay rate, the Sigmoid function is used to constrain the... interval; Represents the Hadama product; This represents the tensor calculated using formula (1). Fixed time step Slices of all batches and all feature dimensions are taken as the input vectors of the spiking neurons. This term is used to balance historical membrane potentials with current inputs, preventing gradient explosion over long time periods.
[0124] Since the step function for pulse firing is non-differentiable, this invention uses the differentiable Sigmoid function to calculate the pulse firing probability during forward propagation. Simultaneously, during backpropagation, the derivative of this activation function is used as the surrogate gradient, enabling the deep spiking network to perform end-to-end training via gradient descent when updating parameters during backpropagation. The specific formula is as follows:
[0125] in, For the Sigmoid function; Set the firing threshold for neurons to 0.5. This is a smoothing factor used to control the steepness of the alternative gradient.
[0126] After pulse firing, traditional LIF models typically employ hard reset, directly returning the signal to zero or resetting it to the resting potential. While simple and direct, this approach abruptly discards any remaining information that might be carried in the membrane potential, leading to gradient discontinuities. Our model, however, uses an adaptive soft reset mechanism, introducing a learnable reset scale. The decrease in amplitude is determined by the pulse intensity. Learnable reset scale The recovery scale, along with the portion exceeding the threshold, determines the recovery speed. Compared to traditional fixed-scale soft repositioning, learnable repositioning scale allows neurons to adaptively adjust their recovery speed and information retention based on task requirements, enhancing the model's representational capabilities. The updated membrane potential is as follows:
[0127] in, The learnable reset scale vector has all components initialized to 0.5.
[0128] This scheme stacks two layers of V-LIF modules. The first layer of V-LIF uses the original input... Input is the pulse tensor, output is the pulse tensor. The second layer V-LIF uses Input, output membrane potential tensor Finally, the membrane potential tensor output by the second V-LIF layer... This will serve as input for subsequent modules, where is the number of hidden dimensions in the second layer of V-LIF.
[0129] To suppress overfitting of the model on photovoltaic time-series data, this scheme sets Dropout regularization units with a dropout rate of 0.3 at the outputs of both V-LIF layers: the pulse tensor output from the first layer is dropped and then input into the second layer, and the membrane potential tensor output from the second layer is dropped and then input into the subsequent multi-scale time-series sensing attention module. This design can effectively improve the model's generalization ability under different operating environments without significantly increasing computational cost.
[0130] Through the iterative process of formulas (2)-(4), V-LIF can adaptively adjust the memory length and firing frequency of spiking neurons according to the dynamic distribution of photovoltaic data, using learnable membrane potential decay rate and reset scale. This mechanism enables the model to maintain high sensitivity under rapid transient faults and stable memory under long-term degradation trends. At the same time, it achieves simultaneous capture of multi-scale fault features through personalized differentiation of neurons, fundamentally improving the detection accuracy and generalization ability of RI-SNN in complex temporal anomaly detection tasks.
[0131] 3. Deep feature enhancement of membrane potential tensors is performed using a multi-scale temporal-aware attention module (MS-PTA).
[0132] Because photovoltaic system failures often exhibit multi-scale characteristics, such as rapid transients caused by shading on a small timescale and long-term degradation anomalies caused by module aging on a large timescale, this invention constructs an RI-SNN model that incorporates a multi-scale temporal attention module oriented towards spiking neural networks within the deep feature space of the SNN. For example... Figure 4 As shown, this mechanism enables the model to adaptively adjust the degree of attention to features at different time scales based on the dynamic characteristics of the input data, thereby achieving a flexible response to various types of faults in photovoltaic systems.
[0133] The membrane potential tensor output by the second-layer V-LIF The features are used as input to the MS-PTA module and are simultaneously fed into the multi-scale convolution branch and the multi-head attention (MHA) branch to extract multi-scale local information based on depth convolution and global long-range information based on the original features in parallel.
[0134] In the multi-scale convolution branch, four sets of one-dimensional depthwise convolutions with different receptive fields are used in parallel to extract multi-scale local features. The set of convolution kernel sizes is as follows: Scale 1 is used to capture transient pulses (such as the instantaneous occupancy of birds), scales 5 and 10 are used to capture short-term cloud movement, and scale 20, which occupies half the length of the input sequence, is used to capture medium- to long-term gradual trends such as inverter temperature rise. Each convolutional sequence is followed by... The activation function and global average pooling compress the features at each time step into... Feature vectors extracted at different scales The mathematical expression is as follows:
[0135] in, This represents the membrane potential tensor. Maintain batch dimension Unchanged, time dimension With feature dimension The tensor after permute transformation has the following shape: To adapt to the input format of one-dimensional convolution; The kernel size is Depth convolution, the number of groups is equal to Each convolutional kernel operates on only a single feature channel, keeping the number of channels constant; This is a global average pooling method, where the average value is taken over the time dimension.
[0136] Subsequently, the feature vectors from the four scales are concatenated along their feature dimensions and then input into the attention scoring network. The Dropout layer randomly discards neuron outputs with a probability of 0.1 to prevent overfitting and enhance the model's generalization ability. The network outputs are normalized to a probability distribution using the Softmax function to obtain the dynamic weights for each scale. The fused multi-scale features are obtained through weighted summation. The expression is as follows:
[0137]
[0138] in, , This is the weight matrix of the fully connected layer; ,satisfy and .
[0139] Simultaneously, in the parallel multi-head self-attention MHA branch, As the query, key, and value inputs, a multi-head self-attention module is used to obtain the attention-weighted feature tensor. :
[0140] Subsequently, the attention output tensor Average pooling is performed over the time dimension to obtain global attention features. as follows:
[0141] Among them, The attention output tensor represents a fixed time step. At the same time, slices that retain both the batch dimension and the feature dimension are preserved. This operation compresses long-range dependencies at the sequence level into a fixed-length vector, facilitating subsequent fusion.
[0142] Ultimately, the output of MS-PTA is a fusion of multi-scale local features and global long-range features:
[0143] This design enables the model to simultaneously utilize local multi-scale features and global temporal correlation information, thereby enhancing its ability to identify complex failure modes in photovoltaic systems.
[0144] 4. The final feature fusion and anomaly probability calculation are completed using the global residual skip connection and MLP classifier module.
[0145] Unlike traditional spiking neural networks that typically employ single-layer or shallow structures, this invention explicitly constructs a two-layer V-LIF backbone architecture. While this adds depth to gradient propagation, it may exacerbate gradient degradation. Therefore, this model designs a global residual skip connection path connecting the input layer and the decision layer. This path fuses the global statistical features of the original input sequence with the temporal features deeply mined by the MS-PTA module and transmits them to the decision layer. This achieves end-to-end reuse of the core electrical statistical features of the original input, preventing the loss of key fundamental features in multi-layer pulse coding. The two-layer V-LIF and global residual complement each other. The two-layer structure provides multi-scale feature extraction capabilities, while the residual connection ensures the stability of deep training. Together, they enable effective training of deep spiking networks.
[0146] Specifically, the residual path adopts a design strategy of pooling before mapping, first processing the original input tensor... The overall statistical features of the sequence are obtained by averaging along the time dimension; then, they are mapped to the hidden layer space through a learnable linear projection layer to obtain the residual features. This significantly reduces the number of parameters while ensuring the stability of deep training, as shown in the following expression:
[0147] in, It is a learnable weight matrix, with dimensions... Fixed time step for the raw input tensor of photovoltaic data Slices that retain both batch dimension and feature dimension; It is a learnable bias vector.
[0148] Then Timing characteristics of the MS-PTA module output By adding elements one by one, we obtain the combined characteristics after fusion. The expression is as follows:
[0149] Features after fusion The input is processed by an MLP classifier and mapped to a two-dimensional output. The MLP classifier consists of two fully connected layers: the first layer transforms the input features into a 64-dimensional hidden representation, followed by ReLU activation and Dropout regularization with a dropout rate of 0.15; the second layer further maps the hidden representation into a two-dimensional vector, denoted as . , and These are the unnormalized scores for the normal and abnormal classes, respectively, also known as log odds. They are used to obtain the probability of the abnormal class. ,right Applying the Softmax function:
[0150] Among them, probability value It represents the confidence level that the current sample belongs to the outlier class.
[0151] It should be clarified that the method of averaging the original input tensor along the time dimension to extract overall statistical features is a preferred embodiment of the present invention. Those skilled in the art will understand that using temporal aggregation strategies such as max pooling, weighted summation, or extracting end features of the sequence as alternatives should all fall within the protection scope of the residual skip connection of the present invention.
[0152] 5. Model training and anomaly detection.
[0153] In this invention, the computational environment of the RI-SNN model is accelerated by NVIDIA GPU, and the software environment is based on Python language and PyTorch deep learning framework, with CUDA and cuDNN acceleration libraries enabled.
[0154] For the RI-SNN model, the length of the input sequence is... Set to 40, corresponding to a 200-minute history window; batch size The value was set to 512 to fully utilize the parallel computing power of the GPU; the total number of training epochs was set to 100. Since the proportion of faulty samples in the photovoltaic system is relatively low, the model training uses FocalLoss as the optimization objective to alleviate the class imbalance between normal and faulty samples. After each batch of forward computation, gradients are obtained through backpropagation, gradient pruning is performed to limit the gradient norm, and then the parameters are updated using the AdamW optimizer, which pre-sets hierarchical differential learning rates and weight decay.
[0155] Specifically, the focus loss function reduces the weight of easily classified samples, making the model training more focused on difficult-to-classify outlier samples. The expression is as follows:
[0156] in, The total number of samples; As the category weight factor, when the true category When it is an exception class, =0.25; when it is the normal class, =0.75, this value is suitable for the class imbalance characteristics of photovoltaic anomaly detection scenarios, where the proportion of normal samples is high and the proportion of abnormal samples is scarce, and balances the gradient contribution of different types of samples. For the model to predict the first Each sample belongs to the true category. The probability of; is the modulation coefficient, set to 2.0, used to amplify the loss weight of difficult-to-classify weak outlier samples.
[0157] Although the proposed two-layer V-LIF structure is achieved through vectorized computation and learnable dynamic parameters , While this improves the expressive power of spiking networks, direct end-to-end training may still face problems such as gradient instability, slow convergence, and insufficient sensitivity to weak fault samples. Therefore, the model further incorporates a joint strategy of gradient clipping and hierarchical differentiated learning rates.
[0158] After obtaining the focal loss, the gradients of each parameter in the network are calculated through backpropagation. To avoid the time-dependent backpropagation due to sequence length, the gradients are calculated. Potential gradient explosion can be addressed by applying gradient norm clipping before parameter updates:
[0159] in, The gradient vector for all parameters. For its Euclidean norm = This is a preset clipping threshold. This operation will use the gradient norm. Limited to Within this range, it effectively prevents excessively large single-step update steps, thereby stabilizing the training process and preserving the ability to learn from minor fault characteristics such as slight fluctuations in early irradiance.
[0160] The hierarchical differential learning strategy divides parameters into impulse dynamics parameters. , Set differentiated learning rates for the other two groups of parameters. , as follows:
[0161] in, The initial learning rate, This is a tiered decay factor. This design stems from the sensitivity of V-LIF dynamics parameters to the learning step size; that is, an excessively large learning rate can easily lead to... and Violent oscillations disrupt the stability of membrane potential updates, while a lower learning rate ensures a smooth evolution of pulse firing behavior.
[0162] The optimizer uses AdamW with differentiated weight decay for different parameter groups: a decay coefficient λ=0.01 is used for the impulse dynamics parameter to enhance regularization; λ=0.001 is used for the other parameters to prevent overfitting while preserving the model's expressive power. The learning rate uses pre-warmed cosine annealing scheduling, and the strategy applies to all parameter groups; that is, in the first 10 rounds, the learning rate for the LIF group linearly increases from 0 to... The remaining groups grew to The learning rate then decays to near 0 according to the cosine function. The learning rate is updated after each round, and remains unchanged within the same round.
[0163] During the training phase, since PyTorch's loss function already integrates Softmax, it can be directly applied to... Calculate the focus loss and update the model parameters via backpropagation; during the validation and testing phases, only the Softmax output probability is used. An assessment will be conducted, but losses will not be calculated.
[0164] On the validation set, an early stopping mechanism is used to search for the optimal threshold, terminating the process if the F1 score does not improve for five consecutive rounds. A grid search is employed, ranging from 0.2 to 0.8, with a step size of 0.05, to select the threshold that maximizes the F1 score on the validation set. When multiple thresholds achieve the same maximum F1 score, the smallest threshold with the highest recall is selected, denoted as [the threshold with the highest recall rate]. The test set samples are then used to make anomaly detection decisions based on this threshold, as shown in the following expression:
[0165] Finally, the RI-SNN model takes the initial input multivariate photovoltaic time series as input, passes through a two-layer V-LIF pulse coding, multi-scale temporal attention feature extraction, global residual skip connections, and an MLP classifier module in sequence, outputs the anomaly probability and compares it with the optimal threshold, thus forming a complete technical solution for photovoltaic power output anomaly detection.
[0166] like Figure 5 As shown, the following are embodiments of the photovoltaic system output anomaly detection system provided in this disclosure. This system and the photovoltaic system output anomaly detection method of the above embodiments belong to the same inventive concept. For details not described in detail in the embodiments of the photovoltaic system output anomaly detection system, please refer to the embodiments of the photovoltaic system output anomaly detection method described above.
[0167] A photovoltaic system output anomaly detection system, comprising: The input sequence construction module is used to obtain multivariate raw operating data of the photovoltaic system, including DC voltage, irradiance and module temperature; construct various derived features based on the multivariate raw operating data; combine the multivariate raw operating data and derived features into a multidimensional feature vector, and after standardization, form the input sequence tensor. The pulse feature extraction module is used to input the input sequence tensor into the first layer of the two-layer vectorized learnable spiking neurons, perform spatial linear mapping and pulse dynamics transformation based on learnable decay rate and learnable reset scale on the input sequence tensor to generate a pulse tensor; and input the pulse tensor into the second layer of the two-layer vectorized learnable spiking neurons, perform spatial linear mapping and pulse dynamics transformation based on learnable decay rate and learnable reset scale on the pulse tensor to generate a membrane potential tensor. The temporal feature enhancement module is used to input the membrane potential tensor into the multi-scale convolutional branch of the multi-scale temporal awareness attention module. The multi-scale convolutional branch is used to extract multi-scale local features through convolution operations at multiple different scales, and the attention mechanism is used to dynamically weight and fuse the features at each scale to obtain multi-scale features. The multi-head self-attention branch is used to extract the global temporal dependencies of the membrane potential tensor through a self-attention mechanism, and the time dimension is aggregated to obtain global attention features. The multi-scale features and global attention features are fused to obtain the temporal features. The residual fusion classification module is used to input the input sequence tensor and temporal features into the global residual skip connection and MLP classifier module; it performs aggregation operation on the input sequence tensor in the time dimension to obtain the overall statistical features, and maps them to residual features through a linear projection layer; it adds the temporal features and residual features element by element to obtain the fused features; it inputs the fused features into the multilayer perceptron classifier, and calculates the anomaly probability through a flexible maximum function.
[0168] The anomaly detection module is used to compare the anomaly probability with a preset optimal threshold; if the anomaly probability is greater than or equal to the optimal threshold, the current photovoltaic system output is determined to be abnormal; otherwise, it is determined to be normal.
[0169] The photovoltaic system output anomaly detection system provided in this embodiment constructs an RI-SNN model based on residual improved spiking neural networks. It employs a two-layer vectorized learnable spiking neurons to decouple spatial linear mapping from temporal dynamics, significantly improving training and inference efficiency in long-term tasks. Simultaneously, it introduces a multi-scale temporal-aware attention module, utilizing multi-scale convolutional branches and multi-head self-attention branches to extract and dynamically fuse multi-scale local features and global temporal dependencies in parallel, significantly enhancing the representation ability of multi-scale anomaly patterns such as rapid transient faults and long-term degradation trends. Furthermore, by directly transmitting the overall statistical features of the original input to the classifier layer through global residual skip connections, it effectively alleviates the feature forgetting and gradient degradation problems in deep spiking networks. Combined with a focus loss function and a hierarchical differentiated learning rate strategy, it achieves high-precision identification of imbalanced fault samples.
[0170] Figure 6 A schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention.
[0171] The photovoltaic system output anomaly detection method provided in this application embodiment can be applied to electronic devices. Those skilled in the art will understand that the electronic device structure involved in the embodiments of this invention does not constitute a limitation on the electronic device. An electronic device may include more or fewer components than illustrated, or combine certain components, or have different component arrangements. In the embodiments of this invention, the electronic device includes, but is not limited to, laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the embodiments of this application described and / or claimed herein.
[0172] Electronic devices may include processors, external memory interfaces, internal memory, universal serial bus (USB) interfaces, charging management modules, power management modules, batteries, wireless communication modules, audio modules, speakers, microphones, sensor modules, buttons, cameras, displays, and SIM card interfaces, etc.
[0173] A processor may include one or more processing units, such as: a central processing unit (CPU), an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors.
[0174] The processor can serve as the nerve center and command center of an electronic device. The controller can generate operation control signals based on the instruction opcode and timing signals to control the fetching and execution of instructions.
[0175] The processor may also include memory for storing instructions and data. In some embodiments, the memory in the processor is a cache memory. This memory can store instructions or data that the processor has just used or that are used repeatedly. If the processor needs to use the instruction or data again, it can retrieve it directly from this memory. This avoids repeated accesses, reduces processor latency, and thus improves system efficiency.
[0176] An external storage interface (ESI) can be used to connect external memory cards, such as microSD cards, to expand the storage capacity of electronic devices. The external memory card communicates with the processor through the ESI to perform data storage functions, such as saving music and video files on the external memory card.
[0177] Internal memory can be used to store computer executable program code, which includes instructions. The processor executes various functional applications and data processing of electronic devices by running the instructions stored in internal memory. Internal memory can include a program storage area and a data storage area. Internal memory can include high-speed random access memory, and can also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
[0178] Wireless communication functionality in electronic devices can be achieved through antennas, wireless communication modules, modem processors, and baseband processors.
[0179] Wireless communication modules can provide solutions for wireless communication applications in electronic devices, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies.
[0180] Electronic devices can implement audio functions through audio modules, speakers, receivers, microphones, headphone jacks, and application processors.
[0181] Electronic devices can achieve shooting functions through ISPs, cameras, video codecs, GPUs, displays, and application processors.
[0182] Electronic devices can achieve display functions through GPUs, displays, and application processors.
[0183] A GPU is a microprocessor for image processing, connected to the display screen and application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering. A processor may include one or more GPUs, which execute program instructions to generate or modify display information.
[0184] A display screen is used to display images, videos, etc. A display screen includes a display panel.
[0185] The aforementioned electronic device realizes the photovoltaic system output anomaly detection method of this application by constructing an RI-SNN model containing a two-layer vectorized learnable spiking neuron, a multi-scale temporal sensing attention module, and a global residual jump connection. This achieves a significant improvement in training efficiency, accurate capture of multi-scale fault features, and stable convergence of deep network training, thus achieving the beneficial effect of high-precision, high-efficiency, end-to-end real-time detection of photovoltaic system output anomalies.
[0186] The storage medium provided in this application stores a program product capable of implementing a method for detecting abnormal output of a photovoltaic system.
[0187] In some possible implementations, the photovoltaic system output anomaly detection method of this disclosure can be implemented as a program product that includes program code. When the program product is run on a terminal device, the program code is used to cause the terminal device to perform the steps described in the "Exemplary Methods" section above according to various exemplary embodiments of this disclosure.
[0188] The storage medium disclosed herein may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof.
[0189] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for detecting abnormal output of a photovoltaic system, characterized in that, The method employs an RI-SNN model constructed based on a residual improved spiking neural network. The RI-SNN model includes a two-layer vectorized learnable spiking neuron, a multi-scale temporal-aware attention module, and a global residual skip connection and MLP classifier module. The method includes the following steps: S1: Obtain multivariate raw operating data of the photovoltaic system, including DC voltage, irradiance and module temperature; construct various derived features based on the multivariate raw operating data; combine the multivariate raw operating data and derived features into a multidimensional feature vector, and after standardization, form the input sequence tensor. S2: Input the input sequence tensor into the first layer of the two-layer vectorized learnable spiking neuron, perform spatial linear mapping and pulse dynamics transformation based on learnable decay rate and learnable reset scale on the input sequence tensor to generate a pulse tensor; After applying Dropout regularization to the pulse tensor, it is input into the second layer of the two-layer vectorized learnable spiking neuron. Spatial linear mapping and pulse dynamics transformation based on learnable decay rate and learnable reset scale are performed on the pulse tensor to generate the membrane potential tensor and apply Dropout regularization. S3: Input the regularized membrane potential tensor into the multi-scale convolution branch of the multi-scale temporal awareness attention module; use the multi-scale convolution branch to extract multi-scale local features through multiple convolution operations at different scales, and use the attention mechanism to dynamically weight and fuse the features at each scale to obtain multi-scale features; The global temporal dependencies of the membrane potential tensor are extracted by using a multi-head self-attention branch through a self-attention mechanism, and the temporal dimension is aggregated to obtain global attention features; the multi-scale features are fused with the global attention features to obtain temporal features. S4: Input the input sequence tensor and temporal features into the global residual skip connection and MLP classifier module; perform aggregation operation on the input sequence tensor in the time dimension to obtain the overall statistical features, and map them into residual features through a linear projection layer; add the temporal features and residual features element by element to obtain the fused features; input the fused features into the multilayer perceptron classifier, and calculate the anomaly probability through the flexible maximum function; S5: Compare the abnormal probability with the preset optimal threshold; if the abnormal probability is greater than or equal to the optimal threshold, the current photovoltaic system output is determined to be abnormal; otherwise, it is determined to be normal.
2. The photovoltaic system output anomaly detection method according to claim 1, characterized in that, Step S1 includes: To obtain the DC voltage, irradiance, and module temperature of the photovoltaic system; Five types of derived characteristics were calculated based on DC voltage, irradiance, and component temperature, including voltage to irradiance ratio, voltage change rate, irradiance change rate, equivalent power, and temperature to irradiance ratio. Voltage to irradiance ratio The calculation formula is: in, DC voltage Irradiance; Voltage change rate The calculation formula is: in, For the current time step DC voltage, This represents the DC voltage of the previous time step; Rate of change of irradiance The calculation formula is: in, For the current time step Irradiance, The irradiance at the previous time step; equivalent power The calculation formula is: in, DC voltage Irradiance; Temperature to irradiance ratio The calculation formula is: in, For component temperature, Irradiance; The DC voltage, irradiance, component temperature, and the five types of derived features are combined into an eight-dimensional feature vector, and Z-score normalization is used to normalize each feature vector. The standardized eight-dimensional feature vectors are arranged in chronological order to form a structure of length [length missing]. input sequence tensor ,in The number of time steps for the input sequence.
3. The photovoltaic system output anomaly detection method according to claim 2, characterized in that, Step S2 includes: The input sequence tensor The input is fed into the first layer of vectorized learnable spiking neurons, which then perform the following operations: Using formula Perform a one-time spatial linear mapping; where, , For batch size, The original feature dimension; For learnable weight matrix, For the hidden layer dimension; A learnable bias vector; At each time step According to the formula The membrane potential is updated according to a weighted average; where... For the first Membrane potential at time step To learn the membrane potential decay rate, Represents the Hadama product. For input tensors At time step Slices; Using differentiable substitution activation functions Calculate the pulse firing probability at the current time step, denoted as the output pulse intensity at the current time step; where, For the Sigmoid function, Set the firing threshold for neurons. It is a smoothing factor; An adaptive soft reset mechanism is adopted, based on the output pulse of the current time step. Update the membrane potential to prepare for the next time step; the specific formula is as follows: in, It is a learnable reset scale vector; The output pulse obtained by calculating all time steps Stacked along the time dimension, they form the pulse tensor of the first layer's output, denoted as... ; The pulse tensor of the first layer output Apply Dropout regularization with a dropout rate of 0.2-0.4 to randomly discard the spike outputs of some neurons to prevent the model from overfitting; The regularized pulse tensor As input, it is fed into the second layer of vectorized learnable spiking neurons to perform the following operations: Using formula Perform a one-time spatial linear mapping; where, This is the learnable weight matrix for the second layer. This is the learnable bias vector for the second layer; At each time step According to the formula The membrane potential is updated according to a weighted average; where... The learnable membrane potential decay rate of the second layer; Using differentiable substitution activation functions Calculate the pulse firing probability at the current time step: An adaptive soft reset mechanism is adopted, based on the pulse of the current time step. The membrane potential is updated via soft reset, using the following formula: in, This is the learnable reset scale vector for the second layer; Membrane potential after soft reset of all time steps Stacked along the time dimension, they form the membrane potential tensor of the second layer output, denoted as . After applying Dropout regularization with a drop rate of 0.2-0.4, proceed to the next step.
4. The photovoltaic system output anomaly detection method according to claim 3, characterized in that, Step S3 includes: The regularized membrane potential tensor Simultaneously, the data is fed into parallel multi-scale convolutional branches and multi-head self-attention branches: The following processing flow is executed through multi-scale convolutional branches: One-dimensional depthwise convolutions with four different kernel sizes are used in parallel to extract multi-scale local features. The set of kernel sizes is as follows: For each convolution kernel size The extracted feature maps are sequentially activated by ReLU and then subjected to global average pooling to obtain feature vectors at various scales: in, Let the membrane potential tensor be... This represents the membrane potential tensor. Maintain batch dimension Unchanged, time dimension With feature dimension The tensor after axis swapping is transformed into the following shape: ; For depthwise convolution, the number of groups is equal to ; For global average pooling; The four scale feature vectors are concatenated along the feature dimensions and then sequentially fed into the attention scoring network: first through a fully connected layer. ReLU activation, then through a Dropout layer, then through a fully connected layer. Finally, the dynamic weights for each scale are obtained by Softmax normalization. The specific formula is as follows: The multi-scale features are obtained by summing the features at each scale according to dynamic weights using the following formula. : The following processing flow is executed through a multi-head self-attention branch: The membrane potential tensor As the query, key, and value inputs, a multi-head self-attention module is used to obtain the attention-weighted feature tensor. : Use the following formula for the feature tensor Global attention features are obtained by performing average pooling over the time dimension. : in, This indicates that the attention output tensor is at a fixed time step. Slices; Using formula Calculate the time series characteristics .
5. The photovoltaic system output anomaly detection method according to claim 4, characterized in that, Step S4 includes: The input sequence tensor is expressed by the following formula. Mean pooling is performed along the time dimension to obtain the overall statistical features, which are then mapped to residual features through a learnable linear projection layer. : in, The learnable weight matrix has dimensions of . ; Fixed time steps for the input sequence tensor Slices; A learnable bias vector; The time series features With the residual features Element-by-element addition yields the fusion feature : The fused features are input into a multilayer perceptron classifier, which contains two fully connected layers. The first layer transforms the input into a 64-dimensional hidden representation and applies a ReLU activation function and Dropout regularization with a dropout rate of 0.1-0.
2. The second layer maps the hidden representation into a two-dimensional vector. The anomaly probability is calculated using the following Softmax function. : in, and These are the unnormalized scores for the normal class and the abnormal class, respectively.
6. The photovoltaic system output anomaly detection method according to claim 1, characterized in that, The process for setting the optimal threshold is as follows: The preset validation set is input into the RI-SNN model to calculate the anomaly probability corresponding to each validation set sample, denoted as the i-th. The probability of anomalies in each validation set sample is ; Within the threshold search range of 0.2 to 0.8, multiple candidate thresholds are set with a step size of 0.05; for each candidate threshold, the anomaly probability of the validation set samples is calculated. Compare with the candidate threshold: If If the value is greater than or equal to the candidate threshold, it is predicted as an abnormal class; otherwise, it is predicted as a normal class. The corresponding F1 score is calculated based on the prediction result and the true label. Select the candidate threshold that maximizes the F1 score as the optimal threshold; When multiple candidate thresholds achieve the same maximum F1 score, the smallest threshold with the highest recall rate is selected as the optimal threshold.
7. The photovoltaic system output anomaly detection method according to claim 1, characterized in that, The training process of the RI-SNN model is as follows: Using the focus loss function As the optimization objective; among which The total number of samples, This represents the true category of the sample and takes the value of either the normal class or the abnormal class. Category weight factor when it is an exception class When the true category When it is a normal class , For the model to predict the first Each sample belongs to the true category. The probability, The modulation coefficient; The gradient vector of all parameters is obtained through backpropagation. Then, perform gradient norm clipping. ,in Gradient vector The Euclidean norm, This is the clipping threshold; A hierarchical differentiated learning rate strategy is adopted to incorporate the learnable membrane potential decay rate from the pulse dynamics parameters. and learnable reset scale vector The learning rate is set to The learning rate for other parameters is set to The initial learning rate Stratified attenuation factor ; Employing a preheated cosine annealing learning rate scheduling strategy, the learning rate for the impulse dynamics parameter is set from [value missing] in the first 10 training epochs. linear growth to For other parameters, the learning rate is from linear growth to After this, the learning rate for all parameters decays according to a cosine function to 0. ; The AdamW optimizer is used to update the model parameters based on the current learning rate in each training epoch, and the pulse dynamics parameter is set to the weight decay coefficient. Set the weight decay coefficient of other parameters to .
8. A photovoltaic system output anomaly detection system, characterized in that, The system employs the photovoltaic system output anomaly detection method as described in any one of claims 1 to 7; The system includes: The input sequence construction module is used to obtain multivariate raw operating data of the photovoltaic system, including DC voltage, irradiance and module temperature; construct various derived features based on the multivariate raw operating data; combine the multivariate raw operating data and derived features into a multidimensional feature vector, and after standardization, form the input sequence tensor. The pulse feature extraction module is used to input the input sequence tensor into the first layer of the two-layer vectorized learnable spiking neurons, perform spatial linear mapping and pulse dynamics transformation based on learnable decay rate and learnable reset scale on the input sequence tensor to generate a pulse tensor; and input the pulse tensor into the second layer of the two-layer vectorized learnable spiking neurons, perform spatial linear mapping and pulse dynamics transformation based on learnable decay rate and learnable reset scale on the pulse tensor to generate a membrane potential tensor. The temporal feature enhancement module is used to input the membrane potential tensor into the multi-scale convolutional branch of the multi-scale temporal awareness attention module. The multi-scale convolutional branch extracts multi-scale local features through convolution operations at multiple different scales, and uses an attention mechanism to dynamically weight and fuse these features to obtain multi-scale features. A multi-head self-attention branch extracts the global temporal dependencies of the membrane potential tensor through a self-attention mechanism, and aggregates the temporal dimension to obtain global attention features. Finally, the multi-scale features are fused with the global attention features to obtain the temporal features. The residual fusion classification module is used to input the input sequence tensor and temporal features into the global residual skip connection and MLP classifier module; it performs aggregation operation on the input sequence tensor in the time dimension to obtain the overall statistical features, and maps them to residual features through a linear projection layer; it adds the temporal features and residual features element by element to obtain the fused features; it inputs the fused features into the multilayer perceptron classifier, and calculates the anomaly probability through a flexible maximum function; The anomaly detection module is used to compare the anomaly probability with a preset optimal threshold; if the anomaly probability is greater than or equal to the optimal threshold, the current photovoltaic system output is determined to be abnormal; otherwise, it is determined to be normal.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the photovoltaic system output anomaly detection method as described in any one of claims 1 to 7.
10. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the photovoltaic system output anomaly detection method as described in any one of claims 1 to 7.
