Adapter-based photovoltaic fault detection federal learning domain offset correction method
By introducing adapters into the federal learning of photovoltaic power stations, the problem of poor generalization capability caused by data domain offset is solved, and more efficient photovoltaic fault detection is achieved, which improves detection accuracy and adaptability.
Patent Information
- Application Number
- CN202510460175.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-14
- Publication Date
- 2025-08-08
AI Technical Summary
In photovoltaic power plants, the existing federated learning method cannot be effectively eliminated due to the data domain offset caused by differences in different geographical locations and equipment specifications, resulting in poor generalization capabilities of the model and degradation of detection performance.
The adapter is introduced in the local model of federated learning. By pre-training and adjusting the adapter parameters, the local data features are brought close to the global data distribution, and the maximum mean difference measurement method is used to optimize feature transformation to reduce the impact of domain offset.
It improves the accuracy and reliability of photovoltaic fault detection, reduces false alarms and missed alarms, and significantly improves the adaptability and detection performance of the model in different photovoltaic power plants.
Smart Images

Figure CN120449987A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of photovoltaic fault detection domain offset, and in particular to an adapter-based photovoltaic fault detection federated learning domain offset correction method. Background Art
[0002] With the rapid development of photovoltaic power generation technology, photovoltaic power plants are widely used worldwide. However, during long-term operation, photovoltaic systems can experience various faults due to factors such as environmental changes and component aging, seriously affecting system stability and power generation efficiency. Therefore, timely and accurate photovoltaic fault detection is particularly important.
[0003] Photovoltaic fault detection technology plays a core role in ensuring the normal operation of photovoltaic systems. Traditional fault detection methods, such as regular manual inspections, not only consume significant manpower, material resources, and time, but also rely heavily on the accuracy and timeliness of detection, relying on the experience and commitment of personnel, making comprehensive, real-time monitoring difficult. Detection methods based on physical models, due to the inherent complexity of photovoltaic systems, including the interplay of multiple factors such as light intensity, temperature, and component aging, make it extremely difficult to establish accurate and universal physical models. Consequently, detection accuracy fails to meet actual requirements.
[0004] In recent years, machine learning-based photovoltaic fault detection methods have gradually emerged. By learning from large amounts of historical data and uncovering patterns hidden within the data, they can effectively detect photovoltaic faults. However, data collected from photovoltaic power plants with different geographic locations, climate conditions, and equipment specifications exhibit significant domain shift. This means that when a model trained at one power plant is directly applied to other plants, detection performance often deteriorates dramatically due to differences in data distribution, significantly limiting the model's generalization capabilities.
[0005] The emergence of federated learning offers a new approach to solving this problem. It allows individual PV plants to collaboratively train a global model without exchanging raw data, thereby improving the model's adaptability to data from different plants. However, federated learning still cannot completely eliminate the negative impact of domain shift. Existing domain shift correction methods either have overly complex computational processes, increasing the cost and difficulty of practical application, or offer unsatisfactory correction results, failing to fundamentally address the performance degradation of the model on data from different domains. Summary of the Invention
[0006] In response to the shortcomings of the existing technology, the present invention proposes an adapter-based federated learning domain offset correction method for photovoltaic fault detection. By introducing an adapter into the local model of federated learning, the accuracy and reliability of photovoltaic fault detection are further improved, providing strong support for the healthy and sustainable development of the photovoltaic industry.
[0007] A first aspect of the present invention provides an adapter-based photovoltaic fault detection federated learning domain offset correction method, comprising the following steps:
[0008] S1, each photovoltaic power station participating in federated learning collects photovoltaic data and performs data preprocessing;
[0009] S2, build an adapter module for each photovoltaic power station and pre-train each adapter module based on the photovoltaic data of each photovoltaic power station;
[0010] S3, each PV plant trains the local model locally using its local data and adapter module;
[0011] S4: Each PV plant uploads the updated parameters of the local model and the updated parameters of the adapter to the central server; the central server performs weighted average aggregation on the parameters of each PV plant to generate a global model;
[0012] S5, adjusting the parameters of the adapter so that the difference between the features converted by the adapter and the global data distribution is minimized; and inputting the features generated by the adjusted adapter into the global model to obtain a fault detection result.
[0013] Furthermore, in S1, the collected photovoltaic data includes the current, voltage, power, temperature and light intensity of the photovoltaic modules; the data preprocessing removes noise data and outliers in the data through statistical methods and rule judgment based on domain knowledge to ensure the quality and reliability of the data.
[0014] Furthermore, in S1, the minimum-maximum normalization method is used to normalize the data of different standards to the interval [0,1] to facilitate subsequent model training and processing; the specific formula is as follows:
[0015]
[0016] Among them, x′ is the normalized data value, x is the original data value, and x min is the minimum value in the feature data, x max is the maximum value in the feature data.
[0017] Furthermore, in S2, constructing adapter modules and pre-training each adapter module includes:
[0018] The adapter module adopts a multi-layer neural network structure to transform the local photovoltaic data features X=[x1,x2,...,x n ] and the feature representation G output by the global model to obtain h 0 And h 0 As the input of the adapter; let the l-th layer input of the adapter be h l-1 , the output is h l , the activation function is σ, and the weight matrix is W l , the bias vector is b l , then the calculation formula of the adapter is:
[0019] h l =σ(W l h l-1 +b l )
[0020] Where l = 1, 2, ..., L, where L is the number of layers in the adapter neural network. After L layers of calculation, the output of the adapter is A(X).
[0021] The adapter parameters are initialized using a pre-training method. Pre-training is performed based on a large number of diverse photovoltaic data samples from different photovoltaic power plants, so that it has the initial ability to adapt to data from different domains. The cross entropy loss function L is used in the pre-training process. g To optimize the adapter parameters, the formula is:
[0022]
[0023] Where N is the number of local samples used to train the adapter; C is the number of categories, such as different types of photovoltaic faults, such as open circuit faults, short circuit faults, component aging, etc.; y ij is the true label of sample i belonging to category j, which takes the value 0 or 1; p ij is the probability that the model predicts that sample i belongs to category j.
[0024] Furthermore, in S3, during the local model training process, the loss function L of the local model local It consists of two parts, one of which is the prediction loss L of local data. pred , the other part is the adaptation loss L between the adapter and the local data adapt :
[0025] L local =L pred +λL adapt
[0026] Among them, λ is a hyperparameter that balances the two parts of loss;
[0027] The prediction loss L of the local data predUsing cross entropy loss function:
[0028]
[0029] Where M is the number of local samples used to train the local model;
[0030] The adaptation loss between the adapter and the local data adopts the mean square error (MSE) loss function:
[0031]
[0032] Among them, A(X m ) is the adapter’s response to the local data sample X m The output of G m is the corresponding global model output feature representation;
[0033] During the training process, the stochastic gradient descent (SGD) algorithm is used to update the parameters of the local model and adapter. The parameter update formula is:
[0034]
[0035] Where θ and θ′ are the parameters before and after update, including local model parameters and adapter parameters; η is the learning rate; is the loss function L local The gradient with respect to the parameters θ.
[0036] Furthermore, the specific method of S4 is:
[0037] Assume there are K photovoltaic power stations in total, and the number of samples of the kth photovoltaic power station is n k The total number of samples is The parameter of the Kth photovoltaic power station is θ′ k , then the aggregated global model parameter θ global for:
[0038]
[0039] Furthermore, in order to optimize the global model, the total number of rounds of federated learning is set to R, and the SGD algorithm is used to update parameters in local model training. The local model learning rate is set to α and trained in E epoch settings.
[0040] Furthermore, in the S5, in the model inference stage, when the new photovoltaic data X is input new =[X new1 ,X new2 ,...,X newn], since the data of different photovoltaic power plants have domain offset, that is, the data distribution is different, directly inputting it into the global model may lead to a decrease in detection performance; therefore, the adapter is used to correct the domain offset. The specific steps are as follows:
[0041] S5.1, local photovoltaic data feature X new and the feature representation G output by the global model related (This feature represents the distribution characteristics of the global data) as the initial input of the adapter [;] represents the feature concatenation operation, which is processed by the multi-layer neural network inside the adapter;
[0042] Assume that the input of the first layer of the adapter is The output is The activation function is σ and the weight matrix is The bias vector is The forward propagation process of the adapter is as follows:
[0043]
[0044] Where l = 1, 2, ..., L, L is the number of layers of the adapter neural network; after L layers of calculation, the output of the adapter for the new photovoltaic data is obtained This output is a new feature representation that maps the domain features of local data to a space close to the global data distribution;
[0045] S5.2, in order to more accurately measure the closeness between the features converted by the adapter and the global data distribution, the maximum mean difference (MMD) measurement method is introduced; specifically, let the feature set sampled from the global data set be G global , the local new data feature set after the adapter conversion is A(X new ), then the MMD calculation formula is:
[0046]
[0047] Among them, n global is the number of samples in the global data feature set, n new is the number of samples of the local new data feature set, g u is the u-th sample in the global data feature set, a v is the vth sample in the local new data feature set after the adapter conversion, It is a mapping function that maps data to the reproducing kernel Hilbert space (RKHS);
[0048] The objective function is to minimize MMD 2 (G global ,A(Xnew )) value, by continuously adjusting the parameters of the adapter (weight matrix) during the training process of the adapter (combined with the loss function optimization during local training). and the bias vector ), so that the feature A(X new ) and global data distribution G global The difference is as small as possible;
[0049] S5.3, after the feature conversion of the above adapter and the adjustment of domain differences, the feature A(X new ) is already closer to the global data in distribution; at this time, the adjusted feature A′(X new ) is input into the global model for fault detection. Because the distribution of input features is more similar to the data distribution on which the global model is trained, the impact of domain shift on model detection performance is effectively reduced, thereby improving the model's fault detection accuracy and reliability for newly input PV data.
[0050] A second aspect of the present invention provides an electronic device, comprising: one or more processors, a memory, and one or more programs; wherein the one or more programs are stored in the memory, and the one or more programs include instructions, which, when executed by the electronic device, enable the electronic device to execute the adapter-based federated learning domain offset correction method for photovoltaic fault detection as described in any one of the first aspects.
[0051] A third aspect of the present invention provides a readable storage medium, which includes a computer program. When the computer program is run on an electronic device, the electronic device executes the adapter-based photovoltaic fault detection federated learning domain offset correction method described in any one of the first aspects.
[0052] Compared with the existing technology, the beneficial effects of the present invention are as follows: the present invention effectively solves the problem of poor model generalization ability caused by domain offset of data from different photovoltaic power stations in federated learning by introducing an adapter. The adapter can learn and adjust local data features to make it closer to the global data distribution, so that the model can maintain good performance on data from different photovoltaic power stations, greatly improving the adaptability of the model to various complex and diverse data. The correction of domain offset enables the model to more accurately identify the type and status of faults in photovoltaic systems. Compared with traditional methods, the present invention reduces false alarms and missed alarms caused by differences in data distribution, significantly improves the accuracy, recall rate and F1 value of fault detection, and provides reliable data support for the efficient operation and maintenance of photovoltaic power stations. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1It is a flow chart of the adapter-based photovoltaic fault detection federated learning domain offset correction method of the present invention.
[0054] Figure 2 It is a structural diagram of the adapter in the present invention. DETAILED DESCRIPTION
[0055] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0056] like Figure 1 As shown, an embodiment of the present invention provides an adapter-based photovoltaic fault detection federated learning domain offset correction method, including the following steps:
[0057] S1, preprocessing the collected data, including cleaning the data and normalizing it; specifically:
[0058] There are three photovoltaic power stations (participants A, B, and C) participating in federated learning. Each photovoltaic power station collected parameter data such as the current I, voltage V, power P, temperature T, and light intensity S of the photovoltaic components over a period of time, and also recorded the fault status of the photovoltaic system (normal, open circuit fault, short circuit fault, component aging fault). First, the data was cleaned. Photovoltaic power station A found that there were some abnormal current values in the data due to sensor failure. These abnormal values were identified and eliminated through statistical methods (such as the 3σ principle); Photovoltaic power station B found that some light intensity data had missing values and used linear interpolation to fill the missing values; Photovoltaic power station C removed unreasonable power data caused by recording errors. The three photovoltaic power stations all used the minimum-maximum normalization method to process the data. Taking the current data of photovoltaic power station A as an example, the original current data range is [1,10], unit: A. For a certain current value I=5A, after normalization
[0059] S2: Design an adapter module for each PV plant and initialize the adapter through pre-training. Specifically:
[0060] A four-layer adapter neural network was constructed. The input layer receives local PV data features (e.g., normalized I, V, P, T, S) and the feature representation of the global model output. The activation function used was the ReLU function σ(x) = max(0, x). The details of each layer are as follows:
[0061] Layer 1: Weight matrix W 1 The dimension is 5×64, the bias vector b 1 The dimension is 64.
[0062] Layer 2: Weight matrix W 2The dimension is 64×128, the bias vector b 2 The dimension is 128.
[0063] Layer 3: Weight matrix W 3 The dimension is 128×64, the bias vector b 3 The dimension is 64.
[0064] Layer 4: Weight matrix W 4 The dimension is 64×5, and the bias vector b 4 The dimension is 5.
[0065] The adapter is pre-trained using a large amount of historical data from multiple photovoltaic power plants. During the pre-training process, the cross entropy loss function L is used. g As the optimization target, C=5 at this time, that is, 4 fault types plus the normal state, the adapter parameters are optimized by the stochastic gradient descent algorithm, and the initial learning rate is set to 0.001.
[0066] S3, train the local model and use the SGD algorithm to update the local model and adapter parameters; specifically:
[0067] Photovoltaic power station A: The local model uses a 6-layer convolutional neural network (CNN) structure. The loss function of the local model is L local =L pred +λL adapt , where λ = 0.5.
[0068] Among them, L pred The cross entropy loss function is used to calculate the local samples; L adapt The mean square error loss function is used to calculate the difference between the adapter output and the global model output features.
[0069] During training, the stochastic gradient descent algorithm is used to update the parameters of the local model and adapter, and training is performed for 10 epochs. PV Plants B and C also undergo the same local model training process.
[0070] S4, upload the trained local model parameters and adapter parameters to the central server, which aggregates them using a weighted average method; specifically:
[0071] After the local model training is completed, PV power stations A, B, and C upload the updated parameters of their local models, including the updated parameters of the adapter, to the central server. After receiving the parameters of the three PV power stations, the central server uses a weighted average aggregation algorithm. The data used in this embodiment has a sample size of n for PV power stations A, B, and C, respectively. A =1000, n B =800,n C=1200, the total number of samples N′=1000+800+1200=3000; then the global model parameters after aggregation are:
[0072]
[0073] S5, uses the adapter to correct the domain offset of the new PV data, and introduces the maximum mean difference (MMD) metric to measure the closeness of the features converted by the adapter to the global data distribution; specifically:
[0074] PV plant A has a new set of PV data X new =[I new ,V new ,P new ,T new ,S new ] input, the adapter receives X new and the related feature representation G output by the global model related After the 4-layer neural network calculation of the adapter, the converted feature A(X new ). Calculate the features A(X after the adapter conversion new ) and the global data feature set G global By combining the loss function optimization in the subsequent local training, the parameters of the adapter are continuously adjusted to gradually reduce the MMD value, that is, let A(X new ) is closer to the global data distribution. The adjusted feature A′(X new ) is input into the global model for fault detection to determine the photovoltaic system status corresponding to this set of data.
[0075] S6: Continue training the model until convergence; specifically:
[0076] In order to optimize the global model, the total number of rounds of federated learning is set to 20, and the SGD algorithm is used for parameter update in local model training. The momentum is set to 0.9, the local model learning rate α is set to 0.001, and the number of epochs E is set to 10.
[0077] The above is a preferred specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with this technical field, within the technical scope disclosed by the present invention, who makes equivalent replacements or changes based on the technical solution and inventive concept of the present invention, should be covered by the scope of protection of the present invention.
Claims
1. An adapter-based federated learning domain offset correction method for photovoltaic fault detection, characterized in that: The following steps are involved: S1, each photovoltaic power station participating in federated learning collects photovoltaic data and performs data preprocessing; S2, build an adapter module for each photovoltaic power station and pre-train each adapter module based on the photovoltaic data of each photovoltaic power station; S3, each PV plant trains the local model locally using its local data and adapter module; S4: Each PV plant uploads the updated parameters of the local model and the updated parameters of the adapter to the central server; the central server performs weighted average aggregation on the parameters of each PV plant to generate a global model; S5, adjusting the parameters of the adapter so that the difference between the features converted by the adapter and the global data distribution is minimized; and inputting the features generated by the adjusted adapter into the global model to obtain a fault detection result.
2. The photovoltaic fault detection federated learning domain offset correction method based on adapter according to claim 1 is characterized in that: The constructing of adapter modules and pre-training of each adapter module include: The adapter module adopts a multi-layer neural network structure to transform the local photovoltaic data features X=[x1,x2,...,x n ] and the feature representation G output by the global model to obtain h 0 And h 0 As the input of the adapter; let the l-th layer input of the adapter be h l-1 , the output is h l , the activation function is σ, and the weight matrix is W l , the bias vector is b l , then the calculation formula of the adapter is: h l =σ(W l h l-1 +b l ) Where l = 1, 2, ..., L, where L is the number of layers in the adapter neural network. After L layers of calculation, the output of the adapter is A(X). The adapter is pre-trained based on diverse photovoltaic data samples from different photovoltaic power plants, so that it has the initial ability to adapt to data from different domains. The cross entropy loss function L is used in the pre-training process. g To optimize the adapter parameters, the formula is: Where N is the number of local samples used to train the adapter; C is the number of categories; y ij is the true label of sample i belonging to category j, which takes the value 0 or 1; p ij is the probability that the model predicts that sample i belongs to category j.
3. The photovoltaic fault detection federated learning domain offset correction method based on adapter according to claim 1 is characterized in that: During the local model training process, the loss function L of the local model local for: THE local =L pred +λL adapt Among them, λ is a hyperparameter that balances the two parts of loss; L pred is the prediction loss of local data, L adapt is the adaptation loss between the adapter and the local data; The prediction loss L of the local data pred Using cross entropy loss function: Where M is the number of local samples used to train the local model; The adaptation loss between the adapter and the local data adopts the mean square error loss function: Among them, A(X m ) is the adapter’s response to the local data sample X m The output of G m is the corresponding global model output feature representation; during the training process, the stochastic gradient descent algorithm is used to update the parameters of the local model and adapter. The parameter update formula is: Where θ and θ′ are the parameters before and after update, including local model parameters and adapter parameters; η is the learning rate; is the loss function L local The gradient with respect to the parameters θ.
4. The photovoltaic fault detection federated learning domain offset correction method based on adapter according to claim 1 is characterized in that: The aggregation method of the global model is: Assume there are K photovoltaic power stations in total, and the number of samples of the kth photovoltaic power station is n k The total number of samples is The parameter of the kth photovoltaic power station is θ′ k , then the aggregated global model parameters 5. The photovoltaic fault detection federated learning domain offset correction method based on adapter according to claim 1 is characterized in that: In S5, domain offset correction is performed using an adapter, and the specific steps are as follows: S5.1, local photovoltaic data feature X new and the feature representation G output by the global model related As the initial input to the adapter [;] represents feature splicing operation; Assume that the input of the first layer of the adapter is The output is The activation function is σ and the weight matrix is The bias vector is The forward propagation process of the adapter is as follows: Where l = 1, 2, ..., L, L is the number of layers of the adapter neural network; after L layers of calculation, the output of the adapter for the new photovoltaic data is obtained S5.2, let the feature set sampled from the global dataset be G global , the local new data feature set after the adapter conversion is A(X new ), then the MMD calculation formula is: Among them, n global is the number of samples in the global data feature set, n new is the number of samples of the local new data feature set, g u is the u-th sample in the global data feature set, a v is the vth sample in the local new data feature set after the adapter conversion, It is a mapping function that maps data to the reproducing kernel Hilbert space; The objective function is to minimize MMD 2 (G global ,A(X new )) value, by continuously adjusting the parameters of the adapter during the training process of the adapter and combining it with the loss function optimization during local training, so as to minimize the difference between the features converted by the adapter and the global data distribution; S5.3, the adjusted feature A′(X new ) is input into the global model for fault detection.
6. The photovoltaic fault detection federated learning domain offset correction method based on adapter according to claim 1, characterized in that: In S1, the collected photovoltaic data includes the current, voltage, power, temperature and light intensity of the photovoltaic module; and the data preprocessing includes removing noise data and abnormal values in the data.
7. The photovoltaic fault detection federated learning domain offset correction method based on adapter according to claim 1, characterized in that: In S1, the minimum-maximum normalization method is used to normalize the data of different standards to the interval [0, 1] to facilitate subsequent model training and processing.
8. An electronic device, comprising: One or more processors, a memory, and one or more programs; wherein the one or more programs are stored in the memory, and the one or more programs include instructions that, when executed by the electronic device, enable the electronic device to perform the adapter-based federated learning domain offset correction method for photovoltaic fault detection according to any one of claims 1 to 7.
9. A readable storage medium comprising a computer program, which, when executed on an electronic device, enables the electronic device to execute the adapter-based federated learning domain offset correction method for photovoltaic fault detection according to any one of claims 1 to 7.
Citation Information
Cited By
Lightweight air detection model based on federated learning and cross-domain environment adaptation method
CN121998130A