Square wave-oriented high-real-time adaptive threshold filtering device and method

By designing a high real-time adaptive threshold filtering device for square waves in scenarios such as optical fiber current sensors, and using variable window sizes and feedback edge thresholds, the problem of square wave signal processing distortion in the existing technology is solved, and efficient Filtering effect and real-time performance, suitable for fiber optic current sensors and fiber optic gyroscope equipment.

CN118826697APending Publication Date: 2024-10-22GUANGZHOU GRG METROLOGY & TEST CO LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411071401.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-06
Publication Date
2024-10-22

AI Technical Summary

Technical Problem

Existing technology can easily cause signal distortion when processing square wave signals with complex spectral components, and cannot effectively track the rapid changes of square wave signals. It cannot meet the filtering requirements, especially in scenarios with high real-time requirements such as fiber optic current sensors.

Method used

A high real-time adaptive threshold filtering device for square waves is designed, including an A/D conversion unit, a cache unit, a subtractor, a transition edge judgment unit and a calculation unit, through variable window size and feedback edge thresholds. , to achieve effective filtering of square wave signals and ensure the smoothness and real-time performance of the filtering results.

Benefits of technology

It effectively retains the characteristics of the square wave, achieves good filtering of the square wave signal with periodic noise interference, ensures the smoothness and real-time performance of the filtering results, and occupies less logic resources, and the implementation method is simple and easy to operate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118826697A_ABST
    Figure CN118826697A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of digital signal processing, in particular to a square-wave-oriented high-real-time self-adaptive threshold filtering device and method, and the device comprises an A / D conversion unit, a first cache unit, a subtractor, a second cache unit, a jump edge judgment unit and a calculation unit. The A / D conversion unit is used for converting the received analog square wave signal into a digital square wave signal; the first cache unit is used for acquiring a first signal according to the digital square wave signal and transmitting the first signal to the subtractor; the second cache unit is used for acquiring a second signal according to the digital square wave signal input in the previous clock period and transmitting the second signal to the jump edge judgment unit; the subtractor is used for performing differential operation on the first signal and the filtering result and acquiring an edge threshold value according to an operation result; the jump edge judgment unit is used for giving a jump edge judgment result; and the calculation unit outputs a filtering result according to the jump edge judgment result and the digital square wave signal. The square wave signal is well filtered, and it is well guaranteed that the square wave is not distorted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of digital signal processing, and in particular to a highly real-time adaptive threshold filtering device and method for square waves. Background Art

[0002] In the field of digital signal processing, filtering technology is a key technology used to remove noise from signals and extract the required information. The output signals of many sensors are square waves, such as photoelectric encoders, rotary encoders, ultrasonic sensors, pressure sensors, etc. The characteristics of square wave signals are that they switch between two states at a fixed frequency or a variable frequency. This type of signal usually needs to be filtered to eliminate possible noise or interference. The output signal of the photodetector in the fiber optic current sensor or fiber optic gyroscope is a square wave signal with a high frequency and changing amplitude. Such sensors usually work in an environment with large electromagnetic interference, so the output signal will be greatly interfered, so that the square wave signal output has a large noise. If it is not filtered, the square wave signal will cause a large error in the output result when it is calculated by the post-processor. At present, common high-real-time filtering methods include: limiting filtering method, median filtering method, recursive averaging filtering method, median averaging filtering method, etc. These methods are simple to implement and have a small amount of calculation, so they have high real-time performance, but the effect is often not good when processing square wave signals. This is mainly because the square wave signal has the characteristics of rapid changes. Such traditional methods cannot effectively track such changes, resulting in serious distortion of the square wave signal. More complex filtering methods such as wavelet noise reduction and LMS adaptive filtering have better filtering effects, but are complex to implement and require large amounts of computation. Most importantly, they cannot meet filtering requirements in scenarios such as fiber optic current sensors that require high real-time filtering.

[0003] The existing patent discloses a digital sliding average low-pass filter and a filtering method thereof, comprising a digital filter, wherein the digital filter comprises an A / D conversion unit, a first calculation unit, a second calculation unit, a first storage unit and a second storage unit; the A / D conversion unit converts the sampled analog signal into a digital signal and sends it to the first calculation unit; the first storage unit stores the accumulated data output by the first calculation unit; the second storage unit stores the digital filter output value output by the first calculation unit; the first calculation unit reads the data of the first storage unit and the second storage unit respectively and calculates the accumulated data value of the current cycle; the second calculation unit receives the data sent by the first calculation unit and updates the digital filter output value and stores it in the second storage unit. This prior art can optimize the traditional filtering method from relying heavily on the chip memory space to a filtering method that only requires 2 storage units, greatly reducing the method's dependence on system resources. However, when processing a square wave signal with complex spectral components, this prior art will cause distortion of the square wave signal; and it cannot effectively track the rapid jump changes of the square wave signal. Summary of the invention

[0004] The primary purpose of the present invention is to overcome the problems existing in the prior art and to provide a high real-time adaptive threshold filtering device for square waves. The present invention can filter square wave signals with periodic noise interference very well. The filtering result has good smoothness, strong real-time performance, can well retain the characteristics of the square wave, occupies less logic resources, and the implementation method is simple and easy to operate.

[0005] As another object of the present invention, a method suitable for the device according to the aforementioned object is also provided.

[0006] In order to achieve the above object, the present invention provides a high real-time adaptive threshold filtering device for square waves, comprising: an A / D conversion unit, a first cache unit, a subtractor, a second cache unit, a transition edge judgment unit and a calculation unit. The A / D conversion unit is used to convert the received analog square wave signal into a digital square wave signal; The first cache unit is used to obtain a first signal according to the digital square wave signal, and transmit the first signal to the subtractor, wherein the first signal is a signal of the digital square wave signal after being delayed by four clock cycles by the first cache unit; The second cache unit is used to obtain a second signal according to the digital square wave signal input in the previous clock cycle, and transmit the second signal to the transition edge judgment unit, wherein the second signal is a signal of the digital square wave signal input in the previous clock cycle after being delayed by one clock cycle by the second cache unit; The subtractor is used to perform a differential operation on the first signal and the filtering result corresponding to the first signal, and the operation result is the filtered noise amplitude. During the filtering process, the maximum value of the noise amplitude is updated according to the noise amplitude, and twice the maximum noise amplitude is set as the edge threshold. The edge threshold is used to determine whether a transition edge occurs in the square wave signal; The transition edge judgment unit is used to calculate the difference between the digital square wave signal and the second signal, and provide a transition edge judgment result according to the difference and the edge threshold; The calculation unit is used to output a filtering result according to the transition edge judgment result and the digital square wave signal.

[0007] Preferably, the first cache unit, the subtractor, the second cache unit, the transition edge judgment unit and the calculation unit are based on an FPGA platform.

[0008] Preferably, the calculation unit includes: an accumulation unit, an operation unit, a window size counter, and a third cache unit. The accumulation unit is used to accumulate the input digital square wave signal and obtain an accumulation result. The operation unit is used to obtain a filtering result according to the accumulation result. The third cache unit is used to cache the input digital square wave signal. The window size counter is used to receive the jump edge judgment result. If the transition edge result is that no transition edge occurs, and the value of the window size counter is less than the preset window size threshold, the value of the window size counter is increased by one, and the accumulating unit accumulates the input digital square wave signal; if the value of the window size counter is greater than or equal to the preset window size threshold, the value of the window size counter remains unchanged, and the accumulating unit accumulates the input digital square wave signal and subtracts the value cached in the third cache unit. Digital square wave signal of clock cycle input ,in, is the current clock cycle, is the preset window size threshold; If the transition edge result is a transition edge, the value of the window size counter becomes 1, and the value in the accumulation unit is cleared and the digital square wave signal input in the current clock cycle is accumulated. The operation unit processes the accumulation result of the accumulation unit to obtain a filtering result.

[0009] Preferably, the operation unit is a divider, and the division coefficient of the divider is the current clock cycle value of the window size counter.

[0010] Preferably, the operation unit is a multiplier, and the multiplication coefficient of the multiplier is the inverse of the current clock cycle value of the window size counter.

[0011] Preferably, the first cache unit is composed of four registers in the FPGA, and the four registers are used to delay the digital square wave signal output by the A / D conversion unit by four clock cycles.

[0012] A highly real-time adaptive threshold filtering method for square waves, the method comprising the following steps: Initialization: clearing the values ​​of the first cache unit, the second cache unit, and the third cache unit to zero, setting the window size threshold, and initializing the edge threshold; The A / D conversion unit converts the collected analog square wave signal into a digital square wave signal; In the current clock cycle, the first cache unit obtains a first signal according to the digital square wave signal, and transmits the first signal to the subtractor, wherein the first signal is a signal of the digital square wave signal after being delayed by four clock cycles by the first cache unit; the second cache unit obtains a second signal according to the digital square wave signal input in the previous clock cycle, and transmits the second signal to the transition edge judgment unit, wherein the second signal is a signal of the digital square wave signal input in the previous clock cycle after being delayed by one clock cycle by the second cache unit; the third cache unit caches the digital square wave signal for the window size threshold number of clock cycles, and outputs it at the window size threshold number of clock cycles. ,in, is the current clock cycle, is the preset window size threshold; In the current clock cycle, the subtractor calculates an edge threshold based on the first signal and a filtering result corresponding to the first signal; In the current clock cycle, the transition edge judgment unit gives a transition edge judgment result based on the second signal, the digital square wave signal output by the A / D conversion unit and the edge threshold; The calculation unit outputs a filtering result according to the transition edge judgment result and the digital square wave signal.

[0013] Further, the subtractor calculates the edge threshold based on the first signal and the filtering result corresponding to the first signal, specifically including: in the current clock cycle, the subtractor performs a differential operation on the first signal and the filtering result corresponding to the first signal, and the operation result is the filtered noise amplitude. During the filtering process, the maximum value of the noise amplitude is updated according to the noise amplitude, and twice the maximum noise amplitude is set as the edge threshold. The edge threshold is used to determine whether a transition edge occurs in the square wave signal. The edge threshold is calculated as follows:

[0014] in, is the edge threshold, is the current clock cycle, is the digital square wave signal of the current clock cycle, is the filtering result corresponding to the digital square wave signal of the current clock cycle, For the previous clock cycle.

[0015] Further, the transition edge judgment unit gives a transition edge judgment result based on the second signal, the digital square wave signal output by the A / D conversion unit and the edge threshold, specifically including: the transition edge judgment unit calculates the difference between the digital square wave signal and the second signal, if the difference is greater than the edge threshold, it is judged that a transition edge occurs, otherwise no transition edge occurs, and the transition edge judgment is determined by the following formula:

[0016] in, is the result of the transition edge judgment. is the edge threshold.

[0017] Furthermore, the calculation unit outputs a filtering result according to the transition edge judgment result and the digital square wave signal, specifically comprising: a window size counter receives the transition edge judgment result, If the transition edge result is that no transition edge occurs, and the value of the window size counter is less than the preset window size threshold, the value of the window size counter is increased by one, and the accumulating unit accumulates the input digital square wave signal; if the value of the window size counter is greater than or equal to the preset window size threshold, the value of the window size counter remains unchanged, and the accumulating unit accumulates the input digital square wave signal and subtracts the value cached in the third cache unit. Digital square wave signal input by clock cycle ,in, is the current clock cycle, is the preset window size threshold; If the transition edge result is a transition edge, the value of the window size counter becomes 1, and the value in the accumulation unit is cleared and the digital square wave signal input in the current clock cycle is accumulated. The operation unit processes the accumulation result of the accumulation unit to obtain a filtering result.

[0018] Compared with the prior art, the present invention has the following beneficial effects: The present invention retains the characteristics of the square wave by means of a variable window size, thereby effectively ensuring that the square wave waveform is not distorted. The square wave signal with periodic noise interference output by the photodetector in the optical fiber current sensor or the optical fiber gyroscope device can be well filtered to achieve a filtering result with better smoothness, stronger real-time performance, less occupied logic resources, and a simple and easy-to-operate implementation method. The edge threshold is also determined by feedback, thereby ensuring the applicability and stability of the filtering method. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 This is a structural diagram of a highly real-time adaptive threshold filtering device for square waves according to an embodiment of the present invention; Figure 2This is a flow chart of a high real-time adaptive threshold filtering method for square waves according to an embodiment of the present invention; Figure 3 This is a timing diagram of the principle of variable window size sliding window mean filtering of a square wave-oriented high real-time adaptive threshold filtering method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0020] The specific implementation of the present invention is further described in detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.

[0021] In the description of the present invention, it should be noted that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance.

[0022] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0023] Furthermore, in the description of the present invention, unless otherwise specified, “plurality” means two or more.

[0024] Example 1 like Figure 1 As shown, a structural diagram of a high real-time adaptive threshold filtering device for square waves according to a preferred embodiment of an embodiment of the present invention includes: an A / D conversion unit 1, a first cache unit 2, a subtractor 3, a second cache unit 4, a transition edge judgment unit 5 and a calculation unit 6, wherein the first cache unit 2, the subtractor 3, the second cache unit 4, the transition edge judgment unit 5 and the calculation unit 6 are based on an FPGA platform.

[0025] The A / D conversion unit 1 is used to convert the received analog square wave signal into a digital square wave signal; in one embodiment, the input stage of the A / D conversion unit module 1 uses an OPA355 amplifier to convert the input signal into a differential analog quantity and output it to the A / D conversion chip. The A / D conversion chip uses AD9244. The module has a resolution of 14 bits, a sampling rate of 65MHz, and a bandwidth of 750MHz. It can sample the square wave waveform well and convert the analog input of the square wave into a digital output to the FPGA module. The FPGA chip in the FPGA module uses the cycloneⅣ series EP4C10F17CN chip of ALTERA.

[0026] The first cache unit 2 is used to obtain a first signal according to the digital square wave signal, and transmit the first signal to the subtractor 3, wherein the first signal is a signal of the digital square wave signal after being delayed by four clock cycles by the first cache unit 2; in one embodiment, the first cache unit is composed of four registers in the FPGA, which are used to cache the input signal digital quantity u for four clock cycles and keep it synchronized with the filtering output result Y.

[0027] The second cache unit 4 is used to obtain a second signal according to the digital square wave signal input in the previous clock cycle, and transmit the second signal to the transition edge judgment unit 5, wherein the second signal is a signal of the digital square wave signal input in the previous clock cycle after being delayed by one clock cycle by the second cache unit 4. In one embodiment, the second cache unit 4 is composed of a register in the FPGA, and the second cache unit 4 converts the digital quantity of the input signal in the previous clock cycle into the digital quantity of the input signal. After caching one clock cycle, the current input signal digital quantity At the same time, it is sent to the jump edge judgment unit 5; Subtractor 3 is used to perform a differential operation on the first signal and the filtering result corresponding to the first signal. The operation result is the filtered noise amplitude. During the filtering process, the maximum value of the noise amplitude is updated according to the noise amplitude, and twice the maximum noise amplitude is set as the edge threshold. The edge threshold is used to determine whether a transition edge occurs in the square wave signal. The edge threshold is calculated as follows:

[0028] in, is the edge threshold, is the current clock cycle, is the digital square wave signal of the current clock cycle, is the filtering result corresponding to the digital square wave signal of the current clock cycle, For the previous clock cycle.

[0029] The transition edge judgment unit 5 is used to calculate the difference between the digital square wave signal and the second signal, and the difference and the edge threshold give a transition edge judgment result; in one embodiment, the transition edge judgment is determined by the following formula:

[0030] in, is the result of the transition edge judgment. is the edge threshold The calculation unit 6 is used to output the filtering result according to the transition edge judgment result and the digital square wave signal.

[0031] Further, the calculation unit 6 includes: an accumulation unit 7, an operation unit 8, a window size counter 9, and a third cache unit 10. The accumulation unit 7 is used to accumulate the input digital square wave signal and obtain the accumulation result. The operation unit 8 is used to obtain the filtering result according to the accumulation result. The third cache unit is used to cache the input digital square wave signal, and the third cache unit 10 is composed of a dual-port RAM inside the FPGA, and its storage depth is equal to the size of SIZE_SET. The window size counter 9 is used to receive the jump edge judgment result. If the transition edge result is that no transition edge occurs, and the value of the window size counter 9 is less than the preset window size threshold, the value of the window size counter 9 is increased by one, and the accumulating unit 7 accumulates the input digital square wave signal to obtain the accumulation result; if the value of the window size counter 9 is greater than or equal to the preset window size threshold, the value of the window size counter 9 remains unchanged, and the accumulating unit 7 accumulates the input digital square wave signal and subtracts the value cached in the third cache unit 10. Digital square wave signal of clock cycle input , that is, subtract the value that first enters the window for accumulation in the accumulation window to keep the number of addends in the accumulation unit equal to the value SIZE of the window size counter 9, where, is the current clock cycle, is the preset window size threshold; If the transition edge result is a transition edge, the value of the window size counter 9 becomes 1, and the value in the accumulator 7 is cleared and the digital square wave signal input in the current clock cycle is accumulated. The calculation unit processes the accumulated result of the accumulator 7 to obtain the filtering result. The specific timing diagram of the variable window size sliding window mean filtering principle is as follows: Figure 3 shown.

[0032] It should be noted that the operation unit 8 is a divider, the division coefficient of the divider is the current clock cycle value of the window size counter, and the operation unit can also be a multiplier, the multiplication coefficient of the multiplier is the inverse of the current clock cycle value of the window size counter.

[0033] Through calculation and experiment, it can be known that the delay between filter output and signal input is four clock cycles. When the FPGA clock is 50MHz, the filter delay is 80ns, which has good real-time performance and can well meet the requirements of fiber optic current sensors or fiber optic gyroscopes for real-time filtering.

[0034] Example 2 like Figure 2 As shown, a flow chart of a high real-time adaptive threshold filtering method for square waves according to an embodiment of the present invention includes: Initialization: clearing the values ​​of the first cache unit, the second cache unit, and the third cache unit to zero, setting the window size threshold, and initializing the edge threshold; The A / D conversion unit converts the collected analog square wave signal into a digital square wave signal; In the current clock cycle, the first cache unit obtains a first signal according to the digital square wave signal, and transmits the first signal to the subtractor, wherein the first signal is a signal of the digital square wave signal after being delayed by four clock cycles by the first cache unit; the second cache unit obtains a second signal according to the digital square wave signal input in the previous clock cycle, and transmits the second signal to the transition edge judgment unit, wherein the second signal is a signal of the digital square wave signal input in the previous clock cycle after being delayed by one clock cycle by the second cache unit; the third cache unit caches the digital square wave signal for the window size threshold number of clock cycles, and outputs it at the window size threshold number of clock cycles. ,in, is the current clock cycle, is the preset window size threshold; In the current clock cycle, the subtractor calculates an edge threshold based on the first signal and a filtering result corresponding to the first signal; In the current clock cycle, the transition edge judgment unit gives a transition edge judgment result based on the second signal, the digital square wave signal output by the A / D conversion unit and the edge threshold; The calculation unit outputs a filtering result according to the transition edge judgment result and the digital square wave signal.

[0035] Further, the subtractor calculates the edge threshold based on the first signal and the filtering result corresponding to the first signal, specifically including: in the current clock cycle, the subtractor performs a differential operation on the first signal and the filtering result corresponding to the first signal, and the operation result is the filtered noise amplitude. During the filtering process, the maximum value of the noise amplitude is updated according to the noise amplitude, and twice the maximum noise amplitude is set as the edge threshold. The edge threshold is used to determine whether a transition edge occurs in the square wave signal. The edge threshold is calculated as follows:

[0036] in, is the edge threshold, is the current clock cycle, is the digital square wave signal of the current clock cycle, is the filtering result corresponding to the digital square wave signal of the current clock cycle, For the previous clock cycle.

[0037] Further, the transition edge judgment unit gives a transition edge judgment result based on the second signal, the digital square wave signal output by the A / D conversion unit and the edge threshold, specifically including: the transition edge judgment unit calculates the difference between the digital square wave signal and the second signal, if the difference is greater than the edge threshold, it is judged that a transition edge occurs, otherwise no transition edge occurs, and the transition edge judgment is determined by the following formula:

[0038] in, is the result of the transition edge judgment. is the edge threshold.

[0039] Furthermore, the calculation unit outputs a filtering result according to the transition edge judgment result and the digital square wave signal, specifically comprising: a window size counter receives the transition edge judgment result, If the transition edge result is that no transition edge occurs, and the value of the window size counter is less than the preset window size threshold, the value of the window size counter is increased by one, and the accumulating unit accumulates the input digital square wave signal; if the value of the window size counter is greater than or equal to the preset window size threshold, the value of the window size counter remains unchanged, and the accumulating unit accumulates the input digital square wave signal and subtracts the value cached in the third cache unit. Digital square wave signal of clock cycle input ,in, is the current clock cycle, is the preset window size threshold; If the transition edge result is a transition edge, the value of the window size counter becomes 1, and the value in the accumulation unit is cleared and the digital square wave signal input in the current clock cycle is accumulated. The operation unit processes the accumulation result of the accumulation unit to obtain a filtering result.

[0040] This embodiment retains the characteristics of the square wave by means of a variable window size, thereby effectively ensuring that the square wave waveform is not distorted. The square wave signal with periodic noise interference output by the photodetector in the optical fiber current sensor or the optical fiber gyroscope device can be well filtered to achieve a filtering result with better smoothness, stronger real-time performance, less logic resource occupation, and a simple and easy implementation method. The edge threshold is also determined by feedback to ensure the applicability and stability of the filtering method.

[0041] In summary, the embodiments of the present invention provide a highly real-time adaptive threshold filtering device and method for square waves, which retains the characteristics of the square wave by means of a variable window size, thereby effectively ensuring that the square wave waveform is not distorted, and can well filter the square wave signal with periodic noise interference output by the photodetector in the optical fiber current sensor or the optical fiber gyroscope device, so as to achieve a filtering result with better smoothness, stronger real-time performance, less occupation of logic resources, and a simple and easy implementation method; it also determines the edge threshold by means of feedback, thereby ensuring the applicability and stability of the filtering method.

[0042] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and substitutions can be made without departing from the technical principles of the present invention. These improvements and substitutions should also be regarded as the scope of protection of the present invention.

Claims

1. A highly real-time adaptive threshold filtering device for square waves, characterized in that: The device comprises: an A / D conversion unit (1), a first cache unit (2), a subtractor (3), a second cache unit (4), a transition edge judgment unit (5) and a calculation unit (6). The A / D conversion unit (1) is used to convert the received analog square wave signal into a digital square wave signal; The first buffer unit (2) is used to obtain a first signal according to the digital square wave signal, and transmit the first signal to the subtractor (3), wherein the first signal is a signal obtained by delaying the digital square wave signal by four clock cycles through the first buffer unit (2); The second buffer unit (4) is used to obtain a second signal according to the digital square wave signal input in the previous clock cycle, and transmit the second signal to the transition edge judgment unit (5), wherein the second signal is a signal of the digital square wave signal input in the previous clock cycle after being delayed by one clock cycle by the second buffer unit (4); The subtractor (3) is used to perform a differential operation on the first signal and the filtering result corresponding to the first signal, the operation result is the filtered noise amplitude, during the filtering process, the maximum value of the noise amplitude is updated according to the noise amplitude, and twice the maximum noise amplitude is set as the edge threshold, and the edge threshold is used to determine whether a jump edge occurs in the square wave signal; The transition edge judgment unit (5) is used to calculate the difference between the digital square wave signal and the second signal, and to provide a transition edge judgment result according to the difference and the edge threshold; The calculation unit (6) is used for outputting a filtering result according to the transition edge judgment result and the digital square wave signal.

2. A highly real-time adaptive threshold filtering device for square waves according to claim 1, characterized in that: The first cache unit (2), the subtractor (3), the second cache unit (4), the transition edge judgment unit (5) and the calculation unit (6) are based on an FPGA platform.

3. A highly real-time adaptive threshold filtering device for square waves according to claim 2, characterized in that: The calculation unit (6) comprises: an accumulation unit (7), an operation unit (8), a window size counter (9), and a third buffer unit (10), wherein the accumulation unit (7) is used to accumulate the input digital square wave signal and obtain an accumulation result, the operation unit (8) is used to obtain a filtering result according to the accumulation result, the third buffer unit is used to cache the input digital square wave signal, and the window size counter (9) is used to receive the jump edge judgment result. If the transition edge result is that no transition edge occurs, and the value of the window size counter (9) is less than a preset window size threshold, the value of the window size counter (9) is increased by one, and the accumulating unit (7) accumulates the input digital square wave signal; if the value of the window size counter (9) is greater than or equal to the preset window size threshold, the value of the window size counter (9) remains unchanged, and the accumulating unit (7) accumulates the input digital square wave signal and subtracts the value cached in the third cache unit (10). Digital square wave signal of clock cycle input ,in, is the current clock cycle, is the preset window size threshold; If the transition edge result is that a transition edge occurs, the value of the window size counter (9) becomes 1, and the value in the accumulation unit (7) is cleared and the digital square wave signal input in the current clock cycle is accumulated, and the operation unit processes the accumulation result of the accumulation unit (7) to obtain a filtering result.

4. The high real-time adaptive threshold filtering device for square waves according to claim 3, characterized in that: The operation unit (8) is a divider, and the division coefficient of the divider is the current clock cycle value of the window size counter (9).

5. The high real-time adaptive threshold filtering device for square waves according to claim 3, characterized in that: The operation unit (8) is a multiplier, and the multiplication coefficient of the multiplier is the inverse of the current clock cycle value of the window size counter (9).

6. A highly real-time adaptive threshold filtering device for square waves according to claim 2, characterized in that: The first cache unit (2) is composed of four registers in the FPGA, and the four registers are used to delay the digital square wave signal output by the A / D conversion unit by four clock cycles.

7. A high real-time adaptive threshold filtering method for square waves, based on a high real-time adaptive threshold filtering device for square waves according to any one of claims 1 to 6, characterized in that: The method comprises the following steps: Initialization: clearing the values ​​of the first cache unit, the second cache unit, and the third cache unit to zero, setting the window size threshold, and initializing the edge threshold; The A / D conversion unit converts the collected analog square wave signal into a digital square wave signal; In the current clock cycle, the first cache unit obtains a first signal according to the digital square wave signal, and transmits the first signal to the subtractor, wherein the first signal is a signal of the digital square wave signal after being delayed by four clock cycles by the first cache unit; the second cache unit obtains a second signal according to the digital square wave signal input in the previous clock cycle, and transmits the second signal to the transition edge judgment unit, wherein the second signal is a signal of the digital square wave signal input in the previous clock cycle after being delayed by one clock cycle by the second cache unit; the third cache unit caches the digital square wave signal for the window size threshold number of clock cycles, and outputs it at the window size threshold number of clock cycles. ,in, is the current clock cycle, is the preset window size threshold; In the current clock cycle, the subtractor calculates an edge threshold based on the first signal and a filtering result corresponding to the first signal; In the current clock cycle, the transition edge judgment unit gives a transition edge judgment result based on the second signal, the digital square wave signal output by the A / D conversion unit and the edge threshold; The calculation unit outputs a filtering result according to the transition edge judgment result and the digital square wave signal.

8. A square wave-oriented high real-time adaptive threshold filtering method according to claim 7, characterized in that: The subtractor calculates the edge threshold based on the first signal and the filtering result corresponding to the first signal, specifically including: in the current clock cycle, the subtractor performs a differential operation on the first signal and the filtering result corresponding to the first signal, and the operation result is the filtered noise amplitude. In the filtering process, the maximum value of the noise amplitude is updated according to the noise amplitude, and twice the maximum noise amplitude is set as the edge threshold. The edge threshold is used to determine whether a transition edge occurs in the square wave signal. The edge threshold is calculated as follows: in, is the edge threshold, is the current clock cycle, is the digital square wave signal of the current clock cycle, is the filtering result corresponding to the digital square wave signal of the current clock cycle, For the previous clock cycle.

9. The high real-time adaptive threshold filtering method for square waves according to claim 7, characterized in that: The transition edge judgment unit gives a transition edge judgment result based on the second signal, the digital square wave signal output by the A / D conversion unit and the edge threshold, specifically comprising: the transition edge judgment unit calculates the difference between the digital square wave signal and the second signal, if the difference is greater than the edge threshold, it is judged that a transition edge occurs, otherwise no transition edge occurs, and the transition edge judgment is determined by the following formula: in, is the result of the transition edge judgment. is the edge threshold.

10. The high real-time adaptive threshold filtering method for square waves according to claim 7, characterized in that: The calculation unit outputs a filtering result according to the transition edge judgment result and the digital square wave signal, specifically comprising: a window size counter receives the transition edge judgment result, If the transition edge result is that no transition edge occurs, and the value of the window size counter is less than the preset window size threshold, the value of the window size counter is increased by one, and the accumulating unit accumulates the input digital square wave signal; if the value of the window size counter is greater than or equal to the preset window size threshold, the value of the window size counter remains unchanged, and the accumulating unit accumulates the input digital square wave signal and subtracts the value cached in the third cache unit. Digital square wave signal of clock cycle input ,in, is the current clock cycle, is the preset window size threshold; If the transition edge result is a transition edge, the value of the window size counter becomes 1, and the value in the accumulation unit is cleared and the digital square wave signal input in the current clock cycle is accumulated. The operation unit processes the accumulation result of the accumulation unit to obtain a filtering result.

Citation Information

Cited By

  • Square wave driving time sequence control method, system, equipment and medium

    CN119360793A