Filtering device, method, electronic device and storage medium
Through the filtering method of the acquisition circuit and controller, the preset time interval and filter coefficient are used to determine the voltage output data value, which solves the problems of poor filtering effect and large resource consumption in the existing filtering method, realizes fast response and low-cost filtering effect, and improves the real-time control capability of computer or microcontroller systems.
Patent Information
- Application Number
- CN202211345450.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-31
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2042-10-31
AI Technical Summary
The existing software filtering methods have problems such as poor filtering effect, high resource consumption, inability to adapt to rapidly changing signals, and difficulty in modifying hardware filters.
Through the acquisition circuit and controller, the voltage output data value is determined using preset time intervals, voltage output data value and filter coefficients, periodic filtering is realized, equipment production costs are reduced, and the cutoff frequency of the voltage input signal is determined by adjusting the filter coefficients.
It realizes a fast response filtering effect, reduces the cost of equipment production, improves the real-time control capabilities of computers or microcontroller systems, and has better filtering performance than existing methods.
Smart Images

Figure CN116111983B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electronic information technology, and in particular to a filtering device, method, electronic equipment and storage medium. Background Art
[0002] It is difficult to modify the hardware filter after it is made by PCBA (Printed Circuit Board Assembly). If the filtering effect of the input signal is not good after it is made, it is often time-consuming and laborious to modify the PCBA, and there is no way to start. The existing technology generally tries to improve it through software filtering methods. In the existing technology, the following three software filtering methods that do not use hardware are usually used for filtering: (1) Average value filtering, a more commonly used filtering method, that is, continuously sampling N data and taking the average value of these N data. This method is simple and easy to implement, and is adopted by many software engineers. The disadvantage is that it is not suitable for real-time control with slow measurement speed or fast data calculation speed, and it wastes the space of the single-chip computer RAM (Random Access Memory). (2) Median filtering method, that is, continuously sampling N times, N is an odd number, the N sampling values are arranged according to size, and the middle value is taken as the effective value of this time. The disadvantage is that it is not suitable for fast-changing parameters such as flow and speed. (3) Limiting filter method: Based on experience, the maximum deviation value allowed between two samples is determined (set as A). Each time a new value is detected, if the difference between the current value and the previous value is less than or equal to A, the current value is valid. If the difference between the current value and the previous value is greater than A, the current value is invalid and discarded. The previous value replaces the current value. The disadvantage is that it cannot suppress periodic signal interference, has poor smoothness, and is far inferior to the filtering effect of the filter circuit. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to overcome the defect of poor filtering effect of software filtering in the prior art and to provide a filtering device, method, electronic equipment and storage medium.
[0004] The present invention solves the above technical problems through the following technical solutions:
[0005] In a first aspect, the present invention provides a filtering device, comprising:
[0006] an acquisition circuit, configured to acquire a voltage input signal at a current moment and input the voltage input signal into a controller;
[0007] The controller is configured to convert the voltage input signal into a voltage input data value, determine the voltage output data value at the current moment based on a preset time interval, the voltage output data value before the preset time interval, the voltage input data value, and a filter coefficient, and convert the voltage output data value into a voltage output signal for output; the filter coefficient determines the cutoff frequency of the voltage input signal; and the voltage output signal is a voltage signal after interference signals have been filtered out.
[0008] Preferably, the controller comprises:
[0009] a filter, configured to determine a ratio of the first sum value to the second sum value as a voltage output data value at the current moment;
[0010] The first sum value is the sum of the first product value and the second product value; the second sum value is the sum of the preset time interval and the filter coefficient; the first product value is the product value of the voltage input data value and the preset time interval; the second product value is the product value of the filter coefficient and the voltage output data value before the preset time interval.
[0011] Preferably, the controller triggers the acquisition circuit to acquire the voltage input signal at the current moment according to a preset time interval.
[0012] Preferably, the filtering device further comprises:
[0013] A display is used to display the voltage output signal after the interference signal is filtered out.
[0014] In a second aspect, the present invention provides a filtering method, the filtering method comprising:
[0015] Collecting a voltage input signal at a current moment and converting the voltage input signal into a voltage input data value;
[0016] determining a voltage output data value at a current moment according to a preset time interval, a voltage output data value before the preset time interval, the voltage input data value, and a filter coefficient; the filter coefficient determines a cutoff frequency of the voltage input signal;
[0017] The voltage output data value at the current moment is converted into a voltage output signal, and the voltage output signal is output; the voltage output signal is a voltage signal after the interference signal is filtered out.
[0018] Preferably, the step of determining the voltage output data value at the current moment according to the preset time interval, the voltage output data value before the preset time interval, the voltage input data value and the filter coefficient includes:
[0019] Determine the ratio of the first sum value to the second sum value as the voltage output data value at the current moment;
[0020] The first sum value is the sum of the first product value and the second product value; the second sum value is the sum of the preset time interval and the filter coefficient; the first product value is the product value of the voltage input data value and the preset time interval; the second product value is the product value of the filter coefficient and the voltage output data value before the preset time interval.
[0021] Preferably, the step of collecting the voltage input signal at the current moment includes:
[0022] According to the preset time interval, the voltage input signal at the current moment is collected.
[0023] Preferably, the filtering method further includes:
[0024] The voltage output signal is sent to a display to display the voltage output signal after the interference signal is filtered out.
[0025] In a third aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned filtering method when executing the computer program.
[0026] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the above-mentioned filtering method when executed by a processor.
[0027] The positive progress effect of the present invention is:
[0028] The present invention utilizes an acquisition circuit and controller to perform periodic filtering based on the voltage output data value, voltage input data value, and filter coefficient before a preset time interval, without the need for a filter circuit, thereby reducing equipment manufacturing costs. Simultaneously, by adjusting the filter coefficient, the cutoff frequency of the voltage input signal can be determined, thereby enabling the appropriate filter coefficient to be set according to the computing power of the controller, thereby improving filtering performance. Furthermore, because the filter device of the present invention has a relatively fast response, it can also enhance the real-time control capability of the computer or single-chip microcomputer system in which the filter device is installed over other resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 This is a first structural diagram of a filtering device according to embodiment 1 of the present invention;
[0030] Figure 2 This is a second structural diagram of the filtering device according to embodiment 1 of the present invention;
[0031] Figure 3 This is a first flow chart of the filtering method according to embodiment 2 of the present invention;
[0032] Figure 4 is a second flow chart of the filtering method according to embodiment 2 of the present invention;
[0033] Figure 5 FIG4 is a hardware filtering circuit diagram for comparison with the filtering method of Example 2 of the present invention;
[0034] Figure 6 1 is an input waveform diagram of a hardware filtering circuit for comparison with the filtering method of Example 2 of the present invention;
[0035] Figure 7 : This is an input waveform diagram of a hardware filtering circuit for comparison with the filtering method of Example 2 of the present invention (time span is 200 milliseconds);
[0036] Figure 8 : This is an input waveform diagram of a hardware filtering circuit for comparison with the filtering method of Example 2 of the present invention (time span is 10 milliseconds);
[0037] Figure 9 1 is an output waveform diagram of a hardware filtering circuit for comparison with the filtering method of Example 2 of the present invention;
[0038] Figure 10 1 is an input waveform diagram of the filtering method according to embodiment 2 of the present invention;
[0039] Figure 11 This is an input waveform diagram of the filtering method according to embodiment 2 of the present invention (time span is 200 milliseconds);
[0040] Figure 12 : This is an input waveform diagram of the filtering method according to embodiment 2 of the present invention (time span is 10 milliseconds);
[0041] Figure 13 1 is an output waveform diagram of the filtering method according to embodiment 2 of the present invention;
[0042] Figure 14 This is a schematic structural diagram of an electronic device according to embodiment 3 of the present invention. DETAILED DESCRIPTION
[0043] The present invention is further described below by way of examples, but the present invention is not limited to the scope of the examples.
[0044] Example 1
[0045] This embodiment provides a filtering device that can perform periodic filtering without the need for a filtering circuit. Figure 1 , the filtering device includes:
[0046] The acquisition circuit 1 is used to acquire the voltage input signal at the current moment and input the voltage input signal into the controller.
[0047] In an optional embodiment, the controller 2 triggers the acquisition circuit to acquire the voltage input signal at the current moment according to a preset time interval, so as to implement a periodic filtering operation.
[0048] Controller 2 is used to convert the voltage input signal into a voltage input data value, determine the voltage output data value at the current moment based on the preset time interval, the voltage output data value before the preset time interval, the voltage input data value and the filter coefficient, and convert the voltage output data value into a voltage output signal for output; the filter coefficient determines the cutoff frequency of the voltage input signal; the voltage output signal is the voltage signal after the interference signal is filtered out.
[0049] This embodiment utilizes an acquisition circuit and controller to perform periodic filtering based on the voltage output data value, voltage input data value, and filter coefficient before a preset time interval, eliminating the need for a filter circuit, thereby reducing device manufacturing costs. Furthermore, by adjusting the filter coefficient, the cutoff frequency of the voltage input signal can be determined, allowing for the appropriate filter coefficient to be set based on the controller's computing power, improving filtering performance. Furthermore, due to the fast response of the filter device of this embodiment, the real-time control capability of the computer or single-chip microcomputer system in which the filter device is installed can be enhanced.
[0050] In an alternative embodiment, see Figure 2 , the controller includes:
[0051] The filter 21 is configured to determine the ratio of the first sum value to the second sum value as the voltage output data value at the current moment.
[0052] Among them, the first sum value is the sum of the first product value and the second product value; the second sum value is the sum of the preset time interval and the filter coefficient; the first product value is the product value of the voltage input data value and the preset time interval; the second product value is the product value of the filter coefficient and the voltage output data value before the preset time interval.
[0053] The following is a specific formula for the voltage output data value at the current moment:
[0054] At a preset time interval Δt, the voltage input signal is sampled and converted into a voltage input data value. At time T1, the voltage output data value output by the following filtering formula is Vout_1. At time T2, after an interval Δt, the voltage input data value is Vin. The voltage output data value Vout output by the following filtering formula at time T2 is obtained by the following formula:
[0055] Vout=(Vin·Δt+TRC·Vout_1) / (Δt+TRC)
[0056] When the voltage output data value is calculated using the above formula for the first time, Vout_1 is equal to Vin.
[0057] TRC is the filter coefficient, which is related to the desired filtering strength, or in other words, determines the cutoff frequency of the voltage input signal. The filter coefficient can be freely determined according to the debugging situation. The larger the TRC value, the smaller the cutoff frequency. Conversely, the smaller the TRC value, the larger the cutoff frequency. In other words, if you need to retain high-frequency signals, set the TRC value to a small value, otherwise set the TRC value to a large value.
[0058] The preset time interval Δt value in the formula can be set according to the performance of the controller chip. The smaller the Δt value, the closer it is to the pure hardware filtering circuit effect. However, the smaller the Δt value, the more computing power resources of the controller are consumed.
[0059] In one implementation, before calculating the voltage output data value at the current moment, it is necessary to normalize Δt and TRC, and calculate the voltage output data value at the current moment based on the normalized Δt and TRC.
[0060] The following describes the derivation process of the above formula:
[0061] First, the formula for the voltage output data value of the hardware filter circuit is as follows:
[0062]
[0063] Where Vin is the voltage input signal, Vout is the voltage output after filtering by the hardware filtering circuit, Zcap is the impedance (capacitive reactance) of the capacitor, and Res is the impedance (or resistance) of the resistor.
[0064] Next, the Laplace transform is introduced and, based on the characteristics of the capacitor, becomes the following formula:
[0065]
[0066] Here, Cap is the capacitance value of the capacitor; s is the complex variable in the Laplace transform. After the introduction of Laplace transform, the voltage input signal and the voltage output signal complete the conversion from the time domain to the frequency domain.
[0067] After sorting out the formula, we can get:
[0068] Vout+Vout·Cap·Res·s=Vin
[0069] That is:
[0070] Vout=Vin-Vout·Cap·Res·s
[0071] Then transform the above formula from Laplace to discretization. In this case, the preset time interval needs to be set as Δt. Then the formula can be obtained after discretization:
[0072] Vout=Vin-Cap·Res·(Vout-Vout_1) / Δt
[0073] Rearranging the above formula, we can get the formula:
[0074] Vout=(Vin·Δt+Vout_1·Cap·Res) / (Δt+Cap·Res)
[0075] Let TRC = Cap·Res, and the filtering formula of this embodiment is obtained:
[0076] Vout=(Vin·Δt+Vout_1·TRC) / (Δt+TRC)
[0077] When Δt is infinitely small, theoretically the filtering effect is almost the same as that of the hardware filtering circuit, but the smaller the Δt value, the more computing power resources of the controller are consumed.
[0078] In an alternative embodiment, see Figure 2 , the filtering device further comprises:
[0079] Display 3 is used to display the voltage output signal after the interference signal is filtered out.
[0080] In this embodiment, the voltage output signal after filtering out the interference signal is displayed on a display, thereby more intuitively showing the filtering effect. At the same time, the filter coefficient and other parameters can be reversely adjusted through the output voltage output signal, thereby improving the filtering performance of the filtering device.
[0081] Example 2
[0082] This embodiment 2 provides a filtering method, see Figure 3 , filtering methods include:
[0083] S1. Collect the voltage input signal at the current moment and convert the voltage input signal into a voltage input data value.
[0084] S2. Determine the voltage output data value at the current moment according to the preset time interval, the voltage output data value before the preset time interval, the voltage input data value, and the filter coefficient.
[0085] The filter coefficient determines the cutoff frequency of the voltage input signal.
[0086] S3. Convert the voltage output data value at the current moment into a voltage output signal, and output the voltage output signal.
[0087] The voltage output signal is the voltage signal after the interference signal is filtered out.
[0088] This embodiment utilizes an acquisition circuit and controller to perform periodic filtering based on the voltage output data value, voltage input data value, and filter coefficient before a preset time interval, eliminating the need for a filter circuit, thereby reducing device manufacturing costs. Furthermore, by adjusting the filter coefficient, the cutoff frequency of the voltage input signal can be determined, thereby enabling the appropriate filter coefficient to be set based on the computing power of the computer or single-chip microcomputer system's controller, improving filtering performance. Furthermore, due to the fast response of the filtering method of this embodiment, the real-time control capability of the computer or single-chip microcomputer system over other resources can be enhanced.
[0089] In an optional embodiment, step S2 includes:
[0090] The ratio of the first sum value to the second sum value is determined as the voltage output data value at the current moment.
[0091] Among them, the first sum value is the sum of the first product value and the second product value; the second sum value is the sum of the preset time interval and the filter coefficient; the first product value is the product value of the voltage input data value and the preset time interval; the second product value is the product value of the filter coefficient and the voltage output data value before the preset time interval.
[0092] The following is a specific formula for the voltage output data value at the current moment:
[0093] At a preset time interval Δt, the voltage input signal is sampled and converted into a voltage input data value. At time T1, the voltage output data value output by the following filtering formula is Vout_1. At time T2, after an interval Δt, the voltage input data value is Vin. The voltage output data value Vout output by the following filtering formula at time T2 is obtained by the following formula:
[0094] Vout=(Vin·Δt+TRC·Vout_1) / (Δt+TRC)
[0095] When the voltage output data value is calculated using the above formula for the first time, Vout_1 is equal to Vin.
[0096] TRC is the filter coefficient, which is related to the desired filtering strength, or in other words, determines the cutoff frequency of the voltage input signal. The filter coefficient can be freely determined according to the debugging situation. The larger the TRC value, the smaller the cutoff frequency. Conversely, the smaller the TRC value, the larger the cutoff frequency. In other words, if you need to retain high-frequency signals, set the TRC value to a small value, otherwise set the TRC value to a large value.
[0097] The preset time interval Δt value in the formula can be set according to the performance of the controller chip. The smaller the Δt value, the closer it is to the pure hardware filtering circuit effect. However, the smaller the Δt value, the more computing power resources of the controller are consumed.
[0098] The following describes the derivation process of the above formula:
[0099] First, the formula for the voltage output data value of the hardware filter circuit is as follows:
[0100]
[0101] Where Vin is the voltage input signal, Vout is the voltage output after filtering by the hardware filtering circuit, Zcap is the impedance (capacitive reactance) of the capacitor, and Res is the impedance (or resistance) of the resistor.
[0102] Next, the Laplace transform is introduced and, based on the characteristics of the capacitor, becomes the following formula:
[0103]
[0104] Here, Cap is the capacitance value of the capacitor, and s is the complex variable in the Laplace transform. After the Laplace transform is introduced, the voltage input signal and the voltage output signal complete the conversion from the time domain to the frequency domain.
[0105] After sorting out the formula, we can get:
[0106] Vout+Vout·Cap·Res·s=Vin
[0107] That is:
[0108] Vout=Vin-Vout·Cap·Res·s
[0109] Then, the above formula is discretized from Laplace transform. In this case, the preset time interval is set to Δt. Then, the above formula can be discretized to obtain the formula:
[0110] Vout=Vin-Cap·Res·(Vout-Vout_1) / Δt
[0111] Rearranging the above formula, we can get the formula:
[0112] Vout=(Vin·Δt+Vout_1·Cap·Res) / (Δt+Cap·Res)
[0113] Let TRC = Cap·Res, and the filtering formula of this embodiment is obtained:
[0114] Vout=(Vin·Δt+Vout_1·TRC) / (Δt+TRC)
[0115] When Δt is infinitely small, theoretically the filtering effect is almost the same as that of the hardware filtering circuit, but the smaller the Δt value, the more computing power resources of the controller are consumed.
[0116] In an optional embodiment, step S1 includes:
[0117] S11. Collect the voltage input signal at the current moment according to the preset time interval.
[0118] In this embodiment, a periodic filtering operation can be achieved through step S11.
[0119] In an alternative embodiment, see Figure 4 , the filtering method also includes:
[0120] S4. Send the voltage output signal to a display to display the voltage output signal after the interference signal is filtered out.
[0121] In this embodiment, the voltage output signal after filtering out the interference signal is displayed on the display, so as to more intuitively display the filtering effect. At the same time, the filtering coefficient and other parameters can be reversely adjusted through the output voltage output signal, thereby improving the filtering performance of the filtering device.
[0122] In order to more intuitively see the filtering accuracy of the filtering method of this embodiment, the filtering results of this embodiment are compared with the filtering results of the hardware filtering circuit. The specific comparison process is as follows:
[0123] 1. Filtering process of hardware filter circuit
[0124] Figure 5 This is the hardware filtering circuit diagram. The circuit uses a 1K resistor and a 100uF capacitor.
[0125] Before filtering: A signal with an amplitude of 2 and a frequency of 5 Hz is superimposed on a 5 V DC voltage (v_dc), and then an interference signal with an amplitude of 2 and a frequency of 500 Hz is superimposed. v_sin is the AC voltage, 1e-4 is the capacitance, and the input signal is Vin(t). Figure 6 is the input waveform. Figure 6The horizontal axis represents the preset interval time t(s), Figure 6 The vertical axis represents the amplitude.
[0126] Due to the high frequency of the waveform, Figure 6 The time span is large, so it presents a black filling effect. Figure 6 The black part refers to the dense waveform, and after pulling it apart, you can see the 500Hz waveform. Figure 7 and Figure 8 As shown, Figure 7 The waveform is displayed with a time span of 200 milliseconds. Figure 8 The waveform diagram has a time span of 10 milliseconds. Figure 7 and Figure 8 The horizontal axis represents the preset interval time t(s), Figure 7 and Figure 8 The vertical axis represents the amplitude.
[0127] After filtering: After filtering circuit, the output signal is obtained, let the output signal be Vout(t), Figure 9 is the output waveform. Figure 9 The horizontal axis represents the preset interval time t(s), Figure 9 The vertical axis represents the amplitude.
[0128] 2. Filtering Method of This Embodiment
[0129] Before filtering: Similarly, a signal with an amplitude of 2 and a frequency of 5Hz is superimposed on a 5V DC voltage, and then an interference signal with an amplitude of 2 and a frequency of 500Hz is superimposed. Let the input signal be Vin(n), Figure 10 The input function and input waveform are shown in Figure 2. The input function is as follows:
[0130] Vin(n)=2·sin(n·2·π·5)+2·sin(n·2·π·500)+5
[0131] It can be seen that the input waveform is consistent with the actual waveform. Figure 10 The horizontal axis represents the preset interval time (n), Figure 10 The vertical axis represents the amplitude.
[0132] Due to the high frequency of the waveform, Figure 10 When the time span becomes larger, it will show a black filling effect. Figure 10 The black part in the figure is a dense waveform, and when you pull it apart you can see the 500Hz waveform. Figure 11 and Figure 12 As shown, Figure 11 The waveform is displayed with a time span of 200 milliseconds. Figure 12 The waveform diagram has a time span of 10 milliseconds. Figure 11 and Figure 12 The horizontal axis represents the preset interval time (n), Figure 11 and Figure 12 The vertical axis represents the amplitude.
[0133] After filtering: By using the filtering method of this embodiment, the value of Δt is set to 0.0001, i.e. 0.1 milliseconds. A shorter preset time interval can achieve a better filtering effect. TRC takes the resistance (RES=1000) and the capacitance (CAP=10 -4 ), which is 0.1; let the output signal be Vo m , Figure 13 The filtering formula and output waveform are as follows:
[0134]
[0135] Figure 13 The horizontal axis represents the preset interval time (m). Figure 13 The vertical axis represents the amplitude.
[0136] Through the above Figure 9 and Figure 13 From the output waveform, we can see that the filtering method of this embodiment is essentially identical to the output of the hardware filtering circuit. In practice, they can be used as a complete substitute. When the controller has sufficient computing power resources, the filtering method of this embodiment can achieve a filtering effect close to that of the hardware filtering circuit.
[0137] Example 3
[0138] This embodiment provides an electronic device, Figure 14 The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the filtering method of Example 2 is implemented. Figure 14 The electronic device 30 shown is only an example and should not limit the functionality and scope of use of the embodiments of the present invention.
[0139] like Figure 14 As shown, the electronic device 30 may be a general-purpose computing device, such as a server device. Components of the electronic device 30 may include, but are not limited to, the at least one processor 31, the at least one memory 32, and a bus 33 connecting different system components (including the memory 32 and the processor 31).
[0140] The bus 33 includes a data bus, an address bus, and a control bus.
[0141] The memory 32 may include a volatile memory, such as a random access memory (RAM) 321 and / or a cache memory 322 , and may further include a read-only memory (ROM) 323 .
[0142] The memory 32 may also include a program / utility 325 having a set (at least one) of program modules 324, such program modules 324 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0143] The processor 31 executes various functional applications and data processing by running computer programs stored in the memory 32, such as the filtering method of embodiment 2 of the present invention.
[0144] The electronic device 30 may also communicate with one or more external devices 34 (e.g., a keyboard, a pointing device, etc.). Such communication may be performed via an input / output (I / O) interface 35. Furthermore, the model generating device 30 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 36. Figure 14 As shown, the network adapter 36 communicates with the other modules of the model-generated device 30 via the bus 33. It should be understood that, although not shown in the figures, other hardware and / or software modules may be used in conjunction with the model-generated device 30, including but not limited to microcode, device drivers, redundant processors, external disk drive arrays, RAID (RAID) systems, tape drives, and data backup storage systems.
[0145] It should be noted that although several units / modules or sub-units / modules of the electronic device are mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of the present invention, the features and functions of two or more units / modules described above may be embodied in a single unit / module. Conversely, the features and functions of a single unit / module described above may be further divided and embodied by multiple units / modules.
[0146] Example 4
[0147] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the filtering method of embodiment 2 is implemented.
[0148] The readable storage medium may include, but is not limited to, a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0149] In a possible implementation manner, the present invention may also be implemented in the form of a program product, which includes program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the filtering method of embodiment 2.
[0150] The program code for executing the present invention may be written in any combination of one or more programming languages, and may be executed entirely on the user device, partially on the user device, as a standalone software package, partially on the user device and partially on a remote device, or entirely on the remote device.
[0151] Although specific embodiments of the present invention have been described above, those skilled in the art will appreciate that these are merely illustrative and that the scope of the present invention is defined by the appended claims. Those skilled in the art may make various changes or modifications to these embodiments without departing from the principles and essence of the present invention, and such changes and modifications are intended to fall within the scope of the present invention.
Claims
1. A filtering device, characterized in that: The filtering device comprises: an acquisition circuit, configured to acquire a voltage input signal at a current moment and input the voltage input signal into a controller; The controller is configured to convert the voltage input signal into a voltage input data value, determine a voltage output data value at a current moment based on a preset time interval, a voltage output data value before the preset time interval, the voltage input data value, and a filter coefficient, and convert the voltage output data value into a voltage output signal for output; the filter coefficient determines a cutoff frequency of the voltage input signal; and the voltage output signal is a voltage signal after interference signals have been filtered out; The controller triggers the acquisition circuit to acquire the voltage input signal at the current moment according to a preset time interval.
2. The filtering device according to claim 1, wherein The controller includes: a filter, configured to determine a ratio of the first sum value to the second sum value as a voltage output data value at the current moment; The first sum value is the sum of the first product value and the second product value; the second sum value is the sum of the preset time interval and the filter coefficient; the first product value is the product value of the voltage input data value and the preset time interval; the second product value is the product value of the filter coefficient and the voltage output data value before the preset time interval.
3. The filtering device according to claim 1, wherein The filtering device further comprises: A display is used to display the voltage output signal after the interference signal is filtered out.
4. A filtering method, characterized in that: The filtering method comprises: Collecting a voltage input signal at a current moment and converting the voltage input signal into a voltage input data value; determining a voltage output data value at a current moment according to a preset time interval, a voltage output data value before the preset time interval, the voltage input data value, and a filter coefficient; the filter coefficient determines a cutoff frequency of the voltage input signal; Converting the voltage output data value at the current moment into a voltage output signal, and outputting the voltage output signal; the voltage output signal is a voltage signal after filtering out interference signals; The step of collecting the voltage input signal at the current moment includes: According to the preset time interval, the voltage input signal at the current moment is collected.
5. The filtering method according to claim 4, wherein: The step of determining the voltage output data value at the current moment according to the preset time interval, the voltage output data value before the preset time interval, the voltage input data value and the filter coefficient includes: Determine the ratio of the first sum value to the second sum value as the voltage output data value at the current moment; The first sum value is the sum of the first product value and the second product value; the second sum value is the sum of the preset time interval and the filter coefficient; the first product value is the product value of the voltage input data value and the preset time interval; the second product value is the product value of the filter coefficient and the voltage output data value before the preset time interval.
6. The filtering method according to claim 4, wherein: The filtering method further comprises: The voltage output signal is sent to a display to display the voltage output signal after the interference signal is filtered out.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the filtering method according to any one of claims 4 to 6 is implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the filtering method according to any one of claims 4 to 6 is implemented.
Citation Information
Patent Citations
Electrical equipment signal filtering method and system
CN104617914A
Electromagnetic switch high frequency signal data acquisition method
CN108614149A