Power grid voltage frequency detection method for suppressing harmonic interference
By combining topological coding, density peak clustering, and lightweight graph neural networks, the anti-interference and adaptability problems of power grid frequency detection under complex operating conditions are solved, achieving high-precision, stable, and reliable frequency detection, which is suitable for power grid voltage and frequency detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NINGXIA UNIVERSITY
- Filing Date
- 2026-01-26
- Publication Date
- 2026-05-05
AI Technical Summary
Existing power grid voltage and frequency detection methods have limited anti-interference capabilities, poor dynamic adaptability, and insufficient detection accuracy and stability under complex operating conditions such as high harmonic distortion, dynamic load changes, and new energy grid connection, resulting in unreliable frequency detection results and low flexibility in engineering applications.
A full-link collaborative technology solution is adopted, which includes topology-encoded signal acquisition, heterogeneous topology collaborative anti-interference and fundamental frequency extraction, lightweight intelligent adaptive calibration, and intelligent adaptive synchronous interactive output. The fundamental frequency and interference signals are initially separated by topology encoding, and frequency calibration is performed by combining density peak clustering and lightweight graph neural network to achieve adaptive frequency detection.
Achieving high-precision, high-stability, and highly adaptive frequency detection in complex power grid environments reduces engineering debugging complexity, improves equipment docking efficiency and system integration, and ensures the phase consistency and reliability of frequency detection data.
Smart Images

Figure CN121978401A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of power grid power quality detection technology, and more specifically, to a power grid voltage frequency detection method for suppressing harmonic interference. Background Technology
[0002] With the large-scale grid connection of new energy sources and the widespread integration of power electronic equipment, the power grid operating environment is becoming increasingly complex. Interference problems such as high-order harmonics, interharmonics, and voltage sags are becoming prominent, placing stringent demands on the accurate and stable detection of power grid voltage and frequency. Existing detection methods based on fixed-parameter filtering, adaptive filtering, or phase-locked loop improvements generally suffer from technical bottlenecks such as limited anti-interference range, insufficient accuracy and stability under dynamic operating conditions, difficulty in adaptive parameter adjustment, and rigid output modes that rely on manual configuration. These methods are insufficient to meet the reliable measurement requirements under complex scenarios such as high harmonic distortion and rapid load fluctuations.
[0003] Therefore, the present invention provides a power grid voltage frequency detection method for suppressing harmonic interference, thereby improving the above-mentioned technical problems. Summary of the Invention
[0004] This invention aims to address the shortcomings of existing technologies by providing a power grid voltage and frequency detection method that suppresses harmonic interference. Through an innovative end-to-end design that integrates topology coding, heterogeneous collaborative anti-interference, intelligent adaptive calibration, and intelligent adaptive synchronous interactive output, this invention achieves high-precision, high-stability, strong adaptability, and high-reliability frequency detection in complex power grid environments.
[0005] The above-mentioned technical objective of the present invention is achieved through the following technical solution: a method for detecting power grid voltage frequency to suppress harmonic interference, comprising the following steps:
[0006] S1. Topology-coded signal acquisition: The original voltage signal of the power grid is amplified and bandpass filtered to obtain a conditioned analog signal; under the trigger of a synchronous clock, the conditioned analog signal is discretely sampled to obtain a sampling sequence; the sampling sequence is mapped to the node attributes of the topology graph to construct an adjacency matrix, and the elements of the adjacency matrix are used to calculate the correlation strength based on the amplitude difference and phase difference of the corresponding sampling points; according to the preset correlation strength threshold, the nodes in the topology graph are divided into strongly correlated core clusters and weakly correlated edge clusters to achieve preliminary separation of the fundamental signal and interference signal;
[0007] S2. Heterogeneous Topology Collaborative Interference Rejection and Fundamental Wave Extraction: Based on the density peak clustering algorithm, the topology graph obtained in step S1 is clustered, dividing the nodes into core clusters dominated by fundamental wave signals and edge clusters dominated by harmonic interference; windowing and fast Fourier transform are applied to the sampled signals within the core clusters to obtain the spectrum; the peak value of the fundamental wave spectrum is located through spectrum analysis, and the initial value of the fundamental wave frequency is calculated using an interpolation algorithm; the validity of the initial value of the fundamental wave frequency is judged based on the spectral amplitude threshold, spectral purity, and spectral flatness, and if the judgment is invalid, resampling is triggered;
[0008] S3. Lightweight Intelligent Adaptive Calibration: Construct a dynamic topology graph reflecting the harmonic propagation characteristics of the power grid; using a trained lightweight graph neural network model, output the correction amount of the initial value of the fundamental frequency according to the node characteristics of the dynamic topology graph to obtain the preliminary calibration frequency; use a reinforcement learning algorithm to dynamically optimize the parameters of the lightweight graph neural network, and perform weighted fusion of the preliminary calibration frequency and the historical calibration frequency based on the reward value of the reinforcement learning algorithm to obtain the final calibration frequency;
[0009] S4. Intelligent Adaptive Synchronous Interactive Output: The final calibration frequency is converted into an analog signal, and the output impedance is adjusted through an adaptive impedance matching network to match the receiving device; the final calibration frequency data with a timestamp is generated, and the synchronization accuracy of the timestamp is dynamically adjusted according to the degree of power grid distortion; the communication protocol is automatically adapted through the intelligent protocol identification module, and a data frame containing basic fields and optional extended fields is encapsulated for output; feedback signals from the receiving device are received, and the transmission strategy is dynamically adjusted according to the feedback signals; if continuous feedback is abnormal, step S3 is triggered for secondary calibration.
[0010] As a preferred embodiment of the present invention, in S1, the elements of the constructed adjacency matrix are... The calculation formula is:
[0011]
[0012] in, and Let the amplitudes be the values at the i-th and j-th sampling points. and For its phase, This is the amplitude attenuation coefficient.
[0013] As a preferred embodiment of the present invention, in S2, the clustering process based on the density peak clustering algorithm includes:
[0014] Calculate the matching degree between the correlation vector of each sampling point in the current topology graph and the correlation vector of the standard fundamental signal. Based on the matching degree Calculate the local density at each sampling point and distance ;according to Determine cluster centers and assign sampling points to core clusters based on the difference in matching degree with the cluster centers. or edge cluster .
[0015] As a preferred embodiment of the present invention, in S2, the initial value of the fundamental frequency is calculated using an interpolation algorithm. The formula is:
[0016]
[0017] in, This represents the peak number of the fundamental spectral line. For frequency resolution, For spectral amplitude, The frequency corresponding to the DC component in the FFT operation.
[0018] As a preferred embodiment of the present invention, in S3, the construction of the dynamic topology graph includes:
[0019] Using the power grid's buses, loads, and grid connection points as nodes, a graph structure containing node feature vectors and edge weight matrices is constructed. Based on real-time measurement data from the synchronous phasor measurement unit, the edge weight matrix is dynamically updated using the following formula:
[0020]
[0021] in, For edge weights, To update the coefficients, For the update cycle, For real-time equivalent impedance, This is the reference impedance.
[0022] As a preferred embodiment of the present invention, in S3, the reinforcement learning algorithm is a soft Actor-Critic algorithm, and its reward function is... for:
[0023]
[0024] in, For calibration error, To calibrate the error threshold, Adjust the penalty coefficient for the parameters. The network parameter adjustment amount; the weights of the weighted fusion. According to the reward value Dynamic adjustment.
[0025] As a preferred embodiment of the present invention, S3 further includes calibration stability judgment: calculating the variance of the final calibration frequency within a sliding window. ;when Exceeding the preset stability threshold In this way, the update cycle of the dynamic topology graph and the parameter optimization cycle of the reinforcement learning algorithm are automatically shortened.
[0026] As a preferred embodiment of the present invention, in S4, the adaptive impedance matching network detects the input impedance of the receiving device in real time. And adjust the matching coefficient To achieve impedance matching, where This is the reference impedance.
[0027] As a preferred embodiment of the present invention, in S4, the dynamic adjustment of the synchronization accuracy level is based on the operating condition distortion coefficient. The calculation formula is as follows: in, The total harmonic distortion (THD) is the harmonic distortion rate. This is the voltage sag level factor. and These are the weighting coefficients;
[0028] according to The different threshold ranges that the synchronization accuracy level is determined. .
[0029] As a preferred embodiment of the present invention, in S4, the step of dynamically adjusting the transmission strategy based on the feedback signal includes:
[0030] Based on the feedback transmission anomaly identifier Dynamically adjust the current communication rate and number of data resends ;
[0031] When continuous When an abnormality is detected, step S3 is automatically triggered to perform a secondary calibration of the frequency.
[0032] In summary, the present invention has the following beneficial effects:
[0033] Firstly, this invention abandons the traditional passive filtering framework. It uses topological coding to initially separate the fundamental frequency and interference signals at the characterization level, and combines this with a topological interference management algorithm based on density peak clustering to achieve deep physical separation and suppression of multi-band harmonics and random interference. This method does not require preset fixed filtering parameters and can adaptively adapt to complex scenarios with different harmonic contents and interference types. It fundamentally overcomes the limitations of traditional FIR / IIR filtering algorithms with fixed parameters and large estimation deviations in adaptive filtering algorithms, ensuring that the pure fundamental frequency signal characteristics can still be effectively preserved and extracted even under high distortion conditions.
[0034] Secondly, this invention refines the spectrum and eliminates the picket fence effect through an interpolation-based Fast Fourier Transform (FFT) algorithm, thereby improving the initial extraction accuracy of the fundamental frequency. Furthermore, it innovatively introduces a lightweight graph neural network (GNN) + reinforcement learning intelligent adaptive calibration mechanism, which can dynamically correct frequency offsets based on real-time updated grid topology features, and balance response speed and output stability through a weighted fusion strategy of historical and real-time results. This design effectively solves the problems of frequency tracking lag, convergence oscillation, and parameter drift inherent in traditional algorithms under dynamic operating conditions such as load mutations and fluctuations in renewable energy output, ensuring long-term high accuracy and stability of the detection results under complex operating conditions.
[0035] Third, this invention is built entirely with industrial-grade mass-production hardware. Its hardware architecture and synchronization mechanism are seamlessly compatible with existing power grid synchronization phasor measurement units (PMUs) and monitoring systems, eliminating the need for large-scale modifications to existing power grid infrastructure. The output stage integrates an adaptive impedance matching network, an intelligent protocol identification module, and a modular data encapsulation mechanism, enabling it to automatically identify and adapt to the electrical interfaces, communication protocols, and data format requirements of different receiving devices. This significantly reduces the complexity of engineering debugging and manual configuration costs, while improving equipment docking efficiency and system integration.
[0036] Fourth, based on the parallel processing architecture of Field-Programmable Gate Array (FPGA) and the coordinated scheduling of Microcontroller Unit (MCU), efficient parallel execution of tasks such as topology clustering, spectrum analysis, and model inference is achieved, ensuring low latency throughout the entire link from signal acquisition to result output. The output stage dynamically optimizes timestamp accuracy through a working condition-linked synchronization algorithm and innovatively introduces a dynamic optimization mechanism for transmission strategies based on bidirectional interactive feedback. This mechanism can adaptively adjust the verification strength, communication rate, and retransmission strategy according to channel conditions, thereby ensuring phase consistency, integrity, and extremely high reliability of frequency detection data transmission across nodes in complex industrial electromagnetic environments, providing a solid data foundation for real-time power grid scheduling and advanced control. Attached Figure Description
[0037] Figure 1This is a flowchart of a power grid voltage frequency detection method for suppressing harmonic interference, provided as an embodiment of the present invention. Detailed Implementation
[0038] The present application will now be described in detail with reference to specific embodiments. These embodiments will help those skilled in the art to further understand the present application, but do not limit the present application in any way. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present application. These all fall within the protection scope of the present application.
[0039] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0040] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. The term "and / or" as used in this specification includes any and all combinations of one or more of the associated listed items.
[0041] Furthermore, the technical features involved in the various embodiments of this application described below can be combined with each other as long as they do not conflict with each other.
[0042] This disclosure aims to address the technical problems of existing power grid voltage and frequency detection methods, which suffer from unreliable frequency detection results and low engineering application flexibility under complex operating conditions such as high harmonic distortion, dynamic load changes, and new energy grid integration. These problems stem from limited anti-interference capabilities, poor dynamic adaptability, insufficient detection accuracy and stability, and a single output mode. Therefore, this disclosure proposes a power grid voltage and frequency detection method that suppresses harmonic interference. It employs a full-link collaborative technology scheme of "topology coding anti-interference - heterogeneous collaborative extraction - intelligent adaptive calibration - intelligent adaptive synchronous interactive output" to achieve high-precision, high-stability, strong adaptive, and reliable output detection of voltage and frequency under complex power grid environments.
[0043] Please refer to Figure 1 , Figure 1 A flowchart of a power grid voltage frequency detection method for suppressing harmonic interference according to an embodiment of this disclosure is shown. The overall process mainly includes the following four steps:
[0044] S1, topology-coded signal acquisition.
[0045] This step, through an innovative combination of industrial-grade hardware and topology coding, achieves high-fidelity acquisition of power grid voltage signals and preliminary separation of fundamental wave and interference, laying the foundation for subsequent in-depth interference immunity and accurate extraction, which is different from the traditional signal preprocessing mode that simply relies on filtering.
[0046] The signal acquisition stage employs a mature industrial-grade hardware combination adapted to power grid engineering scenarios, ensuring project feasibility and operational stability: the low-noise amplifier (LNA) is a mass-produced industrial-grade model with a noise figure of [insert noise figure here]. It features low-noise amplification, capable of amplifying weak grid voltage signals to a preset amplitude range, ensuring signal amplitude matches subsequent discrete sampling requirements and preventing the loss of weak signal characteristics; the high-speed analog-to-digital converter (ADC) uses industrial-grade high-resolution mass-produced products with a resolution of [resolution value missing]. The sampling rate is set to The sampling rate is set according to the capture requirements of the power grid's fundamental and harmonic signals, which can completely preserve the characteristic information of wideband signals without high-frequency signal distortion; the synchronization device adopts a time synchronization module compatible with the power grid synchronization phasor measurement unit (PMU), and its synchronization accuracy is [insert accuracy here]. This is used to ensure the uniformity of the sampling clock across the entire system, avoid sampling phase drift in multi-node deployment scenarios, and ensure the consistency of collaborative measurements across multiple devices.
[0047] S1.1 Hardware Acquisition and Conditioning: The raw grid voltage signal is first input to a low-noise amplifier. Let the raw signal be... The signal amplified by the low-noise amplifier is Magnification is The two satisfy the following relationship:
[0048]
[0049] The amplified signal enters the bandpass filter, and the center frequency of the bandpass filter... Adapt to the rated frequency and bandwidth of the power grid Its transfer function covers the normal frequency fluctuation range of the power grid. ( (where the variable is a complex frequency), the expression is:
[0050]
[0051] A bandpass filter can initially suppress high-frequency interference signals outside the power frequency range, outputting a conditioned analog signal of the mains voltage. Its expression is a superposition of the fundamental signal, harmonic signal, interharmonic signal, and random distortion signal:
[0052]
[0053] In the formula, This represents the fundamental amplitude of the grid voltage. The fundamental angular frequency, The initial phase of the fundamental wave. For harmonic order ( ), For the first The amplitude of the second harmonic. For the first The initial phase of the subharmonic. The highest harmonic order, For random distortion signals such as voltage dips and electromagnetic interference, after bandpass filtering, the signal-to-noise ratio of the input signal to the ADC is effectively improved, providing a high-quality signal source for subsequent sampling and encoding.
[0054] S1.2 Discrete Sampling: Triggered by a standard clock provided by a synchronization device, the high-speed ADC performs discretized sampling on the conditioned analog signal. Let the sampling period of the ADC be... Then the first The time of the next sampling is ( , (Total number of points in a single sampling), the discretized sampling sequence is ,in For the first The amplitude of each sampling point For the first The phase of each sampling point is calculated using the following formulas:
[0055]
[0056]
[0057] In the formula, For ADC quantization noise, For the first The second harmonic in the first Phase shift at each sampling point For the random distorted signal at the th Phase disturbance at each sampling point. The time base of the sampling process is synchronized with the power grid operating status to ensure the time correlation of the sampled data.
[0058] S1.3 Topological Coding: The discrete sampling sequence is then subjected to topological coding to map it to the node attributes of a preset topological graph. This topological graph uses each sampling point as a node, and the total number of nodes is equal to the total number of points in a single sampling. Consistency is achieved by using an adjacency matrix to represent the global correlation between different sampling points. The adjacency matrix of the topological graph is defined as follows: Its elements Indicates the first The sampling point and the first sampling points ( ,and The correlation strength is calculated based on the amplitude and phase differences of the sampling points. The coding logic constructs the correlation strength using the following formula:
[0059]
[0060] In the formula, This is the amplitude attenuation coefficient, reasonably set according to the rated voltage range of the power grid, used to adjust the influence of amplitude differences on correlation strength. Because the fundamental signal has stable amplitude and phase characteristics, the amplitude differences between its corresponding sampling points are small, and the phase differences change regularly, thus affecting the correlation strength. With larger values, these sampling points connect to form a strongly correlated core cluster in the topology graph; while interference signals such as harmonics, electromagnetic interference, and voltage sags, due to random fluctuations in amplitude and phase, have large amplitude differences and irregular phase differences between their corresponding sampling points, resulting in low correlation strength. With smaller values, these sampling points form weakly associated edge clusters in the topological graph. To clearly define the boundary between core clusters and edge clusters, an association strength threshold is introduced. Its value is determined offline using the sampling and encoding results of a pure sinusoidal standard signal. At that time, the judgment of the first The sampling point and the first Each sampling point is strongly correlated and belongs to the core cluster; when When the signal is weakly correlated, it is classified into the edge cluster, thus achieving the initial separation of the fundamental wave and the interference from the signal characterization level, providing support for subsequent in-depth anti-interference.
[0061] S2, Heterogeneous topology collaborative interference rejection and fundamental wave extraction.
[0062] This step is based on Field Programmable Gate Array (FPGA) hardware. Through a heterogeneous collaborative algorithm of "topology interference management + interpolation FFT", it achieves deep suppression of interference signals and accurate extraction of fundamental frequency, taking into account both real-time performance and engineering feasibility, and breaking through the anti-interference limitations of traditional algorithms.
[0063] The hardware uses an FPGA adapted for industrial scenarios, with a number of logic units of [number missing]. The operation clock frequency is It features a parallel computing architecture, capable of simultaneously handling topology clustering, spectrum analysis, and intermediate data caching tasks, ensuring multiple sets of parallel operations are completed within a single cycle, meeting the real-time requirements of power grid frequency detection with no significant processing delay; the FPGA incorporates a dual-port random access memory (RAM) with a storage capacity of [missing information]. ,in Used to buffer the topological adjacency matrix and sampling sequence output from the preceding stage. Used to store standard topology templates, algorithm parameters, and intermediate results of calculations. This ensures the parallel execution of data reading, writing, and computation.
[0064] The algorithm adopts a collaborative scheme of "Topology Interference Management (TIM) + Interpolation Fast Fourier Transform (FFT)". Topology Interference Management achieves physical separation of interference signals and fundamental signals through clustering, while Interpolation FFT improves the accuracy of fundamental frequency calculation through spectrum refinement technology. The two are coordinated and scheduled through the pipeline architecture of FPGA to achieve an optimized balance between anti-interference effect and extraction accuracy.
[0065] S2.1, Topological Interference Depth Suppression: Based on the density peak clustering algorithm, the encoded topological graph is clustered. The specific process is as follows: First, the current topological adjacency matrix after encoding is defined as... Its elements Consistent with the adjacency matrix elements of the preceding topological encoding stage, representing the first... The and the first The correlation strength of each sampling point ( , (This represents the total number of points in a single sampling); the standard topological adjacency matrix is... The amplitude of the standard signal is obtained through offline calibration using the sampling and encoding results of a pure sinusoidal standard signal. angular frequency is The sampling parameters are consistent with the actual detection scenario, and its adjacency matrix elements The calculation method and They must be completely identical to ensure the comparability of topological features.
[0066] To quantify the correlation of fundamental wave attributes at a single sampling point, a correlation vector is introduced. , No. The correlation vector of a sampling point is defined as the set of correlation strengths between that point and all other sampling points, expressed as:
[0067]
[0068] Similarly, in the standard topology, the first... The correlation vector of each sampling point is The cosine similarity function is used to calculate the matching degree between the current correlation vector and the standard correlation vector. The formula is:
[0069]
[0070] In the formula, This is the transpose of the standard correlation vector. Represents the L2 norm of a vector. Matching degree. The larger the value, the better the topological characteristics of the sampling point match the fundamental signal.
[0071] The core parameters for constructing density peak clustering based on matching degree are: defining sampling points. Local density This indicates that the difference in matching degree with the sampling point is less than the density threshold. The number of sampling points is calculated using the following formula:
[0072]
[0073] In the formula, For step functions, when the input value is ≥ 0 ,otherwise Define sampling points distance This represents the minimum difference in matching degree between the sampling point and all sampling points with a local density greater than itself. The formula is:
[0074]
[0075] For the sampling point with the highest local density, its distance Set to the maximum value of the matching difference among all sampling points.
[0076] Through local density With distance The product of cluster centers is used to determine the cluster center. The formula is:
[0077]
[0078] Set cluster center threshold ,when When the sampling point is determined to be a cluster center, based on the difference in matching degree between the cluster center and other sampling points, all sampling points are divided into core clusters dominated by the fundamental wave signal. Edge clusters corresponding to harmonics and interference signals The clustering formula is:
[0079]
[0080]
[0081] In the formula, The matching degree of the cluster centers. The clustering distance threshold was determined offline through a comparative experiment between a standard signal and a typical harmonic interference signal. This clustering method does not require preset filtering parameters and can adaptively adapt to different operating conditions with different harmonic contents and interference types, achieving deep separation of multi-band harmonics and random interference, which is different from traditional fixed parameter filtering or adaptive filtering modes that rely on interference estimation.
[0082] S2.2, Precise extraction of fundamental frequency: First, the core cluster... The sampled signals within the range are preprocessed using a window function to suppress spectral leakage. A second-order Hanning window is selected. As a preprocessing window function, its expression is:
[0083]
[0084] In the formula, The discrete index of the window function ( ), The number of points for the FFT operation is set according to the range of power grid frequency fluctuations. ( (For positive integers), balancing detection accuracy and computational load. The sampling signals within the core cluster need to be zero-padded to ensure signal length is consistent with... Consistent, the zero-padded discrete sampled signal is The signal after being weighted by a window function for:
[0085]
[0086] Execute on the weighted signal Point FFT operation yields the complex spectrum of the signal. Its expression is:
[0087]
[0088] In the formula, The discrete frequency index of the spectrum ( ), The imaginary unit ( The FFT operation is implemented in parallel through the butterfly operation unit of the FPGA, which improves the computational efficiency.
[0089] The index corresponding to the peak value of the fundamental spectral line is located by spectral amplitude analysis. Define the spectral amplitude ,in , These are the complex spectrums. The real and imaginary parts of the spectral line. Record the amplitude of the peak spectral line. and the amplitude of two adjacent spectral lines , Simultaneously calculate the frequency resolution of the FFT. The formula is:
[0090]
[0091] In the formula, This represents the sampling frequency of the preceding ADC.
[0092] To eliminate the influence of the picket fence effect on frequency calculation, a Gaussian interpolation algorithm is used to correct the fundamental frequency. The initial value of the fundamental frequency is... The calculation formula is:
[0093]
[0094] In the formula, The frequency corresponding to the DC component of the FFT operation is set to 0Hz. This interpolation algorithm enhances the amplitude difference between adjacent spectral lines through logarithmic transformation, improving the frequency correction accuracy and making it suitable for fundamental frequency extraction in low signal-to-noise ratio scenarios.
[0095] S2.3, Reliability Guarantee: Introducing a triple judgment mechanism of spectral line amplitude threshold, spectral line purity, and spectral flatness:
[0096] S2.3.1, Define the fundamental spectral line amplitude threshold. Offline calibration based on the fundamental spectrum amplitude corresponding to the rated voltage of the power grid, when When this occurs, the signal amplitude is determined to be insufficient or the distortion is severe;
[0097] S2.3.2, Define spectral line purity The degree of separation between the fundamental spectral line and adjacent interfering spectral lines is characterized by the following formula:
[0098]
[0099] Set spectral purity threshold ,when At that time, it was determined that the fundamental spectral line was severely affected by adjacent interfering spectral lines;
[0100] S2.3.3, Define Spectral Flatness The stationarity of the core cluster signal spectrum is characterized by the following formula:
[0101]
[0102] In the formula, For mean calculation, Set a spectral flatness threshold for the highest spectral line number corresponding to the power grid frequency. ,when At that time, it was determined that there was multi-peak interference in the spectrum.
[0103] When satisfied , and At that time, determine the initial value of the fundamental frequency. If valid, the result is output to the subsequent calibration stage; otherwise, the resampling and clustering process of the preceding topology-coded signal acquisition stage is automatically triggered to avoid outputting invalid detection results and ensure the reliability and stability of the extraction process. All threshold parameters are determined through calibration experiments covering different harmonic distortion rates and different load conditions to adapt to complex power grid operation scenarios.
[0104] S3, lightweight intelligent adaptive calibration.
[0105] This step uses an innovative combination of a "microcontroller unit (MCU) + field-programmable gate array (FPGA)" collaborative architecture and lightweight intelligent algorithms to dynamically calibrate the initial value of the fundamental frequency, solve the frequency offset problem under dynamic operating conditions such as load changes and new energy grid connection, and ensure the long-term stability of the test results, which is different from the traditional fixed calibration coefficient or simple fitting calibration mode.
[0106] The hardware architecture adopts a collaborative "MCU+FPGA" mode, where the MCU is a mass-produced model adapted for industrial scenarios, with a main frequency of [missing information]. The built-in flash memory capacity is Random access memory capacity is It features a floating-point arithmetic unit and interrupt response mechanism, responsible for intelligent algorithm scheduling, model inference, and calibration result fusion; the FPGA selected is an industrial-grade model consistent with the preceding signal processing stage, with a logic unit count of [number missing]. It has a built-in dedicated parallel computing unit responsible for the dynamic updating of the power grid harmonic propagation topology, node feature extraction, and parallel data preprocessing. It interacts with the MCU via a high-speed bus, with an interaction rate of [missing information]. This ensures the real-time nature of the calibration process and hardware compatibility.
[0107] The algorithm employs a collaborative approach of "Lightweight Graph Neural Network (GNN) + Soft Actor-Critic (SAC) Reinforcement Learning." The lightweight GNN is responsible for outputting accurate frequency corrections based on grid topology characteristics, while SAC reinforcement learning dynamically optimizes the GNN network parameters to adapt to changing operating conditions. After pruning and quantization, the total number of parameters is controlled within a certain range. Within this range, it can be fully adapted to the computing and storage capabilities of MCUs without relying on quantum computing resources, and at the same time, it can achieve precise optimization by combining the dynamic characteristics of power grid topology.
[0108] S3.1 Dynamic Topology Construction: Using the power grid bus, key loads, and new energy grid connection interfaces as topology nodes, define the node set as follows: ( (Total number of nodes), each node ( The eigenvectors of ) are ,in For nodes The normalized value of the voltage amplitude, For nodes The total harmonic distortion, For nodes The normalized value of the equivalent impedance. The edge set of the topological graph is defined as... ,side The weight of the node With nodes Equivalent impedance between Construct a topology diagram of power grid harmonic propagation. ,in Let be the edge weight matrix, and its elements are... ( (This is the reference impedance, set according to the rated impedance of the power grid).
[0109] Node voltages are acquired in real time via a synchronous phasor measurement unit (PMU). With current Real-time calculation of equivalent impedance between nodes based on Ohm's law The formula is:
[0110]
[0111] Edge weight matrix The dynamic update formula is:
[0112]
[0113] In the formula, For the current moment, The topology graph update cycle, Update coefficients for weights ( Offline experimental calibration is used to balance the real-time performance and stability of updates, enabling the topology diagram to reflect changes in the power grid's operating status in real time and providing a basis for accurate calibration based on operating conditions.
[0114] S3.2 Lightweight GNN Calibration: A 2-layer Graph Attention Network (GAT) is used as the lightweight GNN structure, with the network input being the topology graph. Node feature matrix The weight matrix of the first GAT convolutional layer is: The attention coefficient matrix is The activation function uses the ReLU function. The weight matrix of the second GAT convolutional layer is: The attention coefficient matrix is The activation function used is the Sigmoid function: .
[0115] First layer convolution output The calculation formula is:
[0116] The second convolutional output The calculation formula is:
[0117] Through global average pooling layer Dimensionality reduction is performed to obtain the global feature vector of the topological graph. Input a fully connected network with a single hidden layer, output the fundamental frequency correction. The formula is:
[0118] In the formula, For the weights of the fully connected layer, This is used for biasing the fully connected layer.
[0119] The lightweight GNN model is based on a historical power grid disturbance dataset:
[0120] ( Training is performed with a sample size of [number] samples, and the training objective is to minimize the mean squared error loss function. The formula is:
[0121]
[0122] In the formula, For the model to the first The predicted value of the correction for each sample; For the first The true correction value for each sample is obtained by measuring with a high-precision frequency standard.
[0123] The trained model was used to initialize the fundamental frequency. Perform preliminary calibration; frequency after preliminary calibration. The calculation formula is:
[0124] S3.3, Reinforcement Learning Dynamic Optimization Stage: The SAC reinforcement learning algorithm is introduced to adjust the GNN network parameters in real time. The state space of the reinforcement learning is defined. Global feature vector of power grid topology With calibration error The concatenated vector, i.e. ,in The actual frequency of the power grid is obtained synchronously via PMU; action space The set of adjustment values for GNN network parameters Reward function With "calibration accuracy stability" as the core, the calculation formula is as follows:
[0125]
[0126] In the formula, To calibrate the error threshold, The penalty coefficient is adjusted for the parameters to balance calibration accuracy and parameter stability.
[0127] The SAC algorithm utilizes an Actor network. Output Action Through the Critic network The objective functions for evaluating the value of an action are as follows:
[0128]
[0129]
[0130] In the formula, For experience replay pool, This represents the state transition probability distribution. For entropy temperature parameter, Discount factor ( ), , These are the target Critic network and the target Actor network, respectively. , These are the parameters for the Critic network and the Actor network, respectively.
[0131] The GNN network parameters are updated in real time using gradient descent. The updated formula is:
[0132]
[0133] In the formula, For parameter optimization period, This is the learning rate.
[0134] To balance the real-time performance and stability of the calibration, the preliminary calibration results will be... calibration results from the previous time step Weighted fusion is performed, and the final calibrated fundamental frequency is obtained. The calculation formula is:
[0135]
[0136] In the formula, For fusion weights ( Its value is determined by the reward value of the reinforcement learning algorithm. Dynamic adjustment: when When the value is large (stable operating conditions, high calibration accuracy), Increase to highlight real-time calibration results; when When the changes are small (due to sudden changes in operating conditions or fluctuations in calibration accuracy), Reduce reliance on historically stable outcomes.
[0137] A calibration stability assessment mechanism is introduced, and the sliding variance of the calibration results is defined. The calculation formula is:
[0138]
[0139] In the formula, The length of the sliding window. The sliding window step size, This is the mean of the calibration results within the sliding window. When ( When the stability threshold is used for offline calibration, the topology graph update cycle is automatically shortened. With parameter optimization cycle Improve the model's adaptive speed; when At the same time, the period parameters are kept constant to ensure a balance between the stability of the calibration process and the computational efficiency.
[0140] S4, intelligent adaptive synchronous interactive output.
[0141] This step, through an innovative design of "adaptive conditioning + operating condition linkage synchronization + intelligent protocol adaptation + two-way interactive feedback", breaks through the limitations of traditional standardized output's one-way transmission and fixed parameters. While ensuring seamless compatibility with existing power grid equipment, it constructs a closed-loop collaboration between the output and the preceding steps, further improving the stability of the overall testing solution.
[0142] The hardware consists of a high-precision digital-to-analog converter (DAC), an adaptive impedance matching network, a power grid synchronization-compatible time synchronization module, and a multi-protocol industrial communication interface. All hardware components are mature, mass-produced industrial-grade products. The DAC's resolution is... The conversion rate is The nonlinear error is This ensures high-precision conversion between digital and analog signals; the adaptive impedance matching network incorporates an impedance detection unit and a programmable impedance adjustment array, achieving a detection accuracy of [missing information]. The adjustment range is It can adapt to the input impedance of different receiving devices in real time; the power grid synchronization compatible time synchronization module supports BeiDou / GPS dual-mode synchronization, with a timekeeping accuracy of [missing information]. It supports seamless integration with power grid synchronization phasor measurement units (PMUs) and their network; its multi-protocol industrial communication interfaces include standard interfaces such as Ethernet and RS485, with communication speeds ranging from [missing information]. It reserves the ability to extend to multiple protocols and adapt to the interface requirements of different terminal devices.
[0143] The core innovation lies in the integration of an adaptive impedance matching mechanism, a working condition linkage synchronization algorithm, an intelligent protocol identification module, and bidirectional interactive feedback logic, achieving full-process intelligentization of "device adaptive adaptation - dynamic working condition linkage - transmission closed-loop optimization." Specifically, the adaptive impedance matching mechanism achieves precise impedance matching through real-time detection and dynamic adjustment; the working condition linkage synchronization algorithm dynamically adjusts synchronization accuracy based on preceding working condition characteristics; the intelligent protocol identification module automatically adapts to the communication protocol through handshake signal analysis; and the bidirectional interactive feedback logic dynamically optimizes the transmission strategy based on the receiver's status, solving the technical problems of poor adaptability and reliance on manual configuration in traditional output solutions.
[0144] S4.1 Adaptive Signal Conditioning: The digital frequency signal output by the FPGA is (Represented in two's complement form), converted into a standard analog voltage signal by a high-precision DAC. The conversion relationship of the DAC is determined by linear coefficients. The representation and conversion formula is as follows:
[0145]
[0146] In the formula, To calibrate the fundamental frequency, The zero-point offset voltage of the DAC is eliminated through offline calibration.
[0147] To avoid amplitude distortion caused by signal reflection, the adaptive impedance matching network acquires the input impedance of the receiving device in real time through a built-in impedance detection unit. The detection formula is:
[0148]
[0149] In the formula, This is the detection voltage output by the impedance detection unit. To detect the current, the network impedance matching coefficient is dynamically adjusted based on the detection results. Make the output impedance impedance of the receiving end To maintain the matching status in real time, adjust the formula as follows:
[0150]
[0151]
[0152] In the formula, This is the reference impedance for the impedance matching network. Simultaneously, the linearity coefficient of the DAC conversion... Supports obtaining power grid operating characteristics (such as total harmonic distortion) in the preceding steps of the linkage. Voltage fluctuation coefficient Dynamic fine-tuning, the fine-tuning formula is:
[0153]
[0154] In the formula, These are the baseline linearity coefficients for the DAC. , The correlation coefficients for operating conditions are determined through offline calibration. , These are the total harmonic distortion rate and voltage fluctuation coefficient at the current moment, respectively, to ensure the accurate correspondence between the analog signal and the calibrated fundamental frequency.
[0155] S4.2, Operating Condition Interlocking Time Synchronization: Obtain UTC standard time signal through a power grid synchronization compatible time synchronization module. Lock the output time base. The timestamp of the output signal. Due to standard time and signal processing delay The formula for superposition generation is: Among them, signal processing delay The compensation formula is obtained by offline testing and real-time compensation:
[0156]
[0157] In the formula, To compensate for the delay, To calibrate the mean delay, This is the current measured delay. This is the compensation coefficient.
[0158] Simultaneously, the synchronization accuracy level is dynamically adjusted based on the operating condition characteristics of the preceding steps in the module linkage. An operating condition distortion coefficient is defined. The result is obtained by weighting the values based on characteristics such as harmonic content and voltage sag.
[0159]
[0160] In the formula, , These are the weighting coefficients. This is the voltage sag level coefficient (0 for no sag, larger for more severe sags). Synchronization accuracy level. The adjustment formula (with values ranging from 1 to 3, where higher levels indicate higher precision) is as follows:
[0161]
[0162] In the formula, , The operating condition distortion threshold was calibrated through offline experiments. Under stable operating conditions (… Maintaining normal synchronization accuracy to balance efficiency, especially when operating conditions are severely distorted. Automatically increase synchronization priority to ensure phase consistency of measurement data from multiple nodes.
[0163] S4.3 Intelligent Protocol Adaptation and Data Encapsulation: Supports mainstream industrial communication protocols such as IEC61850 and ModbusTCP, and innovatively integrates an intelligent protocol identification module. The module parses the protocol negotiation frames or communication handshake signals from the receiving device. (Binary signal stream), extract protocol feature vectors ( (as feature dimension), and the preset protocol feature library Perform similarity matching, matching degree The calculation formula is:
[0164]
[0165] when ( When the protocol matching threshold is set, the system automatically identifies the communication protocol type and data format supported by the receiving end, eliminating the need for manual configuration of protocol parameters.
[0166] The data frame structure adopts a modular design of "basic fields + dynamically extended fields", and the total frame length is... The calculation formula is:
[0167]
[0168] In the formula, Based on the length of the base field, To dynamically expand field length. The base field contains the protocol identifier ( byte), data length ( byte), timestamp ( byte), core data of the calibrated fundamental frequency ( (byte), strictly encapsulated according to the corresponding protocol standard to ensure compatibility; dynamically extended fields selectively add auxiliary working condition information based on the working condition characteristics of the preceding steps, with the selection criteria determined by the working condition importance coefficient. Decide:
[0169]
[0170] In the formula, The threshold for the importance of the operating condition. The preset extended field length includes auxiliary information such as total harmonic distortion rate and calibration correction amount, providing the receiver with a comprehensive operational status reference.
[0171] Cyclic Redundancy Check Code Generated based on the correlation calculation of all fields within the frame, using the CRC-16 algorithm, the formula is as follows:
[0172] In the formula, This is a binary data string containing all fields within the frame. A dynamic checksum optimization mechanism is also introduced, based on historical transmission error rates. The complexity of the adaptive verification algorithm is adjusted using the following formula:
[0173]
[0174] In the formula, For actual verification complexity, Based on the baseline verification complexity, The error rate correlation coefficient is used when the transmission state is stable. (Small) Simplify the verification process to improve transmission efficiency, especially when the transmission error rate is high. (Strengthen verification to ensure data integrity)
[0175] S4.4 Two-way interactive feedback optimization: The output module and the receiving device establish a two-way communication link, and the receiving end provides real-time feedback of data reception status signals. ,in Includes: Data integrity identifier Data validity identifier Parsing result identifier The value can be 0 or 1, where 1 indicates normal and 0 indicates abnormal. The output module dynamically optimizes the transmission strategy based on the feedback information.
[0176] S4.4.1, Transmission Rate Adjustment: Current transmission rate The adjustment formula is:
[0177]
[0178] In the formula, For the rate adjustment period, Adjust the step size coefficient for the rate. This is a transmission error identifier;
[0179] S4.4.2 Adjustment of Data Retransmission Count: Retransmission Count The adjustment formula is:
[0180]
[0181] In the formula, , These are the upper and lower limits for the number of retransmissions. Based on the number of retransmissions, Adjust the step size for the number of retransmissions;
[0182] S4.4.3, Secondary calibration trigger: When continuous Secondary feedback exception ( When this occurs, the preceding lightweight intelligent adaptive calibration step is automatically triggered to perform a secondary correction, forming a closed-loop collaborative mechanism of "output-feedback-optimization".
[0183] Ultimately, the signal, after intelligent adaptation and interactive optimization, is output to terminal equipment such as power grid monitoring systems and renewable energy grid-connected control systems through industrial communication interfaces, realizing reliable transmission and engineering application of frequency detection data without the need for large-scale transformation of the existing power grid system. At the same time, the stability and adaptability of the overall detection solution are further improved through closed-loop collaboration.
[0184] It should be noted that during the implementation of this invention, all hardware (such as LNA, ADC, FPGA, MCU, DAC, synchronization module, communication interface, etc.) are selected from mass-produced models that meet industrial-grade standards. Specific parameters (such as noise figure, resolution, sampling rate, number of logic units, main frequency, storage capacity, synchronization accuracy, communication rate, etc.) can be selected and configured according to the accuracy, real-time performance and cost requirements of the actual application scenario.
[0185] Key parameters in each algorithm step (such as the association strength threshold) Density threshold Cluster center threshold Cluster distance threshold Spectral line amplitude threshold Spectral line purity threshold Spectral flatness threshold Weight update coefficient Learning rate fusion weight Operating condition distortion threshold , Protocol matching threshold Operating condition importance threshold All parameters (such as harmonic distortion rate, load type, and dynamic operating conditions) must be determined through offline calibration experiments. The calibration experiments should cover different harmonic distortion rates, different load types, and different dynamic operating conditions that may occur in the target application scenario to ensure the rationality of parameter settings and the generalization ability of the algorithm.
[0186] The lightweight GNN model and SAC reinforcement learning algorithm need to be trained and optimized based on a representative historical power grid disturbance dataset. The dataset should include the power grid topology features and corresponding true frequency offsets under various typical disturbances. After the model is trained, it is pruned and quantized before being deployed and run on an MCU.
[0187] In practical deployment, the method described in this invention can be integrated into a standalone power quality monitoring device, or it can be embedded as a functional module into existing power grid monitoring equipment or new energy grid-connected control equipment. The entire detection process is automated through the collaboration of hardware logic and software programs, and the output results can be directly used for power grid status monitoring, protection control, and dispatching decisions.
[0188] The method of the present invention, through the above specific implementation, can stably and accurately realize voltage and frequency detection in actual complex power grid environments, and has good prospects for industrial application.
[0189] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.
Claims
1. A method for detecting power grid voltage frequency to suppress harmonic interference, characterized in that, The method includes the following steps: S1. Topology-coded signal acquisition: The original voltage signal of the power grid is amplified and bandpass filtered to obtain a conditioned analog signal; under the trigger of a synchronous clock, the conditioned analog signal is discretely sampled to obtain a sampling sequence; the sampling sequence is mapped to the node attributes of the topology graph to construct an adjacency matrix, and the elements of the adjacency matrix are used to calculate the correlation strength based on the amplitude difference and phase difference of the corresponding sampling points; according to the preset correlation strength threshold, the nodes in the topology graph are divided into strongly correlated core clusters and weakly correlated edge clusters to achieve preliminary separation of the fundamental signal and interference signal; S2. Heterogeneous Topology Collaborative Interference Rejection and Fundamental Wave Extraction: Based on the density peak clustering algorithm, the topology graph obtained in step S1 is clustered, dividing the nodes into core clusters dominated by fundamental wave signals and edge clusters dominated by harmonic interference; windowing and fast Fourier transform are applied to the sampled signals within the core clusters to obtain the spectrum; the peak value of the fundamental wave spectrum is located through spectrum analysis, and the initial value of the fundamental wave frequency is calculated using an interpolation algorithm; the validity of the initial value of the fundamental wave frequency is judged based on the spectral amplitude threshold, spectral purity, and spectral flatness, and if the judgment is invalid, resampling is triggered; S3. Lightweight Intelligent Adaptive Calibration: Construct a dynamic topology graph reflecting the harmonic propagation characteristics of the power grid; using a trained lightweight graph neural network model, output the correction amount of the initial value of the fundamental frequency according to the node characteristics of the dynamic topology graph to obtain the preliminary calibration frequency; use a reinforcement learning algorithm to dynamically optimize the parameters of the lightweight graph neural network, and perform weighted fusion of the preliminary calibration frequency and the historical calibration frequency based on the reward value of the reinforcement learning algorithm to obtain the final calibration frequency; S4. Intelligent Adaptive Synchronous Interactive Output: The final calibration frequency is converted into an analog signal, and the output impedance is adjusted through an adaptive impedance matching network to match the receiving device; the final calibration frequency data with a timestamp is generated, and the synchronization accuracy of the timestamp is dynamically adjusted according to the degree of power grid distortion; the communication protocol is automatically adapted through the intelligent protocol identification module, and a data frame containing basic fields and optional extended fields is encapsulated for output; feedback signals from the receiving device are received, and the transmission strategy is dynamically adjusted according to the feedback signals; if continuous feedback is abnormal, step S3 is triggered for secondary calibration.
2. The method for detecting power grid voltage frequency to suppress harmonic interference according to claim 1, characterized in that, In S1, the adjacency matrix is constructed, and its elements are... The calculation formula is: ; in, and Let i and j be the amplitudes of the i-th and j-th sampling points. and For its phase, This is the amplitude attenuation coefficient.
3. The power grid voltage frequency detection method for suppressing harmonic interference according to claim 1, characterized in that, In S2, the clustering process based on the density peak clustering algorithm includes: Calculate the matching degree between the correlation vector of each sampling point in the current topology graph and the correlation vector of the standard fundamental signal. Based on the matching degree Calculate the local density at each sampling point and distance ;according to Determine cluster centers and assign sampling points to core clusters based on the difference in matching degree with the cluster centers. or edge cluster .
4. The method for detecting power grid voltage frequency to suppress harmonic interference according to claim 1, characterized in that, In S2, the interpolation algorithm is used to calculate the initial value of the fundamental frequency. The formula is: ; in, This represents the peak number of the fundamental spectral line. For frequency resolution, For spectral amplitude, The frequency corresponding to the DC component in the FFT operation.
5. The method for detecting power grid voltage frequency to suppress harmonic interference according to claim 1, characterized in that, In S3, the construction of the dynamic topology graph includes: Using the power grid's buses, loads, and grid connection points as nodes, a graph structure containing node feature vectors and edge weight matrices is constructed. Based on real-time measurement data from the synchronous phasor measurement unit, the edge weight matrix is dynamically updated using the following formula: ; in, For edge weights, To update the coefficients, For the update cycle, For real-time equivalent impedance, This is the reference impedance.
6. The power grid voltage frequency detection method for suppressing harmonic interference according to claim 1, characterized in that, In S3, the reinforcement learning algorithm is a soft Actor-Critic algorithm, and its reward function is... for: ; in, For calibration error, To calibrate the error threshold, Adjust the penalty coefficient for the parameters. The network parameter adjustment amount; the weights of the weighted fusion. According to the reward value Dynamic adjustment.
7. The power grid voltage frequency detection method for suppressing harmonic interference according to claim 1, characterized in that, S3 also includes a calibration stability assessment: calculating the variance of the final calibration frequency within a sliding window. ;when Exceeding the preset stability threshold In this way, the update cycle of the dynamic topology graph and the parameter optimization cycle of the reinforcement learning algorithm are automatically shortened.
8. The method for detecting power grid voltage frequency to suppress harmonic interference according to claim 1, characterized in that, In S4, the adaptive impedance matching network detects the input impedance of the receiving device in real time. And adjust the matching coefficient To achieve impedance matching, where This is the reference impedance.
9. The method for detecting power grid voltage frequency to suppress harmonic interference according to claim 1, characterized in that, In S4, the dynamic adjustment of the synchronization accuracy level is based on the operating condition distortion coefficient. The calculation formula is as follows: ;in, The total harmonic distortion (THD) is the harmonic distortion rate. This is the voltage sag level factor. and These are the weighting coefficients; according to The different threshold ranges that the synchronization accuracy level is determined. .
10. The method for detecting power grid voltage frequency to suppress harmonic interference according to claim 1, characterized in that, In S4, the dynamic adjustment of the transmission strategy based on the feedback signal includes: Based on the feedback transmission anomaly identifier Dynamically adjust the current communication rate and number of data resends ; When continuous When an abnormality is detected, step S3 is automatically triggered to perform a secondary calibration of the frequency.