Digital phase detection method and electronic device
By resampling the input signal and fitting the local waveform, combined with the verification of the fitting model, the accuracy problem of the digital phase-locked loop system in complex environments was solved, high-precision digital phase detection was achieved, and the measurement accuracy and system reliability were improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- MAINTENANCE & TEST CENTRE CSG EHV POWER TRANSMISSION CO
- Filing Date
- 2026-05-14
- Publication Date
- 2026-06-12
AI Technical Summary
Existing dual-loop systems based on digital phase-locked loops and automatic gain control are difficult to meet the requirements of high-precision applications in strong noise or complex electromagnetic environments, especially in power monitoring, aerospace and industrial automation, where measurement accuracy and frequency stability are limited.
By resampling the input signal from the discrete sequence, a reconstructed waveform sequence with high time resolution is generated. Zero-crossing points are detected and continuous sampling point data are extracted. The offset at the zero-crossing time is verified by local waveform fitting and the discriminant of the fitting model, and the phase difference information is output.
It achieves breakthroughs in sampling resolution without increasing the hardware clock frequency, improves digital phase detection accuracy, enhances the system's anti-interference capability and reliability, and improves measurement accuracy and dynamic response speed.
Smart Images

Figure CN122193700A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of digital phase detection technology, and in particular to a digital phase detection method and electronic device. Background Technology
[0002] Currently, dual closed-loop systems based on digital phase-locked loops and automatic gain control have become the main solution for achieving high-precision electric field measurement, and are widely used in fields such as power monitoring, aerospace and industrial automation, forming a typical digital closed-loop detection and control framework.
[0003] As application scenarios increasingly demand higher requirements for measurement accuracy, frequency stability, and environmental interference resistance, especially in environments with strong noise or complex electromagnetic fields, the aforementioned dual closed-loop system, which relies on a digital phase detector as its core, is unable to meet the needs of high-precision applications. Summary of the Invention
[0004] Therefore, it is necessary to provide a digital phase detection method and electronic device that can improve the accuracy of digital phase detection, addressing the aforementioned technical problems.
[0005] Firstly, this application provides a digital phase detection method, which includes:
[0006] The input signal is sampled by a discrete sequence, and then sampled again to obtain a reconstructed waveform sequence. Detect the zero-crossing points of the reconstructed waveform sequence and extract the sampling data of multiple consecutive sampling points centered on the zero-crossing points; Based on the sampled data, a local waveform is fitted using a preset fitting model with the middle sampling point among multiple continuous sampling points as the origin. The zero-crossing offset of the input signal is determined, and the validity of the zero-crossing offset is verified based on the discriminant of the fitting model. Based on the zero-crossing offset that has passed verification, the phase difference information between the input signal and the preset reference signal is output.
[0007] In one embodiment, the input signal is resampled to obtain a reconstructed waveform sequence, including: A preset number of zero values are inserted between adjacent sampling points of the input signal to obtain an upsampled waveform sequence; The upsampled waveform sequence is passed through a low-pass filter with preset coefficients to obtain the reconstructed waveform sequence. The preset coefficients of the low-pass filter are generated using the Hanning window function.
[0008] In one embodiment, detecting the zero-crossing points of the reconstructed waveform sequence includes: Sign bit detection is performed on the reconstructed waveform sequence; If the sign bits of adjacent sampling points are different, it is determined that a zero-crossing point has been detected.
[0009] In one embodiment, local waveform fitting includes quadratic curve fitting; based on sampled data, using a preset fitting model, local waveform fitting is performed with the intermediate sampling point among multiple consecutive sampling points as the origin to determine the zero-crossing offset of the input signal, including: Based on the sampling time of the intermediate sampling point as the origin, a local relative coordinate system is established. The sampling data of multiple consecutive sampling points are substituted into the preset quadratic polynomial model. Through the underlying numerical operation logic, the polynomial coefficients of the quadratic polynomial model are determined. Based on the polynomial coefficients, the offset at the zero-crossing time of the quadratic polynomial model in the local relative coordinate system is determined.
[0010] In one embodiment, multiple consecutive sampling points are represented by three sampling points; a local relative coordinate system is established based on the sampling time of the intermediate sampling point as the origin, including: The three sampling points are defined as the previous point, the current point, and the next point, respectively, with the current point being the intermediate sampling point; In a local relative coordinate system, the time of the current point is set to zero, the time of the previous point is determined as a negative fixed time interval, and the time of the next point is defined as a positive fixed time interval.
[0011] In one embodiment, the polynomial coefficients of the quadratic polynomial model are determined by fixing the underlying numerical operation logic, as shown in the following expression: ; ; ; Where A is the coefficient of the quadratic term, B is the coefficient of the linear term, and C is the coefficient of the constant term. The amplitude of the previous point, The amplitude at the current point. The amplitude of the next point is given, and T is a fixed time interval. The expression operation that determines the polynomial coefficients is implemented through pre-stored constant coefficient multiplication or arithmetic shift operations.
[0012] In one embodiment, determining the zero-crossing offset of the quadratic polynomial model in the local relative coordinate system based on the polynomial coefficients includes: Determine the discriminant of the quadratic polynomial model; When the discriminant is greater than or equal to zero, the offset at the zero-crossing time is determined according to the quadratic formula; When the discriminant is less than zero, the fitting of the current calculation cycle is deemed invalid, and the zero-crossing offset of the previous calculation cycle is maintained; where the current calculation cycle is the cycle following the previous calculation cycle. The discriminant is expressed as follows: .
[0013] In one embodiment, after calculating the zero-crossing offset according to the quadratic formula, the step of validating the zero-crossing offset based on the discriminant of the fitted model includes: Determine whether the offset at the zero crossing time falls within the preset effective time window, where the positive and negative boundaries of the effective time window are fixed time intervals; If the zero-crossing offset exceeds the valid time window, the fitting of the current calculation cycle is invalid, and the zero-crossing offset of the previous calculation cycle is maintained.
[0014] Secondly, this application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described method.
[0015] Thirdly, this application also provides a power grid voltage tracking control system, including: the electronic equipment described in the second aspect.
[0016] The digital phase detection method and electronic device provided in this application generate a reconstructed waveform sequence with higher time resolution by sampling the input signal through a discrete sequence and then sampling the input signal again. This effectively reduces the quantization error introduced by the large original sampling interval, providing a data foundation for subsequent accurate detection of zero crossings. After detecting a zero crossing, data from multiple consecutive sampling points centered on the zero crossing point are extracted, making full use of the local waveform features near the zero crossing point and avoiding the inherent uncertainty of judging the zero crossing point based on a single sampling point. Furthermore, based on these sampling data, local waveform fitting is performed using a preset fitting model with the intermediate sampling point as the origin, which can more accurately approximate the signal at its current position. By analyzing the actual trajectory of the signal near the zero-crossing point, the subtle zero-crossing offset is calculated. This process essentially achieves "sub-sampling" interpolation of the sampling interval, overcoming the time resolution limitations of direct sampling. Simultaneously, a discriminant based on the fitting model is introduced to verify the validity of the zero-crossing offset, identifying and eliminating abnormal results caused by noise interference or fitting distortion, ensuring the reliability of the obtained phase information. Finally, the phase difference information is output based on the verified precise zero-crossing offset, making the overall phase detection result dependent not only on the sampling time but also on the continuous waveform characteristics reconstructed by the algorithm, systematically improving the phase detection accuracy to a level far exceeding that achievable with the original sampling period. Therefore, this application achieves refined measurement of the signal's zero-crossing point by resampling the input signal after discrete sequence sampling to increase data density, restoring waveform details through local fitting, and ensuring the accuracy of the zero-crossing offset result through a verification mechanism for the zero-crossing offset, thereby improving the accuracy of digital phase detection. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a schematic diagram of a dual closed-loop control system provided in an embodiment of this application; Figure 2 A flowchart illustrating a digital phase detection method provided in an embodiment of this application; Figure 3 A flowchart illustrating the steps for determining the zero-crossing offset of an input signal, provided in an embodiment of this application; Figure 4 A schematic diagram illustrating the steps for determining the zero-crossing offset of a quadratic polynomial model in a local relative coordinate system, provided in an embodiment of this application; Figure 5 A schematic flowchart of a phase error detection method based on time interpolation provided in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of a digital phase detector provided in an embodiment of this application; Figure 7 This is a schematic diagram of the internal structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0019] 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.
[0020] Figure 1 This is a schematic diagram of a dual closed-loop control system provided in an embodiment of this application; as shown below. Figure 1 As shown, in the AGC (Automatic Gain Control) subsystem, PI(s) is the transfer function of the proportional-integral controller, used to eliminate the steady-state error of the AGC loop and achieve precise gain adjustment; F lpf (s) is the transfer function of the low-pass filter, which filters out high-frequency interference after multiplying the output signal with the reference sine signal and extracts the slowly varying control component; sin(ω d t+Φ0) is the reference sinusoidal signal for AGC, where ω dΦ0 is the reference signal angular frequency, and Φ0 is the initial phase, used for amplitude comparison with the output signal.
[0021] In the controlled signal path, K vf G is the voltage feedback coefficient, which proportionally feeds the output signal back to the front end of the loop for comparison with the reference signal. x (s) is the transfer function of the controlled object (usually a variable gain amplifier), describing its input-output dynamic characteristics. The gain is adjusted by the AGC control signal. xc K represents the control gain coefficient of the controlled object, characterizing the sensitivity of the AGC control signal to adjusting the gain of the controlled object. cu To control the voltage conversion coefficient, the control signal output by the AGC is converted into a control voltage that the controlled object can recognize.
[0022] In a PLL (Phase-Locked Loop) subsystem, phase synchronization between the output signal and the reference signal can be achieved to obtain a stable carrier phase. VCO(s) is the transfer function of the voltage-controlled oscillator; its output signal frequency / phase is determined by the input control voltage and it is the core oscillation component of the PLL. lpf (s) is the transfer function of the low-pass filter, which filters out the high-frequency components after multiplying the output signal with the reference cosine signal to obtain the slowly varying voltage controlling the VCO; cos(ω d t+Φ0) is the reference cosine signal of the PLL, which is a quadrature carrier with the reference sine signal of the AGC at the same frequency, and is used to compare the phase with the output signal.
[0023] Currently, resonant MEMS (Micro-Electro-Mechanical Systems) electric field sensors are widely used in power monitoring, aerospace, and industrial automation due to their high accuracy. These sensors typically employ a dual closed-loop system with digital phase-locked loop and automatic gain control, such as... Figure 1 The diagram shows the structure of a dual-closed-loop control system. However, its core component, the digital phase detector, is limited by clock resolution and edge detection mechanisms, making it prone to quantization errors and "dead zone" phenomena, and causing output jitter in noisy environments. These problems directly affect the system's measurement accuracy and frequency stability, making it difficult to meet the requirements of high-precision applications.
[0024] Based on this, this application provides a digital phase detection method and electronic device. This application achieves refined measurement of signal zero-crossing points by combining upsampling to increase data density, local fitting to restore waveform details, and a verification mechanism to ensure the results, thereby improving the accuracy of digital phase detection.
[0025] In one exemplary embodiment, Figure 2This is a flowchart illustrating a digital phase detection method provided in an embodiment of this application, as shown below. Figure 2 As shown, a digital phase detection method is provided. An example of this method being applied to an electronic device with phase detection functionality is given. It is understood that this method can also be applied to a server, or to a system including both an electronic device and a server, and is implemented through the interaction between the electronic device and the server. The server can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing cloud computing services. In this embodiment, the method includes the following steps S201 to S204. Wherein: S201. Obtain the input signal sampled by the discrete sequence, and sample the input signal again to obtain the reconstructed waveform sequence.
[0026] The input signal can refer to the digital sequence output by the electric field sensor after sampling by an ADC (Analog-to-Digital Converter). Alternatively, the input signal can refer to a set of discrete values obtained by sampling a continuous-time signal at a fixed sampling period. Resampling refers to the process of increasing the equivalent sampling rate of the original sequence using digital signal processing techniques; this can be upsampling. The reconstructed waveform sequence can refer to a smooth waveform sequence with higher time resolution, obtained after upsampling and further filtering.
[0027] For example, an electronic device or system can acquire an input signal sampled by a discrete sequence. After receiving the input signal through an ADC, it can increase the data rate through interpolation to obtain a reconstructed waveform sequence. For instance, instead of directly calculating the amplitude of the new sampling point, L-1 samples with zero amplitude are inserted between every two adjacent original sampling points, thereby extending the sequence length by a factor of L. This sequence containing a large number of zero values can be filtered out by a well-designed low-pass filter to remove high-frequency image noise caused by interpolation and smooth the waveform, ultimately outputting a high-quality reconstructed waveform sequence.
[0028] As an example, the interpolation factor L can be a power of 2, such as 8, 16, or 32, to facilitate shift operations in subsequent hardware implementation. The low-pass filter can be an FIR (Finite Impulse Response) filter designed based on the Hanning window function, whose coefficients can be pre-calculated and stored in ROM (Read-Only Memory). The excellent sidelobe suppression characteristics of the Hanning window can effectively suppress quantization noise and spectral aliasing introduced by interpolation, ensuring that the reconstructed waveform is smooth and monotonic near the zero-crossing point, creating a foundation for high-precision fitting.
[0029] For example, waveform reconstruction can be performed using zero-value insertion in conjunction with a Hanning window filter that has excellent sidelobe suppression characteristics. This can improve the equivalent time resolution of the signal by a factor of L without introducing nonlinear phase distortion. This overcomes the limitation of the original ADC sampling rate on phase detection resolution, refining the granularity of the phase detection operation from the entire sampling period Ts to Ts / L. This provides a data foundation for subsequent precise zero-crossing point location in the sub-sampling period, thus improving the accuracy of digital phase detection.
[0030] S202. Detect the zero-crossing point of the reconstructed waveform sequence and extract the sampling data of multiple consecutive sampling points centered on the zero-crossing point.
[0031] Zero-crossing points can refer to the point where the signal amplitude changes from positive to negative or vice versa, and can be the reference point for phase comparison by a phase detector. Multiple consecutive sampling points refer to a set of local waveform data needed to accurately calculate the zero-crossing time, and can be an odd number of points (such as 3 or 5). Sampling data can refer to the amplitude and time information corresponding to these sampling points.
[0032] For example, the system can monitor the reconstructed high-resolution waveform sequence y[n] in real time to find the boundary of sign change. Once a sign change is detected, a set of consecutive sampling points near the point of change can be locked and their amplitudes stored in a buffer, while the coarsely located zero-crossing interval (usually between the two sampling points where the sign change occurs) is recorded.
[0033] As an example, sign detection can be achieved by comparing the most significant bit (sign bit) of two adjacent sampling points y[k-1] and y[k]. If the sign bits are different, an interrupt is triggered, and the magnitudes of the three points y[k-1], y[k], and y[k+1] are captured into a set of registers. These three points can constitute the sampling data for fine-tuning.
[0034] In practical applications, by performing coarse zero-crossing localization on high-resolution sequences, local waveform intervals containing the actual zero-crossing points can be quickly and accurately located. Extracting continuous sampling point data centered on this point transforms the global phase detection problem into a precise analysis of a few local data points. This reduces the complexity and real-time requirements of subsequent calculations, preparing the data for fast and accurate fine interpolation calculations, and helps improve the real-time performance and accuracy of digital phase detection.
[0035] S203. Based on the sampled data, a local waveform is fitted using a preset fitting model with the middle sampling point among multiple continuous sampling points as the origin. The zero-crossing offset of the input signal is determined, and the validity of the zero-crossing offset is verified based on the discriminant of the fitting model.
[0036] The preset fitting model can be a mathematical model used to approximate a local waveform, such as a quadratic polynomial model. Local waveform fitting refers to the process of calculating the model parameters that best match the local waveform using captured sampling data. The intermediate sampling point can be the point located at the center of the extracted continuous sampling points. The zero-crossing offset can be the time value at which the fitted curve intersects the zero-amplitude line in a local relative coordinate system with the intermediate sampling point as the time origin. The discriminant is a scalar derived from the mathematical properties of the fitting model and can be used to determine the existence and rationality of the solution to the equation.
[0037] For example, the system can map the captured sampling data (e.g., three points) into a newly created local relative time coordinate system, with the time of the intermediate sampling point as the origin. The system can substitute the coordinates of these points into a preset quadratic polynomial equation and calculate the polynomial coefficients using a highly optimized fixed formula. The zero-crossing offset τ0 can be solved using the quadratic formula. Throughout the calculation process, the system can simultaneously calculate the value of the discriminant Δ and determine the validity of the fitting result based on the sign of Δ and whether τ0 falls within a reasonable range.
[0038] As an example, for three points , , Let t0 = 0, then t-1 = -T, t+1 = +T, where T is the sampling interval of the reconstructed waveform. Substituting... The coefficients A, B, and C can be simplified and derived. Δ = B² - 4AC can be calculated. If Δ ≥ 0 and the calculated τ0 satisfies -T ≤ τ0 ≤ T, then the fit is considered valid; otherwise, the fit is considered invalid, and τ0 is discarded.
[0039] In practical applications, by performing local fitting with the intermediate sampling point as the origin and using discriminant analysis for real-time validity verification, local coordinate transformation can simplify the complex general least squares fitting into a fixed operation with almost no multiplication or division. This allows high-precision fitting to be implemented in real time on low-power, low-latency hardware, which is the algorithmic guarantee for improving the accuracy of digital phase detection. Furthermore, the discriminant verification mechanism can act as an intelligent filter, automatically identifying and eliminating false or unreliable zero-crossing calculation results caused by noise interference. This enhances the robustness and stability of the phase detector output, ensuring high-precision validity and reliability from the perspective of anti-interference.
[0040] S204. Based on the zero-crossing offset that has passed the verification, output the phase difference information between the input signal and the preset reference signal.
[0041] The reference signal can refer to a preset signal with ideal frequency and ideal phase generated within the digital phase-locked loop (DPLL), which can be used for comparison with the input signal. The phase difference information can refer to the digital quantity at the final output that characterizes the phase deviation between the input signal and the reference signal, and can be used as an error signal to drive the loop filter.
[0042] For example, once a zero-crossing offset τ0 is determined to be valid, the system can add it to the absolute time of the coarsely located zero-crossing point (i.e., the system time corresponding to the intermediate sampling point y[k]) to obtain the precise absolute time of the zero-crossing point of the input signal. The difference Δt between the precise absolute time and the corresponding zero-crossing time of the reference signal can be calculated. Δt can be multiplied by the phase detection gain, normalized to a digital phase error word that the loop filter can process, and then output.
[0043] As an example, coarsely locate the absolute time of zero crossing. It can be latched by a free-running counter when coarse positioning is triggered. The calculation and subsequent gain multiplication can be completed by a dedicated arithmetic unit within one or several clock cycles; among which, To ensure precise absolute time, The zero-crossing point corresponds to the reference signal.
[0044] In practical applications, the high-precision time information τ0 obtained from the preceding steps and the absolute time of the coarse zero-crossing point can be integrated. This generates the final phase error. Since τ0 is a high-resolution offset obtained through subsampling interpolation and local fitting, its accuracy is far higher than that of traditional clock edge-based detection methods, allowing the output phase difference information to reflect extremely subtle phase changes. This enables direct driving of the DPLL to achieve faster and more stable locking, improving the performance of the entire sensor system.
[0045] In this embodiment, by upsampling and reconstructing the waveform sequence of the input signal, the temporal resolution of the signal can be improved, laying a data foundation for high-precision phase detection. Furthermore, zero-crossing points can be quickly located and local sampled data extracted, transforming phase detection into local waveform analysis. Waveform fitting can be performed by establishing a local relative coordinate system with the intermediate sampling point as the origin, converting the fitting process into linear operations, thereby reducing computational complexity. Combined with mathematical model verification, the anti-interference capability of the results is ensured. Finally, high-precision phase difference information can be output. This embodiment, through algorithmic innovation, achieves sub-sampling period-level phase detection accuracy without increasing the hardware clock frequency, while ensuring the system's real-time performance, reliability, and engineering practicality. Therefore, it comprehensively and significantly improves the measurement accuracy, dynamic response speed, and overall reliability of the digital phase detection system.
[0046] In an exemplary embodiment, step S201, which involves resampling the input signal to obtain a reconstructed waveform sequence, may specifically include: A preset number of zero values are inserted between adjacent sampling points of the input signal to obtain an upsampled waveform sequence again.
[0047] The upsampled waveform sequence is passed through a low-pass filter with preset coefficients to obtain the reconstructed waveform sequence. The preset coefficients of the low-pass filter are generated using the Hanning window function.
[0048] The preset number can refer to the interpolation factor L-1, where L is an integer and can be a power of 2. The upsampled waveform sequence can refer to a sequence containing only the original sample points and the inserted zero values, and its spectrum can contain periodic repetitions of the original spectrum. The low-pass filter with preset coefficients can refer to an FIR filter designed for waveform reconstruction tasks with fixed tap coefficients.
[0049] For example, waveform reconstruction can be accomplished in two sub-steps. First, zero-value insertion is performed, which can increase the sampling rate from fs to L. The sequence length is increased by fs, but no new information is added; it is merely extended. This sequence can be filtered using a pre-designed FIR low-pass filter. The core function of this filter is to preserve the baseband signal (i.e., the original signal spectrum), while strongly suppressing high-frequency image components centered at fs, 2fs, ..., and smoothing the inserted zero values to reasonable amplitudes, thereby generating a visually continuous and mathematically differentiable reconstructed waveform.
[0050] As an example, with L set to 16, the order of the FIR filter can be designed according to the transition band and stopband attenuation requirements. Its coefficients are obtained by windowing the unit impulse response of the ideal low-pass filter using the Hanning window function. The Hanning window can provide sidelobe peaks up to -31dB, effectively suppressing spectral leakage and ensuring second-order continuity of the reconstructed waveform near the zero-crossing point.
[0051] In this embodiment, zero interpolation simplifies the computational complexity of the interpolation operation itself. A matched Hanning window FIR filter, with its excellent sidelobe suppression capability, ensures high fidelity of the reconstructed waveform, particularly accurately recovering waveform characteristics near zero crossings. This combination provides a high-quality signal source for achieving high-precision digital phase detection at the sub-sampling period level without excessively increasing computational complexity, thus overcoming the limitations of hardware clock resolution.
[0052] In an exemplary embodiment, step S202, detecting the zero-crossing point of the reconstructed waveform sequence, may specifically include: Sign bit detection is performed on the reconstructed waveform sequence; If the sign bits of adjacent sampling points are different, it is determined that a zero-crossing point has been detected.
[0053] Among them, sign bit detection refers to the process of determining whether the value of a sample point is positive, negative or zero, which is usually achieved by checking the most significant bit (MSB) in binary two's complement representation.
[0054] For example, the system can stream the reconstructed waveform sequence y[n]. For each newly arriving sample point y[k], its sign bit (i.e., the bit indicating positive or negative) is compared with the sign bit of the previous sample point y[k-1]. If they are different, it indicates that the signal amplitude crosses the zero axis between y[k-1] and y[k], i.e., there is a zero-crossing point.
[0055] As an example, in hardware, a D flip-flop can be used to register the sign bit of y[k-1], which is then XORed with the sign bit of y[k]. The XOR result of '1' indicates a sign change, which can be immediately output as a zero-crossing detection flag and trigger data capture logic.
[0056] Optionally, for the reconstructed high-resolution sequence Sign bit monitoring is performed. The logic circuit detects two adjacent points. The sign bit. If This triggers a fine interpolation interrupt and locks the value. Three data points are stored in the register.
[0057] In this embodiment, a simple sign bit comparison can be used for coarse zero-crossing localization, which has the advantages of high efficiency and low latency, and can respond to signal phase changes in real time. This detection mechanism can be applied to high-resolution reconstructed waveform sequences, and its localization accuracy has already reached Ts / L, which is much higher than that of detection on the original sampled sequence. This defines an accurate search interval for subsequent fine interpolation, thereby improving the accuracy of digital phase detection.
[0058] In one exemplary embodiment, Figure 3 This application provides a flowchart illustrating the steps for determining the zero-crossing offset of an input signal, as illustrated in the embodiments of the present application. Figure 3 As shown, in step S203, local waveform fitting includes quadratic curve fitting; based on the sampled data, using a preset fitting model, local waveform fitting is performed with the intermediate sampling point among multiple continuous sampling points as the origin to determine the zero-crossing offset of the input signal, which may specifically include: S301. Based on the sampling time of the intermediate sampling point as the origin, establish a local relative coordinate system, substitute the sampling data of multiple continuous sampling points into the preset quadratic polynomial model, and determine the polynomial coefficients of the quadratic polynomial model through simplified fixed underlying numerical operation logic. S302. Based on the polynomial coefficients, determine the zero-crossing offset of the quadratic polynomial model in the local relative coordinate system.
[0059] The local relative coordinate system can be a temporarily established coordinate system with the center of the current processing window as the zero point in time. The preset quadratic polynomial model is... , where τ is the local relative time. Simplified fixed-level numerical computation logic refers to a computational process whose structure does not change with data changes, and whose computational workload is constant and simple.
[0060] For example, the absolute time of multiple consecutive sampling points (such as three points) can be converted into relative time with the intermediate point P0 as the origin (τ=0). The new coordinates (τi, yi) of these points can then be substituted into a quadratic polynomial to form a system of equations. The coordinates τi can be set to simple fixed values (such as -T, 0, +T), and the system of equations for solving coefficients A, B, and C can degenerate into a simple set of arithmetic expressions, which may only contain addition, subtraction, and multiplication by a fixed constant.
[0061] In this embodiment, in order to solve the quadratic polynomial in real time in hardware such as DSP, This paper proposes a local relative coordinate system transformation method based on center alignment. By establishing a local relative coordinate system with the intermediate sampling point as the origin and utilizing symmetrical sampling times (-T, 0, +T), the general process of quadratic curve fitting, which usually requires matrix operations, is simplified to a fixed operation requiring only a few additions, subtractions, and constant multiplications. This simplification makes it possible to perform high-precision fitting in real time on resource-constrained FPGAs or ASICs with low processing latency.
[0062] In an exemplary embodiment, multiple consecutive sampling points are represented by three sampling points; a local relative coordinate system is established based on the sampling time of the intermediate sampling point as the origin, including: The three sampling points are defined as the previous point, the current point, and the next point, respectively, with the current point being the intermediate sampling point; In a local relative coordinate system, the time of the current point is set to zero, the time of the previous point is determined as a negative fixed time interval, and the time of the next point is defined as a positive fixed time interval.
[0063] Here, "previous point," "current point," and "next point" can refer to three consecutive sampling points on the time axis centered at the current point, with amplitudes of y[k-1], y[k], and y[k+1], respectively. The local relative coordinate system can refer to a coordinate system temporarily established for simplified calculations, with the absolute time of a specific sampling point (here, the current point) as its time zero. The fixed time interval can refer to the time difference between adjacent sampling points in the reconstructed waveform sequence; its value can be the ratio of the system sampling period Ts to the upsampling factor L (T=Ts / L), and can be a constant determined by the system design.
[0064] For example, after detecting a zero-crossing and locking three consecutive sampling points, the system performs a coordinate transformation. Ignoring the original absolute timestamps of these three sampling points, it reassigns them a fixed set of symmetrical relative time values based on their inherent sequential relationship. That is, the time of the sampling point in the middle position (the current point) is defined as the new time origin 0; the time of the sampling point in the preceding position (the previous point) is defined as -T; and the time of the sampling point in the following position (the next point) is defined as +T. This process can be a translation and scaling of a segment on the physical timeline, mapping it to a standardized, computationally friendly mathematical coordinate system.
[0065] In this embodiment, the times of the three sampling points are normalized to a fixed value. The symmetric form T, 0, +T transforms the variable absolute timestamp parameters, which would otherwise need to be processed in each fitting iteration, into a set of pre-known constants. This allows the coefficients of time-related terms in the model to become constants when the sampled amplitudes are subsequently substituted into the fitting model (such as a quadratic polynomial). Therefore, the process of solving for the fitting model coefficients degenerates from the general least-squares operation requiring the processing of variable matrices to a process only for the amplitude data y[k] 1], y[k], y[k+1] are combined in a series of fixed linear combinations (such as addition, subtraction, multiplication of constants). This simplification can reduce the requirements for the performance and number of computing units (especially multipliers), enabling high-precision waveform fitting algorithms to be implemented on low-power, low-cost hardware platforms with extremely low latency, thus allowing high-precision phase detection to be achieved with pure digital algorithms.
[0066] In one exemplary embodiment, determining the polynomial coefficients of a quadratic polynomial model through simplified fixed operations includes: Set the coefficient of the constant term in the quadratic polynomial model to the magnitude at the current point; The coefficients of the first term in the quadratic polynomial model are obtained by subtracting the amplitude of the previous point from the amplitude of the subsequent point and dividing by twice the fixed time interval. The quadratic coefficients of the quadratic polynomial model are obtained by subtracting twice the current amplitude from the amplitude of the previous point, adding the amplitude of the next point, and then dividing by twice the square of the fixed time interval. The operation of dividing by twice the fixed time interval or the square of twice the fixed time interval is achieved through multiplication of pre-stored constant coefficients or arithmetic shift operations.
[0067] The coefficient of the constant term (which can be denoted as C) is a quadratic polynomial. The terms independent of the time variable τ can represent the signal amplitude at the origin (τ=0) of the local relative coordinate system. The coefficient of the linear term (which can be denoted as B) is the coefficient of the linear term Bτ of the polynomial, describing the slope or trend of the linear change of the signal near the zero-crossing point. The coefficient of the quadratic term (which can be denoted as A) is the coefficient of the quadratic term of the polynomial. The coefficient can reflect the curvature or acceleration of the signal in that local region. Twice the fixed time interval (which can be denoted as 2T) and its square (2T) 2 This originates from the aforementioned coordinate transformation (the three points at time are respectively...). (T, 0, and +T) and the fixed denominator generated during the polynomial differentiation process.
[0068] For example, when coarse positioning detects a sign flip occurring and When in between, the system can select y[k] The three sampling points are y[k], y[k+1], and y[k+1]. This application does not use absolute time. Instead, it defines a local relative time variable. It is possible to force intermediate sampling points. The moment is defined as the origin. At this point, the coordinates of the three sampling points in the local relative coordinate system are fixed as follows: The previous point P -1 : Current point P0: ; the next point P1: .
[0069] in, This is a fixed time interval after oversampling.
[0070] Based on the specific coordinate definition mentioned above, the quadratic polynomial The process of finding the coefficients can be greatly simplified. Substitute the coordinates of the three points into the equation: (1); (2); (3); Therefore, the formula for calculating the coefficients can be directly derived: Coefficient C (zero-order term): directly assigned, no calculation required.
[0071] Coefficient B (first-order term): Subtracting equation (3) from equation (1) yields: (4); Coefficient A (second-order term): Adding equation (1) and equation (3) together and substituting into C, we get: (5); In practical applications, the polynomial coefficients of the quadratic polynomial model are determined by fixing the underlying numerical computation logic, as shown in the following expression: ; ; ; Where A is the coefficient of the quadratic term, B is the coefficient of the linear term, and C is the coefficient of the constant term. The amplitude of the previous point, The amplitude at the current point. The amplitude of the next point is given, and T is a fixed time interval. The expression operation that determines the polynomial coefficients is implemented through pre-stored constant coefficient multiplication or arithmetic shift operations.
[0072] In this embodiment, in the digital circuit implementation, since the oversampling period T is a preset system constant, the denominator in the above formula... and All are known constants. Therefore, in the division operation... and Instead of calling a resource-intensive hardware divider, it can be pre-compiled into a multiplier (multiplying the reciprocal of the constant), and even when L is a power of 2, it can be simplified to an arithmetic shift operation. Compared to directly using a general interpolation formula, this step, through specific coordinate transformations, can reduce the computational complexity from... Reduce to This significantly reduces the consumption of logic gate resources and reduces the phase detection processing latency to the nanosecond level, thereby ensuring the high bandwidth characteristics of the DPLL loop.
[0073] In one exemplary embodiment, Figure 4 This application provides a schematic diagram illustrating the steps for determining the zero-crossing offset of a quadratic polynomial model in a local relative coordinate system, as shown in the embodiments of this application. Figure 4 As shown, based on the polynomial coefficients, the offset at the zero-crossing time of the quadratic polynomial model in the local relative coordinate system is determined, including: S401. Determine the discriminant of the quadratic polynomial model; S402. When the discriminant is greater than or equal to zero, determine the offset at the zero crossing time according to the quadratic formula. S403. When the discriminant is less than zero, the fitting of the current calculation cycle is deemed invalid, and the zero-crossing offset of the previous calculation cycle is maintained; where the current calculation cycle is the cycle following the previous calculation cycle. The discriminant is expressed as follows: .
[0074] The discriminant can be a scalar value calculated from the coefficients of a quadratic polynomial model, used to determine whether the quadratic curve intersects the zero axis with a real number. The root-solving formula refers to the formula for solving a quadratic equation, which can be used to calculate the precise location of the zero-crossing point. The zero-crossing offset refers to the calculated time value of the signal's zero-crossing point relative to the origin in a local relative coordinate system. The current calculation cycle refers to the time series corresponding to the complete processing flow from detecting the zero-crossing point to completing the fitting calculation.
[0075] For example, after obtaining the coefficients of the quadratic term, the linear term, and the constant term, two calculations can be performed in parallel: calculating preliminary candidate values for the zero-crossing offset based on the quadratic formula; and calculating the value of the discriminant in real time based on the aforementioned coefficients. The system can compare the value of the discriminant with zero as the primary criterion for determining the validity of the result. If the discriminant is less than zero, it indicates that within the current local data window, the quadratic curve fitted based on noise or distorted waveforms has not truly crossed the zero axis. In this case, the system will trigger hold logic to maintain the final phase difference output unchanged from the previous valid value, thereby avoiding the introduction of erroneous transitions caused by noise.
[0076] In this embodiment, by introducing a discriminative real-time verification mechanism, the accuracy of the fitting results can be further improved. This effectively identifies and shields spurious fitting situations caused by strong noise interference that do not physically involve a true zero-crossing. This enhances the anti-interference capability and output stability of the digital phase detector in complex electromagnetic environments, ensuring that high-precision results are obtained with high confidence. Consequently, it improves the reliability and measurement accuracy of the digital phase detector in practical applications.
[0077] In an exemplary embodiment, the step of validating the zero-crossing offset based on the discriminant of the fitted model after calculating the zero-crossing offset according to the quadratic formula includes: Determine whether the offset at the zero crossing time falls within the preset effective time window, where the positive and negative boundaries of the effective time window are fixed time intervals; If the zero-crossing offset exceeds the valid time window, the fitting of the current calculation cycle is invalid, and the zero-crossing offset of the previous calculation cycle is maintained.
[0078] The preset effective time window refers to a time range pre-defined based on system physical constraints, used to determine whether the calculated zero-crossing point is physically reasonable. The fixed time interval can be a predefined sampling period of the reconstructed waveform sequence, which can characterize the time span of the original data points on which the local fitting is based.
[0079] For example, after calculating one or two candidate offset values at zero-crossing times using the quadratic formula, the system can compare them with a reasonable interval based on prior knowledge. The boundaries of this reasonable interval are -T and +T, and the three sampling points used for fitting are located at... The true zero-crossing points are at times T, 0, and +T. Therefore, the true zero-crossing point should appear within the time range (-T to +T) defined by these three points. If the calculated result exceeds this window, it indicates that the result is likely a spurious root caused by severe signal distortion, large interference, or calculation error, and does not conform to the actual situation of the local waveform.
[0080] As an example, in digital circuit implementation, verification can be performed using two parallel comparators. One comparator determines whether the offset is greater than +T, and the other determines whether it is less than -T. If either comparator outputs true, the valid time window has expired. Therefore, the current calculation result can be ignored, and the output multiplexer can be controlled to continue using the previously valid offset output, thereby maintaining the continuity of the phase error signal.
[0081] In this embodiment, by adding a range check of the zero-crossing offset, a supplement and enhancement to the discriminant check is formed, creating a dual validity verification mechanism. This can filter out abnormal solutions that, although mathematically satisfying the solvability condition (discriminant ≥ 0), are physically obviously unreasonable. This improves the robustness of the digital phase detector's output, ensuring that the error signal ultimately used for phase control is generated only by high-confidence, accurate zero-crossing information, thus maintaining high-precision phase detection performance even in complex working environments.
[0082] In some exemplary embodiments, the zero-crossing offset is calculated using the quadratic formula. To prevent false zero crossings or computational overflows caused by noise, discriminative verification logic can be used. It can be calculated... .
[0083] like This indicates that the local waveform did not actually cross zero (floating) under noise interference. In this case, the phase detector output holds the flag, and the DPLL loop filter maintains the output from the previous moment, without performing an error update. If ,calculate .
[0084] Calculated Must meet If the solution exceeds this range, it is considered an invalid solution (a false root caused by large signal interference), and the hold mechanism is also triggered.
[0085] The calculated precise time Zero point of the reference signal Subtract to get the time Difference and move to the left Bit (equivalent to multiplying by gain) The result is normalized into a digital control word and then fed into the loop filter.
[0086] In an exemplary embodiment, based on the verified zero-crossing offset, the phase difference information between the input signal and the reference signal is output, including: The zero-crossing time of the target is determined based on the offset at the zero-crossing time and the time of the intermediate sampling point. The time difference is obtained by subtracting the zero-crossing time of the target signal from the zero-crossing time of the reference signal. Phase difference information is generated based on the time difference.
[0087] The target zero-crossing time can refer to the precise moment on the absolute time axis when the zero-crossing point of the input signal is obtained by adding the aforementioned high-precision relative offset to the absolute time reference. The reference signal's zero-crossing time can refer to the absolute moment corresponding to the zero-crossing point of the reference signal generated inside the digital phase-locked loop for phase comparison. The time difference can refer to the difference between the target zero-crossing time and the reference zero-crossing time, directly characterizing the phase deviation between the two signals. The phase difference information can refer to the final output, formatted (e.g., multiplied by the phase detection gain), digital error signal used to drive the loop filter.
[0088] For example, the system can algebraically add the high-precision relative time offset obtained from local fitting to the absolute time of the intermediate sampling points latched during coarse positioning, thereby recovering the precise absolute time of the zero-crossing point of the input signal under the global time reference. This absolute time is then compared with the absolute time of the corresponding zero-crossing point from the local reference source, and the time difference between the two is calculated using a subtractor. Finally, according to the proportional relationship (phase detection gain) designed in the system, this time difference is converted into a standard format digital control word output.
[0089] As an example, in digital hardware, the absolute time of an intermediate sampling point can be latched by a high-frequency free-running counter upon coarse positioning trigger. The zero-crossing time of the reference signal can be generated by the phase accumulator of a numerically controlled oscillator upon overflow. The time difference is calculated using a subtractor, while the phase difference information is typically generated by left-shifting the time difference value by several bits (equivalent to multiplying by a gain factor to a power of 2) to suit the data format and range of the loop filter input.
[0090] In this embodiment, by combining the offset accuracy of the subsampling period with the absolute time reference, the time resolution of the final output phase difference information is much higher than that of the system's main clock period. This enables the digital phase-locked loop to detect and respond to extremely subtle phase changes, thereby achieving high-precision phase locking and fast dynamic response, which can improve the overall performance of systems such as resonant MEMS sensors.
[0091] In this embodiment, by simplifying the calculation and anomaly verification logic through the above coordinate transformation, not only can a high-precision digital phase detection method be realized, but also the problems of large calculation volume and poor noise resistance in actual engineering are solved, realizing low-cost and high-reliability digital phase detection.
[0092] In some exemplary embodiments, the digital phase detection method provided in this application can be specifically implemented as a phase error detection method based on time interpolation, such as... Figure 5 As shown, Figure 5 A flowchart illustrating a phase error detection method based on time interpolation provided in this application embodiment is shown. The method includes: S501, MEMS sensor, to collect raw signals.
[0093] S502, the signal is transmitted to the ADC output interface.
[0094] S503, ADC output interface, converts to digital signals.
[0095] S504, Generate a discrete digital sequence.
[0096] S505, the digital discrete sequence is transmitted to the oversampling module.
[0097] S506, oversampling module, improves sampling rate.
[0098] S507, the signal is transmitted to the digital low-pass filter.
[0099] S508, Digital Low-Pass Filter (DLPF), outputs smooth, high-resolution digital signals.
[0100] S509 generates smooth, high-resolution digital signals.
[0101] S510, the signal is transmitted to the zero-cross detection module.
[0102] S511, Zero Cross-Detection Module, extracts sampling points near zero value.
[0103] S512, sampling points near zero are transmitted to the interpolation calculation unit.
[0104] S513, Reference Signal VCO and Zero Crossing Detection: Generate a reference signal and detect its zero crossing moment.
[0105] S514. The precise zero-crossing moment of the reference signal is transmitted to the interpolation calculation unit.
[0106] S515, interpolation calculation unit, calculates the precise zero-crossing time.
[0107] S516, Precise zero-crossing time is transmitted to the time difference calculation module.
[0108] S517, Time Difference Calculation Module, calculates phase error.
[0109] S518, Phase error is transmitted to the phase error conversion module.
[0110] S519, Phase Error Conversion Module, processes phase errors.
[0111] Among these, MEMS sensors can refer to microelectromechanical system devices used to sense external physical quantities (such as electric fields) and convert them into electrical signals. ADC output interface refers to the data output terminal of an analog-to-digital converter, responsible for converting analog voltage signals into discrete digital codes. Oversampling module refers to a functional unit that performs upsampling operations to increase the equivalent sampling rate of digital sequences. Digital low-pass filter (DLPF) refers to a digital signal processing module used to filter out high-frequency noise and smooth waveforms. Zero-crossing detection module refers to a functional unit used to detect the zero-crossing point (i.e., the sign change point) of a signal. Interpolation calculation unit refers to the core processing module that performs local waveform fitting and accurate zero-crossing point calculation. Reference signal VCO (voltage-controlled oscillator) and zero-crossing detection refer to the functional part in a digital phase-locked loop that generates a local reference frequency and detects its zero-crossing point. Time difference calculation module is used to calculate the time difference between the zero-crossing points of the input signal and the reference signal. Phase error conversion module is responsible for converting the time difference into the standardized phase error control word required by the loop.
[0112] Exemplarily, this specific embodiment provides a complete system flow from physical signal acquisition to final phase error generation. The raw analog signal sensed by the resonant MEMS sensor is first converted into a digital discrete sequence by an ADC. This sequence then enters the digital processing chain: the data rate is first increased by an oversampling module, and then high-frequency components are filtered out by a digital low-pass filter to obtain a smooth, high-resolution digital waveform. This waveform is sent to a zero-crossing detection module to quickly locate the zero-crossing point and extract data from a few sampling points nearby. At the same time, the VCO inside the system generates a reference signal and also detects its zero-crossing time. The local sampling point data of the input signal and the zero-crossing time of the reference signal are sent together to the interpolation calculation unit. This unit calculates the precise zero-crossing time of the input signal using the method described in the previous embodiment (such as quadratic fitting based on a local relative coordinate system). Subsequently, the time difference calculation module subtracts this precise time from the zero-crossing time of the reference signal to obtain the original phase time error. Finally, the phase error conversion module performs gain adjustment and other processing on the error, outputs the final phase error information, and feeds it back to the control terminal of the VCO in a closed loop to complete the entire phase detection and locking process.
[0113] In this embodiment, through the detailed process described in S501 to S519, a specific implementation architecture for a high-precision digital phase detection system from signal sensing to error output is provided. The algorithm principles (such as time interpolation and local fitting) are clearly mapped to specific functional modules (such as oversampling modules and interpolation calculation units), demonstrating the systematic nature and feasibility of the entire scheme. The front-end processing module (S501-S509) is responsible for providing a high-quality signal source; the intermediate detection and calculation module (S510-S517) achieves high precision and anti-interference capabilities; and the back-end processing module (S518-S519) is responsible for generating usable control signals. This not only ensures the realization of high-precision phase detection but also facilitates system integration, debugging, and optimization, fully demonstrating the feasibility and effectiveness of the method in engineering applications and providing a complete digital solution for realizing high-precision resonant MEMS sensor systems.
[0114] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0115] The digital phase detection device provided in the embodiments of this application is described below. The digital phase detection device has the same inventive concept as the digital phase detection method described above. The solution to the problem provided by the device is similar to the solution described in the method above. Therefore, the specific limitations of one or more digital phase detection device embodiments provided below can be referred to the limitations of the digital phase detection method above. The digital phase detection device described below and the digital phase detection method described above can be referred to each other, and will not be repeated here.
[0116] In one exemplary embodiment, Figure 6 This is a schematic diagram of the structure of a digital phase detector provided in an embodiment of this application, as shown below. Figure 6 As shown, the digital phase detector 60 includes: a signal reconstruction module 610, a zero-crossing point extraction module 620, a zero-crossing offset determination module 630, and a phase difference determination module 640, wherein: The signal reconstruction module 610 is used to acquire the input signal sampled by the discrete sequence and to resample the input signal to obtain the reconstructed waveform sequence.
[0117] The zero-crossing extraction module 620 is used to detect the zero-crossing points of the reconstructed waveform sequence and extract the sampling data of multiple consecutive sampling points centered on the zero-crossing points.
[0118] The zero-crossing offset determination module 630 is used to determine the zero-crossing offset of the input signal based on the sampled data, by using a preset fitting model and taking the middle sampling point among multiple continuous sampling points as the origin for local waveform fitting, and to verify the validity of the zero-crossing offset based on the discriminant of the fitting model.
[0119] The phase difference determination module 640 is used to output phase difference information between the input signal and the reference signal based on the zero-crossing offset that has passed the verification.
[0120] In an exemplary embodiment, the signal reconstruction module 610 is used to insert a preset number of zero values between adjacent sampling points of the input signal to obtain an upsampled waveform sequence; the upsampled waveform sequence is then passed through a low-pass filter with preset coefficients to obtain a reconstructed waveform sequence, wherein the preset coefficients are generated by the Hanning window function.
[0121] In an exemplary embodiment, the zero-crossing extraction module 620 is used to perform sign bit detection on the reconstructed waveform sequence; if the sign bits of adjacent sampling points are different, it is determined that a zero-crossing point has been detected.
[0122] In an exemplary embodiment, local waveform fitting includes quadratic curve fitting; the zero-crossing offset determination module 630 is used to establish a local relative coordinate system based on the sampling time of the intermediate sampling point as the origin, substitute the sampling data of multiple consecutive sampling points into a preset quadratic polynomial model, determine the polynomial coefficients of the quadratic polynomial model through the underlying numerical operation logic, and determine the zero-crossing offset of the quadratic polynomial model in the local relative coordinate system based on the polynomial coefficients.
[0123] In an exemplary embodiment, multiple consecutive sampling points are three sampling points; the zero-crossing offset determination module 630 is used to determine the three sampling points as the previous point, the current point, and the next point, respectively, wherein the current point is the intermediate sampling point; in the local relative coordinate system, the time of the current point is set to zero, the time of the previous point is determined to be a negative fixed time interval, and the time of the next point is defined as a positive fixed time interval.
[0124] In an exemplary embodiment, the zero-crossing offset determination module 630 is used to make the constant term coefficient of the quadratic polynomial model equal to the amplitude at the current point; to obtain the linear term coefficient of the quadratic polynomial model by subtracting the amplitude of the previous point from the amplitude of the next point and dividing by twice the fixed time interval; and to obtain the quadratic term coefficient of the quadratic polynomial model by subtracting twice the amplitude of the current point from the amplitude of the previous point and adding the amplitude of the next point and dividing by twice the square of the fixed time interval; wherein the operation of dividing by twice the fixed time interval or twice the square of the fixed time interval is implemented by pre-stored constant coefficient multiplication or arithmetic shift operation.
[0125] In an exemplary embodiment, the zero-crossing offset determination module 630 is used to determine the discriminant of the quadratic polynomial model. The discriminant is the square of the coefficient of the linear term minus the product of four times the coefficient of the quadratic term and the coefficient of the constant term. When the discriminant is greater than or equal to zero, the zero-crossing offset is determined according to the quadratic formula. When the discriminant is less than zero, the fitting of the current calculation cycle is determined to be invalid, and the zero-crossing offset of the previous calculation cycle is maintained. The current calculation cycle is the cycle following the previous calculation cycle.
[0126] In an exemplary embodiment, the zero-crossing offset determination module 630 is used to determine whether the zero-crossing offset falls within a preset effective time window, the positive and negative boundaries of the effective time window being a fixed time interval; if the zero-crossing offset exceeds the effective time window, the fitting of the current calculation cycle is invalid, and the zero-crossing offset of the previous calculation cycle is maintained.
[0127] In an exemplary embodiment, the phase difference determination module 640 is used to determine the target zero-crossing time based on the zero-crossing time offset and the intermediate sampling point time; subtract the target zero-crossing time from the zero-crossing time of the reference signal to obtain the time difference; and generate phase difference information based on the time difference.
[0128] Each module in the aforementioned digital phase detector can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of the electronic device in hardware form or independent of it, or stored in the memory of the electronic device in software form, so that the processor can call and execute the operations corresponding to each module.
[0129] In one exemplary embodiment, this application also provides a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the steps of any of the digital phase detection methods described above.
[0130] In one exemplary embodiment, this application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of any of the digital phase detection methods described above.
[0131] In one exemplary embodiment, this application also provides a power grid voltage tracking control system, including: the electronic device described in the second aspect above, wherein the power grid voltage tracking control system may be as follows: Figure 1 The specific implementation method is shown below.
[0132] In one exemplary embodiment, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the digital phase detection methods described in the above embodiments.
[0133] Indicatively, such as Figure 7 As shown, Figure 7 This is a schematic diagram of the internal structure of an electronic device 700 provided in an embodiment of this application. The electronic device 700 can be provided as a server. (Refer to...) Figure 7 The electronic device 700 includes a processor 702, which further includes one or more processors, and memory resources represented by memory 701 for storing instructions executable by the processor 702, such as a computer program. The computer program stored in memory 701 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processor 702 is configured to execute instructions to perform the digital phase detection method of any of the above embodiments. The electronic device 700 can operate on an operating system stored in memory 701, such as Windows Server™, Mac OS X™, Unix™, Linux™, Free BSD™, or similar.
[0134] The electronic device 700 may further include a power supply component 703 configured to perform power management of the electronic device 700, a wired or wireless network interface 704 configured to connect the electronic device 700 to a network, and an input / output (I / O) interface 705. Wireless operation may be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a digital phase detection method. The display unit 707 of the electronic device is used to form a visually visible image and may be a display screen, a projection device, or a virtual reality imaging device. The display screen may be a liquid crystal display screen or an e-ink display screen. The input device 706 of the electronic device may be a touch layer covering the display screen, or buttons, a trackball, or a touchpad located on the casing of the electronic device, or an external keyboard, touchpad, or mouse, etc.
[0135] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the electronic device to which the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0136] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0137] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0138] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0139] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A digital phase detection method, characterized in that, The method includes: The input signal is sampled by a discrete sequence, and the input signal is sampled again to obtain a reconstructed waveform sequence; The zero-crossing points of the reconstructed waveform sequence are detected, and the sampling data of multiple consecutive sampling points centered on the zero-crossing points are extracted; Based on the sampled data, a local waveform is fitted using a preset fitting model with the middle sampling point among the multiple consecutive sampling points as the origin, to determine the zero-crossing offset of the input signal, and the validity of the zero-crossing offset is verified based on the discriminant of the fitting model. Based on the zero-crossing offset that has passed verification, the phase difference information between the input signal and the preset reference signal is output.
2. The digital phase detection method according to claim 1, characterized in that, The step of resampling the input signal to obtain the reconstructed waveform sequence includes: A preset number of zero values are inserted between adjacent sampling points of the input signal, and the signal is sampled again to obtain an upsampled waveform sequence; The upsampled waveform sequence is passed through a low-pass filter with preset coefficients to obtain a reconstructed waveform sequence. The preset coefficients of the low-pass filter are generated using the Hanning window function.
3. The digital phase detection method according to claim 1, characterized in that, The detection of zero-crossing points of the reconstructed waveform sequence includes: Sign bit detection is performed on the reconstructed waveform sequence; If the sign bits of adjacent sampling points are different, it is determined that a zero-crossing point has been detected.
4. The digital phase detection method according to claim 1, characterized in that, The step of determining the zero-crossing offset of the input signal based on the sampled data, using a preset fitting model and taking the middle sampling point among the multiple consecutive sampling points as the origin, includes: The local waveform fitting includes quadratic curve fitting; Based on the sampling time of the intermediate sampling point as the origin, a local relative coordinate system is established. The sampling data of the multiple consecutive sampling points are substituted into the preset quadratic polynomial model. Through the underlying numerical operation logic, the polynomial coefficients of the quadratic polynomial model are determined. Based on the polynomial coefficients, the zero-crossing offset of the quadratic polynomial model in the local relative coordinate system is determined.
5. The digital phase detection method according to claim 4, characterized in that, The multiple consecutive sampling points are three sampling points; the establishment of a local relative coordinate system based on the sampling time of the intermediate sampling point as the origin includes: The three sampling points are respectively designated as the previous point, the current point, and the next point, wherein the current point is the intermediate sampling point; In the local relative coordinate system, the time of the current point is set to zero, the time of the previous point is determined to be a negative fixed time interval, and the time of the next point is defined as a positive fixed time interval.
6. The digital phase detection method according to claim 5, characterized in that, The polynomial coefficients of the quadratic polynomial model are determined through underlying numerical computation logic, as shown in the following expression: ; ; ; Where A is the coefficient of the quadratic term, B is the coefficient of the linear term, and C is the coefficient of the constant term. The amplitude of the previous point, The amplitude at the current point. The amplitude of the next point is given, and T is the fixed time interval. The expression operation that determines the polynomial coefficients is implemented through pre-stored constant coefficient multiplication or arithmetic shift operations.
7. The digital phase detection method according to claim 6, characterized in that, The step of determining the zero-crossing offset of the quadratic polynomial model in the local relative coordinate system based on the polynomial coefficients includes: Determine the discriminant of the quadratic polynomial model; When the discriminant is greater than or equal to zero, the offset at the zero-crossing time is determined according to the quadratic formula; When the discriminant is less than zero, the fitting of the current calculation cycle is determined to be invalid, and the zero-crossing offset of the previous calculation cycle is maintained. The discriminant is expressed as follows: 。 8. The digital phase detection method according to claim 7, characterized in that, The step of determining the zero-crossing offset according to the root-finding formula, and then validating the zero-crossing offset based on the discriminant of the fitted model, includes: Determine whether the zero-crossing offset falls within a preset effective time window, wherein the positive and negative boundaries of the effective time window are the fixed time interval; If the zero-crossing offset exceeds the effective time window, the fitting of the current calculation cycle is invalid, and the zero-crossing offset of the previous calculation cycle is maintained.
9. An electronic device, characterized in that, It includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the method according to any one of claims 1 to 8.
10. A power grid voltage tracking control system, characterized in that, include: The electronic device as described in claim 9.