A method, apparatus and test bench for digital filtering

CN115765684BActive Publication Date: 2026-10-13XIAMEN TUNGSTEN CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211412627.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-11
Publication Date
2026-10-13
Estimated Expiration
2042-11-11

AI Technical Summary

Technical Problem

现有技术可以利用一阶递归数字滤波器串联得到高阶数字滤波器,但是设计高阶数字滤波器时,需要设置和调整的参数较多,设计难度高,过程复杂

Benefits of technology

[0034]本申请实施例中,预设函数以滤波系数a为常数,第n次采样值Xn和第k次至第n-1次N阶滤波值为自变量,第n次N阶滤波值为因变量。由于n=N+k,则k=n-N,可见预设函数的本质是根据第n-N次至第n-1次N阶滤波值,也就是根据第n次N阶滤波值之前的N次N阶滤波值,以及第n次采样值Xn递推地确定第n次N阶滤波值采用预设函数计算第n次N阶滤波值能够综合考虑当前的采样值和前N次的滤波值,使得滤波效果更加可靠。在设计高阶滤波器时,需要确定的参数只有滤波阶数N、滤波系数a,以及第1次至第N次N阶滤波值的初始值,参数少,且无需进行复杂的参数计算,设计过程简单,难度较低。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115765684B_ABST
    Figure CN115765684B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a digital filtering method, device and test bench, which are used for simplifying the design parameters of a high-order filter. The digital filtering method comprises the following steps: initialization; obtaining an nth sampling value X n ; obtaining an nth N-order filtering value according to a preset function, wherein the preset function is a function of a filtering coefficient a, the nth sampling value X n and kth to (n-1)th N-order filtering values; if an ending condition is not met, increasing k by 1, and executing the step of obtaining the nth sampling value X n ; if the ending condition is met, ending. The nth N-order filtering value is determined recursively according to the N-order filtering values before the nth N-order filtering value and the nth sampling value X n When a high-order filter is designed, only the filtering order N, the filtering coefficient a and the initial values of the 1st to Nth N-order filtering values need to be determined, so that the parameters are less.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of digital filtering, and in particular, to a digital filtering method, apparatus and test bench. Background Art

[0002] An Infinite Impulse Response Filter, also known as a recursive filter, is a commonly used filter for data filtering processing. In the prior art, a high-order digital filter can be obtained by connecting first-order recursive digital filters in series, but when designing a high-order digital filter, there are many parameters to be set and adjusted, leading to high design difficulty and complex process. Summary of the Invention

[0003] The embodiments of the present application provide a digital filtering method, apparatus and test bench, which are used to simplify the design parameters of a high-order filter.

[0004] A first aspect of the embodiments of the present application provides a digital filtering method, including:

[0005] determining a filtering order N, determining initial values of the 1st to Nth N-order filtering values, where N>1, determining a filtering coefficient a, where 0<a≤1, and setting k=1;

[0006] acquiring the nth sampling value X n , where n=N+k;

[0007] obtaining the nth N-order filtering value according to a preset function where the preset function is a function of the nth N-order filtering value with respect to the filtering coefficient a, the nth sampling value X n and the kth to (n-1)th N-order filtering values;

[0008] judging whether an end condition is satisfied;

[0009] if the end condition is not satisfied, increment k by 1, and execute the step of acquiring the nth sampling value X n ;

[0010] if the end condition is satisfied, ending the process.

[0011] Based on the first aspect of the embodiments of the present application, in a first implementation manner of the first aspect of the embodiments of the present application, the preset function is

[0012]

[0013] Based on the first aspect or the first implementation manner of the first aspect of the embodiments of the present application, in a second implementation manner of the first aspect of the embodiments of the present application, in the step of obtaining the nth N-order filtering value according to a preset function Subsequently, the method further includes:

[0014] Output target data, which includes the N+1th to nth Nth order filter values.

[0015] Based on any one of the first aspect, the first implementation method, and the second implementation method of the embodiments of this application, in the third implementation method of the first aspect of the embodiments of this application, in the step of obtaining the nth order N-th filter value according to the preset function... Subsequently, the method further includes:

[0016] Plot the filtering curves based on the N+1th to the nth Nth order filtering values;

[0017] Output filter curve.

[0018] Based on the first aspect of the embodiments of this application, and any one of the first to third implementations of the first aspect, in the fourth implementation of the first aspect of the embodiments of this application, the step of determining the filter order N, determining the initial values ​​of the Nth to Nth order filter values, and determining the filter coefficient a specifically includes:

[0019] Receive input data sent by the input device;

[0020] Determine the filter order N based on the input data, determine the initial values ​​of the Nth to Nth order filter values, and determine the filter coefficients a.

[0021] Based on the first aspect of the embodiments of this application, and any one of the first to fourth implementations of the first aspect, in the fifth implementation of the first aspect of the embodiments of this application, the determination of whether the termination condition is met specifically includes:

[0022] Determine if n is greater than a preset value;

[0023] If n is greater than the preset value, then the termination condition is met;

[0024] If n is not greater than the preset value, then the termination condition is not met.

[0025] Based on the first aspect of the embodiments of this application, and any one of the first to fifth implementations of the first aspect, in the sixth implementation of the first aspect of the embodiments of this application, the determination of whether the termination condition is met specifically includes:

[0026] Determine whether an end command has been received from the input device;

[0027] If an end command is received from the input device, the end condition is met;

[0028] If no end command is received from the input device, the termination condition is not met.

[0029] Based on the first aspect of the embodiments of the present application, or any one of the first to sixth implementation manners of the first aspect, in the seventh implementation manner of the first aspect of the embodiments of the present application, the determining whether the end condition is met specifically includes:

[0030] determining whether a (n+1)-th sampling value exists;

[0031] if the (n+1)-th sampling value does not exist, the end condition is met;

[0032] if the (n+1)-th sampling value exists, the end condition is not met.

[0033] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:

[0034] In the embodiments of the present application, the preset function takes the filter coefficient a as a constant, the n-th sampling value X n and the k-th to (n-1)-th N-order filtered values as independent variables, and the n-th N-order filtered value as a dependent variable. Since n=N+k, then k=n-N. It can be seen that the essence of the preset function is to recursively determine the n-th N-order filtered value according to the (n-N)-th to (n-1)-th N-order filtered values, that is, according to the N N-order filtered values before the n-th N-order filtered value, and the n-th sampling value X n to determine the n-th N-order filtered value in a recursive manner Calculating the n-th N-order filtered value by using the preset function can comprehensively consider the current sampling value and the previous N filtered values, making the filtering effect more reliable. When designing a high-order filter, only the filter order N, the filter coefficient a, and the initial values of the 1st to N-th N-order filtered values need to be determined, with few parameters, no complex parameter calculation is required, the design process is simple, and the difficulty is low.

[0035] A second aspect of the embodiments of the present application provides a digital filtering apparatus, including:

[0036] an initialization unit, configured to determine a filter order N, determine initial values of 1st to N-th N-order filtered values where N>1, determine a filter coefficient a where 0<a≤1, and determine k=1;

[0037] a sampling unit, configured to acquire an n-th sampling value X n , where n=N+k;

[0038] a calculation unit, configured to obtain the n-th N-order filtered value according to a preset function The preset function is a function of the n-th N-order filtered value with respect to the filter coefficient a, the n-th sampling value X n and the k-th to (n-1)-th N-order filtered values;

[0039] The decision unit is used to determine whether the termination condition is met.

[0040] The loop unit is used to increment k by 1 and execute the process of obtaining the nth sample value X when the termination condition is not met. n Steps;

[0041] Termination unit, used to terminate when the termination condition is met.

[0042] Based on the second aspect of the embodiments of this application, in the first implementation of the second aspect of the embodiments of this application, the preset function is:

[0043]

[0044] Based on the second aspect or the first implementation of the embodiments of this application, in the second implementation of the second aspect of the embodiments of this application, the apparatus further includes:

[0045] The output data unit is used to output the target data, which includes the N+1th to nth Nth order filter values.

[0046] Based on the second aspect of the embodiments of this application, and any one of the first and second implementations of the second aspect, in the third implementation of the second aspect of the embodiments of this application, the apparatus further includes:

[0047] The plotting unit is used to plot the filter curve based on the N+1th to the nth Nth order filter values;

[0048] Output curve unit, used to output the filter curve.

[0049] Based on the second aspect of the embodiments of this application, and any one of the first to third implementations of the second aspect, in the fourth implementation of the second aspect of the embodiments of this application, the initialization unit is specifically used for:

[0050] Receive input data sent by the input device;

[0051] Determine the filter order N based on the input data, determine the initial values ​​of the Nth to Nth order filter values, and determine the filter coefficients a.

[0052] Based on the second aspect of the embodiments of this application, and any one of the first to fourth implementations of the second aspect, in the fifth implementation of the second aspect of the embodiments of this application, the determining unit is specifically used for:

[0053] Determine if n is greater than a preset value;

[0054] If n is greater than the preset value, then the termination condition is met;

[0055] If n is not greater than the preset value, then the termination condition is not met.

[0056] Based on the second aspect of the embodiments of this application, and any one of the first to fifth implementations of the second aspect, in the sixth implementation of the second aspect of the embodiments of this application, the determining unit is specifically used for:

[0057] Determine whether an end command has been received from the input device;

[0058] If an end command is received from the input device, the end condition is met;

[0059] If no end command is received from the input device, the termination condition is not met.

[0060] Based on the second aspect of the embodiments of this application, and any one of the first to sixth implementations of the second aspect, in the seventh implementation of the second aspect of the embodiments of this application, the determining unit is specifically used for:

[0061] Determine if there exists a sample value of the (n+1)th time.

[0062] If there is no sampled value for the (n+1)th time, then the termination condition is met;

[0063] If there is a sample value for the (n+1)th time, then the termination condition is not met.

[0064] A third aspect of this application provides a test bench, including a data acquisition device and a data analysis device, wherein the data analysis device receives data sent by the data acquisition device, and the data analysis device performs digital filtering on the data using the method described in the first aspect. Attached Figure Description

[0065] Figure 1 This is a schematic diagram of a two-stage digital filter according to an embodiment of this application;

[0066] Figure 2 This is a flowchart of Embodiment 1 of this application;

[0067] Figure 3 This is a flowchart of Embodiment 2 of this application;

[0068] Figure 4 This is the original curve of motor efficiency from the experimental example in this application;

[0069] Figure 5 This is a comparison chart of the original motor efficiency curve and the first-order filter in Experiment Example 1 of this application;

[0070] Figure 6 This is a comparison chart of the original motor efficiency curve and the first and third order filters in Experiment Example 2 of this application;

[0071] Figure 7This is a comparison chart of the original motor efficiency curve and the first, third, and fifth order filters in Experiment Example 3 of this application;

[0072] Figure 8 This is a comparison chart showing the effect of different 'a' values ​​on the filtering effect in Experiment Example 4 of this application;

[0073] Figure 9 This is a schematic diagram illustrating the effect of different initial values ​​on the filtering effect in Experiment Example 5 of this application. Detailed Implementation

[0074] First, the mathematical principles of the embodiments of this application will be explained:

[0075] An Nth-order digital filter is designed by cascading N first-order recursive digital filters. The order of this filter depends on the number of cascaded first-order recursive digital filters. A recursive digital filter can be simply called a digital filter or filter. The detailed derivation is shown below:

[0076] A first-order recursive digital filter satisfies the following formula:

[0077]

[0078] In the formula, T0 is the sampling interval; T = RC, which is equivalent to the time constant of an analog circuit; X n This is the value sampled in this test. Y is the first-order filter value for the (n-1)th time. (1) n Let n be the nth first-order filter value; n>1. First-order, second-order, third-order, ..., Nth-order filter values ​​can all be simply referred to as filter values. The nth filter value can also be called the current filter value or the current filtering value. The (n-1)th filter value can also be called the previous filter value. The nth first-order filter value can also be called the current first-order filter value or the current first-order filter value. The (n-1)th first-order filter value can also be called the previous first-order filter value. A formula can also be called an expression or a function.

[0079] First, let's analyze the second-order recursive digital filter:

[0080] like Figure 1 As shown, a second-order recursive digital filter can be obtained by cascading two first-order recursive digital filters.

[0081] According to (1), we can obtain:

[0082]

[0083]

[0084] According to (4), we can obtain and Relation (5)

[0085]

[0086] In (5), n>2.

[0087] According to (5), we can obtain

[0088]

[0089] Substituting formulas (3) and (6) into formula (4) respectively, we get:

[0090]

[0091] In the above formula, Y n (2) This is the nth second-order filter value. This is the (n-1)th second-order filter value. The (n-2)th second-order filter value. The nth second-order filter value can also be called the current second-order filter value, the (n-1)th second-order filter value can also be called the previous second-order filter value, and the (n-2)th second-order filter value can also be called the previous two second-order filter values.

[0092] Similarly, it can be deduced that third-order, fourth-order, and fifth-order digital filters satisfy the following formulas respectively:

[0093]

[0094]

[0095]

[0096] Y n (3) Y is the nth third-order filter value. n (4) Y is the nth fourth-order filter value. n (5) This is the value of the nth fifth-order filter.

[0097] By comparing (1), (7), (8), (9), and (10), it can be seen that the filter coefficients of orders 1 to 5 satisfy the Pascal's triangle coefficient rule. Based on Pascal's triangle coefficient, the Nth-order digital filter satisfies the following formula:

[0098]

[0099] The value is the nth Nth order filter value, where the superscript indicates the digital filter order and the subscript indicates the filter sequence.

[0100] Two design embodiments of the present application are presented below. In Embodiment 1, n is incremented by itself to implement counting. In Embodiment 2, n does not need to be incremented by itself, and the filter value is continuously obtained through loop iteration.

[0101] The solutions of Embodiment 1 and Embodiment 2 are essentially the same, and only differ in the expression manner.

[0102] Embodiment 1, as shown in Figure 2 :

[0103] 101. Determine the filter order N, determine the initial values of the N-th order filter values from the 1st time to the N-th time, where N>1, determine the filter coefficient a, where 0<a≤1, and determine k=1. This step performs initialization, and the initialization needs to determine each parameter and the initial values of part of the filter values. The methods for determining each parameter and the initial values of part of the filter values may be various: determined according to input data sent by an input device; determined according to a default value; randomly generated; determined according to historical data. A user may input part or all of the filter order N, the initial values of the N-th order filter values from the 1st time to the N-th time, and the filter coefficient a through the input device. Default values are preset in a program, and part or all of the filter order N, the initial values of the N-th order filter values from the 1st time to the N-th time, and the filter coefficient a are determined according to the default values. A random number is used in the program, and the initial values of the N-th order filter values from the 1st time to the N-th time are determined according to the random number. Historical data retained from previous filtering is called, and part or all of the filter order N, the initial values of the N-th order filter values from the 1st time to the N-th time, and the filter coefficient a are determined according to the historical data.

[0104] 102. Obtain the n-th sampling value X n , where n=N+k. The sampling value is raw data acquired by a sensor or the like, and the sampling value may be data obtained by measuring temperature, voltage, current, speed, force, and the like. k is used for loop counting. It should be noted that the sampling values are not required for determining the initial values of the N-th order filter values from the 1st time to the N-th time, that is, the 1st to N-th sampling values do not exist. Therefore, in order to make full use of the sampling values, the n-th sampling value may be the k-th data obtained by sampling. For example, if N=3, the 4th sampling value is the 1st data obtained by sampling, the 5th sampling value is the 2nd data obtained by sampling... and the 1st to N-th sampling values do not exist.

[0105] 103. Obtain the n-th N-th order filter value according to a preset function The preset function is a function of the n-th N-th order filter value with respect to the filter coefficient a, the n-th sampling value X n and the k-th to (n-1)-th N-th order filter values. In the preset function, the filter coefficient a is a constant, the n-th sampling value X n and the k-th to (n-1)-th N-th order filter values are independent variables, and the n-th N-th order filter value Let X be the dependent variable. Since n = N + k, then k = nN. Therefore, the essence of the preset function is based on the Nth to (n-1)th order N-order filter values, that is, on the Nth order N-order filter values ​​before the nth order N-order filter value, and the nth sample value X. n Determine the Nth order filter value recursively The nth Nth order filter value is calculated using a preset function. It can comprehensively consider the current sample value and the previous N filter values, making the filtering effect more reliable.

[0106] 104. Determine if the termination condition is met. There can be one or more termination conditions. If there are multiple termination conditions, the process can end as long as any one of them is met.

[0107] 105. If the termination condition is not met, increment k by 1 and execute the step of obtaining the nth sample value X. n The steps are as follows. k is used for counting; before entering the next loop, k is incremented by 1, that is, k+1 is assigned to k. If the termination condition is not met, steps 102 to 104 are executed to perform iterative calculations, continuously calculating new Nth-order filter values.

[0108] 106. If the termination condition is met, the process ends. The filtering is complete, and the data filtering process is finished.

[0109] In one implementation of this application, the preset function is:

[0110]

[0111] As can be seen, the coefficients before each Nth-order filter are determined based on Pascal's triangle, which greatly simplifies the parameter setting process and reduces the number of parameters that need to be set.

[0112] In one implementation of this application, the step of obtaining the nth Nth order filter value according to a preset function is described. Subsequently, the method further includes:

[0113] Output target data, which includes the (N+1)th to (n)th order N-th filter values. These (N+1)th to (N+k)th order N-th filter values ​​are used as the target data output. When k=1, the (N+1)th and (N+k)th order N-th filter values ​​are the same data, and the (N+1)th order N-th filter value is output. The (N+1)th to (n)th order N-th filter values ​​can be output sequentially or all at once. Sequential output means that after each loop, the current order N-th filter value is output, and this process continues with each loop. All-at-once output means that after calculating all n order N-th filter values, all N-th order filter values ​​are output at once. It should be noted that the target data can also include the (1st to Nth)th order N-th filter values.

[0114] In one implementation of this application, the step of obtaining the nth Nth order filter value according to a preset function is described. Subsequently, the method further includes:

[0115] Plot the filter curves based on the (N+1)th to the nth order N filter values. The filter curves can be scatter plots, line graphs, or smooth curves, etc. It should be noted that when plotting the filter curves, the 1st to Nth order N filter values ​​can also be considered.

[0116] Output the filtered curve. The curve plotted based on the sampled values ​​and the filtered curve can be output together for comparison to demonstrate the filtering effect.

[0117] In one implementation of this application, determining the filter order N, determining the initial values ​​of the Nth to Nth order filter values, and determining the filter coefficients a specifically include:

[0118] Receive input data sent by the input device. The user sends input data through the input device.

[0119] The filter order N is determined based on the input data, as are the initial values ​​for the Nth to Nth order filters, and the filter coefficients a. Determining each parameter through input data allows for greater flexibility, enabling users to set the appropriate parameters according to their specific needs.

[0120] In one implementation of this application, the determination of whether the termination condition is met specifically includes:

[0121] determine whether n is greater than a preset value. Since n = N + k and k increments automatically after each cycle, n also increments automatically after each cycle. It should be noted that since the difference between n and k is always a constant, determining whether k is greater than the preset value and determining whether n is greater than the preset value are essentially the same solution, both falling within the protection scope of the present application. For example, determining whether k is greater than the preset value P is essentially determining whether n is greater than the preset value P+N.

[0122] If n is greater than the preset value, the end condition is satisfied. That n is greater than the preset value indicates that the cycle has reached the preset number of times, thus satisfying the end condition.

[0123] If n is not greater than the preset value, the end condition is not satisfied. That n is not greater than the preset value indicates that the cycle has not reached the preset number of times, thus not satisfying the end condition.

[0124] In an implementation of the embodiment of the present application, the determining whether the end condition is satisfied specifically includes:

[0125] determine whether an end instruction sent by an input device is received. A user may send the end instruction through the input device, so that the user can end filtering more flexibly, which improves controllability.

[0126] If the end instruction sent by the input device is received, the end condition is satisfied.

[0127] If the end instruction sent by the input device is not received, the end condition is not satisfied.

[0128] In an implementation of the embodiment of the present application, the determining whether the end condition is satisfied specifically includes: determining whether the (n+1)th sampling value exists. The (n+1)th sampling value is a new sampling value, or referred to as the next sampling value.

[0129] If the (n+1)th sampling value does not exist, the end condition is satisfied. If the (n+1)th sampling value does not exist, it indicates that all sampling values have been subjected to filtering processing, and there is no new sampling value to be filtered, thus satisfying the end condition.

[0130] If the (n+1)th sampling value exists, the end condition is not satisfied. If the (n+1)th sampling value exists, it indicates that there are still sampling values that have not been subjected to filtering processing, and there are new sampling values to be filtered, thus not satisfying the end condition.

[0131] Embodiment 2, as Figure 3 shown in the following:

[0132] 201. Determine a filtering order N, where 1 < N, determine a filtering coefficient a, where 0 < a ≤ 1, and determine initial values of the N-order filtering values from the 1st previous one to the Nth previous one . In In the equation, i=1 represents the first Nth-order filter value, i=2 represents the second Nth-order filter value, i=3 represents the third Nth-order filter value, and so on, i=N represents the Nth Nth-order filter value.

[0133] 202. Obtain the current sampled value X n n = N + k. Step 202 is similar to step 102, and will not be described in detail here.

[0134] 203. Obtain the current Nth-order filter value according to the preset function. The preset function is the current Nth order filter value. Regarding the filter coefficient a and the current sampled value X n A function of the Nth to Nth order filter values. The preset function uses the filter coefficient 'a' as a constant, and the nth sample value X... n The Nth order filter value is the independent variable, and the current Nth order filter value is the result of filtering from the 1st to the Nth order. The dependent variable is X. The essence of the preset function is based on the Nth to (n-1)th order N-order filter values, that is, the Nth order N-order filter values ​​prior to the current order N-order filter value, and the current sampled value X. n Determine the current Nth order filter value recursively. The current Nth-order filter value is calculated using a preset function. It can comprehensively consider the current sample value and the previous N filter values, making the filtering effect more reliable.

[0135] The current Nth-order filter value is obtained according to a preset function. Then, the current Nth-order filter value can be output. Or the current Nth order filter value Stored in memory or database.

[0136] The preset function can be

[0137]

[0138] As can be seen, the coefficients before each Nth-order filter are determined based on Pascal's triangle, which greatly simplifies the parameter setting process and reduces the number of parameters that need to be set.

[0139] 204. Determine if the termination condition is met. Step 204 is similar to step 104, and will not be described in detail here.

[0140] 205. If the termination condition is not met, assign the (i-1)th Nth-order filter value to the ith Nth-order filter value, assign the current Nth-order filter value to the eleventh Nth-order filter value, and execute the process of obtaining the current sampled value X. nThe steps are as follows: Assign the (i-1)th Nth-order filter value to the ith Nth-order filter value. Specifically: assign the (N-1)th Nth-order filter value to the ith Nth-order filter value, the (N-2)th Nth-order filter value to the (N-1)th Nth-order filter value, and so on. Assign the (i-1)th Nth-order filter value to the ith Nth-order filter value, the (i-2)th Nth-order filter value to the (i-1)th Nth-order filter value, and so on. Assign the 2nd Nth-order filter value to the 3rd Nth-order filter value, and the 1st Nth-order filter value to the 2nd Nth-order filter value. If the termination condition is not met, proceed to steps 202 to 204 to perform a loop calculation, continuously calculating new Nth-order filter values.

[0141] 206. If the termination condition is met, then the process ends. Step 206 is similar to step 106, and will not be described in detail here.

[0142] The various implementation methods in Example 1 can also be applied to Example 2 by analogy, and will not be elaborated here.

[0143] To verify the feasibility of this application, several experimental examples are provided below.

[0144] The digital filtering method of this application can be used to filter offline or online data. Taking motor testing data as an example, the digital filtering method of this application is used to filter offline data. The original motor efficiency data of a certain motor is obtained through a motor test bench, such as... Figure 4 As shown.

[0145] Experimental Example 1:

[0146] Taking a first-order filter as an example for design, let With a = 0.8, using the algorithm proposed in this application, the first-order filter curve can be obtained as follows: Figure 5 As shown, the curves that intersect the horizontal axis are the first-order filter curves, while those that do not intersect the horizontal axis are the original data curves.

[0147] Experimental Example 2:

[0148] Taking a third-order filter as an example for design, the initialization command is... With a = 0.8, using the algorithm proposed in this application, the third-order filtering curve can be obtained as follows: Figure 6 As shown. The curves intersecting the horizontal axis to the left are first-order filtered curves, those intersecting to the right are third-order filtered curves, and those not intersecting the horizontal axis are the original data curves.

[0149] Experimental Example 3:

[0150] Taking a fifth-order filter as an example for design, the initialization command is... With a = 0.8, using the algorithm proposed in this application, the fifth-order filtered data can be obtained as follows: Figure 7 as shown in the figure. The curve whose intersection with the horizontal axis is on the left is the first-order filtering curve, the curve whose intersection with the horizontal axis is at the center is the third-order filtering curve, the curve whose intersection with the horizontal axis is on the right is the fifth-order filtering curve, and the curve that has no intersection with the horizontal axis is the raw data curve.

[0151] It can be seen through Figure 7 that as the filtering order increases, the motor efficiency curve plotted from the filtered values becomes increasingly smoother, and meanwhile, a higher order leads to greater data delay.

[0152] Experimental Example 4:

[0153] To compare the effects of different a values on filtering, set a=0.9, and still set to obtain filtering comparison curves under different a values, as shown in Figure 8 the figure. The curve whose intersection with the horizontal axis is on the left is the fifth-order filtering curve with a=0.8, the curve whose intersection with the horizontal axis is on the right is the fifth-order filtering curve with a=0.9, and the curve that has no intersection with the horizontal axis is the raw data curve.

[0154] It can be seen from Figure 8 the figure that for 5th-order digital filtering, a larger a value results in smoother data, but also greater data delay.

[0155] Experimental Example 5:

[0156] A third-order filter is taken as an example for design, and the initialization is set as a=0.8. Using the algorithm proposed in the present application, the third-order filtering curve is obtained as shown in Figure 9 the figure. The curve whose intersection with the vertical axis is on the upper side is the third-order filtering curve, and the curve whose intersection with the vertical axis is on the lower side is the raw data curve.

[0157] According to Experimental Examples 1 to 5, it can be seen that filtering using the algorithm proposed in the present application achieves good filtering effects, which are basically consistent with those of common filtering methods, and can meet the requirements of production, testing and the like.

[0158] It should be noted that, in Figures 4 to 9 the figure, the unit of the horizontal axis may be a time unit, such as ms, s, min and the like, or may be a dimensionless point.

[0159] The embodiments of the present application further provide a digital filtering apparatus, comprising:

[0160] an initialization unit, configured to determine a filtering order N, determine initial values of the 1st to Nth N-order filtered values, where N>1, determine a filtering coefficient a, where 0<a≤1, and set k=1;

[0161] a sampling unit, configured to acquire the nth sampled value X n , where n=N+k;

[0162] The calculation unit is used to obtain the nth order N-th filter value according to a preset function. The preset function is the nth Nth order filter value. Regarding the filter coefficient a and the nth sample value X n A function of the Nth order filter values ​​from the kth to the (n-1th)th order;

[0163] The decision unit is used to determine whether the termination condition is met.

[0164] The loop unit is used to increment k by 1 and execute the process of obtaining the nth sample value X when the termination condition is not met. n Steps;

[0165] Termination unit, used to terminate when the termination condition is met.

[0166] Optionally, the preset function is:

[0167]

[0168] Optionally, the device further includes:

[0169] The output data unit is used to output the target data, which includes the N+1th to nth Nth order filter values.

[0170] Optionally, in a third implementation of the second aspect of this application, the apparatus further includes:

[0171] The plotting unit is used to plot the filter curve based on the N+1th to the nth Nth order filter values;

[0172] Output curve unit, used to output the filter curve.

[0173] Optionally, in the fourth implementation of the second aspect of the embodiments of this application, the initialization unit is specifically used for:

[0174] Receive input data sent by the input device;

[0175] Determine the filter order N based on the input data, determine the initial values ​​of the Nth to Nth order filter values, and determine the filter coefficients a.

[0176] Optionally, the decision unit is specifically used for:

[0177] Determine if n is greater than a preset value;

[0178] If n is greater than the preset value, then the termination condition is met;

[0179] If n is not greater than the preset value, then the termination condition is not met.

[0180] Optionally, the decision unit is specifically used for:

[0181] Determine whether an end command has been received from the input device;

[0182] If an end command is received from the input device, the end condition is met;

[0183] If no end command is received from the input device, the termination condition is not met.

[0184] Optionally, the decision unit is specifically used for:

[0185] Determine if there exists a sample value of the (n+1)th time.

[0186] If there is no sampled value for the (n+1)th time, then the termination condition is met;

[0187] If there is a sample value for the (n+1)th time, then the termination condition is not met.

[0188] This application embodiment also provides a test bench, including a data acquisition device and a data analysis device. The data analysis device receives data sent by the data acquisition device, and the data analysis device performs digital filtering on the data using the method described in Embodiment 1 or Embodiment 2.

[0189] Test benches can be dedicated test benches, such as motor test benches; or they can be general-purpose test benches. Test benches can collect and filter electrical, thermal, and mechanical parameters, for example, the electrical, thermal, and mechanical parameters of a motor.

[0190] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0191] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0192] The terms "first," "second," "third," "fourth," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein.

[0193] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0194] The units described as separate components may or may not be physically separate. 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 units can be selected to achieve the purpose of this embodiment according to actual needs.

[0195] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0196] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

Claims

1. A digital filtering method, characterized in that, comprising: determining a filter order N, determining initial values of N-order filtered values from the 1st time to the Nth time, where N>1, determining a filter coefficient a, where 0<a≤1, and setting k=1; Obtain the nth sample value , n = N + k; The nth Nth order filter value is obtained according to the preset function. The preset function is the Nth order filter value. Regarding the filter coefficient a and the nth sample value A function of the Nth order filter values ​​from the kth to the (n-1th)th order; judging whether an end condition is satisfied; If the termination condition is not met, increment k by 1 and re-execute the process of obtaining the nth sample value. Obtain the nth order N-th filter value according to the preset function. The steps include determining whether the termination condition is met. if the end condition is satisfied, ending the process; wherein the preset function is ; In the formula, i is a positive integer ranging from 1 to N. The coefficient is the binomial coefficient, representing the number of combinations of choosing i elements from N elements. Let i represent the number of combinations when i takes values ​​from 1 to N.

2. The digital filtering method according to claim 1, characterized in that, The nth Nth order filter value is obtained according to the preset function. Subsequently, the method further includes: outputting target data, wherein the target data comprises N-order filtered values from the (N+1)th time to the nth time.

3. The digital filtering method according to claim 1, characterized in that, The nth Nth order filter value is obtained according to the preset function. Subsequently, the method further includes: plotting a filtering curve according to the N-order filtered values from the (N+1)th time to the nth time; outputting the filtering curve.

4. The digital filtering method according to claim 1, characterized in that, The step of determining a filter order N, determining initial values of N-order filtered values from the 1st time to the Nth time, and determining a filter coefficient a specifically comprises: receiving input data sent by an input device; determining the filter order N according to the input data, determining the initial values of the N-order filtered values from the 1st time to the Nth time, and determining the filter coefficient a.

5. The digital filtering method according to claim 1, characterized in that, The step of judging whether an end condition is satisfied specifically comprises: judging whether n is greater than a preset value; if n is greater than the preset value, the end condition is satisfied; if n is not greater than the preset value, the end condition is not satisfied.

6. The digital filtering method according to claim 1, characterized in that, The step of judging whether an end condition is satisfied specifically comprises: judging whether an end instruction sent by the input device is received; if the end instruction sent by the input device is received, the end condition is satisfied; if the end instruction sent by the input device is not received, the end condition is not satisfied.

7. The digital filtering method according to claim 1, characterized in that, The step of judging whether an end condition is satisfied specifically comprises: judging whether a (n+1)th sampled value exists; if the (n+1)th sampled value does not exist, the end condition is satisfied; if the (n+1)th sampled value exists, the end condition is not satisfied.

8. A digital filtering device, characterized in that, comprising: an initialization unit, configured to determine a filter order N, determine initial values of N-order filtered values from the 1st time to the Nth time, where N>1, determine a filter coefficient a, where 0<a≤1, and set k=1; A sampling unit is used to obtain the nth sample value. , n = N + k; The calculation unit is used to obtain the nth order N-th filter value according to a preset function. The preset function is the Nth order filter value. Regarding the filter coefficient a and the nth sample value A function of the Nth order filter values ​​from the kth to the (n-1th)th order; a judgment unit, configured to judge whether an end condition is satisfied; The loop unit is used to increment k by 1 and re-execute the process of obtaining the nth sample value if the termination condition is not met. Obtain the nth order N-th filter value according to the preset function. The steps include determining whether the termination condition is met. an ending unit, configured to end the process when the end condition is satisfied; wherein the preset function is ; In the formula, i is a positive integer ranging from 1 to N. The coefficient is the binomial coefficient, representing the number of combinations of choosing i elements from N elements. Let i represent the number of combinations when i takes values ​​from 1 to N.

9. A test bench, characterized in that, comprising a data acquisition device and a data analysis device, wherein the data analysis device receives data sent by the data acquisition device, and the data analysis device performs digital filtering on the data by using the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Infinite impulse response filter and method for realizing IIR filtering

    CN112713875A

  • High-order multiphase digital filtering sampling method and system

    CN114614795A