Voltage ripple filtering method and electronic equipment
The voltage ripple filtering method, which involves individual judgment and secondary difference processing, solves the problem of inaccurate ripple values caused by filtering peaks and troughs in existing technologies, and achieves more accurate ripple value calculation and test results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU RAYER ACOUSTIC TECH CO LTD
- Filing Date
- 2024-11-07
- Publication Date
- 2026-05-08
AI Technical Summary
Existing voltage ripple filtering methods filter out some peaks and troughs during the process of removing interference values, resulting in inaccurate ripple value calculations. This may lead to defective products being judged as qualified, causing test abnormalities.
The voltage ripple is filtered by a step-by-step judgment method using the first and second modification strategies. The original voltage value is judged to determine whether it is an interference value, and the modification is made according to the changes of adjacent data to avoid filtering out peak or valley values. The second difference processing is combined to improve the judgment accuracy.
Ensure that the maximum and minimum values of the filtered voltage ripple are consistent with the actual values, improve the accuracy of ripple value calculation, avoid misjudgment, and improve the accuracy of testing.
Smart Images

Figure CN122001196A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the technical field of filtering, and particularly to a method for filtering voltage ripple and an electronic device. Background Art
[0002] Voltage fluctuations in a DC power supply will cause ripple. When the ripple is large, it will not only reduce the efficiency of the DC power supply, but in severe cases, it will also generate surge voltage or current, resulting in the burning of electrical equipment. Therefore, it is necessary to perform ripple tests on the voltage output by the product to determine whether the product meets the design specification requirements.
[0003] In existing ripple test schemes, generally, a microcontroller is used to sample voltage ripple data within a certain period of time in real time to obtain the ripple value. Due to the interference of the sampling circuit, wiring, and external environment, there will be some pulse interference in the sampled voltage ripple data. It is necessary to filter the voltage ripple data to eliminate the pulse interference, and finally calculate the ripple value, so as to determine whether the product is qualified according to the ripple value.
[0004] During the process of filtering the voltage ripple data, while filtering out the interference values, some wave peaks and wave valleys will also be filtered. Then, the maximum and minimum values of the ripple may change, resulting in inaccurate calculated ripple values. A defective product may be determined to be a qualified product, leading to abnormal testing. Summary of the Invention
[0005] Embodiments of the present invention provide a method for filtering voltage ripple and an electronic device to solve the problem that some wave peaks and wave valleys in the ripple are also filtered, resulting in inaccurate calculated ripple values, and a defective product may be determined to be a qualified product, leading to abnormal testing.
[0006] The objectives of the embodiments of the present invention are achieved through the following technical solutions:
[0007] To solve the above technical problem, in a first aspect, embodiments of the present invention provide a method for filtering voltage ripple, including:
[0008] Sampling the voltage ripple to obtain N original voltage values, and sequentially selecting an original voltage value a[i] from the N original voltage values, where i is a positive integer and 3 ≤ i ≤ N - 2;
[0009] Judging whether the original voltage value a[i] is an interference value;
[0010] If the original voltage value a[i] is an interference value, modifying the original voltage value a[i] according to a first modification strategy, and judging whether the original voltage value a[i + 1] is an interference value based on the modified original voltage value a[i];
[0011] If the original voltage value a[i+1] is also an interference value, then the original voltage value a[i] and the original voltage value a[i+1] are modified according to the second modification strategy to filter the voltage ripple.
[0012] In one embodiment, determining whether the original voltage value a[i] is an interference value includes:
[0013] Construct the target voltage value corresponding to the original voltage value a[i] based on the original voltage value a[i], the original voltage value a[i-1], and the original voltage value a[i-2];
[0014] If the target voltage value is greater than the reference value, then the original voltage value a[i] is an interference value;
[0015] If the target voltage value is less than or equal to the reference value, then the original voltage value a[i] is a normal value, and i = i + 1 is set to select the next original voltage value a[i] from the N original voltage values.
[0016] In one embodiment, constructing the target voltage value corresponding to the original voltage value a[i] based on the original voltage value a[i], the original voltage value a[i-1], and the original voltage value a[i-2] includes:
[0017] Obtain the first difference between the original voltage value a[i] and the original voltage value a[i-1], and take the absolute value of the first difference as the first intermediate voltage value;
[0018] Obtain the second difference between the original voltage value a[i-1] and the original voltage value a[i-2], and take the absolute value of the second difference as the second intermediate voltage value;
[0019] Obtain the third difference between the first intermediate voltage value and the second intermediate voltage value, and use the absolute value of the third difference as the target voltage value corresponding to the original voltage value a[i].
[0020] In one embodiment, if the original voltage value a[i] is an interference value, modifying the original voltage value a[i] according to the first modification strategy, and determining whether the original voltage value a[i+1] is an interference value based on the modified original voltage value a[i] includes:
[0021] If the original voltage value a[i] is an interference value, then obtain the average value of the original voltage value a[i-1] and the original voltage value a[i+1], and modify the original voltage value a[i] to the average value;
[0022] The target voltage value is recalculated based on the modified original voltage value a[i].
[0023] If the recalculated target voltage value is greater than the reference value, then the original voltage value a[i+1] is the interference value.
[0024] In one embodiment, if the original voltage value a[i+1] is also an interference value, then modifying the original voltage value a[i] and the original voltage value a[i+1] according to the second modification strategy includes:
[0025] If the original voltage value a[i+1] is also an interference value, then the change value is determined according to the preset ratio condition, the original voltage value a[i-1], the original voltage value a[i+2], and the reference value;
[0026] Compare the magnitude relationship between the original voltage value a[i-1] and the original voltage value a[i+2] to determine the data trend from the original voltage value a[i-1] to the original voltage value a[i+2].
[0027] Based on the data trend, the preset ratio condition, the change value, and the original voltage value a[i+2], the original voltage value a[i] and the original voltage value a[i+1] are modified to filter out interference, and the next original voltage value a[i] is selected from the N original voltage values.
[0028] In one embodiment, comparing the magnitude relationship between the original voltage value a[i-1] and the original voltage value a[i+2] to determine the data trend from the original voltage value a[i-1] to the original voltage value a[i+2] includes:
[0029] If the original voltage value a[i-1] is less than the original voltage value a[i+2], then the data trend from the original voltage value a[i-1] to the original voltage value a[i+2] is an upward trend;
[0030] If the original voltage value a[i-1] is greater than or equal to the original voltage value a[i+2], then the data trend from the original voltage value a[i-1] to the original voltage value a[i+2] is a downward trend.
[0031] In one embodiment, the preset ratio condition is b[i]:b[i+1]:b[i+2]=1:t:t+1, where t is greater than or equal to 2; b[i]=abs(a[i]-a[i-1]), b[i+1]=abs(a[i+1]-a[i]), b[i+2]=abs(a[i+2]-a[i+1]), where abs() represents the absolute value operation.
[0032] In one embodiment, the data trend from the original voltage value a[i-1] to the original voltage value a[i+2] is either an upward trend or a downward trend;
[0033] The step of modifying the original voltage value a[i] and the original voltage value a[i+1] according to the data trend, the preset ratio condition, the change value, and the original voltage value a[i+2] to filter out interference includes:
[0034] If the data trend is upward, then the modified original voltage value a[i+1] = a[i+2] - m × (t+1), and the modified original voltage value a[i] = a[i+2] - m × (2t+1);
[0035] If the data trend is downward, then the modified original voltage value a[i+1] = a[i+2] + m × (t+1), and the modified original voltage value a[i] = a[i+2] + m × (2t+1);
[0036] Where m is the change value.
[0037] In one embodiment, if the original voltage value a[i+1] is also an interference value, determining the change value based on a preset proportional condition, the original voltage value a[i-1], the original voltage value a[i+2], and the reference value includes:
[0038] If the original voltage value a[i+1] is also an interference value, obtain the fourth difference between the original voltage value a[i-1] and the original voltage value a[i+2], and divide the absolute value of the fourth difference by 2t+2 to obtain the intermediate value;
[0039] Divide the baseline value by 2t+2 to obtain the reference value;
[0040] If the intermediate value is greater than the reference value, then the reference value is used as the change value;
[0041] If the intermediate value is less than or equal to the reference value, then the intermediate value is used as the change value.
[0042] In one embodiment, the benchmark value is determined as follows:
[0043] The average value of the N original voltage values is obtained, and the average value is multiplied by a preset coefficient to obtain the reference value.
[0044] To address the aforementioned technical problems, in a second aspect, embodiments of the present invention provide an electronic device, comprising:
[0045] At least one processor; and,
[0046] A memory communicatively connected to the at least one processor; wherein,
[0047] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the voltage ripple filtering method described in the first aspect.
[0048] To address the aforementioned technical problems, in a third aspect, embodiments of the present invention provide a non-volatile computer storage medium storing computer-executable instructions, which are executed by one or more processors to perform the voltage ripple filtering method described in the first aspect.
[0049] Compared with existing technologies, the beneficial effects of this invention are as follows: In the filtering method provided by this invention, it is sequentially determined whether the original voltage value a[i] is an interference value. If it is an interference value, the original voltage value a[i] needs to be modified according to the first modification strategy. Based on the modified original voltage value a[i], it is further determined whether the original voltage value a[i+1] is an interference value. If it is an interference value, the original voltage value a[i] is modified again according to the second modification strategy, and the original voltage value a[i+1] is modified according to the second modification strategy to filter out interference. By adopting a step-by-step judgment method, peak or valley values are avoided from being filtered out, ensuring that the maximum and minimum values of the filtered voltage ripple are consistent with the maximum and minimum values of the actual voltage ripple, improving the accuracy of ripple value calculation, avoiding misjudgment, and improving the accuracy of testing.
[0050] Furthermore, a quadratic interpolation method is used to obtain the changes between adjacent data. These changes can reflect whether there are interfering values in the adjacent data, thus improving the accuracy and efficiency of the judgment. Attached Figure Description
[0051] One or more embodiments are illustrated by way of example with reference to the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements / modules and steps with the same reference numerals in the drawings are represented as similar elements / modules and steps. Unless otherwise stated, the figures in the drawings do not constitute a limitation on scale.
[0052] Figure 1 This is a schematic diagram of a harmonic voltage ripple provided in an embodiment of the present invention;
[0053] Figure 2 This is a schematic diagram of a pulse wave type voltage ripple provided in an embodiment of the present invention;
[0054] Figure 3 This is a schematic diagram of voltage ripple with pulse interference provided in an embodiment of the present invention;
[0055] Figure 4 This is another schematic diagram of voltage ripple with pulse interference provided in an embodiment of the present invention;
[0056] Figure 5 This is a schematic diagram comparing voltage ripple before and after filtering provided by an embodiment of the present invention (the curve corresponding to the original data is the voltage ripple before filtering, and the curve corresponding to the old filtering algorithm is the voltage ripple after filtering).
[0057] Figure 6 This is another schematic diagram comparing voltage ripple before and after filtering provided by an embodiment of the present invention (the curve corresponding to the original data is the voltage ripple before filtering, and the curve corresponding to the old filtering algorithm is the voltage ripple after filtering).
[0058] Figure 7 This is a partial comparison diagram of voltage ripple before and after filtering provided by an embodiment of the present invention (the curve corresponding to the original data is the voltage ripple before filtering, and the curve corresponding to the old filtering algorithm is the voltage ripple after filtering).
[0059] Figure 8 This is a partial comparison diagram of voltage ripple before and after filtering provided by another embodiment of the present invention (the curve corresponding to the original data is the voltage ripple before filtering, and the curve corresponding to the old filtering algorithm is the voltage ripple after filtering).
[0060] Figure 9 This is a schematic flowchart of a voltage ripple filtering method provided in an embodiment of the present invention;
[0061] Figure 10 This is provided by the embodiments of the present invention. Figure 9 A detailed flowchart of step 102 is shown below;
[0062] Figure 11 This is a data schematic diagram of a secondary subtraction process provided in an embodiment of the present invention;
[0063] Figure 12 This is provided by the embodiments of the present invention. Figure 9 A detailed flowchart of step 104 is shown below;
[0064] Figure 13 This is another partial comparison diagram of voltage ripple before and after filtering provided by an embodiment of the present invention (the curve corresponding to the original data is the voltage ripple before filtering, and the curve corresponding to the new filtering algorithm is the voltage ripple after filtering).
[0065] Figure 14This is a partial comparison diagram of voltage ripple before and after filtering provided in another embodiment of the present invention (the curve corresponding to the original data is the voltage ripple before filtering, and the curve corresponding to the new filtering algorithm is the voltage ripple after filtering).
[0066] Figure 15 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0067] The present invention will now be described in detail with reference to specific embodiments. These embodiments will help those skilled in the art to further understand the present invention, but do not limit the invention in any way. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention. These all fall within the scope of protection of the present invention.
[0068] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0069] It should be noted that, unless otherwise specified, the various features in the embodiments of the present invention can be combined with each other, and all are within the protection scope of the present invention. Furthermore, although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed differently from the module division in the device or the order shown in the flowchart.
[0070] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of the invention described below can be combined with each other as long as they do not conflict with each other.
[0071] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, features defined as "first" or "second" may explicitly or implicitly include one or more features. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0072] Ripple is mainly caused by voltage fluctuations in the DC power supply. The rapid switching of the switching transistor results in high-frequency pulsating components in the output voltage or current. Due to incomplete filtering, residual AC components remain, inevitably introducing some AC component into the DC stability. This AC component superimposed on the DC stability is called ripple. Ripple is mainly divided into two categories: such as... Figure 1 Ripple is generally a harmonic wave with a frequency higher than the power frequency, similar to a sine wave; such as Figure 2 Ripple can also be a pulse wave with a very narrow width.
[0073] When performing ripple testing, voltage ripple data is usually obtained by sampling. Due to interference from the sampling circuit, wiring, and external environment, the sampled voltage ripple data may contain some pulse interference. Therefore, the voltage ripple data needs to be filtered to remove the pulse interference.
[0074] Common voltage filtering algorithms include moving average filtering, median filtering, and amplitude limiting filtering. These algorithms can filter out interference caused by external disturbances. However, while filtering out interference, these algorithms (such as median filtering) may also filter out the peaks and troughs of each waveform. Since the ripple value is calculated by subtracting the minimum value from the maximum value, the calculated ripple value after filtering will be smaller than the actual value. For applications requiring high measurement accuracy, current filtering algorithms are not suitable.
[0075] Taking a certain power supply board as an example, the power supply board needs to be tested to see if the ripple values of harmonics and pulse waves meet the requirements. Figure 3 The ripple curve represents harmonic types, with the circled portion representing pulse interference. Figure 4 This is a ripple curve for pulse wave type; the circled area represents pulse interference. Figure 3 In the middle, the maximum value of the harmonic type ripple curve is 1465mV, the minimum value is 907mV, and the measured ripple value is 558mV; in Figure 4 In the pulse wave type, the maximum value of the ripple curve is 1545mV, the minimum value is 1169mV, and the measured ripple value is 376mV.
[0076] Figure 3 and Figure 4 After the ripple curves are processed by the old filtering algorithm, the following results are obtained: Figure 5 The harmonic type of filtered data curve shown, and as... Figure 6 The filtered data curve for the pulse wave type is shown. Figure 5 In the data curve, the maximum value of the filtered data is 1307mV, the minimum value is 1126mV, and the ripple value is 181mV; Figure 6 In the data, the maximum value of the filtered data curve is 1436mV, the minimum value is 1174mV, and the ripple value is 262mV. However, in Figure 5 and Figure 6 In the middle, some peaks and troughs are filtered out, for example, Figure 5 The valleys corresponding to sampling points such as 6 and 32 on the horizontal axis were filtered out. Figure 5 The peaks corresponding to sampling points such as 43 and 76 on the horizontal axis were filtered out, causing changes in the maximum and minimum values. The calculated ripple value was less than the actual ripple value, which may lead to defective products being judged as qualified products.
[0077] To illustrate this issue more clearly, we will extract... Figure 5 Displaying some curves in the image (i.e.) Figure 7 As can be seen, some peaks and troughs were filtered out; truncating... Figure 6 Displaying some curves in the image (i.e.) Figure 8 As can be seen, some peaks and troughs were filtered out. Figure 5 In the example, the filtered ripple value corresponding to this local ripple curve is 109mV; however, the actual ripple value should be 111mV. Figure 6 In the example, the filtered ripple value corresponding to the local ripple curve is 250mV, while the actual ripple value should be 323mV. Because some peaks and troughs are filtered out during the filtering process, the maximum and minimum values change, resulting in a calculated ripple value that is less than the actual ripple value. Assuming the power board requires a ripple value no greater than 300mV for the pulse wave type, since the filtered ripple value of 250mV is less than 300mV, the test result indicates the power board is a qualified product. However, the actual ripple value of 323mV is greater than 300mV, making the power board a defective product. Therefore, using the current filtering method will classify a defective product as a qualified one, leading to test anomalies.
[0078] Because voltage ripple pulse interference exhibits periodicity, the voltage ripple data collected in one sampling period typically contains only one or two consecutive interference values. This embodiment provides a novel filtering method to address this characteristic. It sequentially determines whether the original voltage value a[i] is an interference value. If it is, the original voltage value a[i] needs to be modified according to the first modification strategy. Based on the modified original voltage value a[i], it further determines whether the original voltage value a[i+1] is an interference value. If it is, the original voltage value a[i] is modified again according to the second modification strategy, and then the original voltage value a[i+1] is modified according to the second modification strategy to filter out the interference. By using a sequential judgment method, peak or valley values are avoided from being filtered out, making the filtered voltage ripple closer to the actual voltage ripple, improving the accuracy of ripple value calculation, and thus improving the accuracy of product judgment, preventing defective products from being judged as qualified products.
[0079] Furthermore, a quadratic interpolation method is used to obtain the changes between adjacent data. These changes can reflect whether there are interfering values in the adjacent data, thus improving the accuracy and efficiency of the judgment.
[0080] The voltage ripple filtering method provided in this embodiment is described below with reference to the accompanying drawings.
[0081] Example 1:
[0082] See Figure 9 This embodiment provides a voltage ripple filtering method, including:
[0083] Step 101: Sample the voltage ripple to obtain N raw voltage values, and select one raw voltage value a[i] from the N raw voltage values in sequence.
[0084] In one embodiment, a microcontroller-based sampling circuit can be used to continuously sample the voltage ripple to obtain N raw voltage values, where each sampling point corresponds to one raw voltage value. The value of N is related to the required test accuracy and test time: when higher test accuracy is required, N is larger, and vice versa. When short test time is required, N is smaller, and vice versa.
[0085] In one embodiment, the microcontroller can be a GD32E230C8T6, with a sampling parameter of a voltage reference of 2.495V, a sampling precision of 12 bits, a sampling data range of 0-4095, and the number of sampling points N being 500. In other embodiments, other methods can be used to sample the voltage ripple, depending on the actual situation, and are not specifically limited here.
[0086] In one embodiment, i is a positive integer, and 3 ≤ i ≤ N-2. The reason for satisfying this condition is that when the filtering method determines whether a certain original voltage value a[i] is an interference value, it needs to combine the two original voltage values preceding the original voltage value a[i] (i.e., the original voltage values a[i-1] and a[i-2]) to determine whether the original voltage value a[i] is an interference value. Therefore, i needs to be greater than or equal to 3. If the original voltage value a[i] is an interference value and the original voltage value a[i+1] following the original voltage value a[i] is also an interference value, then it is necessary to combine the original voltage values a[i-1] and a[i+2] to determine how much the original voltage values a[i] and a[i+1] can be modified to in order to filter out the interference value. Therefore, i needs to be less than or equal to N-2.
[0087] Step 102: Determine whether the original voltage value a[i] is an interference value.
[0088] In this embodiment, an original voltage value a[i] is selected sequentially from the N original voltage values. It is then determined whether the original voltage value a[i] is an interference value. If the original voltage value a[i] is an interference value, step 103 is executed to modify the original voltage value a[i] to filter out interference values. If the original voltage value a[i] is a normal value, i = i + 1 is set to select the next original voltage value a[i] from the N original voltage values.
[0089] Step 103: If the original voltage value a[i] is an interference value, modify the original voltage value a[i] according to the first modification strategy, and determine whether the original voltage value a[i+1] is an interference value based on the modified original voltage value a[i].
[0090] The first modification strategy can be to modify the original voltage value a[i] to the average of the two original voltage values before and after it (i.e., the original voltage value a[i-1] and the original voltage value a[i+1]). When modifying the original voltage value a[i] in this way, the magnitude of the original voltage value a[i+1] will affect the magnitude of the modified original voltage value a[i]. If the modified original voltage value a[i] is still judged as an interference value, then the original voltage value a[i+1] is too large (or too small), and the original voltage value a[i+1] is also an interference value. In this way, two consecutive interference values can be identified. After modifying the original voltage value a[i+1] according to step 104, i can be set to i+1, and the modified original voltage value a[i+1] can be used as the original voltage value a[i] to be judged to improve accuracy. Since the modified original voltage value a[i+1] is already a normal value, we can also set i = i+2 to skip the judgment of the modified original voltage value a[i+1], thus improving efficiency. In actual scenarios, the choice can be made according to the actual situation, and no specific restrictions are made here.
[0091] Another possible modification strategy is to directly change the interference value to the average of N original voltage values, or to directly delete the interference value. These strategies are feasible, although the filtered voltage ripple waveform may not closely resemble the actual voltage ripple waveform, but this does not affect the accuracy of the ripple value. In practical scenarios, the appropriate strategy can be chosen based on the specific circumstances; no specific limitations are imposed here.
[0092] Step 104: If the original voltage value a[i+1] is also an interference value, then modify the original voltage value a[i] and the original voltage value a[i+1] according to the second modification strategy to filter the voltage ripple.
[0093] The second modification strategy can take into account factors such as the original voltage value a[i+2], the data trend from the original voltage value a[i-1] to the original voltage value a[i+2], and preset ratio conditions, and set a certain calculation method to modify the original voltage value a[i] and the original voltage value a[i+1] so that the filtered voltage ripple is closer to the actual voltage ripple.
[0094] In other embodiments, the original voltage values a[i] and a[i+1] can be directly modified to the average of N original voltage values or other values. Alternatively, the original voltage values a[i] and a[i+1] can be directly deleted. These modification strategies are also feasible, although the filtered voltage ripple waveform may not be very close to the actual voltage ripple waveform, but this does not affect the accuracy of the ripple value. In practical scenarios, the choice can be made according to the actual situation, and no specific limitation is made here.
[0095] In this embodiment, the original voltage value a[i] is sequentially determined to be an interference value. If it is an interference value, the original voltage value a[i] needs to be modified according to the first modification strategy. Then, based on the modified original voltage value a[i], the original voltage value a[i+1] is further determined to be an interference value. If it is an interference value, the original voltage value a[i] is modified again according to the second modification strategy, and then the original voltage value a[i+1] is modified according to the second modification strategy to filter out interference. By using a sequential determination method, peak or valley values are avoided from being filtered out, making the filtered voltage ripple closer to the actual voltage ripple, improving the accuracy of ripple value calculation, avoiding misjudgments, and improving the accuracy of testing.
[0096] In one embodiment, a quadratic difference method can be used to determine whether a given original voltage value a[i] is an interference value. The quadratic difference method involves two difference calculations: the first to obtain the data variation, and the second to obtain the variation of the difference itself. The specific implementation principle is as follows: Theoretically, a ripple curve without pulse interference is a regular, smooth curve (sine or pulse curve), and the voltage value corresponding to the sampling point generally falls on this curve. The voltage value variation between adjacent sampling points is smooth. Based on the characteristics of sine and pulse curves, if only one difference calculation (i.e., obtaining the data variation) is performed, the difference calculated using the maximum or minimum value of each cycle will be significantly higher than other differences, thus being treated as interference and causing misjudgment. Therefore, a quadratic difference calculation (i.e., obtaining the variation of the difference) is needed based on the first difference calculation, which removes the influence caused by the maximum or minimum value of each cycle participating in the difference calculation.
[0097] In one implementation, step 102 specifically includes:
[0098] Step 201: Construct the target voltage value corresponding to the original voltage value a[i] based on the original voltage value a[i], the original voltage value a[i-1], and the original voltage value a[i-2].
[0099] In one embodiment, a second subtraction process is used to determine the target voltage value corresponding to a certain original voltage value a[i], and the original voltage value a[i] is determined to be an interference value based on the target voltage value.
[0100] The process of performing the second subtraction is as follows: b[i] = abs(a[i] - a[i-1]), b[i-1] = abs(a[i-1] - a[i-2]), c[i] = abs(b[i] - b[i-1]), where abs() represents the absolute value operation. The c[i] obtained from the above calculation is the target voltage value.
[0101] In one embodiment, a first difference between the original voltage value a[i] and the original voltage value a[i-1] is obtained, and the absolute value of the first difference is taken as a first intermediate voltage value (i.e., b[i]). A second difference between the original voltage value a[i-1] and the original voltage value a[i-2] is obtained, and the absolute value of the second difference is taken as a second intermediate voltage value (i.e., b[i-1]). A third difference between the first intermediate voltage value and the second intermediate voltage value is obtained, and the absolute value of the third difference is taken as the target voltage value (i.e., c[i]) corresponding to the original voltage value a[i].
[0102] Step 202: If the target voltage value is greater than the reference value, then the original voltage value a[i] is an interference value.
[0103] In one embodiment, the benchmark value may be determined according to the actual situation, and no specific limitation is made here.
[0104] In one embodiment, the reference value is determined by: obtaining the average value of the N original voltage values, multiplying the average value by a preset coefficient to obtain the reference value, wherein the preset coefficient ranges from 0.03 to 0.05. For example, the preset coefficient can be 0.05, 0.03, or 0.04. A smaller preset coefficient results in higher accuracy, and a larger preset coefficient results in lower accuracy. In practical use, a preset coefficient matching the actual accuracy requirements can be selected. Of course, due to differences in product design, interference environment, interference factors, sampling frequency, and / or accuracy requirements, the preset coefficient may vary. For example, the sampling frequency is related to the preset coefficient; a higher sampling frequency requires a lower preset coefficient. The range of the preset coefficient can also be other ranges, which need to be determined through multiple experiments based on the actual situation. For example, the preset coefficient can be less than 0.03 or greater than 0.05.
[0105] Step 203: If the target voltage value is less than or equal to the reference value, then the original voltage value a[i] is a normal value, and i = i + 1 is set to select the next original voltage value a[i] from the N original voltage values.
[0106] If the target voltage value is less than or equal to the reference value, it means that the original voltage value a[i] is close to the two preceding original voltage values (i.e., original voltage value a[i-1], original voltage value a[i-2]) and there is no sudden change. Therefore, the original voltage value a[i] is a normal value and not an interference value. Then, set i = i+1 and return to step 101 to select the original voltage value a[i] from the N original voltage values in sequence.
[0107] In one embodiment, such as Figure 11 As shown, initialize i=3, take the original voltage value a[3] from N original voltage values, then b[3]=abs(a[3]-a[2]), b[2]=abs(a[2]-a[1]), c[3]=abs(b[3]-b[2]). If the target voltage value c[3] is less than or equal to the reference value, then the original voltage value a[3] is normal. Set i = 3 + 1 = 4, and take the original voltage value a[4] from the N original voltage values. Then b[4] = abs(a[4] - a[3]), b[3] = abs(a[3] - a[2]), c[4] = abs(b[4] - b[3]). If c[4] is less than or equal to the reference value, then the original voltage value a[4] is normal. Set i = 4 + 1 = 5, and take the original voltage value a[5] from the N original voltage values. And so on, and judge each original voltage value a[i].
[0108] In one embodiment, in step 103, the implementation of the first modification strategy specifically includes: if the original voltage value a[i] is an interference value, then the average value of the original voltage value a[i-1] and the original voltage value a[i+1] is obtained, and the original voltage value a[i] is modified to the average value, that is, a[i] = (a[i+1] + a[i-1]) / 2; the target voltage value is recalculated based on the modified original voltage value a[i]; if the recalculated target voltage value is greater than the reference value, then the original voltage value a[i+1] is an interference value. If the recalculated target voltage value is less than or equal to the reference value, then the original voltage values a[i] and a[i+1] are not interference values. The original voltage value a[i] is modified according to the first modification strategy.
[0109] In one embodiment, i is initialized to 3, and the target voltage value c[3] corresponding to the original voltage value a[3] is calculated in the aforementioned manner. If the target voltage value c[3] is greater than the reference value, then the original voltage value a[3] is an interference value, and the original voltage value a[3] is modified. The target voltage value c[3] is recalculated using the modified original voltage value a[3]. If the target voltage value c[3] is greater than the reference value, then the original voltage value a[4] is also an interference value. In this case, the original voltage value a[3] and the original voltage value a[4] need to be modified using the second modification strategy. If the target voltage value c[3] is less than or equal to the reference value, then the original voltage value a[4] is not an interference value, and the original voltage value a[4] does not need to be modified. The original voltage value a[3] can be modified according to the first modification strategy.
[0110] In one embodiment, if two interfering values with particularly large deviations appear, the average value cannot be used to modify the interfering value; otherwise, the modified value may still be an interfering value. Therefore, when two consecutive interfering values appear, the interfering value needs to be modified according to the second modification strategy. Figure 12 In step 104, the specific implementation of the second modification strategy includes:
[0111] Step 301: If the original voltage value a[i+1] is also an interference value, then the change value is determined according to the preset ratio condition, the original voltage value a[i-1], the original voltage value a[i+2], and the reference value.
[0112] In one embodiment, the preset ratio condition is b[i]:b[i+1]:b[i+2] = 1:t:t+1, where t is greater than or equal to 2; where b[i] is equal to the absolute value of a[i]-a[i-1], b[i+1] is equal to the absolute value of a[i+1]-a[i], and b[i+2] is equal to the absolute value of a[i+2]-a[i+1]. That is, b[i] = abs(a[i]-a[i-1]), b[i+1] = abs(a[i+1]-a[i]), b[i+2] = abs(a[i+2]-a[i+1]), where abs() represents the absolute value operation.
[0113] In one embodiment, t can be equal to a value such as 2, 3, 4, or 5. That is, the preset ratio condition can be 1:2:3, 1:3:4, 1:4:5, 1:5:6, etc. The specific ratio can be determined according to the actual situation and is not specifically limited here.
[0114] Step 302: Compare the magnitude relationship between the original voltage value a[i-1] and the original voltage value a[i+2] to determine the data trend from the original voltage value a[i-1] to the original voltage value a[i+2].
[0115] In one embodiment, the data trend from the original voltage value a[i-1] to the original voltage value a[i+2] will affect the subsequent second modification strategy, so the data trend needs to be confirmed first.
[0116] In one embodiment, if the original voltage value a[i-1] is less than the original voltage value a[i+2], then the data trend from the original voltage value a[i-1] to the original voltage value a[i+2] is an upward trend; if the original voltage value a[i-1] is greater than or equal to the original voltage value a[i+2], then the data trend from the original voltage value a[i-1] to the original voltage value a[i+2] is a downward trend.
[0117] The upward trend in the data from the original voltage value a[i-1] to the original voltage value a[i+2] refers to: a[i-1] <a[i]<a[i+1]<a[i+2]。
[0118] The data trend from the original voltage value a[i-1] to the original voltage value a[i+2] is a downward trend, which means that a[i-1]≥a[i]≥a[i+1]≥a[i+2].
[0119] Step 303: Modify the original voltage value a[i] and the original voltage value a[i+1] according to the data trend, the preset ratio condition, the change value and the original voltage value a[i+2] to filter out interference, and set i = i+1 to select the next original voltage value a[i] from the N original voltage values.
[0120] In this embodiment, when modifying the original voltage value a[i] and the original voltage value a[i+1] according to this modification strategy, it is necessary to satisfy 3≤i≤N-2. The reason for satisfying this condition is that if the original voltage value a[i] is an interference value and the original voltage value a[i+1] located after the original voltage value a[i] is also an interference value, then it is necessary to combine the original voltage value a[i-1] and the original voltage value a[i+2] to determine how much the original voltage value a[i] and the original voltage value a[i+1] can be modified to in order to filter out the interference value. Therefore, i needs to be less than or equal to N-2.
[0121] In one embodiment, the data trend from the original voltage value a[i-1] to the original voltage value a[i+2] is either an upward trend or a downward trend, and the calculation method will also differ when the data trend is different.
[0122] If the data trend is upward, then the modified original voltage value a[i+1] = a[i+2] - m × (t+1), and the modified original voltage value a[i] = a[i+2] - m × (2t+1); if the data trend is downward, then the modified original voltage value a[i+1] = a[i+2] + m × (t+1), and the modified original voltage value a[i] = a[i+2] + m × (2t+1); where m is the change value.
[0123] By modifying the original voltage value a[i] in the aforementioned manner, it can be ensured that the target voltage value c[i] calculated and processed will not exceed the reference value, and interference can be effectively filtered out.
[0124] In one embodiment, the change value can be determined as follows, specifically in step 301: if the original voltage value a[i+1] is also an interference value, obtain a fourth difference between the original voltage value a[i-1] and the original voltage value a[i+2], divide the absolute value of the fourth difference by 2t+2 to obtain an intermediate value; divide the reference value by 2t+2 to obtain a reference value; if the intermediate value is greater than the reference value, then the reference value is used as the change value; if the intermediate value is less than or equal to the reference value, then the intermediate value is used as the change value.
[0125] In this embodiment, when calculating the change value, the intermediate value and the reference value are first calculated according to the preset ratio condition 1:t:(t+1).
[0126] Where, the intermediate value = (abs(a[i+2]-a[i-1])) / (2t+2); the reference value = the baseline value / (2t+2).
[0127] If the median value is greater than the reference value, it means that the median value is too large, and the reference value will be used as the change value.
[0128] If the median value is less than or equal to the reference value, it means that the median value is within a reasonable range, and the median value is taken as the change value.
[0129] In this embodiment, the filtering method can accurately identify the interference value without filtering out the peaks and troughs of the voltage ripple, thus making the calculated ripple value more accurate. The filtering method is simple and can be quickly calculated using a microcontroller.
[0130] The following is a brief explanation of the design origin of the preset ratio condition 1: t: (t+1).
[0131] To make the filtered waveform smoother, the following conditions must be met: c[i+1] = abs(b[i+1] - b[i]) = k; c[i+2] = abs(b[i+2] - b[i+1]) = k.
[0132] Assuming the data trend is upward, then we need to satisfy b[i] = a[i] - a[i-1] = k; b[i+1] = a[i+1] - a[i] = 2k; b[i+2] = a[i+2] - a[i+1] = 3k. That is, the preset ratio condition 1:t:(t+1) equals 1:2:3.
[0133] In practical applications, the main purpose of filtering is to remove interference values. It is acceptable for the filtered waveform to be less smooth, as long as the target voltage value corresponding to the modified original voltage value is less than the reference value. Therefore, in actual filtering methods, the preset ratio condition does not necessarily have to be 1:2:3, as long as it meets the condition of 1:t:(t+1).
[0134] In practical applications, after filtering the voltage ripple using the aforementioned filtering method, the filtered voltage ripple can be obtained. The maximum and minimum values of the filtered voltage ripple can be obtained to get the voltage ripple value. Based on the ripple value and the ripple requirements of the power board, it can be determined whether the product is a qualified product or a defective product.
[0135] Figure 13 and Figure 14 This demonstrates the filtering effect of the filtering method provided in this embodiment.
[0136] exist Figure 13In the process, for harmonic ripple curves, only the interference values are filtered out, without filtering out the peaks and troughs. This does not affect the maximum and minimum values of the actual ripple curve, ensuring the accuracy of ripple value calculation. This can improve the accuracy of product judgment and avoid misclassifying defective products as qualified products.
[0137] exist Figure 14 In the process, for ripple curves of pulse wave type, only the interference value is filtered out, but the peaks and troughs are not filtered out. This will not affect the maximum and minimum values of the actual ripple curve, ensuring the accuracy of ripple value calculation. This can improve the accuracy of product judgment and avoid classifying defective products as qualified products.
[0138] Example 2:
[0139] Based on the aforementioned embodiment 1, such as Figure 15 As shown, this embodiment also provides an electronic device, including: at least one processor 21; and a memory 22 communicatively connected to the at least one processor 21; wherein the memory 22 stores instructions executable by the at least one processor 21, the instructions being executed by the at least one processor 21 to enable the at least one processor 21 to execute the voltage ripple filtering method described in the foregoing embodiment, the voltage ripple filtering method including: sampling the voltage ripple to obtain N raw voltage values, and sequentially selecting one from the N raw voltage values. Let there be an initial voltage value a[i], where i is a positive integer and 3≤i≤N; determine whether the initial voltage value a[i] is an interference value; if the initial voltage value a[i] is an interference value, modify the initial voltage value a[i] according to the first modification strategy, and determine whether the initial voltage value a[i+1] is an interference value based on the modified initial voltage value a[i]; if the initial voltage value a[i+1] is also an interference value, modify the initial voltage value a[i] and the initial voltage value a[i+1] according to the second modification strategy to filter the voltage ripple.
[0140] In one embodiment, determining whether the original voltage value a[i] is an interference value includes: constructing a target voltage value corresponding to the original voltage value a[i] based on the original voltage value a[i], the original voltage value a[i-1], and the original voltage value a[i-2]; if the target voltage value is greater than a reference value, then the original voltage value a[i] is an interference value; if the target voltage value is less than or equal to the reference value, then the original voltage value a[i] is a normal value, and setting i = i+1 to select the next original voltage value a[i] from the N original voltage values.
[0141] For the specific implementation process of the voltage ripple filtering method, please refer to the aforementioned embodiments, which will not be repeated here.
[0142] The processor 21 and the memory 22 can be connected via a bus or other means. Figure 15 Taking the example of a connection between China and Israel via a bus.
[0143] The memory 22, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions / modules corresponding to the voltage ripple filtering method in the embodiments of the present invention. The processor 21 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions, and modules stored in the memory 22, thereby implementing the voltage ripple filtering method in the above-described method embodiments.
[0144] The memory 22 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the electronic device. Furthermore, the memory 22 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 22 may optionally include memory remotely located relative to the processor 21, and these remote memories may be connected to the electronic device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0145] The one or more modules are stored in the memory 22. When executed by the one or more processors 21, they perform the voltage ripple filtering method in any of the above method embodiments, for example, the method steps of the voltage ripple filtering method described above.
[0146] The above-described product can execute the method provided in the embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in the method provided in the embodiments of the present invention.
[0147] This invention also provides a non-volatile computer-readable storage medium storing computer-executable instructions that are executed by one or more processors, for example, performing the method steps of the voltage ripple filtering method described above.
[0148] This invention also provides a computer program product, including a computing program stored on a non-volatile computer-readable storage medium. The computer program includes program instructions that, when executed by a computer, cause the computer to perform the voltage ripple filtering method in any of the above method embodiments, for example, to perform the method steps of the voltage ripple filtering method described above.
[0149] It should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0150] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software and a general-purpose hardware platform, or of course, using hardware. Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0151] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; under the concept of the present invention, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of the present invention as described above. For the sake of brevity, they are not provided in detail; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for filtering voltage ripple, characterized in that, include: The voltage ripple is sampled to obtain N raw voltage values. Then, a raw voltage value a[i] is selected from the N raw voltage values in sequence, where i is a positive integer and 3≤i≤N-2. Determine whether the original voltage value a[i] is an interference value; If the original voltage value a[i] is an interference value, the original voltage value a[i] is modified according to the first modification strategy, and the original voltage value a[i+1] is determined to be an interference value based on the modified original voltage value a[i]. If the original voltage value a[i+1] is also an interference value, then the original voltage value a[i] and the original voltage value a[i+1] are modified according to the second modification strategy to filter the voltage ripple.
2. The voltage ripple filtering method according to claim 1, characterized in that, The determination of whether the original voltage value a[i] is an interference value includes: Construct the target voltage value corresponding to the original voltage value a[i] based on the original voltage value a[i], the original voltage value a[i-1], and the original voltage value a[i-2]; If the target voltage value is greater than the reference value, then the original voltage value a[i] is an interference value; If the target voltage value is less than or equal to the reference value, then the original voltage value a[i] is a normal value, and i = i + 1 is set to select the next original voltage value a[i] from the N original voltage values.
3. The voltage ripple filtering method according to claim 2, characterized in that, The process of constructing the target voltage value corresponding to the original voltage value a[i] based on the original voltage value a[i], the original voltage value a[i-1], and the original voltage value a[i-2] includes: Obtain the first difference between the original voltage value a[i] and the original voltage value a[i-1], and take the absolute value of the first difference as the first intermediate voltage value; Obtain the second difference between the original voltage value a[i-1] and the original voltage value a[i-2], and take the absolute value of the second difference as the second intermediate voltage value; Obtain the third difference between the first intermediate voltage value and the second intermediate voltage value, and use the absolute value of the third difference as the target voltage value corresponding to the original voltage value a[i].
4. The voltage ripple filtering method according to claim 1, characterized in that, If the original voltage value a[i] is an interference value, the original voltage value a[i] is modified according to the first modification strategy. Determining whether the original voltage value a[i+1] is an interference value based on the modified original voltage value a[i] includes: If the original voltage value a[i] is an interference value, then obtain the average value of the original voltage value a[i-1] and the original voltage value a[i+1], and modify the original voltage value a[i] to the average value; The target voltage value is recalculated based on the modified original voltage value a[i]. If the recalculated target voltage value is greater than the reference value, then the original voltage value a[i+1] is the interference value.
5. The voltage ripple filtering method according to claim 1, characterized in that, If the original voltage value a[i+1] is also an interference value, then modifying the original voltage value a[i] and the original voltage value a[i+1] according to the second modification strategy includes: If the original voltage value a[i+1] is also an interference value, then the change value is determined according to the preset ratio condition, the original voltage value a[i-1], the original voltage value a[i+2], and the reference value; Compare the magnitude relationship between the original voltage value a[i-1] and the original voltage value a[i+2] to determine the data trend from the original voltage value a[i-1] to the original voltage value a[i+2]. Based on the data trend, the preset ratio condition, the change value, and the original voltage value a[i+2], the original voltage value a[i] and the original voltage value a[i+1] are modified to filter out interference, and the next original voltage value a[i] is selected from the N original voltage values.
6. The voltage ripple filtering method according to claim 5, characterized in that, The comparison between the original voltage value a[i-1] and the original voltage value a[i+2] to determine the data trend from the original voltage value a[i-1] to the original voltage value a[i+2] includes: If the original voltage value a[i-1] is less than the original voltage value a[i+2], then the data trend from the original voltage value a[i-1] to the original voltage value a[i+2] is an upward trend; If the original voltage value a[i-1] is greater than or equal to the original voltage value a[i+2], then the data trend from the original voltage value a[i-1] to the original voltage value a[i+2] is a downward trend.
7. The voltage ripple filtering method according to claim 5, characterized in that, The preset ratio condition is b[i]:b[i+1]:b[i+2]=1: t: t+1, where t is greater than or equal to 2, b[i] = abs(a[i]-a[i-1]), b[i+1] = abs(a[i+1]-a[i]), b[i+2] = abs(a[i+2]-a[i+1]), where abs() represents the absolute value operation.
8. The voltage ripple filtering method according to claim 7, characterized in that, The data trend from the original voltage value a[i-1] to the original voltage value a[i+2] is either an upward trend or a downward trend; The step of modifying the original voltage value a[i] and the original voltage value a[i+1] according to the data trend, the preset ratio condition, the change value, and the original voltage value a[i+2] to filter out interference includes: If the data trend is upward, then the modified original voltage value a[i+1] = a[i+2] - m × (t+1), and the modified original voltage value a[i] = a[i+2] - m × (2t+1); If the data trend is downward, then the modified original voltage value a[i+1] = a[i+2] + m × (t+1), and the modified original voltage value a[i] = a[i+2] + m × (2t+1); Where m is the change value.
9. The voltage ripple filtering method according to claim 7, characterized in that, If the original voltage value a[i+1] is also an interference value, then determining the change value based on the preset proportional condition, the original voltage value a[i-1], the original voltage value a[i+2], and the reference value includes: If the original voltage value a[i+1] is also an interference value, obtain the fourth difference between the original voltage value a[i-1] and the original voltage value a[i+2], and divide the absolute value of the fourth difference by 2t+2 to obtain the intermediate value; Divide the baseline value by 2t+2 to obtain the reference value; If the intermediate value is greater than the reference value, then the reference value is used as the change value; If the intermediate value is less than or equal to the reference value, then the intermediate value is used as the change value.
10. The voltage ripple filtering method according to any one of claims 1 to 9, characterized in that, The benchmark value is determined as follows: The average value of the N original voltage values is obtained, and the average value is multiplied by a preset coefficient to obtain the reference value.
11. An electronic device, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the voltage ripple filtering method as described in any one of claims 1 to 10.