Leakage protection device and method
By introducing a signal generation model and Bayesian optimization method into the leakage protector, reference data is automatically generated based on the power grid load data, the problem of low detection accuracy of existing leakage protectors in different environments is solved, and the flexibility of leakage detection is improved and reliability reduces misoperation and missed actions, ensuring user safety.
Patent Information
- Application Number
- CN202411253491.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-09
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-09-09
AI Technical Summary
The existing leakage protectors have a constant signal threshold under different detection environments and load conditions, which can easily lead to mis-checking or mischecking, affecting detection accuracy and reliability.
Adaptive leakage protection equipment is adopted to generate reference data based on the power grid load data through the trained signal generation model, and compare it with the detected current signal effective value to determine whether it is leakage, including amplification module, rectification module, calculation module, reference Modules, comparison modules and switch modules, optimize machine learning models using Bayesian optimization and K-fold cross-validation methods to improve detection accuracy and reliability.
Adaptive adjustment of leakage detection is realized, detection accuracy and reliability are improved, power supply interruptions caused by malfunctioning or leakage are reduced, and user safety is ensured.
Smart Images

Figure CN118763595B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of leakage protection, and in particular to a leakage protection device and method. Background Art
[0002] A leakage protection device (LPD), also known as a leakage circuit breaker or leakage protection switch, is a safety device used to detect leakage in electrical circuits and quickly cut off the power supply to prevent electrical accidents. Its main function is to protect personal safety and equipment safety, and prevent electric shock accidents or fires caused by leakage. Existing leakage protection devices amplify and rectify the detected current signal, and compare it with the signal threshold. If the signal threshold is exceeded, it is considered that leakage has occurred.
[0003] However, the signal threshold is usually generated by a fixed circuit, but different detection environments and load conditions will cause the leakage current signal to change. If the signal threshold remains unchanged, it is easy to cause false detection or missed detection in some cases. Summary of the invention
[0004] The present application provides a leakage protection device and method, which can realize adaptive adjustment of reference data, make leakage detection more flexible and reliable, improve the detection accuracy and reliability of leakage protection equipment in various working environments, reduce power supply interruptions caused by false operation or leakage operation, and ensure user safety at the same time.
[0005] In a first aspect, an embodiment of the present application provides a leakage protection device, including:
[0006] an amplification module, used for receiving and amplifying the current signal of the current transformer to obtain an amplified signal;
[0007] A rectifier module, used for receiving the amplified signal from the amplifier module and rectifying it to obtain a rectified signal;
[0008] A calculation module, used for receiving and calculating the effective value of the rectified signal of the rectifier module and using it as the data to be tested;
[0009] A reference module is used to input the acquired power grid load data into the trained signal generation model to obtain reference data;
[0010] A comparison module is used to compare the reference data with the data to be tested to obtain the leakage detection result;
[0011] The switch module is used to receive the leakage detection result of the comparison module and disconnect the line from the load when the leakage detection result is leakage.
[0012] Furthermore, the above-mentioned amplification module includes:
[0013] Interconnected switched capacitor amplifier and instrumentation amplifier;
[0014] A switched capacitor amplifier, used to amplify the current signal and output a gain signal;
[0015] The instrument amplifier is used to amplify the differential mode signal in the gain signal and output the amplified signal.
[0016] Furthermore, the above-mentioned power grid load data includes:
[0017] The current data, voltage data and power factor between two adjacent nodes of the leakage protection device at the access location of the power grid system within a preset time period with the current time as the end time.
[0018] Furthermore, the above-mentioned power grid load data also includes:
[0019] The air temperature data and air humidity data within a preset time period starting from the current time.
[0020] Furthermore, the above reference module is specifically used for:
[0021] Obtain historical load data between two adjacent nodes where the leakage protection device is connected to the power grid system;
[0022] Identify severe out-of-limit scenarios in historical load data;
[0023] The historical load data corresponding to the serious over-limit scenario is marked as leakage load data;
[0024] Determine the hyperparameter combination of machine learning models based on Bayesian optimization methods;
[0025] Input historical load data and leakage load data into the machine learning model for training;
[0026] The K-fold cross-validation method is used to determine whether the machine learning model reaches the preset variance;
[0027] If not, the training is terminated and the machine learning model is used as the signal generation model.
[0028] Furthermore, the above reference module is also used for:
[0029] Before determining the serious over-limit scenario, perform denoising filtering on the historical load data;
[0030] Linear interpolation is used to supplement the missing point values in the historical load data.
[0031] Furthermore, the above device also includes:
[0032] The early warning module is used to input the real-time load data into the trained current prediction model to obtain the predicted current effective value; obtain the reference data of the reference module, and issue a leakage warning when the predicted current effective value exceeds the reference data.
[0033] Furthermore, the above-mentioned calculation module is also used for:
[0034] The peak value of the rectified signal of the rectifier module is received and calculated, and used as the data to be tested.
[0035] Furthermore, the above-mentioned device also includes: a communication module, which is used to upload the amplified signal, the rectified signal, the data to be tested, the reference data and the leakage detection result to the cloud server.
[0036] Furthermore, the reference module is also used to: receive user instructions from the communication module, and generate reference data according to the user instructions.
[0037] In a second aspect, an embodiment of the present application provides a leakage protection method, including:
[0038] Receive the current signal of the current transformer and input it into the amplification module for amplification to obtain an amplified signal;
[0039] Inputting the amplified signal into a rectifier module for rectification to obtain a rectified signal;
[0040] Calculating the effective value of the rectified signal by a calculation module and using it as the data to be measured;
[0041] Obtain grid load data and input it into the trained signal generation model of the reference module to obtain reference data;
[0042] Inputting the data to be tested and the reference data into a comparator to obtain a leakage detection result;
[0043] The leakage detection result is input into the switch module, so that the switch module disconnects the connection between the line and the load when the leakage detection result is leakage.
[0044] Furthermore, the method further comprises:
[0045] Obtain historical load data between two adjacent nodes where the leakage protection device is connected to the power grid system;
[0046] Identify severe out-of-limit scenarios in historical load data;
[0047] The historical load data corresponding to the serious over-limit scenario is marked as leakage load data;
[0048] Determine the hyperparameter combination of machine learning models based on Bayesian optimization methods;
[0049] Input historical load data and leakage load data into the machine learning model for training;
[0050] The K-fold cross-validation method is used to determine whether the machine learning model reaches the preset variance;
[0051] If not, the training is terminated and the machine learning model is used as the signal generation model.
[0052] Furthermore, the above-mentioned determination of severe over-limit scenarios in historical load data includes:
[0053] Calculate the active power flow value based on the historical load data at the same time;
[0054] Determine whether the active power flow value exceeds the preset power flow limit;
[0055] If so, the active power flow value and the corresponding time are regarded as a serious over-limit scenario.
[0056] Furthermore, the K-fold cross-validation method is used to determine whether the machine learning model reaches a preset variance, including:
[0057] Extract a normal test subset from the historical load data;
[0058] After each training, the normal test subset is input into the machine learning model to obtain the test data corresponding to multiple trainings;
[0059] Calculate the test variance of the latest preset number of test data;
[0060] Determine whether the test variance reaches the preset variance.
[0061] Furthermore, the above-mentioned hyperparameter combination of the machine learning model determined based on the Bayesian optimization method includes:
[0062] Construct an objective function; the objective function takes the hyperparameter combination as input and takes the difference between two output data corresponding to the two input historical load data of the machine learning model under the hyperparameter combination as output;
[0063] Define the value range of each hyperparameter in the hyperparameter combination;
[0064] Select the Bayesian optimization library and use it to update the hyperparameter combination;
[0065] Input the hyperparameter combination into the objective function and record the function value of the objective function;
[0066] After repeated updates for multiple times, the hyperparameter combination corresponding to the minimum function value is selected.
[0067] Furthermore, the above-mentioned training is completed, and the machine learning model is used as a signal generation model, including:
[0068] When the test variance is less than the preset variance, the average value of each test data corresponding to the test variance is calculated;
[0069] The machine learning model corresponding to the test data closest to the mean value is selected as the signal generation model.
[0070] Furthermore, the above method also includes:
[0071] Before determining the severe over-limit scenario, the historical load data is subjected to denoising filtering.
[0072] Furthermore, the above method also includes:
[0073] After filtering, the missing point values in the historical load data are supplemented by linear interpolation.
[0074] Furthermore, the above method also includes:
[0075] After marking the leakage load data, the quantity difference between the historical load data and the leakage load data is calculated;
[0076] If the quantity difference is greater than the preset training difference, historical load data equal to half of the quantity difference is randomly selected to add noise to make it leakage load data.
[0077] Furthermore, the loss function of the machine learning model is a binary cross entropy loss function or a focal loss function.
[0078] In summary, compared with the prior art, the technical solution provided in the embodiment of the present application has at least the following beneficial effects:
[0079] A leakage protection device provided in an embodiment of the present application introduces a large model in the process of generating reference data, generates reference data under the current working environment of the leakage protection device according to the grid load data through a trained signal generation model, and then compares the reference data with the effective value of the detected current signal to determine whether there is a leakage; the present application realizes adaptive adjustment of reference data, making leakage detection more flexible and reliable, improving the detection accuracy and reliability of the leakage protection device in various working environments, reducing power supply interruptions caused by false operations or missed operations, and ensuring the safety of users. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] Figure 1 A structural diagram of a leakage protection device provided as an exemplary embodiment of the present application.
[0081] Figure 2 An internal structural diagram of an amplification module provided for an exemplary embodiment of the present application.
[0082] Figure 3 A structural diagram of a leakage protection device provided as yet another exemplary embodiment of the present application.
[0083] Figure 4 A flow chart of a leakage protection method provided for an exemplary embodiment of the present application.
[0084] Figure 5 A flowchart of the model training steps provided for an exemplary embodiment of the present application.
[0085] Figure 6 A flowchart of the model performance determination steps provided for an exemplary embodiment of the present application.
[0086] Figure 7 A flowchart of the hyperparameter optimization steps provided for an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0087] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0088] Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making any creative work shall fall within the scope of protection of this application.
[0089] See also Figure 1 The embodiment of the present application provides a leakage protection device, which may specifically include: an amplification module, a rectification module, a calculation module, a reference module, a comparison module and a switch module.
[0090] The amplification module is used to receive the current signal of the current transformer and amplify it to obtain an amplified signal.
[0091] Specifically, the leakage protection device is connected to the grid circuit through a zero-sequence current transformer. When the circuit is working normally, the current vector sum of the phase line and the neutral line is zero, and the current transformer does not generate an induced electromotive force. When leakage occurs, the current vector sum is not zero, and the secondary coil of the current transformer generates an induced electromotive force and sends a current signal to the amplifier module.
[0092] The rectifier module is used to receive the amplified signal from the amplifier module and perform rectification to obtain a rectified signal.
[0093] Specifically, in an electronic leakage protector, the amplified current signal needs to be rectified by a rectifier to convert the AC signal into a DC signal for subsequent electronic circuit processing. The implementation method of the rectifier module mainly includes:
[0094] Half-wave rectification: A simple rectifier circuit composed of a diode, which only uses the positive half-cycle or negative half-cycle of the alternating current for rectification, outputs pulsating direct current, and has a low current utilization rate, making it suitable for high voltage and low current occasions.
[0095] Full-wave rectification: It is composed of two diodes and a transformer secondary coil with a center tap. It can use the positive and negative half-cycles of the alternating current for rectification, output smoother direct current, and improve the utilization rate of the current.
[0096] Bridge rectifier: Using four diodes to form a bridge structure can also achieve the effect of full-wave rectification, and the structure is simple.
[0097] Synchronous rectification: Synchronous rectification technology is used to control the switching timing of the rectifier devices to achieve synchronization of voltage and current waveforms during the rectification process, reduce switching losses, and improve rectification efficiency.
[0098] The rectifier module first steps down the AC current signal through a transformer to adapt to the operating voltage range of the rectifier circuit. Then, through the unidirectional conductivity of the rectifier device (such as a diode), the current is allowed to flow in only one direction, thereby realizing the conversion from AC to DC. Among them, for full-wave or bridge rectification, a specific circuit structure is used to ensure that both the positive and negative half-cycles of the AC power can be utilized and a relatively smooth DC power is output. Finally, through components such as filter capacitors, the AC component in the DC voltage is further reduced to improve the stability of the output voltage. When designing a rectifier module, it is necessary to consider parameters such as the current carrying capacity, reverse voltage, packaging, and data sheet of the rectifier device to ensure that the rectifier module can work safely and effectively.
[0099] The calculation module is used to receive and calculate the effective value of the rectified signal of the rectifier module and use it as the data to be tested.
[0100] Specifically, the effective value The calculation formula is:
[0101]
[0102] in, is the DC voltage value of the rectified signal after rectification.
[0103] The reference module is used to input the acquired power grid load data into the trained signal generation model to obtain reference data.
[0104] The grid load data may include: current data, voltage data and power factor between two adjacent nodes of the leakage protection device at the access location of the grid system within a preset time period with the current time as the end time.
[0105] This application uses the access position of the current transformer as a reference, and the circuit nodes on the left and right sides of the access position as end points to obtain the grid load data between the two circuit nodes in a preset time period, such as the last hour.
[0106] The comparison module is used to compare the reference data with the data to be tested to obtain the leakage detection result.
[0107] Specifically, the data to be tested and the reference data are input into the comparison module in the form of corresponding voltage values. When the data to be tested is greater than the reference data, the leakage detection result is leakage, otherwise it is normal.
[0108] The comparison module is specifically a comparator, which receives two input voltages and outputs a high-level or low-level signal, i.e., the leakage detection result, according to the magnitude of the two input voltages. The terminal structure of the comparator is the same as that of the operational amplifier, and usually includes a positive power supply terminal, a negative power supply terminal, a positive input terminal, a negative input terminal, and an output terminal.
[0109] A major difference between a comparator and an operational amplifier is that a comparator is not designed to form a negative feedback circuit and therefore does not have a built-in phase compensation capacitor. This means that the response time of a comparator is usually faster than that of an operational amplifier because the phase compensation capacitor limits the response time between input and output, so the comparator can quickly output leakage detection results to ensure power safety.
[0110] The internal circuit structure of a comparator usually consists of an input stage, an intermediate stage, and an output stage. The input stage usually takes the form of a differential amplifier, the intermediate stage includes some gain stages to increase the response speed, and the output stage provides different output forms as needed, such as open collector or push-pull output. When designing a comparator circuit, its electrical characteristics need to be considered, including input bias current, input offset voltage, power supply voltage rejection ratio (PSRR), common mode signal rejection ratio (CMRR), etc.
[0111] In addition, the frequency characteristics of the comparator are also one of the factors that need to be considered during design. The gain of the comparator decreases as the frequency increases, which is similar to an operational amplifier. The gain-bandwidth product (GBW) is a parameter that describes the available frequency bandwidth of the comparator under small signal conditions. Due to its fast response characteristics, comparators are very useful in situations where voltage changes need to be detected quickly.
[0112] The switch module is used to receive the leakage detection result of the comparison module, and disconnect the connection between the line and the load when the leakage detection result is leakage. The switch module can be a tripper, which is arranged in the circuit. When the tripper is disconnected, it is equivalent to disconnecting the connection between the circuit and the load, thereby cutting off the power supply of the leakage and ensuring the safety of the user.
[0113] The above-mentioned embodiment provides a leakage protection device, which introduces a large model in the process of generating reference data, generates reference data under the current working environment of the leakage protection device according to the grid load data through a trained signal generation model, and then compares the reference data with the effective value of the detected current signal to determine whether there is a leakage. The present application realizes adaptive adjustment of reference data, making leakage detection more flexible and reliable, improving the detection accuracy and reliability of the leakage protection device in various working environments, reducing power supply interruptions caused by false operations or leakage operations, and ensuring the safety of users.
[0114] See also Figure 2 In some embodiments, the amplification module includes: a switched capacitor amplifier and an instrumentation amplifier connected to each other. The switched capacitor amplifier is used to amplify the current signal and output a gain signal.
[0115] The instrument amplifier is used to amplify the differential mode signal in the gain signal and output the amplified signal.
[0116] Among them, the switched capacitor amplifier uses a combination of switches and capacitors to sample, hold and amplify the received current signal, while the instrumentation amplifier (IA amplifier) is an amplifier with differential input and single-ended output, which has the characteristics of high input impedance, low noise and high common mode rejection ratio (CMRR).
[0117] Specifically, the working principle of the switched capacitor amplifier is based on the fact that when the switch is turned on, the capacitor charges or discharges at a high speed to sample the current signal; when the switch is turned off, the voltage of the capacitor is maintained as the output signal. Through continuous switching operations, the voltage of the capacitor is quickly sampled and maintained to achieve signal amplification. The switched capacitor amplifier has the characteristics of high gain, wide bandwidth, low noise, low power consumption and high stability. It is suitable for occasions where weak signals need to be amplified, and its power consumption is low.
[0118] IA amplifiers are usually constructed from three operational amplifiers, two of which are used as differential input stages to provide high input impedance, and the third as a gain stage. IAs are primarily used to amplify small differential signals and provide common-mode rejection, eliminating any signals with the same potential on both inputs and only amplifying signals with a potential difference between the inputs.
[0119] When the switched capacitor amplifier and the IA amplifier are used in combination, the high gain and wide bandwidth characteristics of the switched capacitor amplifier can be used for preliminary amplification, and then the IA amplifier can be used for further precise amplification and improve the common-mode rejection capability of the signal. This combination of amplifier modules can provide high-precision, low-noise, and high-stability signal amplification.
[0120] Furthermore, the amplification module of the present application adopts chopping to adjust and amplify the current signal. Chopping technology is a technology used to improve accuracy and stability in analog signal processing, also known as "chopping" technology. The core idea is to modulate a direct current (DC) signal or a low-frequency signal to a higher frequency, and then filter out the high-frequency component through a low-pass filter (LPF), thereby restoring the original DC or low-frequency signal, but with lower noise and offset.
[0121] The present application applies chopping technology in the amplification module, which can not only achieve lower input offset voltage and almost unmeasured offset drift by eliminating the offset voltage in real time, but also effectively reduce low-frequency noise, especially 1 / f noise, which is crucial to improving the accuracy of the amplification module.
[0122] In addition, chopping technology also helps to reduce the impact of temperature changes on the performance of the amplifier module.
[0123] In some embodiments, the above-mentioned power grid load data also includes:
[0124] The air temperature data and air humidity data within a preset time period starting from the current time.
[0125] Specifically, changes in temperature and humidity will affect the working state of electrical equipment or circuits; higher temperature and humidity or temperature and humidity with large changes will increase the risk of leakage, and the corresponding reference data should be appropriately adjusted downward.
[0126] In some embodiments, the reference module is specifically used to perform the following steps:
[0127] Obtain historical load data between two adjacent nodes where the leakage protection device is connected to the power grid system.
[0128] Identify critical out-of-limit scenarios in historical load data.
[0129] The historical load data corresponding to the serious over-limit scenario is the leakage load data.
[0130] Determine the hyperparameter combination of machine learning models based on Bayesian optimization methods.
[0131] The historical load data and leakage load data are input into the machine learning model for training.
[0132] The K-fold cross-validation method is used to determine whether the machine learning model reaches the preset variance.
[0133] If not, the training is terminated and the machine learning model is used as the signal generation model.
[0134] Among them, the data types included in the historical load data are the same as those of the above-mentioned power grid load data. The difference is that the collection time of the historical load data is different from the "preset time period with the current time as the end time" of the above-mentioned power grid load data, and in order to train the model, the amount of historical load data must also be much larger than that of the power grid load data.
[0135] The machine learning model can adopt random forest model or gradient boosting machine, etc.
[0136] Specifically, since there is no trained signal generation model to generate reference data to determine whether the historical load data was collected under leakage conditions before the machine learning model is trained, the present application uses the judgment of out-of-limit scenarios to screen the historical load data under leakage conditions before training, and inputs the data into the machine learning model as leakage load data, so that the machine learning model can learn the boundary between normal operation and leakage of the circuit under different load data, thereby accurately locating the reference data.
[0137] Furthermore, before training the machine learning, the present application uses the Bayesian optimization method to determine the hyperparameter combination of the machine learning model, where the hyperparameter combination includes the amount of data input to the machine learning model each time, the number of convolution layers (if the model used includes convolution layers), the learning rate, etc. Tuning the hyperparameters of the machine learning model between trainings helps improve the training efficiency of the machine learning model and ensure the generalization ability of the signal generation model.
[0138] The Bayesian optimization method used in the reference module of this application is an efficient hyperparameter optimization method. It approximates the objective function by building a proxy model and intelligently selects hyperparameter combinations for evaluation. The basic idea of Bayesian optimization is to use the Gaussian process model to predict the objective function and use the acquisition function (such as expected improvement EI) to determine the next sampling point. This process is repeated until the optimal hyperparameter combination is found.
[0139] Finally, this application uses the K-fold cross-validation method to verify whether the performance of the trained machine learning model meets the standard for ending training. The K-fold cross-validation method here is a statistical method, which is mainly used to verify the generalization ability and stability of the model to ensure that the trained signal generation model can also perform well on new power grid load data.
[0140] The reference module proposed in the above embodiment can improve the training efficiency of the machine learning model and ensure the stability of the trained signal generation model by determining the out-of-limit scenario, hyperparameter tuning and K-fold cross-validation method and other operations.
[0141] In some embodiments, the reference module is further used to:
[0142] Before determining the severe over-limit scenario, the historical load data is subjected to denoising filtering.
[0143] Linear interpolation is used to supplement the missing point values in the historical load data.
[0144] Specifically, the reference module denoises and filters the collected historical load data before determining the serious over-limit scenario so that the serious over-limit scenario can be accurately determined; secondly, if there are missing values in the collected historical load data, they are supplemented based on linear interpolation to avoid the missing data affecting the judgment of the serious over-limit scenario.
[0145] The reference module of the above embodiment pre-processes the collected historical load data before determining the serious over-limit scenario, thereby improving the accuracy of determining the serious over-limit scenario and the accuracy of marking the leakage load data.
[0146] See also Figure 3 In some embodiments, the above device may further include:
[0147] The early warning module is used to input the real-time load data into the trained current prediction model to obtain the predicted current effective value; obtain the reference data of the reference module, and issue a leakage warning when the predicted current effective value exceeds the reference data.
[0148] The real-time load data is the load data of the line between two adjacent nodes at the access position at the current moment.
[0149] Specifically, the early warning module predicts the predicted effective current value at the next moment, while the reference module calculates the reference data based on the grid load data of a preset time period. The preset time period often includes grid load data of multiple moments. Therefore, even if the grid load data of the next moment is added, in most cases it will not cause too much impact on the reference data output by the signal generation model. Therefore, this application allows the early warning module to directly obtain the reference data and compare it with the predicted effective current value, which can realize the leakage warning of the circuit, remind the user to respond as soon as possible, and ensure the safety of electricity use.
[0150] In some embodiments, the above-mentioned calculation module is also used for:
[0151] The peak value of the rectified signal of the rectifier module is received and calculated, and used as the data to be tested.
[0152] Specifically, in addition to using the effective value of the rectified signal as the data to be tested, the peak value of the rectified signal can also be used as the data to be tested; whether to choose the effective value or the peak value for threshold judgment depends on the specific application scenario and safety standards.
[0153] In most cases, the effective value provides a more comprehensive and accurate assessment of the impact of current. Using the effective value as a basis for judgment can better reflect the thermal effect of current on the human body, because the human body's perception and tolerance of current is related to the heat generated by the current; and the peak current is important for detecting whether the insulation performance of electrical equipment has declined, and can quickly identify potential insulation problems. In practical applications, the measurement results of the effective value and the peak value can also be combined to jointly determine whether there is leakage.
[0154] In some embodiments, the above-mentioned device also includes: a communication module, which is used to upload the amplified signal, the rectified signal, the data to be tested, the reference data and the leakage detection result to the cloud server.
[0155] Specifically, the present application may adopt a PLC-based communication module.
[0156] When conducting leakage detection, the PLC communication module can use its communication capabilities to read the status and actions of various modules. In addition, the PLC communication module can also control the actions of the switch module, such as tripping or closing.
[0157] The basic principle of PLC communication is to achieve data exchange through various communication interfaces and protocols. Common PLC communication interfaces include serial ports, Ethernet ports, etc., while communication protocols such as MODBUS, Profibus, EtherNet / IP, etc. support efficient and stable communication between different devices. In practical applications, the PLC communication module can send alarm information to the cloud server through the communication interface when the leakage detection result is leakage, so as to realize remote reminder of users and improve the reliability of equipment; in addition, the communication capability of PLC is not limited to the connection with the leakage protector, but can also realize communication with other intelligent systems such as the host computer and human-machine interface (HMI), so as to realize more extensive system integration and monitoring.
[0158] In some embodiments, the reference module is further used to:
[0159] Receive user instructions from the communication module, and generate reference data according to the user instructions.
[0160] Specifically, the communication module can also receive user instructions and send them to the reference module. At this time, the reference module can use the specified threshold in the user instruction as reference data, that is, the user can remotely control the reference data for leakage detection.
[0161] Furthermore, since the setting of reference data is closely related to the accuracy of leakage protection, after receiving the user instruction, it is necessary to judge the difference between the specified threshold in the user instruction and the reference data, and modification is allowed only when the difference is within a certain range; or security verification can be set in the communication module: after receiving the user instruction, the communication module sends a verification code to the terminal that sends the user instruction, and only after receiving the verification code sent by the user terminal is the user instruction allowed to be sent to the reference module.
[0162] See also Figure 4 Another embodiment of the present application provides a leakage protection method, comprising:
[0163] Step S11, receiving the current signal of the current transformer and inputting it into an amplification module for amplification to obtain an amplified signal.
[0164] Step S12, inputting the amplified signal into a rectifying module for rectification to obtain a rectified signal.
[0165] Step S13, calculating the effective value of the rectified signal by a calculation module and using it as the data to be tested.
[0166] Step S14, acquiring power grid load data and inputting the trained signal generation model of the reference module to obtain reference data.
[0167] The grid load data includes the air temperature data and air humidity data within a preset time period ending at the current time, as well as the current data, voltage data and power factor between two adjacent nodes where the leakage protection device is connected to the grid system. Therefore, the reference data is generated by the signal generation model according to the environment of the grid system to which the leakage protection device is connected, and its value conforms to the leakage characteristics of the current grid working condition.
[0168] Step S15, inputting the data to be tested and the reference data into a comparator to obtain a leakage detection result.
[0169] Specifically, when the data to be tested is greater than the reference data, the leakage detection result is leakage, otherwise it is normal.
[0170] Step S16, input the leakage detection result into the switch module, so that the switch module disconnects the line from the load when the leakage detection result is leakage. Specifically, assuming that there is an amplitude of 10mA (10×10 -3 A) of the sine wave leakage current signal, the frequency of which is 50Hz. The amplifier module is used to amplify it 10 times, and the amplified signal amplitude is 100mA (0.1A).
[0171] The rectification process converts an alternating current (AC) signal into a direct current (DC) signal. For a sine wave signal, the DC component after full-wave rectification is 63.66% of its maximum value (i.e. ).
[0172] The rectified DC signal value = the amplified amplitude × 63.66% = 0.1 × 0.6366 = 0.06366A.
[0173] The effective value (RMS value) is the value of the AC signal that is equivalent to the DC signal in terms of thermal effect. For a sine wave signal, the effective value is the peak value. times, so the effective value of the rectified signal = the amplified amplitude / = Then convert 0.0707 A into milliampere units, which is 70.7mA, that is, the data to be measured is 70.7mA.
[0174] Assume that the reference data output by the signal generation model is 60mA. In this example, the measured data 70.7mA is greater than the reference data 60mA, the output leakage detection result is leakage, and the switch module disconnects the line from the load.
[0175] The above embodiment provides a leakage protection method, which introduces a large model in the process of generating reference data, generates reference data under the current working environment of the leakage protection device according to the grid load data through the trained signal generation model, and then compares the reference data with the effective value of the detected current signal to determine whether there is a leakage. The present application realizes adaptive adjustment of reference data, making leakage detection more flexible and reliable, improving the detection accuracy and reliability of leakage protection in various working environments, reducing power supply interruptions caused by false operations or leakage operations, and ensuring the safety of users.
[0176] See also Figure 5 In some embodiments, the method may further include:
[0177] Step S21, obtaining historical load data between two adjacent nodes of the leakage protection device at the access location of the power grid system.
[0178] The historical load data includes current data, voltage data, power factor, air temperature data, and air humidity data of the circuit between two nodes at each historical moment.
[0179] Step S22, determining serious over-limit scenarios in historical load data.
[0180] Specifically, since there is no trained signal generation model to generate reference data to determine whether the historical load data was collected under leakage conditions before the machine learning model is trained, the present application uses the judgment of out-of-limit scenarios to screen the historical load data under leakage conditions before training, and inputs the data into the machine learning model as leakage load data, so that the machine learning model can learn the boundary between normal operation and leakage of the circuit under different load data, thereby accurately locating the reference data.
[0181] Step S23, marking the historical load data corresponding to the serious over-limit scenario as leakage load data.
[0182] Step S24, determining the hyperparameter combination of the machine learning model based on the Bayesian optimization method.
[0183] Among them, Bayesian optimization is an efficient method for hyperparameter optimization, which uses the principles of Bayesian statistics to guide the process of searching for optimal hyperparameters. Bayesian optimization is particularly suitable for optimization problems that are computationally expensive, such as training large machine learning models. Compared with brute force search or grid search, Bayesian optimization can find near-optimal hyperparameter combinations faster and can handle various types of hyperparameters, including continuous, discrete, and categorical; and Bayesian optimization methods can work well even in high noise conditions.
[0184] Step S25, inputting historical load data and leakage load data into a machine learning model for training.
[0185] Among them, the loss function of the machine learning model can adopt a binary cross entropy loss function or a focal loss function.
[0186] Specifically, it can be understood as classifying historical load data by determining serious over-limit scenarios to obtain historical load data and leakage load data, and then extracting multiple normal load subsets and leakage load subsets for the two types of load data respectively; dividing each load subset into batches, and inputting them into the machine learning model for training in batches. The machine learning model adjusts the output reference data by learning the difference between the two types of load data, thereby optimizing the accuracy of the reference data during the training process.
[0187] Step S26, using the K-fold cross-validation method to determine whether the machine learning model reaches a preset variance.
[0188] Specifically, the variance reflects the stability of the output data of the machine learning model. When the stability of the machine learning model is below the preset variance, it can be judged that the output has become stable and the training can be terminated.
[0189] Step S27: if not, end the training and use the machine learning model as the signal generation model.
[0190] The above embodiment provides a training method for a signal generation model, which can not only improve the training efficiency of the machine learning model, but also ensure the stability of the reference data generated by the trained signal generation model.
[0191] In some embodiments, the above-mentioned determination of a serious over-limit scenario in the historical load data includes:
[0192] Step S221, calculating the active power flow value according to the historical load data at the same time.
[0193] Specifically, first obtain the elements between the two nodes corresponding to the historical load data at a certain moment, including generators, transmission lines, loads and other elements, as well as the connection relationship between them; then, set the initial voltage amplitude and phase angle for each element. Usually, the voltage amplitude and phase angle of the generator are known conditions, and the initial voltage of other loads can be assumed to be the nominal voltage of the element. Then, use the AC power flow calculation method or the DC power flow calculation method to iteratively calculate according to the historical load data (current, voltage, power), initial voltage amplitude and phase angle of each element until the convergence condition is met. In each iteration, the voltage amplitude is updated according to the power balance equation and Ohm's law of the circuit. After each iteration, check the convergence of the power flow calculation. If the change in voltage amplitude or line power in continuous iterations is less than the preset threshold, it is considered that the power flow calculation has converged, and the power flow calculated at this time is used as the active power flow and judged against the preset power flow limit.
[0194] Step S222, determining whether the active power flow value exceeds a preset power flow limit.
[0195] Step S223: If yes, the active power flow value and the corresponding time are regarded as a serious limit-exceeding scenario.
[0196] The above embodiment realizes the determination of whether there is leakage in the line without reference data, and can realize the classification of load data in the early stage of model training so as to carry out model training and formal leakage point detection.
[0197] See also Figure 6 In some embodiments, the K-fold cross-validation method is used to determine whether the machine learning model reaches a preset variance, which may specifically include the following steps:
[0198] Step S261, extracting a normal test subset from the historical load data.
[0199] Step S262, after each training, the normal test subset is input into the machine learning model to obtain test data corresponding to multiple trainings. Furthermore, in the actual training process, the machine learning model usually needs to be trained dozens to hundreds of times, so for performance testing, it is also possible to choose how many trainings to start testing after according to the type of machine learning model; for example, the number of trainings of the random forest model depends on the number of decision trees in the random forest, and it is usually started from about 50 trees and gradually increased, that is, at least 50 times are required, so the input of the normal test subset can also start from the 51st training.
[0200] Step S263, calculating the test variance of each of the latest preset number of test data.
[0201] Specifically, "the latest preset number" refers to the test data corresponding to the current training and the previously preset number of test data. For example, the preset number is 6, and the test starts from the 51st training. The first test variance is calculated at the end of the 56th training, and the 6 test data after the 51st to 56th training are selected to obtain the test variance. The second test variance is calculated based on the test data after the 52nd to 57th training, and so on.
[0202] Step S264, determining whether the test variance reaches a preset variance.
[0203] The above embodiment can better judge the output stability of the machine learning model by calculating the test variance, and ensure that the trained signal generation model can output stable reference data according to the power grid load data.
[0204] See also Figure 7 In some embodiments, the above-mentioned method for determining the hyperparameter combination of the machine learning model based on the Bayesian optimization method may specifically include the following steps:
[0205] Step S241, constructing an objective function; the objective function takes a hyperparameter combination as input, and takes as output the difference between two output data corresponding to when the machine learning model inputs historical load data twice under the hyperparameter combination.
[0206] Among them, the "output data" can be considered as the reference data output after the training is completed. However, before the training, the output data here cannot temporarily reflect the true leakage characteristics.
[0207] Specifically, the historical load data input twice are the same, that is, the objective function is to output the difference between the two corresponding output data when the machine learning model inputs the same historical load data twice.
[0208] Step S242, defining the value range of each hyperparameter in the hyperparameter combination.
[0209] Step S243, select a Bayesian optimization library, and use the Bayesian optimization library to update the hyperparameter combination.
[0210] Among them, the Bayesian optimization library includes Bayesian Optimization, bayes-optim, Hyperopt, Optuna, and Scikit-Optimize. Bayesian Optimization is a pure Python implementation of the Bayesian global optimization package, which uses Gaussian processes and is suitable for optimizing high-cost functions. bayes-optim supports decision spaces for real, integer, and categorical variables. The library provides a variety of acquisition functions and surrogate models, such as Gaussian process regression (GPR) and random forest (RF). Hyperopt is a powerful hyperparameter optimization library that supports a variety of optimization algorithms including Bayesian optimization. Hyperopt performs hyperparameter search through the Bayesian optimized TPE algorithm, which has the characteristics of clear progress bar and beautiful display. Scikit-Optimize is an optimization library based on scikit-learn, which allows users to use GP and ET methods for optimization, and can handle real, integer, and categorical variables.
[0211] Step S244, input the hyperparameter combination into the objective function, and record the function value of the objective function.
[0212] Among them, the function value is the output value of the objective function, that is, "the difference between the two corresponding output data when the machine learning model inputs the same historical load data twice."
[0213] Step S245, after repeated updates for multiple times, select the hyperparameter combination corresponding to the minimum function value.
[0214] Specifically, the minimum function value is equivalent to the minimum difference between the two output data of the machine learning model, which means that the machine learning model has the best stability performance under the corresponding hyperparameter combination, thereby reducing the number of subsequent training times and improving training efficiency.
[0215] The hyperparameter optimization process provided in the above embodiment can determine a hyperparameter combination with better initial stability of the machine learning model before training begins, which can reduce the number of training times and enable the signal generation model to be applied to leakage protection as soon as possible.
[0216] In some embodiments, the above-mentioned ending of training and using the machine learning model as a signal generation model includes:
[0217] Step S271, when the test variance is less than the preset variance, the average value of each test data corresponding to the test variance is calculated.
[0218] Step S272, select the machine learning model corresponding to the test data closest to the average value as the signal generation model.
[0219] In the selection of the signal generation model, the performance that this application pays most attention to is the output stability and accuracy of the model. Therefore, when the output of the model tends to be stable, the model with the most accurate output is screened out as the signal generation model through the average value of the test data.
[0220] This is because the input data corresponding to different test data are the same, that is, the input data is the same normal test subset, so the average value of the output test data is closest to the correct output. Selecting the model corresponding to the test data closest to the average value can ensure the output accuracy of the signal generation model.
[0221] In some embodiments, the above method further comprises:
[0222] Before determining the severe over-limit scenario, the historical load data is subjected to denoising filtering.
[0223] After filtering, the missing point values in the historical load data are supplemented by linear interpolation.
[0224] This application denoises and filters the collected historical load data before determining the serious over-limit scenario so as to accurately determine the serious over-limit scenario; secondly, if there are missing values in the collected historical load data, they are supplemented based on linear interpolation to avoid the missing data affecting the judgment of the serious over-limit scenario.
[0225] In some embodiments, the above method also includes: after marking the leakage load data, calculating the quantitative difference between the historical load data and the leakage load data; if the quantitative difference is greater than the preset training difference, randomly selecting historical load data equal to half of the quantitative difference to add noise to make it leakage load data.
[0226] Among them, the preset training difference is the requirement of the machine learning model for the data volume difference of different categories of training data. Because the machine learning model needs to learn the load data during normal operation and the load data during leakage, the data volume of the two load data cannot differ too much, otherwise it will affect the learning efficiency and output accuracy of the machine learning model.
[0227] However, affected by factors such as service life and collection time, the number of severe out-of-limit scenarios in the collected historical load data may not meet the training requirements of the machine learning model. Therefore, in this case, the present application can artificially adjust the leakage load data by adding noise to the historical load data, adjusting the data amplitude, etc., so that the difference between the number of leakage load data and the number of normal historical load data is within the range of the preset training difference.
[0228] The above embodiment avoids the impact of too large difference in the amount of data of different categories on the training efficiency and accuracy of the machine learning model by judging the difference between the two types of load data.
[0229] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0230] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A leakage protection device, characterized in that: include: an amplification module, used for receiving and amplifying the current signal of the current transformer to obtain an amplified signal; A rectifier module, used for receiving the amplified signal from the amplification module and rectifying it to obtain a rectified signal; A calculation module, used for receiving and calculating the effective value of the rectified signal of the rectifier module and using it as the data to be tested; A reference module is used to input the acquired power grid load data into the trained signal generation model to obtain reference data; The reference module is specifically used to obtain historical load data between two adjacent nodes of the leakage protection device at the access position of the power grid system; calculate the active power flow value according to the historical load data at the same time; Determining whether the active power flow value exceeds a preset power flow limit; If yes, the active power flow value and the corresponding time are regarded as a serious over-limit scenario; Mark the historical load data corresponding to the serious over-limit scenario as leakage load data; determine the hyperparameter combination of the machine learning model based on the Bayesian optimization method; input the historical load data and the leakage load data into the machine learning model for training; use the K-fold cross-validation method to determine whether the machine learning model reaches a preset variance; if not, end the training and use the machine learning model as the signal generation model; A comparison module, used for comparing the reference data with the data to be tested to obtain a leakage detection result; The switch module is used to receive the leakage detection result of the comparison module, and disconnect the circuit from the load when the leakage detection result is leakage.
2. The leakage protection device according to claim 1, characterized in that: The amplification module comprises: Interconnected switched capacitor amplifier and instrumentation amplifier; The switched capacitor amplifier is used to amplify the current signal and output a gain signal; The instrument amplifier is used to amplify the differential mode signal in the gain signal and output the amplified signal.
3. The leakage protection device according to claim 1, characterized in that: The power grid load data includes: The current data, voltage data and power factor between two adjacent nodes of the leakage protection device at the access location of the power grid system within a preset time period with the current moment as the end moment.
4. The leakage protection device according to claim 3, characterized in that: The power grid load data also includes: The air temperature data and air humidity data within a preset time period starting from the current time.
5. The leakage protection device according to claim 1, characterized in that: The reference module is also used to: Before determining the severe over-limit scenario, performing denoising filtering on the historical load data; The missing point values in the historical load data are supplemented by linear interpolation.
6. The leakage protection device according to claim 1, characterized in that: Also includes: The early warning module is used to input the real-time load data into the trained current prediction model to obtain the predicted current effective value; The reference data of the reference module is obtained, and when the predicted current effective value exceeds the reference data, a leakage warning is issued.
7. The leakage protection device according to claim 1, characterized in that: The calculation module is also used for: The peak value of the rectified signal of the rectifier module is received and calculated, and used as the data to be tested.
8. The leakage protection device according to claim 1, characterized in that: Also includes: The communication module is used to upload the amplified signal, the rectified signal, the data to be tested, the reference data and the leakage detection result to a cloud server.
9. The leakage protection device according to claim 8, characterized in that: The reference module is also used to: A user instruction of the communication module is received, and the reference data is generated according to the user instruction.
10. A leakage protection method, characterized in that: include: Receive the current signal of the current transformer and input it into the amplification module for amplification to obtain an amplified signal; Inputting the amplified signal into a rectifier module for rectification to obtain a rectified signal; Calculating the effective value of the rectified signal by a calculation module and using it as the data to be measured; Obtain grid load data and input it into the trained signal generation model of the reference module to obtain reference data; Specifically, historical load data between two adjacent nodes of the leakage protection device at a location where the leakage protection device is connected to the power grid system is obtained; active power flow value is calculated according to the historical load data at the same time; Determining whether the active power flow value exceeds a preset power flow limit; If yes, the active power flow value and the corresponding time are regarded as a serious over-limit scenario; Mark the historical load data corresponding to the serious over-limit scenario as leakage load data; determine the hyperparameter combination of the machine learning model based on the Bayesian optimization method; input the historical load data and the leakage load data into the machine learning model for training; use the K-fold cross-validation method to determine whether the machine learning model reaches a preset variance; if not, end the training and use the machine learning model as the signal generation model; Inputting the data to be tested and the reference data into a comparator to obtain a leakage detection result; The leakage detection result is input into a switch module, so that the switch module disconnects the line from the load when the leakage detection result is leakage.
11. The leakage protection method according to claim 10, characterized in that: The K-fold cross validation method is used to determine whether the machine learning model reaches a preset variance, including: Extracting a normal test subset from the historical load data; After each training, the normal test subset is input into the machine learning model to obtain test data corresponding to multiple trainings; Calculate the test variance of the latest preset number of test data; It is determined whether the test variance reaches the preset variance.
12. The leakage protection method according to claim 10, characterized in that: The method of determining the hyperparameter combination of the machine learning model based on the Bayesian optimization method includes: Constructing an objective function; the objective function takes the hyperparameter combination as input, and takes the difference between two output data corresponding to two inputs of the historical load data by the machine learning model under the hyperparameter combination as output; Defining the value range of each hyperparameter in the hyperparameter combination; Selecting a Bayesian optimization library, and using the Bayesian optimization library to update the hyperparameter combination; Inputting the hyperparameter combination into the objective function, and recording the function value of the objective function; After repeated updates for multiple times, the hyperparameter combination corresponding to the smallest function value is selected.
13. The leakage protection method according to claim 11, characterized in that: The step of ending the training and using the machine learning model as the signal generation model includes: When the test variance is less than the preset variance, calculating the average value of each of the test data corresponding to the test variance; The machine learning model corresponding to the test data closest to the average value is selected as the signal generation model.
14. The leakage protection method according to claim 10, characterized in that: Also includes: Before determining the severe limit-crossing scenario, the historical load data is subjected to denoising filtering.
15. The leakage protection method according to claim 14, characterized in that: Also includes: After filtering, the missing point values in the historical load data are supplemented by linear interpolation.
16. The leakage protection method according to claim 10, characterized in that: Also includes: After marking the leakage load data, calculating the quantity difference between the historical load data and the leakage load data; If the quantity difference is greater than the preset training difference, the historical load data equal to half of the quantity difference is randomly selected to add noise to make it the leakage load data.
17. The leakage protection method according to claim 10, characterized in that: The loss function of the machine learning model is a binary cross entropy loss function or a focal loss function.
