Error compensation method and system for ac sampling current transformer
By pre-training an MLP network on an unlabeled dataset and combining it with the coupling relationship of a labeled dataset, the accuracy and generalization ability of current transformer error compensation are improved, solving the problem of insufficient generalization of traditional methods under complex working conditions and achieving efficient error compensation effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HEXING ELECTRICAL CO LTD
- Filing Date
- 2026-01-29
- Publication Date
- 2026-06-19
AI Technical Summary
Traditional supervised learning-based error compensation methods for current transformers have high accuracy under preset operating conditions, but their generalization ability is insufficient under actual complex operating conditions, and they fail to effectively handle the coupling relationship between ratio error and angle error.
A contrastive learning approach is used to pre-train a multilayer perceptron (MLP) network on an unlabeled dataset to learn the physical model similarity and difference of current transformer errors. The coupling relationship between ratio difference and angle difference is introduced on a labeled dataset. The robustness and accuracy of the model are improved through an end-to-end hybrid training strategy.
It improves the accuracy and generalization capability of current transformer error compensation, supports edge deployment, and enables low-latency, high-real-time online error compensation, making it suitable for scenarios with high response speed requirements such as smart grids.
Smart Images

Figure CN122241017A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electrical information acquisition, and in particular to a method and system for error compensation of current transformers used in AC sampling. Background Technology
[0002] Traditional supervised learning-based error compensation methods for current transformers train neural networks using supervised learning on a set of preset operating conditions and labeled datasets collected under the same conditions. While this method achieves high error compensation accuracy under the conditions covered by the preset set, the complexity and variability of actual operating conditions make it difficult to create labeled datasets covering all working scenarios. This limits the generalization ability of the neural network under operating conditions outside the preset set, leading to reduced error compensation accuracy. Furthermore, traditional supervised learning-based error compensation methods typically treat ratio error and phase angle error as independent variables, neglecting their coupling relationship in the secondary current output.
[0003] In summary, there is a need for a current transformer error compensation method and system for AC sampling to address the shortcomings of existing technologies. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides a current transformer error compensation method and system for AC sampling, aiming to solve the aforementioned problems.
[0005] To achieve the above objectives, the present invention provides the following technical solution: a current transformer error compensation method for AC sampling, comprising the following steps:
[0006] Step S1: Under preset operating conditions, the primary side input current and its phase, the secondary side output current, the ambient temperature, the ambient humidity, and the secondary side load of the current transformer are collected. Based on the primary side input current, phase, and secondary side output current, the ratio difference and angle difference are calculated as labels to construct a labeled dataset.
[0007] Step S2: In the actual working environment of the current transformer, collect its secondary side output current, ambient temperature, ambient humidity and secondary side load in real time to construct an unlabeled dataset;
[0008] Step S3: Using the unlabeled dataset, a contrastive learning approach is used to pre-train the multilayer perceptron (MLP) network, enabling the MLP network to learn the similarities and differences in the physical models of current transformer errors under different operating conditions, and to construct a robust feature representation.
[0009] Step S4: Based on the pre-trained MLP network, supervised fine-tuning training is performed using the labeled dataset. A composite error term that integrates the coupling relationship between ratio difference and angle difference is introduced into the loss function of the fine-tuning training.
[0010] Step S5: Deploy the trained MLP network parameters to the edge inference device, collect the secondary output current of the current transformer, ambient temperature, ambient humidity and secondary load in real time, input them into the MLP network, obtain the predicted ratio difference and angle difference, and perform error compensation on the output of the current transformer.
[0011] Optionally, step S1 is implemented in the following manner:
[0012] Step A1: Systematic data acquisition. Based on the set operating condition matrix, the effective value and phase of the primary current, the effective value and phase of the secondary current, the ambient temperature and humidity, and the secondary load impedance of the current transformer are collected synchronously under different combinations of primary current, secondary load, and typical temperature and humidity to obtain the original characteristics.
[0013] Step A2: Calculate the ratio difference and angle difference of the monitoring tag. Calculate the angle difference using the synchronously acquired phase information. Calculate the ratio difference, i.e., the current error, based on the rated ratio of the transformer and the theoretical secondary current.
[0014] Step A3: Construct a structured dataset by pairing the raw features collected at each test point with the calculated angle difference ratio label to form a complete training sample. Construct a labeled dataset using all samples.
[0015] Optionally, step S2 is implemented in the following manner:
[0016] Step B1: Collect and record the effective value of the secondary output current of the current transformer, ambient temperature, ambient humidity and secondary load impedance under real power grid conditions;
[0017] Step B2: Construct an unlabeled dataset by pooling all raw sampled data from one or more mutual inductors into a central database and formatting it into a uniform structure to build an unlabeled dataset for comparative learning.
[0018] Optionally, step S3 is implemented in the following manner:
[0019] Step C1: Data preprocessing and augmentation. Standardize each feature dimension in the unlabeled dataset to eliminate dimensional differences. Generate positive samples by applying data augmentation that simulates real-world working condition perturbations to each original sample, and construct semantically consistent positive sample pairs.
[0020] Step C2: Construct the MLP encoder and projection head. The MLP encoder is designed as a multilayer perceptron that takes secondary side current, ambient temperature, humidity and load as inputs and outputs a high-dimensional latent vector as output, serving as the core module for downstream tasks.
[0021] The projection head maps features to a low-dimensional space dedicated to contrastive learning to obtain vectors by connecting a small MLP consisting of two fully connected layers after the encoder.
[0022] Step C3: Select a loss function and use InfoNCE loss as the optimization objective. This is achieved by maximizing the similarity between the encoder vector and the projection head vector of the same sample and its augmented positive sample in the projection space, and minimizing the similarity between the same sample and all other negative sample representations in the same batch.
[0023] Step C4: Perform training by inputting a batch of original samples and their corresponding augmented samples into the network. Two sets of representation vectors are obtained by passing the encoder and the projector head respectively. Calculate the InfoNCE loss and update the parameters of the entire network through backpropagation. Repeat the above process until the model converges.
[0024] Optionally, the MLP encoder includes an input connection layer, one or more fully connected layers, and an output connection layer connected in sequence, with each hidden layer employing the ReLU activation function.
[0025] Optionally, the contrastive learning in step S3 includes regularizing the unlabeled data, generating positive sample pairs through data augmentation, filtering negative samples from other samples in the batch based on cosine similarity, and optimizing the MLP network parameters using a contrastive loss function.
[0026] Optionally, step S4 is implemented in the following manner:
[0027] Step D1: Load the model. Load the MLP network weights that have completed the contrastive learning pre-training as the initial model for fine-tuning. The model input layer receives four features: secondary side output current, ambient temperature, ambient humidity, and secondary side load. The output layer contains two neurons to predict the ratio difference and angle difference.
[0028] Step D2: Construct a composite loss function. Design a composite loss function consisting of a mean square error monitoring term for the ratio difference and angle difference, and a coupled error term that reconstructs the primary current phasor based on the physical model and calculates the comprehensive deviation of the measured values on the complex plane.
[0029] Step D3: Model training fine-tuning. The total loss is formed by weighted summation of the conventional supervised loss and the composite error term. The MLP network is fine-tuned end-to-end by the optimizer to minimize this total loss, so that the model can explicitly satisfy the physical coupling relationship while fitting the ratio difference and angle difference labels, until the verification performance converges, and a high-precision and physically consistent mutual inductor error prediction model is obtained.
[0030] Optionally, step S5 is implemented in the following manner:
[0031] The fine-tuned MLP model is lightweighted and converted into an inference format for the target edge device. The inference runtime environment is integrated and deployed on the edge device, and the edge-side data acquisition module is configured. The data acquisition module inputs the preprocessed four-dimensional features into the loaded MLP model, and the edge device performs forward inference locally to quickly output the predicted ratio difference and angle difference values, and corrects the original secondary current measurement values.
[0032] A current transformer error compensation system for AC sampling, employing the aforementioned current transformer error compensation method for AC sampling, includes a tagged data collection module, an untagged data collection module, a data upload module, a model training module, a model parameter distribution module, and an edge inference module.
[0033] The tagged data collection module is used to collect the primary input current, primary input current phase, secondary output current, temperature, humidity, and secondary load of the current transformer under set operating conditions using relevant equipment, and calculate the ratio difference and angle difference as tags to form a tagged dataset.
[0034] The tagless data collection module is used to collect data on the secondary side output current, temperature, humidity, and secondary side load of the current transformer in real-time under actual working conditions, forming a tagless dataset.
[0035] The data upload module is used to upload the data collected by the labeled data collection module and the unlabeled data collection module to the model training module.
[0036] The model training module receives data uploaded from the data upload module. First, it pre-trains the MLP network using unlabeled data in a contrastive training manner. After the contrastive training converges, it fine-tunes the MLP network using labeled data on the pre-trained MLP network until the model converges again.
[0037] The model parameter distribution module is used to distribute the MLP network parameters trained by the model training module to the edge inference module.
[0038] The edge inference module is used to deploy the MLP network, receive model parameters from the model parameter distribution module, load the received parameters into its own MLP network, and collect the output of the current transformer, temperature, humidity, and secondary load input into the MLP network to obtain the ratio difference and angle difference obtained by the model fitting, and compensate the output of the current transformer.
[0039] The beneficial effects of this invention are:
[0040] 1. In this invention, the MLP network is subjected to comparative learning on an unlabeled dataset, enabling the MLP network to consolidate its learning of the similarity and differences of the physical model of current transformer error under different operating conditions, constructing a robust feature representation, and enhancing the generalization ability of the MLP network under unseen operating conditions. When training the MLP network in a supervised learning manner on a labeled dataset, the coupling relationship between the ratio difference and the angle difference is considered, and a composite error term is added to the loss function, enabling the MLP network to better fit the physical model of current transformer error and improve the accuracy of error compensation.
[0041] 2. This invention proposes a hybrid training strategy that integrates supervised learning and self-supervised contrastive learning. It effectively utilizes limited labeled data and a large amount of unlabeled field data. Through pre-training and fine-tuning mechanisms, it improves the generalization ability and robustness of the model under real and complex working conditions. It introduces a composite error term that couples the ratio difference and angle difference, making the compensation result more consistent with the physical characteristics of the transformer, improving the compensation accuracy, supporting edge deployment, and realizing low-latency, high-real-time online error compensation. It is suitable for scenarios with high response speed requirements, such as smart grids.
[0042] 3. In this invention, the system constructs an end-to-end error compensation system, covering the entire process of data acquisition, training, distribution, and inference. It features a modular design, strong scalability, and easy integration into existing power monitoring systems. It enables cloud-edge collaboration, with the cloud and center completing complex training and the edge completing efficient inference, balancing performance and efficiency. The overall system can dynamically adapt to non-ideal factors such as transformer aging, environmental changes, and load fluctuations, maintaining high-precision measurement over a long period. Attached Figure Description
[0043] Figure 1 This is a schematic diagram of a method flow of the present invention.
[0044] Figure 2 This is a schematic diagram of step S1 of the present invention.
[0045] Figure 3 This is a schematic diagram of step S2 of the present invention.
[0046] Figure 4 This is a schematic diagram of step S3 of the present invention.
[0047] Figure 5 This is a schematic diagram of step S4 of the present invention.
[0048] Figure 6 This is a schematic diagram of a comparative learning process according to the present invention.
[0049] Figure 7 This is a schematic diagram of a positive sample generation process according to the present invention.
[0050] Figure 8This is a schematic diagram of a negative sample generation process according to the present invention.
[0051] Figure 9 This is a schematic diagram of a system structure according to the present invention.
[0052] Figure 10 This is a schematic diagram of an MLP network structure according to the present invention. Detailed Implementation
[0053] To more clearly illustrate the technical solutions in the embodiments of the invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0054] like Figures 1 to 8 As shown, a current transformer error compensation method for AC sampling includes the following:
[0055] Step S1: Under preset operating conditions, the primary side input current and its phase, the secondary side output current, the ambient temperature, the ambient humidity, and the secondary side load of the current transformer are collected. Based on the primary side input current, phase, and secondary side output current, the ratio difference and angle difference are calculated as labels to construct a labeled dataset.
[0056] Implemented in the following ways:
[0057] Step A1: Systematic data acquisition. Based on the set operating condition matrix, the effective value and phase of the primary current, the effective value and phase of the secondary current, the ambient temperature and humidity, and the secondary load impedance of the current transformer are collected synchronously under different combinations of primary current, secondary load, and typical temperature and humidity to obtain the original characteristics.
[0058] Step A2: Calculate the ratio difference and angle difference of the monitoring tag. Calculate the angle difference using the synchronously acquired phase information. Calculate the ratio difference, i.e., the current error, based on the rated ratio of the transformer and the theoretical secondary current.
[0059] Step A3: Construct a structured dataset by pairing the raw features collected at each test point with the calculated angle difference ratio label to form a complete training sample. Construct a labeled dataset using all samples.
[0060] Step S2: In the actual working environment of the current transformer, collect its secondary side output current, ambient temperature, ambient humidity and secondary side load in real time to construct an unlabeled dataset;
[0061] Implemented in the following ways:
[0062] Step B1: Collect and record the effective value of the secondary output current of the current transformer, ambient temperature, ambient humidity and secondary load impedance under real power grid conditions;
[0063] Step B2: Construct an unlabeled dataset by pooling all raw sampled data from one or more mutual inductors into a central database and formatting it into a uniform structure to build an unlabeled dataset for comparative learning.
[0064] Step S3: Using the unlabeled dataset, a contrastive learning approach is used to pre-train the multilayer perceptron (MLP) network, enabling the MLP network to learn the similarities and differences in the physical models of current transformer errors under different operating conditions, and to construct a robust feature representation.
[0065] Implemented in the following ways:
[0066] Step C1: Data preprocessing and augmentation. Standardize the feature dimensions, ambient temperature, and ambient humidity in the unlabeled dataset to eliminate differences in units. Generate positive samples by applying data augmentation that simulates real working conditions to each original sample, and construct semantically consistent positive sample pairs.
[0067] Step C2: Construct the MLP encoder and projection head. The MLP encoder is designed as a multilayer perceptron that takes secondary side current, ambient temperature, humidity and load as inputs and outputs a high-dimensional latent vector as output, serving as the core module for downstream tasks.
[0068] The projection head maps features to a low-dimensional space dedicated to contrastive learning to obtain vectors by connecting a small MLP consisting of two fully connected layers after the encoder.
[0069] Step C3: Select a loss function and use InfoNCE loss as the optimization objective. This is achieved by maximizing the similarity between the encoder vector and the projection head vector of the same sample and its augmented positive sample in the projection space, and minimizing the similarity between the same sample and all other negative sample representations in the same batch.
[0070] Step C4: Perform training by inputting a batch of original samples and their corresponding augmented samples into the network. Two sets of representation vectors are obtained by passing the encoder and the projector head respectively. Calculate the InfoNCE loss and update the parameters of the entire network through backpropagation. Repeat the above process until the model converges.
[0071] The MLP encoder consists of an input connection layer, one or more fully connected layers, and an output connection layer connected in sequence. Each hidden layer uses the ReLU activation function. Contrastive learning includes regularizing the unlabeled data, generating positive sample pairs through data augmentation, filtering negative samples from other samples in the batch based on cosine similarity, and optimizing the MLP network parameters using a contrastive loss function.
[0072] Step S4: Based on the pre-trained MLP network, supervised fine-tuning training is performed using the labeled dataset. A composite error term that integrates the coupling relationship between ratio difference and angle difference is introduced into the loss function of the fine-tuning training.
[0073] Implemented in the following ways:
[0074] Step D1: Load the model. Load the MLP network weights that have completed the contrastive learning pre-training as the initial model for fine-tuning. The model input layer receives four features: secondary side output current, ambient temperature, ambient humidity, and secondary side load. The output layer contains two neurons to predict the ratio difference and angle difference.
[0075] Step D2: Construct a composite loss function. Design a composite loss function consisting of a mean square error monitoring term for the ratio difference and angle difference, and a coupled error term that reconstructs the primary current phasor based on the physical model and calculates the comprehensive deviation of the measured values on the complex plane.
[0076] Step D3: Model training fine-tuning. The total loss is formed by weighted summation of the conventional supervised loss and the composite error term. The MLP network is fine-tuned end-to-end by the optimizer to minimize this total loss, so that the model can explicitly satisfy the physical coupling relationship while fitting the ratio difference and angle difference labels, until the verification performance converges, and a high-precision and physically consistent mutual inductor error prediction model is obtained.
[0077] Step S5: Deploy the trained MLP network parameters to the edge inference device, collect the secondary output current of the current transformer, ambient temperature, ambient humidity and secondary load in real time, input them into the MLP network, obtain the predicted ratio difference and angle difference, and perform error compensation on the output of the current transformer.
[0078] The fine-tuned MLP model is lightweighted and converted into an inference format for the target edge device. The inference runtime environment is integrated and deployed on the edge device, and the edge-side data acquisition module is configured. The data acquisition module inputs the preprocessed four-dimensional features into the loaded MLP model, and the edge device performs forward inference locally to quickly output the predicted ratio difference and angle difference values, and corrects the original secondary current measurement values.
[0079] like Figure 6 As shown, the definition of the regularization function is:
[0080] In the formula This represents the i-th feature of curr_data. This represents the average of the i-th feature across all data in the dataset. It represents the standard deviation of the i-th feature across all data in the dataset.
[0081] like Figure 7 As shown, [] represents the array element retrieval operation, with element indices starting from 0, and random() is the random number generation function.
[0082] like Figure 8 As shown, the consine_similarity function is defined as follows:
[0083] In the formula Represents the dot product of vectors. The modulus representing the orientation quantity.
[0084] Figure 8 The calculation of the loss during contrastive learning is performed using the compute_contrastive_loss function, which is as follows:
[0085] ,
[0086] In the formula, L represents the loss value.
[0087] The loss function used in supervised learning in this patent is as follows:
[0088] In the formula, L is the loss value, λ is the parameter, and the specific expression of L1 is as follows:
[0089] In the formula, re is the ratio difference output by the MLP network during supervised learning inference, rel is the label ratio difference, pe is the angle difference output by the MLP network, pel is the label angle difference, and L2 is the composite error considering the coupling relationship between the mutual inductor angle difference and the ratio difference, specifically expressed as follows:
[0090] ,
[0091] In the formula This is the primary input phase current. To deduce the primary current based on the secondary output current and the current transformer ratio, and considering the inverse relationship between the current transformer ratio error and phase angle error, the phasor formula is as follows:
[0092] ,
[0093] In the formula denoted as the secondary output current of the current transformer, n as the transformation ratio of the current transformer, re as the ratio difference output by the MLP network, I1 as the amplitude of the primary phase current, and pe as the phase angle difference output by the MLP network.
[0094] like Figure 9and Figure 10 As shown, a current transformer error compensation system for AC sampling adopts the current transformer error compensation method for AC sampling, including a tagged data collection module, an untagged data collection module, a data upload module, a model training module, a model parameter distribution module, and an edge inference module.
[0095] The tagged data collection module is used to collect the primary input current, primary input current phase, secondary output current, temperature, humidity, and secondary load of the current transformer under set operating conditions using relevant equipment, and calculate the ratio difference and angle difference as tags to form a tagged dataset.
[0096] The tagless data collection module is used to collect data on the secondary side output current, temperature, humidity, and secondary side load of the current transformer in real-time under actual working conditions, forming a tagless dataset.
[0097] The data upload module is used to upload the data collected by the labeled data collection module and the unlabeled data collection module to the model training module.
[0098] The model training module receives data uploaded from the data upload module. First, it pre-trains the MLP network using unlabeled data in a contrastive training manner. After the contrastive training converges, it fine-tunes the MLP network using labeled data on the pre-trained MLP network until the model converges again.
[0099] The model parameter distribution module is used to distribute the MLP network parameters trained by the model training module to the edge inference module.
[0100] The edge inference module is used to deploy the MLP network, receive model parameters from the model parameter distribution module, load the received parameters into its own MLP network, and collect the output of the current transformer, temperature, humidity, and secondary load input into the MLP network to obtain the ratio difference and angle difference obtained by the model fitting, and compensate the output of the current transformer.
[0101] The labeled data collection module collects labeled data and passes it to the data upload module. The unlabeled data collection module collects unlabeled data and passes it to the data upload module. The data upload module receives the data from both the labeled and unlabeled data collection modules and uploads it to the model training module. The model training module receives the dataset uploaded by the data upload module, then uses the unlabeled dataset to train the MLP network through comparative training. It then uses the labeled dataset to fine-tune the MLP network. After the model converges, it passes the model parameters to the model parameter distribution module. The model parameter distribution module receives the model parameters from the model training module and distributes them to the edge inference module. The edge inference module loads the model parameters distributed by the model parameter distribution module into its own deployed MLP network. It also collects the output current, temperature, humidity, and load of the current transformer in real time, inputs them into its own deployed deep parameter network, performs inference, obtains error prediction values, and compensates for the output of the current transformer.
[0102] The ability of the MLP network to perceive changes in operating conditions has been improved: By comparing and training with unlabeled data, the MLP network's ability to understand the differences in data under different operating conditions has been enhanced, the generalization ability of the MLP network to different operating conditions has been improved, and the error compensation accuracy of the MLP network for current transformers has been improved.
[0103] like Figure 10 As shown, the input connection layer is defined as follows:
[0104] In the formula x is the input vector of the MLP network. , y is the output vector of the input connection layer. , This is the ReLU activation function. Figure 10 The fully connected layer in the middle is defined as follows:
[0105] In the formula x is the input vector of the current layer. , y is the output vector of the fully connected layer. , This is the ReLU activation function. Figure 10 The output connection layer is:
[0106] In the formula x is the input vector of the current layer. , y is the output vector of the MLP network. , This is the ReLU activation function.
[0107] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions or improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for compensating errors in a current transformer used for AC sampling, characterized in that, Includes the following steps: Step S1: Under preset operating conditions, the primary side input current and its phase, the secondary side output current, the ambient temperature, the ambient humidity, and the secondary side load of the current transformer are collected. Based on the primary side input current, phase, and secondary side output current, the ratio difference and angle difference are calculated as labels to construct a labeled dataset. Step S2: In the actual working environment of the current transformer, collect its secondary side output current, ambient temperature, ambient humidity and secondary side load in real time to construct an unlabeled dataset; Step S3: Using the unlabeled dataset, a contrastive learning approach is used to pre-train the multilayer perceptron (MLP) network, enabling the MLP network to learn the similarities and differences in the physical models of current transformer errors under different operating conditions, and to construct a robust feature representation. Step S4: Based on the pre-trained MLP network, supervised fine-tuning training is performed using the labeled dataset. A composite error term that integrates the coupling relationship between ratio difference and angle difference is introduced into the loss function of the fine-tuning training. Step S5: Deploy the trained MLP network parameters to the edge inference device, collect the secondary output current of the current transformer, ambient temperature, ambient humidity and secondary load in real time, input them into the MLP network, obtain the predicted ratio difference and angle difference, and perform error compensation on the output of the current transformer.
2. The current transformer error compensation method for AC sampling according to claim 1, characterized in that, Step S1 is implemented in the following manner: Step A1: Systematic data acquisition. Based on the set operating condition matrix, the effective value and phase of the primary current, the effective value and phase of the secondary current, the ambient temperature and humidity, and the secondary load impedance of the current transformer are collected synchronously under different combinations of primary current, secondary load, and typical temperature and humidity to obtain the original characteristics. Step A2: Calculate the ratio difference and angle difference of the monitoring tag. Calculate the angle difference using the synchronously acquired phase information. Calculate the ratio difference, i.e., the current error, based on the rated ratio of the transformer and the theoretical secondary current. Step A3: Construct a structured dataset by pairing the raw features collected at each test point with the calculated angle difference ratio label to form a complete training sample. Construct a labeled dataset using all samples.
3. The current transformer error compensation method for AC sampling according to claim 1, characterized in that, Step S2 is implemented in the following manner: Step B1: Collect and record the effective value of the secondary output current of the current transformer, ambient temperature, ambient humidity and secondary load impedance under real power grid conditions; Step B2: Construct an unlabeled dataset by pooling all raw sampled data from one or more mutual inductors into a central database and formatting it into a uniform structure to build an unlabeled dataset for comparative learning.
4. The current transformer error compensation method for AC sampling according to claim 1, characterized in that, Step S3 is implemented in the following manner: Step C1: Data preprocessing and augmentation. Standardize each feature dimension in the unlabeled dataset to eliminate dimensional differences. Generate positive samples by applying data augmentation that simulates real-world working condition perturbations to each original sample, and construct semantically consistent positive sample pairs. Step C2: Construct the MLP encoder and projection head. The MLP encoder is designed as a multilayer perceptron that takes secondary side current, ambient temperature, humidity and load as inputs and outputs a high-dimensional latent vector as output, serving as the core module for downstream tasks. The projection head maps features to a low-dimensional space dedicated to contrastive learning to obtain vectors by connecting a small MLP consisting of two fully connected layers after the encoder. Step C3: Select a loss function and use InfoNCE loss as the optimization objective. This is achieved by maximizing the similarity between the encoder vector and the projection head vector of the same sample and its augmented positive sample in the projection space, and minimizing the similarity between the same sample and all other negative sample representations in the same batch. Step C4: Perform training by inputting a batch of original samples and their corresponding augmented samples into the network. Two sets of representation vectors are obtained by passing the encoder and the projector head respectively. Calculate the InfoNCE loss and update the parameters of the entire network through backpropagation. Repeat the above process until the model converges.
5. The current transformer error compensation method for AC sampling according to claim 4, characterized in that, The MLP encoder includes an input connection layer, one or more fully connected layers, and an output connection layer connected in sequence, with each hidden layer employing the ReLU activation function.
6. The current transformer error compensation method for AC sampling according to claim 1, characterized in that, The contrastive learning in step S3 includes regularizing the unlabeled data, generating positive sample pairs through data augmentation, filtering negative samples from other samples in the batch based on cosine similarity, and optimizing the MLP network parameters using a contrastive loss function.
7. The current transformer error compensation method for AC sampling according to claim 1, characterized in that, Step S4 is implemented in the following manner: Step D1: Load the model. Load the MLP network weights that have completed the contrastive learning pre-training as the initial model for fine-tuning. The model input layer receives four features: secondary side output current, ambient temperature, ambient humidity, and secondary side load. The output layer contains two neurons to predict the ratio difference and angle difference. Step D2: Construct a composite loss function. Design a composite loss function consisting of a mean square error monitoring term for the ratio difference and angle difference, and a coupled error term that reconstructs the primary current phasor based on the physical model and calculates the comprehensive deviation of the measured values on the complex plane. Step D3: Model training fine-tuning. The total loss is formed by weighted summation of the conventional supervised loss and the composite error term. The MLP network is fine-tuned end-to-end by the optimizer to minimize this total loss, so that the model can explicitly satisfy the physical coupling relationship while fitting the ratio difference and angle difference labels, until the verification performance converges, and a high-precision and physically consistent mutual inductor error prediction model is obtained.
8. The current transformer error compensation method for AC sampling according to claim 1, characterized in that, Step S5 is implemented in the following manner: The fine-tuned MLP model is lightweighted and converted into an inference format for the target edge device. The inference runtime environment is integrated and deployed on the edge device, and the edge-side data acquisition module is configured. The data acquisition module inputs the preprocessed four-dimensional features into the loaded MLP model, and the edge device performs forward inference locally to quickly output the predicted ratio difference and angle difference values, and corrects the original secondary current measurement values.
9. A current transformer error compensation system for AC sampling, employing the current transformer error compensation method for AC sampling as described in any one of claims 1-8, characterized in that, It includes a labeled data collection module, an unlabeled data collection module, a data upload module, a model training module, a model parameter distribution module, and an edge inference module; The tagged data collection module is used to collect the primary input current, primary input current phase, secondary output current, temperature, humidity, and secondary load of the current transformer under set operating conditions using relevant equipment, and calculate the ratio difference and angle difference as tags to form a tagged dataset. The tagless data collection module is used to collect the secondary side output current, temperature, humidity and secondary side load of the current transformer in real working scenarios to form a tagless dataset. The data upload module is used to upload the data collected by the labeled data collection module and the unlabeled data collection module to the model training module. The model training module is used to receive data uploaded from the data upload module. First, it pre-trains the MLP network using unlabeled data in a contrastive training method. After the contrastive training converges, it fine-tunes the MLP network using labeled data on the pre-trained MLP network until the model converges again. The model parameter distribution module is used to distribute the MLP network parameters trained by the model training module to the edge inference module; The edge inference module is used to deploy the MLP network, receive model parameters from the model parameter distribution module, load the received parameters into its own MLP network, and collect the output of the current transformer, temperature, humidity, and secondary load input into the MLP network to obtain the ratio difference and angle difference obtained by the model fitting, and compensate the output of the current transformer.