A method and apparatus for power quality optimization based on artificial intelligence prediction and optimization

By employing AI-based prediction and optimization methods, combined with LSTM networks and reinforcement learning algorithms, the power quality problem in photovoltaic grid-connected systems was solved, achieving rapid response and high-precision power quality control, and improving the system's adaptability and operational reliability.

CN121192698BActive Publication Date: 2026-01-30ELECTRIC POWER RES INST OF STATE GRID ZHEJIANG ELECTRIC POWER COMAPNY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511736514.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-25
Publication Date
2026-01-30
Estimated Expiration
2045-11-25

AI Technical Summary

Technical Problem

Existing photovoltaic grid-connected systems suffer from slow response to power quality issues, insufficient control precision, and poor dynamic adaptability. Existing equipment cannot track grid load changes in real time, leading to grid instability and equipment damage.

Method used

An AI-based prediction and optimization method is adopted, which uses a long short-term memory network (LSTM) to predict changes in current components and combines reinforcement learning algorithms to optimize compensation strategies. A multi-band quasi-proportional resonance (PR) controller is used to achieve accurate current tracking, and a power quality optimization device is constructed with the ability to update model parameters online on a cloud platform.

Benefits of technology

It achieves forward-looking, dynamic, and high-precision control of power quality, avoids the lag and miscompensation problems caused by fixed parameter strategies, improves the system's adaptability and robustness to complex power grid environments, avoids redundant compensation and equipment overload, and improves the operational reliability of photovoltaic systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121192698B_ABST
    Figure CN121192698B_ABST
Patent Text Reader

Abstract

This invention relates to a power quality optimization method and apparatus based on artificial intelligence prediction and optimization, belonging to the field of photovoltaic grid-connected control technology. The method samples and extracts signals from the three-phase current at the grid connection point, utilizes a long short-term memory network to predict reactive power, harmonics, and unbalanced current components for the next control cycle, and dynamically generates multi-objective compensation commands using an edge optimizer. The system uses a multi-band quasi-proportional resonant controller for precise current tracking and introduces a time delay compensation mechanism for higher harmonics to improve dynamic response and control accuracy. Simultaneously, the system possesses cloud data synchronization and model update capabilities, enabling long-term adaptive adaptation to changes in grid conditions. This method effectively improves the power quality of photovoltaic grid-connected systems, reduces harmonic content and current imbalance, and has the advantages of fast response, precise control, and flexible deployment, making it suitable for intelligent photovoltaic control scenarios in complex grid environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of photovoltaic grid-connected control technology, and relates to a power quality optimization method and device based on artificial intelligence prediction and optimization. Background Technology

[0002] As the penetration rate of photovoltaic power generation in the power grid gradually increases, its intermittent and random characteristics lead to more complex power quality problems for the grid. Specifically, this manifests as severe reactive power fluctuations, serious three-phase current imbalances, and a significant increase in harmonic pollution. These problems not only affect the operational stability of the power grid but may also cause overload or damage to grid equipment, reducing grid reliability and power supply quality.

[0003] Existing technologies mostly employ static or fixed power quality compensation strategies, such as traditional Static Var Generators (SVG) and Active Power Filters (APF). While these devices can improve power quality to some extent, they generally suffer from slow response speed, fixed and limited compensation range, and inability to track the actual grid conditions in real time. Furthermore, some novel control strategies, such as proportional resonant (PR) control and model predictive control (MPC), while improving harmonic control performance and response speed to some extent, still face limitations in practical applications due to their typically fixed parameter settings. These limitations prevent them from adaptively adjusting to real-time changes in grid load, resulting in insufficient control accuracy and low dynamic performance.

[0004] However, existing research mostly remains at the theoretical level, lacking practical application solutions for efficient integration of prediction, optimization and real-time control technologies, especially in photovoltaic grid-connected systems where there are still few technical solutions for achieving dynamic and adaptive power quality compensation.

[0005] Therefore, developing an advanced photovoltaic converter power quality control method with fast response, precise control, and adaptability to changes in grid operating conditions has become a current research hotspot and challenge. Summary of the Invention

[0006] This application addresses the shortcomings of existing technologies by providing a power quality optimization method and apparatus based on artificial intelligence prediction and optimization. By deeply integrating artificial intelligence prediction models, dynamic optimization strategies, and high-precision real-time control technology, it solves key problems in photovoltaic grid-connected systems such as slow response speed, insufficient control precision, and poor dynamic adaptability in power quality issues.

[0007] This application provides a power quality optimization method based on artificial intelligence prediction and optimization, which includes the following steps:

[0008] S1, sample the three-phase current at the grid connection point to obtain the three-phase current. After processing with Clark and Park transforms and a second-order generalized integrator filter, the positive-sequence reactive current component is extracted. Components of negative sequence current on the dq axis , The harmonic components of the three-phase current are also considered, and the maximum effective value of the three-phase harmonic current is calculated based on these components. Among them, the positive sequence reactive current component This refers to the reference value of the positive-sequence reactive current and the component of the negative-sequence current on the q-axis. This refers to the reference value of the negative sequence reactive current, and the component of the negative sequence current on the d-axis. This is the negative sequence active current reference value;

[0009] S2, construct a long short-term memory network current prediction model, take the result of step S1 as the input of the model, and output the predicted values ​​of the positive sequence reactive current component, the negative sequence current component on the dq axis, and the maximum effective value of the three-phase harmonic current in the next control cycle; and calculate the uncompensated reactive current, harmonic current, and unbalanced current based on the predicted values ​​of the positive sequence reactive current component, the negative sequence current component on the dq axis, and the maximum effective value of the harmonic current in the next control cycle, and take the uncompensated reactive current, harmonic current, and unbalanced current as the optimization objects;

[0010] S3, based on the results of step S1 and the Softmax function, obtain the weight coefficients for each optimization object;

[0011] S4, construct the optimization objective function based on the optimization object and the weight coefficients of the optimization object obtained in S3;

[0012] S5, the Q-learning reinforcement learning algorithm is used to solve the constructed optimization objective function to obtain the compensation instruction for the next cycle;

[0013] S6, based on the results obtained in S5, utilizes a multi-band quasi-PR controller to enable the photovoltaic inverter to achieve precise multi-band current tracking.

[0014] Furthermore, in step S2, real-time running data (such as prediction error, current waveform THD value, and optimization target value) are periodically uploaded to the cloud platform to update model parameters and compensation strategies.

[0015] Further, step S2 includes: the Long Short-Term Memory (LSTM) network current prediction model comprises two cascaded LSTM layers, where the first LSTM layer returns complete temporal features for use by the second layer. Both layers contain 64 neurons and use the tanh activation function to enhance nonlinear fitting ability. The network training method is a hybrid mode of offline training and edge incremental learning. The training data comes from historical sampled load currents and labeled power pollution events. Weight updates are completed using backpropagation and the Adam optimizer. The specific model construction formula is as follows:

[0016] First-layer LSTM cell state update:

[0017]

[0018] in: The cell state at time t stores long-term information. Forget gates are used to control the proportion of historical information retained. The input gate is used to control the proportion of new information included. for Hide your status at all times. Let t be the 4-dimensional current component input at time t. , For candidate state weights and biases, It is the element-wise product.

[0019] Output of the first hidden state:

[0020]

[0021] in: Output the hidden state of the short-term features at time t. An output gate for controlling the proportion of cell state output.

[0022] Final prediction output:

[0023]

[0024] in: The predicted value for the compensation component in the next cycle. This is the hidden state at the last moment of the second layer. , represents the output layer parameters, and T represents the length of the input sequence.

[0025] Further, step S3 includes:

[0026] S3.1, Calculate the root mean square of the predicted value of the current component within the current control cycle based on the amplitude of the predicted component;

[0027] S3.2, based on the root mean square of the predicted value within the current control cycle of the current component, the weight coefficients of the optimization object are dynamically adjusted through the Softmax function.

[0028] Furthermore, in step S3.2, the weight coefficients of the optimization object are dynamically adjusted using the Softmax function, specifically using the following formula:

[0029]

[0030]

[0031] in, , , They are respectively , , The corresponding pollution weight coefficient, In order to be with the first i The root mean square (RMS) of the predicted current component related to the compensation target within the current control cycle. i =1, 2, and 3 correspond to the reactive current component, harmonic current component, and negative sequence current component, respectively. M To predict the number of sample points, i.e., obtained in step S2, For the first i Class I current component m One predicted sample.

[0032] Furthermore, the objective function expression in S4 is:

[0033]

[0034] in, To optimize the objective function, The uncompensated reactive current portion The uncompensated harmonic current component. The uncompensated portion of the unbalanced current. This represents the positive-sequence reactive current component, i.e., the positive-sequence reactive current reference value. This represents the q-axis component of the negative-sequence current, i.e., the reference value for the negative-sequence reactive current. This is a positive-sequence reactive current command. , These are the current commands for the negative sequence current on the d-axis and q-axis, respectively. This represents the maximum effective value of the three-phase harmonic current. This is the harmonic current compensation coefficient, and , , , They are respectively , , The corresponding pollution weight coefficient. , , and Related, and It changes periodically, therefore , , It is dynamically adjusted.

[0035] Further, step S5 includes:

[0036] S5.1, State Acquisition and Discretization: The deviation between the predicted and actual values ​​of reactive current, harmonic current and negative sequence current in the current cycle is calculated in a distributed manner. Each type of residual is distinguished by amplitude to identify and characterize the characteristics of power grid pollution deviation.

[0037] S5.2, Constructing the Action Space: The discrete compensation coefficients corresponding to the compensation intensity of harmonic current, reactive current, and negative sequence current constitute the action space, and each discrete compensation coefficient is distinguished according to the converter capacity to correspond to different compensation intensities.

[0038] S5.3, utilizing - Greedy strategy for action selection: Construct a two-dimensional Q-table, with the state of S5.1 as the row of the Q-table and the action of S5.2 as the column. The cell of the Q-table represents the expected long-term reward of executing the action in the column corresponding to the state of the row. Set a random number and an exploration rate, and compare their magnitudes. When the exploration rate is greater than the random number, randomly select an action; otherwise, select the action with the largest Q value in the current state. Based on this, generate a compensation instruction and send it to the PR controller.

[0039] S5.4 Reward Calculation: Based on the periodic change of the objective function, the difference between the periodic value before the action and the current periodic value is used as the reward value. When the periodic value before the action is greater than the current periodic value, the reward is deemed to be valid compensation; otherwise, the action is deemed to be invalid punishment.

[0040] S5.5, Q-value update: The Q-table is updated in real time after the cycle ends to optimize the state-action mapping.

[0041] The edge optimizer is a table-driven reinforcement learning Q-learning algorithm, which includes a state-action value function:

[0042] The state space is divided into several discrete intervals based on the magnitude of the various prediction residuals in the current period.

[0043] A set of fixed or discrete compensation coefficient triples {k h ,k q ,k un Action space;

[0044] Optimize the objective function f The rate of decline between two consecutive cycles is used as the reward function;

[0045] use - A greedy strategy is combined with a step-size decay learning rate for online updates.

[0046] Where, k h k is the harmonic current compensation coefficient. q k is the reactive current compensation coefficient. un This is the unbalanced current compensation coefficient.

[0047] We weigh the maximum value in the q table against the weight of a set of randomly selected new data.

[0048] Randomly selecting actions aims to try strategies that have not been fully validated, and may discover better actions than currently known (e.g., trying a new set of compensation coefficients may find a combination that makes the optimization objective function f smaller).

[0049] The maximum value in the Q-table represents an existing optimal value. The existing optimal value is compared with a new set of values ​​to select the optimal one. That is, the output of the greedy module is a choice, which may be the maximum value in the q-table (the corresponding value in the q-table in the diagram), or it may be the reward value (a possible better value).

[0050] The Q table is a two-dimensional matrix in the form Q(status, a), where the row index corresponds to the state space and the column index corresponds to the action space, i.e., the states and actions obtained earlier.

[0051] Further, step S6 includes:

[0052] The tracking control process of the compensation current is implemented by the converter, and a quasi-proportional resonant (PR) controller is used to achieve frequency-division precise current tracking.

[0053] To reduce resource consumption, the coordinate transformation starting point is changed from... αβ The method of shifting the coordinate system to the fundamental rotating coordinate system enables the 6k+1 harmonic and 6k–1 harmonic to be uniformly mapped to the 6k harmonic, thereby reducing the number of controllers by half.

[0054] A power quality optimization device based on artificial intelligence prediction and optimization, comprising:

[0055] The sampling module samples the three-phase current at the grid connection point. After processing by Clark and Park transforms and a second-order generalized integrator filter, it extracts the positive-sequence reactive current component, the negative-sequence current component on the dq axis, and the harmonic components of the three-phase current. Based on the harmonic components of the three-phase current, the maximum effective value of the three-phase harmonic current is calculated.

[0056] The model building module constructs a long short-term memory network current prediction model, using the results of the sampling module as input. The model outputs the predicted values ​​of the positive-sequence reactive current component, the negative-sequence current component on the dq axis, and the maximum effective value of the three-phase harmonic current for the next control cycle. Based on the predicted values ​​of the positive-sequence reactive current component, the negative-sequence current component on the dq axis, and the maximum effective value of the harmonic current for the next control cycle, the uncompensated reactive current, harmonic current, and unbalanced current are calculated, and these are used as optimization targets.

[0057] The weight coefficient construction module, the results of the sampling module, and the Softmax function are used to obtain the weight coefficients for each optimization object.

[0058] The objective function construction module constructs the optimization objective function based on the optimization object and the weight coefficients of the optimization object obtained from the weight coefficient construction module.

[0059] The solution module uses the Q-learning reinforcement learning algorithm to solve the constructed optimization objective function and obtain the compensation instruction for the next cycle;

[0060] The tracking module, based on the results obtained from the solution module, uses a multi-band quasi-PR controller to enable the photovoltaic inverter to achieve precise multi-band current tracking.

[0061] An artificial intelligence-based prediction and optimization power quality optimization device includes a memory and one or more processors. The memory stores executable code, and when the one or more processors execute the executable code, they are used to implement the aforementioned artificial intelligence-based prediction and optimization power quality optimization method.

[0062] Compared with the prior art, the present invention has the following beneficial effects:

[0063] (1) This invention proposes an adaptive compensation control method for power quality of photovoltaic converter based on artificial intelligence prediction and optimization. It uses LSTM network to predict the changing trends of reactive power, harmonics and unbalanced current components, and combines reinforcement learning optimizer to generate compensation instructions, thereby realizing forward-looking, dynamic and high-precision control of power quality management.

[0064] (2) The edge optimizer proposed in this invention adopts the Q-learning strategy, which can dynamically adjust the compensation strategy according to the actual prediction residual, so that the compensation result fits the current power grid state in real time, effectively avoiding the lag and miscompensation problems caused by the fixed parameter strategy.

[0065] (3) In the current tracking control, the present invention adopts a multi-band quasi-proportional resonant (PR) controller and introduces a phase compensation mechanism to improve the control performance of high-order harmonics. At the same time, the 6k±1 harmonics are uniformly mapped by the coordinate system transformation method, reducing the number of controllers by about 50% and greatly improving the system efficiency.

[0066] (4) The present invention has the ability to update model parameters online on the cloud platform, and combines edge computing to realize the continuous adaptive evolution of prediction and optimization models, which significantly enhances the long-term adaptability and robustness of the system to complex power grid environments.

[0067] (5) In the photovoltaic grid-connected scenario, the present invention realizes the identification of power quality pollution sources and the coordinated compensation control of multiple converters, effectively avoiding the problems of repeated compensation and equipment overload, and improving the overall compensation efficiency and the reliability of photovoltaic system operation. Attached Figure Description

[0068] Figure 1 This is a block diagram of the overall control system of Embodiment 1;

[0069] Figure 2 The structure diagram of the positive and negative sequence components of the fundamental voltage and current is obtained by filtering, sequence component extraction, and phase-locked loop.

[0070] Figure 3 This is a structural diagram of the LSTM prediction model;

[0071] Figure 4 This is a schematic diagram of the Softmax module with dynamically adjusted weight coefficients;

[0072] Figure 5 This is a flowchart of step S5;

[0073] Figure 6 A schematic diagram of current inner loop control - multi-PR control based on fundamental rotating coordinate system;

[0074] Figure 7 This is a topology diagram of the converter collaborative compensation control network;

[0075] Figure 8 Here is the waveform diagram corresponding to Thd;

[0076] Figure 9 The waveform diagram is for the power factor. Detailed Implementation

[0077] The technical solutions of the embodiments of the present invention will be explained and described below with reference to the accompanying drawings. However, the following embodiments are only preferred embodiments of the present invention and not all embodiments. Other embodiments obtained by those skilled in the art based on the embodiments in the implementation methods without creative effort are all within the protection scope of the present invention.

[0078] Example 1

[0079] This invention relates to a power quality optimization method based on artificial intelligence prediction and optimization. Figure 1 This is an overall control flowchart of the photovoltaic converter power quality compensation control method based on artificial intelligence prediction and optimization described in this invention. The diagram illustrates the complete closed-loop structure from current sampling, signal component extraction, LSTM prediction, edge optimizer, PR controller to compensation current output.

[0080] It includes the following steps:

[0081] S1, sample the three-phase current at the grid connection point to obtain the three-phase current. After processing by Clark and Park transforms and a second-order generalized integrator (SOGI) filter, the positive-sequence reactive current component is extracted. Components of negative sequence current on the dq axis , The harmonic components of the three-phase current are also considered, and the maximum effective value of the three-phase harmonic current is calculated based on these components. Among them, the positive sequence reactive current component This refers to the reference value of the positive-sequence reactive current and the component of the negative-sequence current on the q-axis. This refers to the reference value of the negative sequence reactive current, and the component of the negative sequence current on the d-axis. This is the negative sequence active current reference value;

[0082] Figure 2 The process involves filtering, sequence component extraction, and phase-locked loop (PLL) to obtain the fundamental positive and negative sequence components of the voltage and current. The diagram illustrates the process, which includes: obtaining the fundamental positive and negative sequence components from the three-phase current... Extract the positive-sequence reactive power component, negative-sequence component, and harmonic components, and explain. αβ The transformation process from a coordinate system to a fundamental synchronous rotating coordinate system.

[0083] S2, construct a long short-term memory network current prediction model, take the result of step S1 as the input of the model, and output the predicted values ​​of the positive sequence reactive current component, the negative sequence current component on the dq axis, and the maximum effective value of the harmonic current in the next control cycle; and calculate the uncompensated reactive current, harmonic current, and unbalanced current based on the predicted values ​​of the positive sequence reactive current component, the negative sequence current component on the dq axis, and the maximum effective value of the harmonic current in the next control cycle, and take the uncompensated reactive current, harmonic current, and unbalanced current as the optimization objects;

[0084] like Figure 3 As shown, the target compensation component for the next control cycle is predicted using a Long Short-Term Memory (LSTM) network:

[0085] , , ,

[0086] The specific details are as follows:

[0087] The LSTM network consists of two cascaded layers, each containing 64 neurons. It uses the tanh activation function and employs a hybrid mode of offline training and edge incremental learning. The training data comes from historical sampled load currents and labeled power pollution events. Weight updates are performed using backpropagation and the Adam optimizer. Figure 3 This is a structure diagram of the LSTM prediction model; the diagram includes an input layer (current components from the past few cycles), a two-layer LSTM hidden layer, a linear regression output layer, and output prediction components. , , , ;

[0088] The uncompensated reactive, negative sequence, and harmonic current components can be expressed as follows:

[0089]

[0090] S3, based on the results of step S1 and the Softmax function, obtain the weight coefficients for each optimization object; such as Figure 4 As shown, the process includes:

[0091] S3.1, Calculate the root mean square of the predicted value of the current component within the current control cycle based on the amplitude of the predicted component;

[0092] S3.2, based on the root mean square of the predicted value within the current control cycle of the current component, the weight coefficients of the optimization object are dynamically adjusted using the Softmax function. The specific formula used is:

[0093]

[0094]

[0095] in The root mean square (RMS) of the predicted current component related to the i-th type of compensation objective within the current control cycle. i =1, 2, and 3 correspond to the reactive current component, harmonic current component, and negative sequence current component, respectively, and M is the number of prediction sample points, obtained in step S2. For the first i The m-th prediction sample of the current component.

[0096] S4, construct the optimization objective function based on the optimization object and the weight coefficients of the optimization object obtained in S3;

[0097] The reactive current, harmonic current, and unbalanced current that have been compensated but not yet compensated are taken as the optimization objects, and an optimization objective function is constructed with the sum of squares of the optimization objects as the minimum.

[0098] Construct the optimization objective function:

[0099]

[0100] in To optimize the objective function, The uncompensated reactive current portion The uncompensated harmonic current component. The uncompensated portion of the unbalanced current is represented by the superscript 'w', indicating the uncompensated portion, and the subscript 'un', indicating the three-phase unbalanced portion, i.e., the negative sequence portion. , , They are respectively , , The corresponding pollution weight coefficient; , , and Related, and It changes periodically, therefore , , It is dynamically adjusted.

[0101] S5, the Q-learning reinforcement learning algorithm is used to solve the constructed optimization objective function to obtain the compensation instruction for the next cycle;

[0102] The converter output current must not exceed the limit value. Under the constraints, the compensation instructions are solved using the edge optimizer. , , , ;

[0103] The edge optimizer is a table-driven reinforcement learning Q-learning algorithm with a state-action value function of the following form:

[0104] State space: Divided into several discrete intervals based on the magnitude of various prediction residuals in the current period;

[0105] Action space: a set of fixed or discrete compensation coefficient triplets {k} h k q k un};

[0106] Reward function: to optimize the decrease of the objective function f between two consecutive cycles;

[0107] Strategy update method: Adopt - A greedy strategy is combined with a step-size decay learning rate for online updates.

[0108] Figure 5 This is a flowchart of step S5. The diagram illustrates the state transition process, action space (compensation coefficients), reward update mechanism, and policy output method of Q-learning, explaining how it collaborates with AI prediction results to form optimal control instructions. The process includes:

[0109] S5.1 performs state acquisition and discretization processing, calculates the deviation between the predicted and actual sampled power quality pollution values ​​within the current control cycle, and obtains three types of prediction residuals, corresponding to reactive current residuals, harmonic current residuals, and negative sequence current residuals, respectively; the residual dimensions are fixed at 3, corresponding one-to-one with the three types of power quality pollution: reactive, harmonic, and negative sequence; the amplitude range of each type of residual is divided into three discrete intervals: "low," "medium," and "high"; since the residual dimension is 3 and each dimension has 3 intervals, the total number of states is 27 (i.e., 3... 3 There are 10 types, and each state is represented by a unique identifier (such as "low-medium-high") to indicate the current power grid pollution deviation characteristics.

[0110] S5.2, define and initialize the action space. The action space is a discrete "compensation coefficient triplet" {k h ,k q ,k un}, where k h The harmonic compensation coefficient controls the harmonic compensation level, k q The reactive power compensation coefficient controls the reactive power compensation level, k un The negative sequence compensation coefficient controls the degree of negative sequence compensation. Each compensation coefficient is divided into three discrete levels based on the converter's output capacity, corresponding to "weak compensation, medium compensation, and strong compensation." Since each coefficient has three levels, the total number of actions is 27 (i.e., 3...). 3 There are 1,000 types, and each action corresponds to a specific set of compensation intensity combinations.

[0111] S5.3, based on - A greedy strategy is used to select actions, balancing "utilizing known optimal actions" with "exploring new actions" to avoid getting trapped in local optima; a high exploration rate is initially adopted. =0.8, adapting to unknown power grid conditions, gradually decays with each control cycle iteration, every 100 cycles, Multiply by 0.9, later stage The rate is kept stable at 0.1, i.e., a low exploration rate, to ensure compensation stability; when selecting an action, a random number r between 0 and 1 is generated first, and if r < 0, the action is considered stable. Then randomly select one action; if r ≥ Then query the Q-table and select the action with the largest Q-value in the current state; based on the selected {k} h ,k q ,k un}, combined with the optimization objective function constraints of step S3, calculate the specific compensation command ( , , , ), and send it to the multi-band PR controller.

[0112] S5.4 calculates and provides feedback on the reward value. The reward is based on the "periodic variation amplitude" of the optimization objective function f, which reflects the improvement effect of the action on power quality. During the calculation, the objective function value f of the previous cycle before the action is executed is recorded first. prev (Based on the uncompensated pollution component of the previous cycle), then calculate the objective function value f for the current cycle after the action is executed. curr (Calculated based on the uncompensated pollution component of the current cycle), the reward value formula is Reward=f prev -f curr If f curr <f prev That is, if uncompensated pollution is reduced, the reward is positive and the larger the difference, the higher the reward. If f curr ≥f prev This means that if pollution increases without compensation, the reward will be negative, meaning that the punishment is ineffective or harmful.

[0113] S5.5 performs Q-value updates and policy iterations. The Q-table is a two-dimensional table, with rows corresponding to 27 states and columns corresponding to 27 actions. The cell value Q(status, a) represents the "expected long-term reward for performing action a in state status". The classic Q-learning update rule is adopted:

[0114]

[0115] Where α is the learning rate (initial α=0.5, decays with iterations, multiplied by 0.9 every 100 cycles to avoid Q-value oscillations in the later stages), γ is the discount factor (γ=0.9, emphasizing rewards in future cycles to ensure long-term optimality of the strategy), status is the current state, status' is the state of the next cycle after executing action a, and max(Q(status',a')) is the maximum Q-value of all actions under the next state status'. After each control cycle ends, the corresponding Q(status,a) value in the Q table is updated in real time based on the current state status, the executed action a, the calculated reward, and the next state status', gradually optimizing the state-action mapping relationship.

[0116] S6, based on the results obtained in S5, utilizes a multi-band quasi-PR controller to enable the photovoltaic inverter to achieve precise multi-band current tracking. The specific process includes:

[0117] Because ideal PR controllers have component errors in digital implementation, quasi-PR controllers are used to track fundamental and harmonic currents.

[0118] According to the national standard GB17625.1-2022 "Electromagnetic Compatibility Limits Part 1: Harmonic Current Emission Limits (Input Current per Phase Not Exceeding 16A)", clear regulations are made for the emission of harmonic currents of the 25th order and below. In order to achieve compensation for harmonics below the 25th order, in the traditional αβ stationary coordinate system, a separate PR controller needs to be designed for each harmonic frequency, which leads to a complex compensation process and high computational resource consumption.

[0119] like Figure 6 As shown, given that the harmonics in the system are mainly odd harmonics, with the 6k+1 harmonic being mostly positive-sequence components, the 6k–1 harmonic being negative-sequence components, and the 3k harmonic being zero-sequence (usually suppressed by delta-connected transformers), to optimize control efficiency, it is proposed to transfer the reference coordinate system in the PR control strategy from the αβ system to the fundamental rotating coordinate system. This transformation uniformly converts the 6k+1 and 6k–1 harmonics into harmonics of the 6k frequency, thereby effectively halving the number of controllers required and the computational burden.

[0120] Real-time operational data (such as prediction error, current waveform THD value, and optimization target value) are periodically uploaded to the cloud platform to update model parameters and compensation strategies.

[0121] Example 2

[0122] A power quality optimization device based on artificial intelligence prediction and optimization, comprising:

[0123] The sampling module samples the three-phase current at the grid connection point. After processing by Clark and Park transforms and a second-order generalized integrator filter, it extracts the positive-sequence reactive current component, the negative-sequence current component on the dq axis, and the harmonic components of the three-phase current. Based on the harmonic components of the three-phase current, the maximum effective value of the three-phase harmonic current is calculated.

[0124] The model building module constructs a long short-term memory network current prediction model, using the results of the sampling module as input. The model outputs the predicted values ​​of the positive-sequence reactive current component, the negative-sequence current component on the dq axis, and the maximum effective value of the three-phase harmonic current for the next control cycle. Based on the predicted values ​​of the positive-sequence reactive current component, the negative-sequence current component on the dq axis, and the maximum effective value of the harmonic current for the next control cycle, the uncompensated reactive current, harmonic current, and unbalanced current are calculated, and these are used as optimization targets.

[0125] The weight coefficient construction module, the results of the sampling module, and the Softmax function are used to obtain the weight coefficients for each optimization object.

[0126] The objective function construction module constructs the optimization objective function based on the optimization object and the weight coefficients of the optimization object obtained from the weight coefficient construction module.

[0127] The solution module uses the Q-learning reinforcement learning algorithm to solve the constructed optimization objective function and obtain the compensation instruction for the next cycle;

[0128] The tracking module, based on the results obtained from the solution module, uses a multi-band quasi-PR controller to enable the photovoltaic inverter to achieve precise multi-band current tracking.

[0129] The current sampling and signal extraction module is used to obtain... , , , Embedded processor with integrated LSTM network model and edge optimization strategy; multi-band PR controller module; uses CAN bus, Ethernet or RS485 communication protocol to synchronize information and issue commands with cloud or other devices.

[0130] Figure 7 This is a topology diagram of the converter collaborative compensation control network, illustrating the collaborative control structure built by interconnecting multiple converter control devices via CAN or Ethernet. It marks the master-slave coordination mechanism, information exchange paths, and task allocation strategies. In a photovoltaic grid-connected system, multiple photovoltaic converter controllers are interconnected via Ethernet or CAN bus, employing a distributed master node voting negotiation mechanism or a master-slave structure to achieve the following functions: determining the main pollution source types in the current system; collaboratively allocating reactive power and harmonic compensation tasks; avoiding redundant compensation and equipment overload; and optimizing overall compensation efficiency.

[0131] Example 3

[0132] A power quality optimization device based on artificial intelligence prediction and optimization includes a memory and one or more processors. The memory stores executable code, and when the one or more processors execute the executable code, they are used to implement the power quality optimization method based on artificial intelligence prediction and optimization described in Embodiment 1.

[0133] Application examples

[0134] To verify the practicality and effectiveness of the method described in this invention, an application example was simulated using MATLAB / Similink-2023a. The power quality adaptive compensation control system proposed in this invention was deployed on a 50kW photovoltaic system. This system is connected to a low-voltage 380V three-phase AC power grid, and the following power quality problems exist on-site: reactive power fluctuations caused by drastic load changes in the morning and evening, negative sequence current imbalances caused by equipment switching at midday, and high-order harmonic interference generated by periodic equipment startup.

[0135] After the three-phase grid-connected current is acquired by the Hall sensor, it is sent to the DSP controller for Clark and Park transformation and SOGI filtering to extract the positive sequence reactive power component. ), negative order dq components ( , ) and the maximum effective value of harmonics ( );

[0136] Based on sampling data from 7 historical control periods (including) , , , Using a pre-trained two-layer LSTM network model, the expected compensation target in the next cycle is predicted, and the model accuracy on the validation set reaches over 98%.

[0137] The edge optimizer uses the Q-learning algorithm to dynamically adjust the combination of compensation coefficients (k) based on the current period prediction error. h ,k q ,k un And adaptively allocate reactive power, harmonics, and negative sequence weights through the Softmax function;

[0138] The compensation current reference value is tracked and controlled by the quasi-PR controller. The PR module automatically adjusts the resonant frequency for odd harmonics from the 1st to the 25th. After switching to the synchronous rotating coordinate system, the number of controllers is reduced from 24 to 12, significantly reducing computational resource consumption. The system considers the delay characteristics of each harmonic and automatically introduces a phase compensation angle, improving control accuracy.

[0139] The system connects to a cloud platform via an Ethernet interface, uploading THD values, power factor, compensation current, and optimization targets in real time. The cloud platform uses an incremental learning mechanism to periodically fine-tune the LSTM weights and optimization strategies, improving its long-term adaptability.

[0140] Experimental results:

[0141] Before system deployment, the peak total harmonic distortion (THD) of the current on a typical working day reached 8.6%, which was controlled below 3.2% after compensation; the three-phase current imbalance was reduced from 7.3% to 1.5%; and the power factor was kept stable above 0.99.

[0142] like Figure 8 The graph shows the waveform corresponding to Thd, with the horizontal axis representing time and the vertical axis representing the Thd value. Power quality management began at 0.65s, and the graph shows that Thd decreased from 27% to approximately 2.5%. Figure 9 The graph shows the waveform corresponding to the power factor. The horizontal axis represents time, and the vertical axis represents the power factor. Power quality management begins at 0.6s, and the graph shows that the power factor increases from 0.6 to about 1.

[0143] This application example verifies the robustness and effectiveness of the present invention under various power quality interference scenarios, and has good prospects for engineering promotion.

[0144] It should be noted that the above content merely illustrates the technical concept of the present invention and should not be construed as limiting the scope of protection of the present invention. For those skilled in the art, various improvements and modifications can be made without departing from the principle of the present invention, and all such improvements and modifications fall within the scope of protection of the claims of the present invention.

Claims

1. A power quality optimization method based on artificial intelligence prediction and optimization, characterized in that, It comprises the following steps: S1, the three-phase current of the grid-connected point is sampled to obtain three-phase current, which is processed by Clark and Park transformation and second-order generalized integrator filter to extract positive sequence reactive current component, negative sequence current component on dq axis and harmonic component of three-phase current, and the maximum effective value of three-phase harmonic current is calculated based on the harmonic component of three-phase current; S2, a long short-term memory network current prediction model is constructed, the results of step S1 are taken as the input of the model, and the prediction values of the positive sequence reactive current component, the negative sequence current component on dq axis and the maximum effective value of three-phase harmonic current in the next control period are output by the model; And based on the prediction values of the positive sequence reactive current component, the negative sequence current component on dq axis and the maximum effective value of harmonic current in the next control period, the uncompensated reactive current, harmonic current and unbalanced current are calculated, and the uncompensated reactive current, harmonic current and unbalanced current are taken as the optimization object; S3, based on the results of step S1 and the Softmax function, the weight coefficient of each optimization object is obtained; S4, based on the optimization object and the weight coefficient of the optimization object obtained in S3, an optimization objective function is constructed; S5, the Q-learning reinforcement learning algorithm is used to solve the constructed optimization objective function to obtain the compensation instruction in the next period; S6, according to the results obtained in S5, a multi-band quasi-PR controller is used to make the photovoltaic inverter realize accurate tracking of current in multiple frequency bands.

2. The power quality optimization method based on artificial intelligence prediction and optimization according to claim 1, characterized in that, In the step S2, the long short-term memory network current prediction model comprises two layers of LSTM networks connected in series, wherein the first layer of LSTM returns complete time sequence features for use by the second layer, both layers have neurons, and both use tanh activation function, the network training mode is offline training plus edge incremental learning hybrid mode, the training data is derived from historical sampling load current and labeled power pollution events, and the weight update is completed by using back propagation and Adam optimizer. 3.The power quality optimization method based on artificial intelligence prediction and optimization according to claim 1, wherein, Step S3 includes: S3.1, according to the amplitude of the predicted component, the root mean square of the predicted value of the current component in the current control period is calculated; S3.2, based on the root mean square of the predicted value of the current component in the current control period, the weight coefficient of the optimization object is dynamically adjusted by the Softmax function.

4. The power quality optimization method based on artificial intelligence prediction and optimization according to claim 3, characterized in that, In the step S3.2, the weight coefficient of the optimization object is dynamically adjusted by the Softmax function, and the specific formula used is: wherein, , , are respectively , , corresponding pollution weight coefficients, is the root mean square of the predicted value of the current component related to the compensation target of the i class in the current control period, i = 1, 2, 3 respectively correspond to the reactive current component, the harmonic current component, the negative sequence current component, M is the number of prediction sample points, is the i prediction sample of the m current component.

5. The power quality optimization method based on artificial intelligence prediction and optimization according to claim 4, characterized in that, The optimization objective function expression in S4 is: wherein is the objective function to be optimized, is the uncompensated reactive current component, is the uncompensated harmonic current component, is the uncompensated unbalanced current component, is the positive sequence reactive current component, i.e. the positive sequence reactive current reference value, is the negative sequence current component on the q-axis, i.e. the negative sequence reactive current reference value, is the positive sequence reactive current command, , are the current commands of the negative sequence current on the d-axis and q-axis, respectively, is the maximum effective value of the three-phase harmonic current, is the harmonic current compensation factor, and , , , are the , , corresponding pollution weight factors.

6. The power quality optimization method based on artificial intelligence prediction and optimization according to claim 1, characterized in that, Step S5 includes: S5.1, state acquisition and discretization: the prediction value and actual value deviation of the reactive current, harmonic current and negative sequence current in the current period are calculated, each type of residual is divided according to the amplitude, and the deviation characteristics of the power grid pollution are identified; S5.2, action space construction: the discrete compensation coefficients corresponding to the compensation strength of harmonic current, reactive current and negative sequence current are constructed into an action space, and each discrete compensation coefficient is divided according to the converter capacity to correspond to different compensation strengths; S5.3, utilizing - Greedy strategy action selection: construct a two-dimensional Q table, the state of S5.1 as the row of the Q table, the action of S5.2 as the column of the Q table, then the cell of the Q table means the expected long-term reward of executing the action of the column in the state corresponding to the row; set a random number and an exploration rate, and compare the sizes of the two, when the exploration rate is greater than the random number, randomly select an action, otherwise select the action with the maximum Q value in the current state; accordingly, generate a compensation instruction and issue it to the PR controller; S5.4 reward calculation: based on the period change of the optimization objective function, the difference between the period value before action and the current period value is taken as the reward value, when the period value before action is greater than the current period value, it is determined that the reward is effective compensation, otherwise it is determined that the punishment is invalid action; S5.5, Q value update: update the Q table in real time after the period ends to optimize the state-action mapping.

7. An electric power quality optimization device based on artificial intelligence prediction and optimization, characterized by, It comprises: The sampling module samples the three-phase current of the grid-connected point, processes the positive sequence reactive current component, the negative sequence current components on the dq axis and the harmonic components of the three-phase current through Clark and Park transformation and second-order generalized integrator filter, and calculates the maximum effective value of the three-phase harmonic current based on the harmonic components of the three-phase current; The model construction module constructs a long short-term memory network current prediction model, takes the results of the sampling module as the input of the model, and outputs the prediction values of the positive sequence reactive current component, the negative sequence current components on the dq axis and the maximum effective value of the three-phase harmonic current in the next control period through the model; And based on the prediction values of the positive sequence reactive current component, the negative sequence current components on the dq axis and the maximum effective value of the harmonic current in the next control period, the uncompensated reactive current, harmonic current and unbalanced current are calculated, and the uncompensated reactive current, harmonic current and unbalanced current are taken as the optimization objects; The weight coefficient construction module obtains the weight coefficient of each optimization object by the results of the sampling module and the Softmax function; The objective function construction module constructs the optimization objective function based on the weight coefficients of the optimization objects obtained by the weight coefficient construction module; The solving module solves the constructed optimization objective function by using the Q-learning reinforcement learning algorithm to obtain the compensation instruction of the next period; The tracking module uses the multi-frequency band quasi-PR controller to realize the accurate tracking of the current of the photovoltaic inverter according to the results obtained by the solving module.

8. An electric power quality optimization device based on artificial intelligence prediction and optimization, characterized by, The memory stores executable code, and the one or more processors execute the executable code to implement the artificial intelligence prediction and optimization based power quality optimization method in any one of claims 1-6.

Citation Information

Patent Citations

  • Flexible control method for new energy grid connection

    CN120638478A

  • Model prediction control method for voltage source-type rectifier when grid voltage is unbalanced

    WO2014079124A1