User side reactive compensation optimization control method and system based on machine learning
Through machine learning model training and online learning mechanism, the adaptability problem of traditional reactive power compensation control methods in dynamic load scenarios is solved, and the coordinated optimization of power factor, voltage stability and capacitor life is achieved, which improves the effect of reactive power compensation.
Patent Information
- Application Number
- CN202510839768.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-23
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2045-06-23
AI Technical Summary
Traditional reactive power compensation control methods cannot dynamically adapt to load changes in different scenarios, lack multi-constrained collaborative optimization capabilities, which can easily lead to under-compensation or over-compensation, and do not consider the healthy status of the capacitor.
Using machine learning model training and online learning mechanism, a multi-objective loss function is constructed by obtaining historical data of the distribution network, optimizing the capacitor turnover prediction model, and real-time data learning is carried out in embedded devices to realize adaptive compensation decisions.
Adaptive compensation decisions in dynamic scenarios are realized, power factor, voltage stability and equipment life are synchronously optimized, and reactive compensation effect is improved.
Smart Images

Figure CN120357487A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of user-side reactive power compensation optimization control, and particularly relates to a user-side reactive power compensation optimization control method and system based on machine learning. Background Art
[0002] User-side reactive power compensation is an important means for the optimal operation of the power system. Its core is to improve the power factor, reduce line losses, and enhance voltage stability by adjusting reactive power. Currently, widely used well-known technologies include the static reactive power compensation method of shunt capacitor banks, static var generators (SVG), etc. Among them, the capacitor bank switching technology has become the mainstream solution for low-voltage distribution networks due to its low cost and simple structure. Its basic principle is: real-time monitoring of the system power factor or voltage value. When the detected power factor is lower than a preset threshold (such as 0.9) or the voltage exceeds the limit, the switching operation of the capacitor bank is triggered through a logic controller to compensate for the required reactive power.
[0003] In the prior art, the solution closest to the present invention is a rule-based control strategy (such as the nine-zone diagram method). For example, the patent application with the publication number CN103972902A discloses a reactive power compensation control method and device for a low-voltage distribution network. This method is based on an improved nine-zone diagram method, and by dividing the threshold intervals of voltage and power factor, it triggers the hierarchical switching operation of capacitors. The steps of this method include: 1) Collecting the real-time voltage and real-time reactive power data of the low-voltage distribution network; 2) Obtaining the nine-zone diagram of the low-voltage distribution network; 3) Obtaining the capacitor switching configuration table; 4) Comparing the collected real-time voltage and real-time reactive power data with the upper / lower voltage values and upper / lower reactive power values in the nine-zone diagram respectively to determine the operating point coordinates corresponding to the current system operating point in the nine-zone diagram; 5) Matching the operating point coordinates with the area identifiers in the capacitor switching configuration table to determine the corresponding switching control method and execute it. However, the compensation logic of this method depends on fixed thresholds. When applied to scenarios with different line impedances and load capacities, it is necessary to repeatedly recalculate the thresholds, which brings a huge workload and is prone to threshold mismatch, resulting in repeated switching in the critical state and damaging the capacitor life. In addition, there is a solution that focuses on the regulation effect of low-voltage side reactive power compensation on the low grid voltage. For example, the patent application with the publication number CN119029912A discloses an intelligent grid low-voltage intelligent compensation method and system. However, this algorithm uses power parameters and thresholds to customize the reactive power compensation strategy, mainly focuses on the impact of reactive power compensation on voltage, does not consider the regulation effect on power factor, and also depends on threshold adjustment. Another example is the patent application with the publication number CN119276010A, which discloses an intelligent monitoring method for a power reactive power compensation controller. The method includes data collection, data preprocessing, real-time monitoring of the power reactive power compensation controller, hyperparameter optimization, and intelligent warning. This method uses a machine learning algorithm and does not rely on fixed thresholds, but the key problem it solves is the monitoring and warning of the abnormal state of the reactive power compensation controller for the power grid.
[0004] Traditional methods rely on fixed thresholds or manual rules and cannot adapt to different line impedances and dynamic load scenarios, resulting in frequent switching and accelerating capacitor loss; the prior art mainly takes power factor as a single optimization target and lacks the ability to synergistically optimize multiple constraints such as power factor optimization combined with voltage and capacitor life attenuation (reducing changes in switching amount, etc.); existing methods are based on empirical formulas or static models and cannot predict the impact of compensation operations on the system voltage, easily causing under-compensation (power factor is still lower than the threshold) or over-compensation (voltage exceeds the limit or capacitor is overloaded). Therefore, there is an urgent need for a reactive power compensation control method that can solve the problems of traditional control methods being unable to dynamically adapt to load changes in different scenarios, lacking multi-constraint collaborative optimization ability, lacking consideration of the health state of capacitors during compensation, and being prone to under-compensation or over-compensation. Summary of the Invention
[0005] To address the deficiencies in the existing technologies, the present invention provides a method and system for optimizing the reactive power compensation on the user side based on machine learning. Through the training of the machine learning model and the online learning mechanism, an adaptive compensation decision is realized in a dynamic scenario, synchronously optimizing multiple objectives such as power factor, voltage stability, and equipment life, effectively improving the effect of reactive power compensation.
[0006] The present invention adopts the following technical solutions.
[0007] A method for optimizing the reactive power compensation on the user side based on machine learning includes: S1, obtaining the historical operation data of the distribution network, performing preprocessing, and constructing a data set; S2, using the data set to train the machine learning model for predicting the capacitor switching amount; constructing a multi-objective loss function based on the capacitive reactive power switching amount, power factor, and voltage amplitude; S3, during the training process of the machine learning model for predicting the capacitor switching amount, constructing an objective function to optimize the prediction result of the machine learning model for predicting the capacitor switching amount, and adding hard constraint conditions to the optimized prediction result, thereby optimizing the network parameters of the machine learning model for predicting the capacitor switching amount to obtain an initial machine learning model for predicting the capacitor switching amount; S4, collecting the real-time operation data of the power grid, inputting it into the initial machine learning model for predicting the capacitor switching amount for online training to obtain the predicted value of the capacitor switching amount, and realizing the optimized control of reactive power compensation based on the predicted value of the capacitor switching amount.
[0008] Further, in S1, obtaining the historical operation data of the distribution network includes three-phase active power, three-phase reactive power, three-phase power factor, positive and negative sequence voltage amplitudes, the value of the capacitor put into the compensation device, the deviation between the three-phase voltage and the rated voltage, and the three-phase power factor difference; the preprocessing includes removing extreme values and supplementing missing values.
[0009] Further, in S2, the input of the machine learning model for predicting the capacitor switching amount is three-phase active power, three-phase reactive power, the deviation between the three-phase voltage and the rated voltage, and the three-phase power factor difference, and the output is the capacitive reactive power switching amount, power factor, and voltage amplitude; Based on the multi-task network structure Constructing the machine learning model for predicting the capacitor switching amount includes a shared layer, a capacitive reactive power prediction layer, a power factor prediction layer, and a voltage amplitude prediction layer, and the structure of the machine learning model for predicting the capacitor switching amount is as shown in the following formula: ; where x is the input of the eigenvalue, is the output of the shared layer, is the output of the capacitive reactive power prediction layer, is the output of the power factor prediction layer, is the output of the voltage amplitude prediction layer, represents the ReLU activation function, and are the weight coefficient matrix and bias vector of the shared layer respectively, and are the weight coefficient matrix and bias vector of the ReLU activation function in the capacitive reactive power prediction layer respectively, and are the weight coefficient matrix and bias vector of the capacitive reactive power prediction layer respectively, and are the weight coefficient matrix and bias vector of the ReLU activation function in the power factor prediction layer respectively, and are the weight coefficient matrix and bias vector of the power factor prediction layer respectively, and are the weight coefficient matrix and bias vector of the ReLU activation function in the voltage amplitude prediction layer, and are the weight coefficient matrix and bias vector of the power factor prediction layer respectively, represents the swish activation function.
[0010] Further, in S3, the specific steps include: S301, during the training process, the capacitive reactive power switching amount predicted by the capacitive switching amount prediction machine learning model is encoded in BCD code according to the configured capacity of the current compensable capacitor, and the number of capacitor insertions is determined according to the encoding result; a target function is constructed to optimize the predicted capacitive reactive power switching amount, voltage amplitude, and capacitor switching action times to obtain an optimization result; among them, the initial value of the target function is calculated based on the current target power factor, current phase active power, and reactive power; S302, add hard constraint conditions to the optimization result to force the output of the model to be within the set range, thereby optimizing the network parameters of the capacitive switching amount prediction machine learning model.
[0011] Further, in S301, the calculation formula of the target function is: ; wherein, is the weight coefficient of the capacitive reactive power switching amount is the weight of the positive sequence voltage amplitude deviation amount, is the weight coefficient of the negative sequence voltage amplitude is the penalty coefficient of the capacitor switching action times is the indicator function, is the switching operation times interval; For each phase {a, b, c}, the initial value of the objective function is the theoretical value of capacitive reactive power of the capacitor
[0012] Furthermore, in S302, the hard constraint condition formula is: ; Among them, is the three-phase capacitive reactive power switching amount, where i = a, b, c, is the power factor of each phase, is the target power factor, is the remaining available capacitive reactive power value of each phase of the device, that is, the difference between the rated capacitive reactive power value of each phase of the device and the currently switched-in capacitive reactive power, is the positive-sequence voltage amplitude, is the negative-sequence voltage amplitude.
[0013] Furthermore, in S4, the initial capacitor switching amount prediction machine learning model is deployed in the embedded reactive power compensation device, and online learning is performed according to real-time data to obtain a new model and new network parameters, and the capacitor switching amount prediction value is obtained, and the optimal control of reactive power compensation is realized based on the capacitor switching amount prediction value; During the online learning process, the elastic weight loss function is used; the elastic weight loss function constrains the difference between the parameters trained by the new model and the parameters trained by the old model, and constrains the differences between the capacitive reactive power switching amount, power factor, and voltage amplitude output by the new model and the actual values; During the operation cycle of the emergency locking judgment program, when the predicted capacitive reactive power switching amount is greater than the rated capacitive reactive power value of the device, and the negative-sequence voltage amplitude at all time points within the cycle is greater than the preset threshold, emergency locking is performed.
[0014] Furthermore, during the online learning process, when new data is added, the input dimension is expanded, the original model is frozen, and the new data is trained; and the similarity of the new data and the prediction error are periodically judged to adjust the model structure and parameters; among them, the prediction error refers to the error between the voltage amplitude actually measured after switching the capacitive reactive power switching amount predicted by the old model and the theoretically obtained voltage amplitude after switching.
[0015] The present invention also proposes a user-side reactive power compensation optimization control system based on machine learning, which operates according to any one of the method steps of a user-side reactive power compensation optimization control method based on machine learning, including a data set construction module, a model training module, an optimization and constraint module, and an online update module, and is characterized in that: A dataset construction module acquires historical operation data of a distribution network, preprocesses it, and constructs a dataset. A model training module uses the dataset to train a machine learning model for predicting capacitor switching amounts that has been constructed; constructs a multi-objective loss function based on capacitive reactive power switching amounts, power factors, and voltage amplitudes. An optimization and constraint module constructs an objective function for the prediction results of the trained machine learning model for predicting capacitor switching amounts, performs optimization, and obtains an optimization result; adds hard constraint conditions to the optimization result to force the output of the model to be within a set range. An online update module enables the machine learning model for predicting capacitor switching amounts after hard constraints to perform online learning based on real-time data.
[0016] The present invention also proposes a terminal, including a processor and a storage medium: The storage medium is used to store instructions; the processor is used to operate according to the instructions to execute the steps of any one of the above methods. Description of the Drawings
[0017] Figure 1 is a main step flowchart of a method for optimizing and controlling reactive power compensation on the user side based on machine learning according to the present invention; Figure 2 is a specific step flowchart of a method for optimizing and controlling reactive power compensation on the user side based on machine learning according to the present invention; Figure 3 is a schematic diagram of a low-voltage side distribution network simulation model of a method for optimizing and controlling reactive power compensation on the user side based on machine learning according to the present invention; Figure 4 is a schematic diagram of a simulation dataset generated by a distribution network simulation model of a method for optimizing and controlling reactive power compensation on the user side based on machine learning according to the present invention; Figure 5 is a schematic diagram of user data before reactive power compensation generated by a distribution network simulation model of a method for optimizing and controlling reactive power compensation on the user side based on machine learning according to the present invention; Figure 6 is a schematic diagram of the training progress of a machine learning model for predicting capacitor switching amounts of a method for optimizing and controlling reactive power compensation on the user side based on machine learning according to the present invention; Figure 7 is a comparison chart of three-phase average power factors after reactive power compensation of a method for optimizing and controlling reactive power compensation on the user side based on machine learning according to the present invention; Figure 8 is a comparison of voltage deviation rates after reactive power compensation of a method for optimizing and controlling reactive power compensation on the user side based on machine learning according to the present invention; Figure 9It is a schematic diagram of a device for optimizing the reactive power compensation control on the user side based on machine learning according to the present invention. Detailed implementation manners
[0018] To make the objectives, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. The embodiments described in this application are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the spirit of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0019] The main technical problems solved by the present invention are that the traditional control method cannot dynamically adapt to the load changes in different scenarios, lacks the ability of multi-constraint collaborative optimization, lacks consideration of the health status of capacitors during compensation, and is prone to under-compensation or over-compensation.
[0020] Embodiment 1 To solve the above technical problems, the present invention proposes an optimization control method for reactive power compensation on the user side based on machine learning. The operation data of the distribution network is obtained for machine learning model training, and then the model is deployed on an embedded device and applied in the distribution network. The model is continuously optimized through online learning according to the compensation effect during the operation process, and finally a stable, efficient and adaptive control model is obtained. The main solutions provided by the present invention are as Figure 1 shown, and the specific solution steps are as Figure 2 shown.
[0021] The present invention proposes an optimization control method for reactive power compensation on the user side based on machine learning, including the following steps: S1. Obtain the historical operation data of the distribution network, perform preprocessing and extract features to construct a data set. The specific steps include: S101. Obtain the historical operation database of the distribution network, clean the data to remove extreme values and missing values; S102. Normalize each feature value in the database and divide it into a training set and a test set.
[0022] Specifically, in S101, the historical operation data of the distribution network is obtained through a distribution network monitoring system, a substation data center, etc., and the extreme operation data in the original data is cleaned to help accelerate the training process and improve the performance of the machine learning model for predicting the capacitor switching amount.
[0023] Furthermore, a distribution network simulation platform is built, as Figure 3 shown. A large amount of simulation data is obtained, including important features such as three-phase active power, three-phase reactive power, three-phase power factor, positive and negative sequence voltage amplitudes, and the capacitance value of the compensation device put into operation, to form an original data set , as Figure 4 shown: ; In the formula, and are respectively the three-phase active powers, and are respectively the three-phase power factors, and are respectively the three-phase reactive powers, and are respectively the positive-sequence and negative-sequence voltage amplitudes. As Figure 5 shown, the user data before reactive power compensation generated by the simulation model is presented.
[0024] Furthermore, in S102, new features are constructed from the basic data, including the deviation of the three-phase voltage amplitude from the rated voltage, the three-phase power factor difference degree, etc. The basic data and the new features are normalized. Specifically, the three-phase active power and the three-phase reactive power are normalized to the range of 0 to 1 according to 20% to 80% of the transformer capacity, the positive and negative-sequence voltage amplitudes are normalized using the mean value, and the three-phase power factors are normalized using the standard deviation.
[0025] Furthermore, the processed data set is split, and 80% of it is selected as the training set and 20% as the test set.
[0026] Calculate the theoretical value of the capacitive reactive power to be adjusted to make the power factor of each phase meet the standard , for each phase {a, b, c}, the calculation formula is: ; where is the target power factor of the current phase, set to 0.9, is the active power of the current phase, is the reactive power of the current phase, is the target reactive power of the current phase.
[0027] S2. Construct a machine learning model for predicting the capacitor switching amount, and construct a multi-objective loss function; use the data set to train and test the machine learning model for predicting the capacitor switching amount. The specific steps include: using the training set to train a machine learning model for predicting the capacitive reactive power switching amount, power factor, and voltage amplitude; constructing a multi-objective loss function to evaluate the prediction effect, and using the test set for verification.
[0028] Specifically, based on the multi-task network structure construct a machine learning model for predicting the capacitor switching amount, including a shared layer, a capacitive reactive power prediction layer, a power factor prediction layer, and a voltage amplitude prediction layer. The structure of the machine learning model for predicting the capacitor switching amount is as follows: ; where \(x\) is the eigenvalue input, is the output of the shared layer, is the output of the capacitive reactive power prediction layer, is the output of the power factor prediction layer, is the output of the voltage amplitude prediction layer, represents the ReLU activation function, and are the weight coefficient matrix and bias vector of the shared layer respectively, and are the weight coefficient matrix and bias vector of the ReLU activation function in the capacitive reactive power prediction layer respectively, and are the weight coefficient matrix and bias vector of the capacitive reactive power prediction layer respectively, and are the weight coefficient matrix and bias vector of the ReLU activation function in the power factor prediction layer respectively, and are the weight coefficient matrix and bias vector of the power factor prediction layer respectively, and are the weight coefficient matrix and bias vector of the ReLU activation function in the voltage amplitude prediction layer, and are the weight coefficient matrix and bias vector of the power factor prediction layer respectively, represents the swish activation function, and the formula is .
[0029] Furthermore, a multi-objective loss function is constructed to evaluate the prediction effect, and the specific formula is: ; In the formula, is the cost coefficient of the difference between the actual capacitive reactive power switching amount and the predicted capacitive reactive power switching amount, is the cost coefficient of the difference between the actual power factor and the predicted power factor, is the cost coefficient of the difference between the actual voltage amplitude and the predicted voltage amplitude, is the predicted capacitive reactive power switching amount predicted by the capacitive reactive power prediction layer, is the actual capacitive reactive power switching amount, is the predicted value of the power factor prediction layer, is the actual power factor, is the predicted value of the voltage amplitude prediction layer, is the actual voltage amplitude.
[0030] S3. During the training process of the machine learning model for predicting capacitor switching amount, construct an objective function for the prediction results of the machine learning model for predicting capacitor switching amount, add hard constraint conditions to the prediction results, optimize the network parameters of the machine learning model for predicting capacitor switching amount, and obtain an initial machine learning model for predicting capacitor switching amount. The specific steps include: S301. Use BCD code to obtain the corresponding capacitor switching action times according to the predicted capacitive reactive power switching amount; construct an objective function with adjustable weights to optimize the capacitive reactive power switching amount and voltage amplitude of the prediction variable, as well as the capacitor switching action times; and calculate the theoretical capacitance value as the initial guess value to accelerate the model prediction speed; S302. Add hard constraint conditions to force the predicted value to be within the allowable range to ensure safety, stability, and prediction accuracy.
[0031] In this embodiment, the actual capacitor is not continuously variable. For example, the capacitor configuration is 1, 2, 4, 8 kvar. It is necessary to encode the predicted capacitive reactive power switching amount to obtain the action times. Assume that the capacitive reactive power to be adjusted is 7 kvar, encoded as 0111 in BCD code. There are 3 bits that are 1, so 3 actions are required (that is, three capacitors of 1, 2, and 4 kvar are put into operation). Assume that the capacitive reactive power to be adjusted is 8 kvar, encoded as 1000 in BCD code. Only 1 bit is 1, so only 1 action is required (that is, the 8 kvar capacitor is put into operation).
[0032] Specifically, in S301, an optimization stage is established to achieve joint solution of the prediction-optimization two-stage. As Figure 6 shown, it shows the model training progress. In the optimization stage, an objective function with adjustable weights is constructed on the basis of the predicted value to optimize the capacitive reactive power switching amount and voltage amplitude of the prediction variable, as well as the capacitor switching action times. The objective function formula is: ; Among them, is the weight coefficient of the capacitive reactive power switching amount , is the weight of the deviation of the positive-sequence voltage amplitude , is the weight coefficient of the negative-sequence voltage amplitude , is the penalty coefficient of the capacitor switching action times , is the indicator function, is the switching action times interval.
[0033] During the optimization process, the theoretical capacitance value required to meet the power factor standard is used as the initial guess value to improve the prediction speed.
[0034] The optimization objective follows the following physical relationship model of power factor and voltage, and the specific formula is: ; In the formula, is the power factor of each phase, where i = a, b, c, is the three-phase active power, is the current three-phase capacitive reactive power input value, is the three-phase capacitive reactive power switching amount, is the power factor optimization prediction function, is the voltage amplitude optimization prediction function.
[0035] Furthermore, in S302, hard constraint conditions are added to force the predicted value of the capacitive reactive power switching amount prediction machine learning model to be within the allowable range, so as to optimize the network parameters of the capacitive reactive power switching amount prediction machine learning model and obtain the initial capacitive reactive power switching amount prediction machine learning model. Specifically, the three-phase power factor requires that the average power factor is not less than the target power factor, the positive sequence amplitude deviation of the voltage does not exceed 10% of the rated voltage, and the negative sequence amplitude does not exceed 2% of the rated voltage to ensure safety and stability. The adjustment amount of the capacitor should not exceed the maximum adjustable amount of the device. The hard constraint condition formula is:
[0036] Among them, is the three-phase capacitive reactive power switching amount, where i = a, b, c, is the power factor of each phase, is the target power factor, is the remaining available capacitive reactive power value of each phase of the device, that is, the difference between the rated capacitive reactive power value of each phase of the device and the currently input capacitive reactive power, is the positive sequence amplitude of the voltage, is the negative sequence amplitude of the voltage.
[0037] S4. Deploy the initial capacitive reactive power switching amount prediction machine learning model in the embedded device, perform online learning according to the real-time data of the power grid operation, obtain the predicted value of the capacitive reactive power switching amount, realize the optimized control of reactive power compensation based on the predicted value of the capacitive reactive power switching amount, and at the same time establish a safety protection mechanism to start emergency locking when the prediction deviation exceeds the limit. The specific steps include: S401. Deploy the trained capacitive reactive power switching amount prediction machine learning model in the embedded reactive power compensation device to adjust the power factor on the user side of the distribution network, and perform online learning according to the actual application effect to continuously optimize and adjust the capacitive reactive power switching amount prediction machine learning model; S402. Establish a safety protection mechanism, and when the prediction deviation exceeds the limit, the embedded device starts emergency locking and sends a system alarm.
[0038] Specifically, in S401, the initial capacitor switching amount prediction machine learning model is trained using the training set, the test set is input into the trained model for prediction, and the error index is calculated to evaluate the model performance. Based on the evaluation results, the initially set weight coefficients or constraint thresholds are dynamically fine-tuned, and the adjusted initial capacitor switching amount prediction machine learning model is used as the old model, and the network parameters of the old model are saved. The old model is deployed in the embedded reactive power compensation device to adjust the power factor on the user side of the distribution network, and online learning is carried out according to the actual application effect, and continuous optimization and adjustment are performed to obtain the new model.
[0039] The old model is trained using simulation data or data collected from other regions. When actually applied, due to the slight differences in the line impedance of users, the old model is deployed in the embedded reactive power compensation device, and the actual user data is continuously input into the training set, which can improve the matching degree between the old model and the users. When there is no major topological change in the user, the new model and the old model only differ in parameters, aiming to improve the prediction accuracy.
[0040] The new and old models are mixed for prediction, the output difference is monitored, progressive updates are performed, and the model is automatically scheduled for regular updates. During the mixed prediction process, it is necessary to effectively retain the important knowledge in the previous training and slow down the catastrophic forgetting that occurs during new learning. Therefore, an online learning mechanism is realized through elastic weight consolidation (EWC) and importance sampling weights to flexibly adjust the adaptability of the new model. Elastic weight loss function The difference between the parameters trained by the new model and the parameters trained by the old model is constrained, and the differences between the capacitive reactive power switching amount, power factor, and voltage amplitude output by the new model and the actual values are constrained. The specific formula is: ; Among them, is the diagonal element of the Fisher information matrix, which is used to represent the importance of the weight parameters of the new and old models in the current task, is the hyperparameter that controls the strength of the EWC regularization term, is the parameter trained by the new model, is the parameter trained by the old model, is the loss function of the new model, which is consistent with the multi-objective loss function in the present invention Consistent.
[0041] The parameters of the new and old models are updated using the reinforcement learning policy gradient and the advantage function. The formula is: ; Among them, represents the objective function with respect to the policy parameter The gradient. By optimizing this gradient adjustment parameter update strategy, the model can obtain more scores; represents that given the policy parameters the probability that the new and old models take switching actions in the state ; The probability; is the advantage function, representing the advantage of choosing the action at the state at time t compared to the average of choosing other actions; is the action value function, representing the expected return of following the policy after choosing the action a in the state s; is the discount factor (0 ≤ γ ≤ 1), which controls the importance of future scores relative to the current score. A higher value means the model pays more attention to future scores, and a lower value means the model pays more attention to immediate scores; r is the score obtained at time step t + k + 1, k represents the future time step, k = 0 represents the score at the current moment, k = 1 represents the score at the next moment, and so on; is the value function, representing the overall expected return of following the policy starting from the state s.
[0042] The acquisition function and Bayesian are used to optimize the outputs of the new and old models. The specific formula is: ; where x are the new and old parameters to be adjusted, including the learning rate, the number of neural network hidden layer units, the capacitor switching step, the target power factor, the upper limit of the positive and negative sequence amplitude deviation, etc.; is the acquisition function, f(x) is the objective function in S301, D is the existing observation data set, is the expected value, is the expected improvement acquisition function, is the current optimal objective value, is the improvement amount. The improvement amount is positive only when the new score f(x) exceeds the current best. This function can filter out invalid negative improvements.
[0043] Furthermore, when new sensors or new acquisition metrics are added, the input dimension is expanded as needed, and the original model is frozen. Every week, the distribution similarity of the new data is judged. If it exceeds 90%, the feature layer is fixed, the fully connected layer is adjusted, and parameter fine-tuning is performed. Every month, if the prediction error for three consecutive days exceeds 15%, an LSTM time series processing layer is added; the prediction error refers to the error between the actual measured voltage amplitude after switching according to the capacitive reactive power switching amount predicted by the old model and the theoretically obtained voltage amplitude after switching.
[0044] Specifically, in the present invention, a residual time series structure LSTM is added to the voltage amplitude prediction layer in S201 to offset the prediction errors caused by the time-varying characteristics of the grid impedance and the inertial change of the voltage. The formula is as follows: ; Where is the voltage amplitude predicted by the trained static model, is the difference between the voltage amplitude predicted in the previous time and the actual voltage amplitude fed back by the system, And so on, is the predicted voltage amplitude after fine-correcting the dynamic error term. LSTM learns the residual of the voltage change. By analyzing the voltage fluctuation pattern in the previous time (such as a continuous rising trend), it anticipates the underestimation tendency of the static model in advance to achieve precise compensation.
[0045] Every quarter, if there is a major change in the system topology, the entire model is retrained.
[0046] Furthermore, in S402, a safety protection mechanism is established. When the prediction deviation exceeds the limit or the capacitor switching amount exceeds the limit, an emergency lockout is initiated and a system alarm is sent.
[0047] Adding dynamic learning rate decay and emergency lockout conditions as safety constraints, the mathematical expression is: ; Where, is the current time, is the operating cycle of the emergency lockout judgment program, is the predicted capacitive reactive power switching amount, is the rated capacitive reactive power value of the device, is the predicted negative sequence voltage amplitude.
[0048] The comprehensive performance of the model is evaluated using the following scoring formula: ; Where, is the score, is the qualified rate of the power factor, is the positive sequence voltage amplitude, is the change amount of the total three-phase capacitive reactive power.
[0049] A reactive power compensation optimization control method based on machine learning proposed in this embodiment is compared with the reactive power compensation method corresponding to the calculated theoretical value of the capacitor . Figure 7 And Figure 8 respectively show the comparison chart of the three-phase average power factor after reactive power compensation and the comparison of the voltage deviation rate after reactive power compensation. As shown in Table 1, the comparison table of the compensation effects is presented.
[0050] Table 1 Comparison of Compensation between Theoretical Value and Predicted Value
[0051] Wherein: The qualified standard of power factor is: F > 0.9. The theoretical value compensation generally fails to meet the standard due to under-compensation; The qualified standard of positive-sequence voltage is: 90%Un < Upos < 110%Un; The qualified standard of negative-sequence voltage is: Uneg < 2%Un (Un = 380V); The voltage amplitude deviation is: Upos - Un; The voltage deviation rate is: (Upos - Un) / Un.
[0052] From the experimental results, a reactive power compensation optimization control method for the user side based on machine learning proposed in this embodiment realizes adaptive compensation decision-making in dynamic scenarios through machine learning model training and online learning mechanism, synchronously optimizes multiple objectives such as power factor, voltage stability, and equipment life, and effectively improves the effect of reactive power compensation.
[0053] Embodiment 2 The present invention proposes a reactive power compensation optimization control system for the user side based on machine learning, including a data set construction module, a model optimization and constraint module, a model training and tuning module, and a model online learning module: The data set construction module obtains the historical operation data of the distribution network, performs preprocessing and extracts features to construct a data set; The model optimization and constraint setting module adds optimization objectives and hard constraints to the machine learning model for predicting the capacitor switching amount to achieve multi-objective collaborative optimization; The model training and tuning module constructs a machine learning model for predicting the capacitor switching amount, uses the training set for training, and uses the test set for verification and parameter tuning; The model online learning module deploys the machine learning model for predicting the capacitor switching amount in an embedded device, performs online learning according to the actual application effect, and simultaneously establishes a security protection mechanism to start emergency locking when the prediction deviation exceeds the limit.
[0054] Embodiment 3 The present invention also provides a reactive power compensation optimization control device for the user side based on machine learning, which is applied to the reactive power compensation optimization control method for the user side described in Embodiment 1, as Figure 9 shown, including a sampling module, a protection module, a communication module, and an algorithm module: The sampling module collects voltage and current data and calculates the power factor and voltage amplitude; The protection module shuts down the device when a device failure, grid anomaly, or a predicted failure occurs; Communication module; communicating with the data acquisition module and the intelligent capacitor or the cloud platform; Algorithm module, running a machine learning model for reactive power compensation prediction.
[0055] In this embodiment, a hardware system architecture is built, and the field layer devices collect the operation parameters of the distribution network and control the capacitor switching. Specifically, an intelligent capacitor bank is adopted, which has capacitor units configured according to the capacity gradient, a zero-crossing switching controller and a communication module. A power parameter acquisition terminal is used to obtain the operation data of the distribution network and the switching situation of the intelligent capacitor bank, and transmit it to the edge computing layer and the cloud platform layer through a communication interface.
[0056] Specifically, in this embodiment, a communication mechanism for the device layer is designed. The physical layer uses the IEC 61850 protocol for sampling value transmission, and the application layer uses the MQTT protocol for communication.
[0057] Use DVC to manage the machine learning model version, use TensorRT for optimization, and lightweight the model to ensure the real-time operation of the model.
[0058] The edge computing layer adopts an embedded reactive power compensation device, which runs the prediction model in real time and controls the intelligent capacitor bank to switch. The cloud platform layer remotely monitors and adds time stamps to the data obtained by the acquisition terminal, regularly updates the real-time database, removes old data and extreme data, and completes the model cluster training after preprocessing the data.
[0059] The embedded device uses a ZYNQ7010 processor, and the operating system is Linux. In the task system, data acquisition tasks, communication tasks, fault protection tasks and model prediction algorithms are scheduled hierarchically to complete the high-precision and reliable reactive power compensation control function.
[0060] The present invention also proposes a terminal, including a processor and a storage medium: The storage medium is used to store instructions; the processor is used to operate according to the instructions to execute the steps of the method described in any one of the above.
[0061] The present disclosure may be a system, a method, and / or a computer program product. The computer program product may include a computer-readable storage medium having thereon computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.
[0062] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: still can modify the specific implementation manners of the present invention or make equivalent replacements, and any modification or equivalent replacement that does not depart from the spirit and scope of the present invention shall be covered by the protection scope of the claims of the present invention.
Claims
1. A reactive power compensation optimization control method for the user side based on machine learning, characterized in that, Including: S1. Obtain the historical operation data of the distribution network, perform preprocessing, and construct a data set; S2. Use the data set to train the constructed machine learning model for predicting the capacitor switching amount; Construct a multi-objective loss function based on the capacitive reactive power switching amount, power factor, and voltage amplitude; S3. During the training process of the machine learning model for predicting the capacitor switching amount, construct an objective function to optimize the prediction results of the machine learning model for predicting the capacitor switching amount, and add hard constraint conditions to the optimized prediction results, so as to optimize the network parameters of the machine learning model for predicting the capacitor switching amount and obtain an initial machine learning model for predicting the capacitor switching amount; S4. Collect the real-time operation data of the power grid, input it into the initial machine learning model for predicting the capacitor switching amount for online training to obtain the predicted value of the capacitor switching amount, and realize the optimized control of reactive power compensation based on the predicted value of the capacitor switching amount.
2. The method for optimized control of user-side reactive power compensation based on machine learning according to claim 1, wherein: In S1, the historical operation data of the distribution network is obtained, including three-phase active power, three-phase reactive power, three-phase power factor, positive and negative sequence voltage amplitudes, the capacitance value of the compensation device put into operation, the deviation between the three-phase voltage and the rated voltage, and the three-phase power factor difference; the preprocessing includes removing extreme values and supplementing missing values.
3. The method for optimized control of user-side reactive power compensation based on machine learning according to claim 1, wherein: In S2, the input of the machine learning model for predicting the capacitor switching amount is three-phase active power, three-phase reactive power, the deviation between the three-phase voltage and the rated voltage, and the three-phase power factor difference, and the output is the capacitive reactive power switching amount, power factor, and voltage amplitude; Based on a multi-task network structure Construct a machine learning model for predicting capacitor switching amount, including a shared layer, a capacitive reactive power prediction layer, a power factor prediction layer, and a voltage amplitude prediction layer, and the structure of the machine learning model for predicting capacitor switching amount As shown in the following formula: ; where x is the eigenvalue input, is the output of the shared layer, is the output of the capacitive reactive power prediction layer, is the output of the power factor prediction layer, is the output of the voltage amplitude prediction layer, represents the ReLU activation function, and are the weight coefficient matrix and bias vector of the shared layer respectively, and are the weight coefficient matrix and bias vector of the ReLU activation function in the capacitive reactive power prediction layer respectively, and are the weight coefficient matrix and bias vector of the capacitive reactive power prediction layer respectively, and are the weight coefficient matrix and bias vector of the ReLU activation function in the power factor prediction layer respectively, and are the weight coefficient matrix and bias vector of the power factor prediction layer respectively, and are the weight coefficient matrix and bias vector of the ReLU activation function in the voltage amplitude prediction layer, and are the weight coefficient matrix and bias vector of the power factor prediction layer respectively, represents the swish activation function.
4. The method for optimized control of user-side reactive power compensation based on machine learning according to claim 1, wherein: In S3, the specific steps include: S301. During the training process, encode the capacitive reactive power switching amount predicted by the machine learning model for predicting the capacitor switching amount according to the configured capacity of the currently compensable capacitor, and determine the number of times the compensation capacitor is put into operation according to the encoding result; construct an objective function to optimize the predicted capacitive reactive power switching amount, voltage amplitude, and the number of capacitor switching actions to obtain an optimized result; wherein, the initial value of the objective function is calculated based on the current target power factor, current phase active power, and reactive power; S302. Add hard constraint conditions to the optimized result to force the output of the model to be within the set range, so as to optimize the network parameters of the machine learning model for predicting the capacitor switching amount.
5. The method for optimized control of user-side reactive power compensation based on machine learning according to claim 4, wherein: In S301, the calculation formula of the objective function is: ; Among them, is the weight coefficient of the capacitive reactive power switching amount , is the weight of the positive-sequence voltage amplitude deviation amount, is the weight coefficient of the negative-sequence voltage amplitude , is the penalty coefficient of the capacitor switching operation times , is the indicator function is the interval of the switching operation times; For each phase {a, b, c}, the initial value of the objective function is the theoretical capacitive reactive power value of the capacitor .
6. The method for optimized control of user-side reactive power compensation based on machine learning according to claim 4 or 5, wherein: In S302, the hard constraint condition formula is: ; Among them, is the three-phase capacitive reactive power switching amount, where \(i = a, b, c\), is the power factor of each phase, is the target power factor, is the remaining available capacitive reactive power value of each phase of the device, that is, the difference between the rated capacitive reactive power value of each phase of the device and the currently switched-in capacitive reactive power, is the positive-sequence voltage amplitude, is the negative-sequence voltage amplitude.
7. The method for optimized control of user-side reactive power compensation based on machine learning according to claim 1, wherein: In S4, the initial capacitor switching amount prediction machine learning model is deployed in the embedded reactive power compensation device, and online learning is performed based on real-time data to obtain a new model and new network parameters, and a capacitor switching amount prediction value is obtained. Based on the capacitor switching amount prediction value, optimal control of reactive power compensation is achieved; During the online learning process, an elastic weight loss function is used ; The elastic weight loss function constrains the difference between the parameters of the new model training and the parameters of the old model training, and also constrains the differences between the capacitive reactive power switching amount, power factor, and voltage amplitude output by the new model and the actual values; During the operation cycle of the emergency blocking judgment program, when the predicted capacitive reactive power switching amount is greater than the rated capacitive reactive power value of the device, and the voltage negative sequence amplitude at all time points within the cycle is greater than the preset threshold, emergency blocking is performed.
8. A user-side reactive power compensation optimal control method based on machine learning according to claim 7, characterized in that: During the online learning process, when new data is added, the input dimension is expanded, the original model is frozen, and the new data is trained; and the similarity of the new data and the prediction error are periodically judged to adjust the model structure and parameters; wherein, the prediction error refers to the error between the actual measured voltage amplitude after switching the capacitive reactive power switching amount predicted by the old model and the theoretically obtained voltage amplitude after switching.
9. A user-side reactive power compensation optimal control system based on machine learning, operating according to any one of the claims of a user-side reactive power compensation optimal control method based on machine learning as claimed in claims 1-8, including a data set construction module, a model training module, an optimization and constraint module, and an online update module, characterized in that: The data set construction module obtains the historical operation data of the distribution network, performs preprocessing, and constructs a data set; The model training module uses the data set to train the constructed capacitor switching amount prediction machine learning model; Construct a multi-objective loss function based on the capacitive reactive power switching amount, power factor, and voltage amplitude; The optimization and constraint module constructs an objective function for the prediction result of the trained capacitor switching amount prediction machine learning model, performs optimization to obtain an optimization result; adds hard constraint conditions to the optimization result to force the output of the model to be within the set range; The online update module performs online learning on the capacitor switching amount prediction machine learning model after hard constraints according to real-time data.
10. A terminal, including a processor and a storage medium; characterized in that: The storage medium is used to store instructions; the processor is used to operate according to the instructions to execute the steps of the method according to any one of claims 1-8.
Citation Information
Patent Citations
Power distribution network reactive voltage control method and device thereof
CN108376986A
Reactive power control method, device and equipment of direct current converter station and medium
CN117791692A
Low-voltage capacitor dynamic adjustment compensation control method and device
CN119944719A
Cited By
Passive vector parameter real-time monitoring method in AC-DC conversion process
CN120724348A
Voltage zero-crossing monitoring protection device for reactive switching switch
CN120955562A