Ad sampling processing method and system based on periodic variable signal

By performing AD sampling on periodic variable signals, calculating the sum of squares and averaging, and using a mapping table to find the actual value, the problems of large computational load and low reliability in traditional methods are solved, achieving more efficient AD sampling processing.

CN119892085BActive Publication Date: 2026-01-27东莞捷璞电子科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411944873.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2026-01-27
Estimated Expiration
2044-12-27

AI Technical Summary

Technical Problem

Traditional periodic variable signal AD sampling methods require algorithm adjustments based on different hardware circuits, resulting in high computational load and low reliability.

Method used

By performing AD sampling on the periodic variable signal, calculating the sum of squares of the sampled values ​​and averaging them, and using a preset mapping table between effective values ​​and offsets to find the actual value, the dependence on hardware circuitry is reduced.

Benefits of technology

This reduces the computational load on the MCU, improves the reliability of AD sampling tasks, and reduces the sensitivity to hardware circuit settings.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119892085B_ABST
    Figure CN119892085B_ABST
Patent Text Reader

Abstract

This invention relates to an AD sampling processing method based on a periodic variable signal, comprising the following steps: S10: performing AD sampling on the periodic variable signal; wherein, the periodic variable signal is sampled once at intervals Δt to obtain a sampled value dx. S20: calculating the sum of squares (SUM(∑dx)) of the sampled values ​​dx collected within one period T0 of the periodic variable signal. 2 S30: Calculate SUM(∑dx) within the interval T1. 2 S40: Find the offset Diff mapped to the effective value D1 in step S30 from the preset mapping table of effective value D1 and offset Diff. Then, the actual value D0 of the periodic variable signal is D1 = D1 + Diff. This invention also provides an AD sampling processing system based on periodic variable signals. This eliminates the need for the MCU of electronic devices to perform calculations according to preset algorithms of different hardware circuits when executing AD sampling tasks, thereby reducing the computational load and improving reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electrical signal detection technology, and in particular to an AD sampling processing method based on periodic variable signals, and an AD sampling processing system based on periodic variable signals. Background Technology

[0002] In electronic devices, it is often necessary to perform AD sampling on a known periodic variable signal to achieve monitoring of operating parameters and automated control. Traditional AD sampling methods for periodic variable signals typically require continuous sampling within the same period, followed by obtaining an effective value D1 using various algorithms (e.g., mean, root mean square, maximum, etc.). Then, in conjunction with hardware design, the relationship between the effective value D1 and the actual value D0 is found, ultimately yielding an effective value D1 that approximates the actual value D0, which is then output as the actual value D0. The drawback of this traditional AD sampling method for periodic variable signals is:

[0003] The algorithm used needs to be adjusted according to the specific hardware circuit; different hardware requires different algorithms to obtain the effective value. For example, the root mean square algorithm or peak voltage calculation may be used. Simultaneously, it's necessary to consider whether there is DC bias in the circuit, whether the rectification is full-wave or half-wave, the voltage division ratio, and some necessary filtering algorithms to finally obtain the effective value D1. Errors in any step will affect the calculation result. Therefore, different hardware circuits require different algorithms, making the algorithm highly dependent on the hardware. This leads to the MCU of electronic devices needing to perform calculations according to the preset algorithms of different hardware circuits when executing AD sampling tasks, resulting in a large computational load and low reliability. Summary of the Invention

[0004] Based on this, the present invention provides an AD sampling processing method based on periodic variable signals, so that when the MCU of an electronic device performs AD sampling tasks, it does not need to perform calculations according to the preset algorithms of different hardware circuits, thereby reducing the amount of computation and improving reliability.

[0005] An AD sampling processing method based on a periodic variable signal includes the following steps:

[0006] S10: Perform AD sampling on the periodic variable signal; wherein, the periodic variable signal is sampled once at intervals of Δt to obtain the sampled value dx; wherein, Δt=(T0 / N1), T0 is the period of change of the periodic variable signal, and N1 is a positive integer;

[0007] S20: SUM(∑dx) is obtained by summing the squares of the sampled values ​​dx collected within one period T0 of the periodic variable signal. 2 );

[0008] S30: Calculate SUM(∑dx) within the interval T1. 2 The effective value D1 is obtained by averaging; where T1 = N2 * T0, and N2 is a positive integer;

[0009] S40: Find the offset Diff mapped to the effective value D1 in step S30 from the preset mapping table of effective value D1 and offset Diff, then the actual value D0 of the periodic variable signal is D1 + Diff.

[0010] The aforementioned AD sampling processing method based on periodic variable signals performs a sum-of-squares operation on the sampled values ​​dx collected within one period T0 of the variable signal, followed by averaging at a preset time interval T1. This sum-of-squares averaging method can be used to measure signal power, yielding results with very small oscillation amplitudes when the input power remains constant. Therefore, this method eliminates the need to consider factors such as DC bias, full-wave or half-wave characteristics, or voltage division ratios. A relatively constant value, the effective value D1, can be obtained while maintaining constant input power. The offset Diff is then mapped from the effective value D1 using a lookup table, and the sum of D1 and Diff yields the actual value D0. This design eliminates the need for the MCU of electronic devices to perform calculations based on preset algorithms of different hardware circuits when executing AD sampling tasks, thereby reducing computational load and improving reliability.

[0011] In one embodiment, in step S10, if the number of bits for AD sampling is greater than 8, the sampled value dx is right-shifted so that the number of bits for dx does not exceed 8. To reduce the computational load on the MCU, when the number of bits for AD sampling is greater than 8, the sampled value dx is right-shifted to reduce the number of bits for dx, keeping it within 8 bits.

[0012] In one embodiment, in step S30, N2 is a positive integer not less than 2. A larger value for N2 allows for the reduction of noise interference through multiple sampling periods, thereby reducing the impact of noise on the calculation results and achieving a filtering effect. Therefore, the value of N2 is preferably a positive integer not less than 2.

[0013] In one embodiment, the method for obtaining the mapping table of the effective value D1-offset Diff includes the following steps:

[0014] S01: The frequency converter provides a signal source for electronic equipment and performs AD sampling processing;

[0015] S02: Gradually adjust the output signal of the frequency converter to the electronic equipment according to the preset signal strength interval and record the actual value D0' at each adjustment; at the same time, execute steps S10, S20 and S30 to obtain the effective value D1 corresponding to each actual value D0', calculate the difference between each effective value D1 and the corresponding actual value D0', and obtain the offset Diff = D0' - D1.

[0016] S03: Establish and archive the mapping table between valid value D1 and offset Diff.

[0017] As an adjustable and stable signal source, the frequency converter is used to simulate the periodic variable signal when electronic equipment is working. By gradually adjusting the signal strength, the mapping relationship between the actual value D0 and the effective value D1 calculated according to steps S10 to S30 is measured, thereby establishing a mapping relationship table of effective value D1-offset Diff. For each electronic equipment, a unique mapping relationship table of effective value D1-offset Diff can be obtained.

[0018] In one embodiment, in step S40, if the current valid value D1 does not have a corresponding value in the preset valid value D1-offset Diff mapping table, then the partition in the valid value D1-offset Diff mapping table where the current valid value D1 is located is found, and the average of the offsets Diff corresponding to the two endpoints of the partition where the current valid value D1 is located is used as the offset Diff output corresponding to the current valid value D1. Considering that it is impossible to exhaustively cover all possible valid values ​​D1 when creating the valid value D1-offset Diff mapping table, if the current valid value D1 does not have a corresponding value in the preset valid value D1-offset Diff mapping table, then the average of the offsets Diff mapped to the two endpoints of the partition where the current valid value D1 is located is used as the offset Diff output corresponding to the current valid value D1.

[0019] In one embodiment, in step S10, the periodic variable signal is sampled by an AD converter using a timer.

[0020] Meanwhile, the present invention also provides an AD sampling processing system based on periodic variable signals.

[0021] An AD sampling processing system based on a periodic variable signal is provided, which is controlled by the AD sampling processing method based on a periodic variable signal in any of the above embodiments.

[0022] The aforementioned AD sampling system based on a periodic variable signal performs a sum-of-squares operation on the sampled values ​​dx collected within one period T0 of the variable signal, followed by averaging at preset time intervals T1. This sum-of-squares averaging method can be used to measure signal power, yielding results with minimal oscillation amplitude when the input power remains constant. Therefore, this method eliminates the need to consider factors such as DC bias, full-wave or half-wave characteristics, or voltage division ratios. A relatively constant value, the effective value D1, can be obtained while maintaining constant input power. The effective value D1 is then used to look up the offset Diff in a table, and the sum of D1 and Diff yields the actual value D0. This design eliminates the need for the MCU of the electronic device to perform calculations based on preset algorithms of different hardware circuits when executing AD sampling tasks, thereby reducing computational load and improving reliability. Attached Figure Description

[0023] Figure 1 This is a flowchart of an AD sampling processing method based on a periodic variable signal, according to an embodiment of the present invention. Detailed Implementation

[0024] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Many specific details are set forth in the following description to provide a thorough understanding of the present invention. However, the present invention can be practiced in many other ways different from those described herein, and those skilled in the art can make similar modifications without departing from the spirit of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0025] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," "counterclockwise," "axial," "radial," and "circumferential" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.

[0026] 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, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0027] In this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," "linking," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components, unless otherwise explicitly limited. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0028] In this invention, unless otherwise explicitly specified and limited, "above" or "below" the second feature can mean that the first feature is in direct contact with the second feature, or that the first feature is in indirect contact with the second feature through an intermediate medium. Furthermore, "above," "over," and "on top" of the second feature can mean that the first feature is directly above or diagonally above the second feature, or simply that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature can mean that the first feature is directly below or diagonally below the second feature, or simply that the first feature is at a lower horizontal level than the second feature.

[0029] It should be noted that when an element is referred to as being "fixed to" or "set on" another element, it can be directly on the other element or there may be an intervening element. When an element is considered to be "connected to" another element, it can be directly connected to the other element or there may be an intervening element. The terms "vertical," "horizontal," "upper," "lower," "left," "right," and similar expressions used herein are for illustrative purposes only and do not represent the only possible implementation.

[0030] like Figure 1 As shown, this is an embodiment of the AD sampling processing method based on a periodic variable signal according to the present invention.

[0031] like Figure 1 As shown, this AD sampling processing method based on periodic variable signals includes the following steps:

[0032] S10: Perform AD sampling on the periodic variable signal; wherein, the periodic variable signal is sampled once at intervals of Δt to obtain the sampled value dx; wherein, Δt=(T0 / N1), T0 is the period of change of the periodic variable signal, and N1 is a positive integer.

[0033] For example, in step S10, the periodic variable signal is sampled by an AD converter using a timer.

[0034] In step S10, to ensure effective sampling of the periodic variable signal during AD sampling, the sampling interval Δt must not exceed the period T0 of the periodic variable signal. Therefore, in this scheme, Δt is set to 1 / N1 of T0. It should be noted that this scheme is for AD sampling of a known periodic variable signal; therefore, T0 of the periodic variable signal is a known value.

[0035] Preferably, in step S10, if the number of bits in the AD sampling is greater than 8, the sampled value dx is right-shifted so that the number of bits in dx does not exceed 8. To reduce the computational load on the MCU, when the number of bits in the AD sampling is greater than 8, the sampled value dx is right-shifted to reduce the number of bits in dx, keeping it within 8 bits. For example, if 10-bit AD sampling is used, the sampling result is amplitude-limited, and the sampled value dx is right-shifted by 2 bits, limiting it to within 8 bits (i.e., within 2 to the power of 8).

[0036] S20: SUM(∑dx) is obtained by summing the squares of the sampled values ​​dx collected within one period T0 of the periodic variable signal. 2 ).

[0037] For example, in step S20, if 100 valid sample values ​​dx are collected within one period T0, then the squares of each sample value dx are summed to obtain SUM(∑dx). 2 ).

[0038] S30: Calculate SUM(∑dx) within the interval T1. 2 The effective value D1 is obtained by averaging; where T1 = N2 * T0, and N2 is a positive integer.

[0039] In step S30, with a calculation period of not less than 2 periods T0 as one calculation period T1, all SUM(∑dx) within the calculation period T1 are processed. 2The summation is then used to calculate the average value, thus obtaining the effective value D1. Steps S20 and S3 are the core processing steps of this scheme. The average method of summation of squares can be used to measure the power of the signal. When the input power remains constant, a result with a very small oscillation amplitude can be obtained. The purpose is to find the corresponding effective value based on the input power, thereby ignoring the algorithmic effects caused by the specific hardware settings in the circuit, such as DC bias, full-wave or half-wave processing, and voltage division ratio, etc., so that no filtering algorithm needs to be introduced in the subsequent process.

[0040] Furthermore, in step S30, the value of N2 is a positive integer not less than 2. When the value of N2 is larger, the interference of noise can be reduced by sampling over multiple periods, thereby reducing the impact of noise on the calculation results and achieving a filtering effect. Therefore, the value of N2 is preferably a positive integer not less than 2.

[0041] S40: Find the offset Diff mapped to the valid value D1 in step S30 from the preset mapping table of valid value D1 and offset Diff, and then sum the valid value D1 and offset Diff to obtain the actual value D0.

[0042] In step S40, the mapping table of effective value D1 and offset Diff is a table that is pre-stored in the storage unit of the circuit. After obtaining the effective value D1 in step S30, the corresponding offset Diff can be found by looking up the table. Then, the actual value D0 can be obtained by summing the effective value D1 and the offset Diff, that is, D0 = D1 + Diff.

[0043] In this embodiment, the method for obtaining the mapping table of effective value D1 and offset Diff includes the following steps:

[0044] S01: The frequency converter provides a signal source to the electronic equipment and performs AD sampling processing.

[0045] S02: Gradually adjust the output signal of the frequency converter to the electronic equipment according to the preset signal strength interval and record the actual value D0' at each adjustment; at the same time, execute steps S10, S20 and S30 to obtain the effective value D1 corresponding to each actual value D0', calculate the difference between each effective value D1 and the corresponding actual value D0, and obtain the offset Diff = D0' - D1;

[0046] S03: Establish and archive the mapping table between valid value D1 and offset Diff.

[0047] As an adjustable and stable signal source, the frequency converter is used to simulate the periodic variable signal when electronic equipment is working. By gradually adjusting the signal strength, the mapping relationship between the actual value D0' and the offset Diff calculated according to steps S10 to S30 is measured, thereby establishing a mapping relationship table of effective value D1-offset Diff. For each electronic equipment, a unique mapping relationship table of effective value D1-offset Diff can be obtained.

[0048] Further, in step S40, if the current valid value D1 has no corresponding value in the preset mapping table of valid value D1-offset Diff, then the partition in the mapping table of valid value D1-offset Diff where the current valid value D1 is located is found, and the average of the offsets Diff corresponding to the two endpoints of the partition where the current valid value D1 is located is used as the offset Diff output corresponding to the current valid value D1. Considering that it is impossible to exhaustively cover all possible valid values ​​D1 when creating the mapping table of valid value D1-offset Diff, if the current valid value D1 has no corresponding value in the preset mapping table of valid value D1-offset Diff, then the average of the offsets Diff mapped to the two endpoints of the partition where the current valid value D1 is located is used as the offset Diff output corresponding to the current valid value D1.

[0049] Brief description of working principle:

[0050] The sampled values ​​dx collected within one period T0 of the variable signal are summed by squares and then averaged over a preset time interval T1. This sum-of-squares averaging method can be used to measure signal power, yielding results with very small oscillation amplitudes when the input power remains constant. Therefore, this method eliminates the need to consider whether the circuit has DC bias, whether it's a full-wave or half-wave signal, or the voltage division ratio. A relatively constant value, the effective value D1, can be obtained while ensuring the input power remains constant. The offset Diff is then mapped from the effective value D1 using a lookup table, resulting in the actual value of the periodic variable signal, D0 = D1 + Diff.

[0051] The aforementioned AD sampling processing method based on periodic variable signals eliminates the need for the MCU of electronic devices to perform calculations according to the preset algorithms of different hardware circuits when executing AD sampling tasks, thereby reducing the amount of computation and improving reliability.

[0052] To make it easier to understand, let's take AC voltage sampling at 50Hz (corresponding to a period of 20ms) as an example:

[0053] During sampling, the AC voltage is sampled by AD at 100μs intervals using a timer to obtain the sampled value dx. Therefore, the number of samplings within a 20ms interval is 200.

[0054] Next, the sum of squares of the 200 sampled values ​​is calculated to obtain SUM(∑dx). 2 ).

[0055] Next, at 200ms intervals, the above SUM(∑dx) is... 2 Calculate the average value to obtain the effective value D1.

[0056] Finally, based on the obtained valid value D1, look up the table to find the offset Diff that it maps to, and then the actual value D0 = D1 + Diff.

[0057] The mapping table between valid value D1 and offset Diff is as follows:

[0058] Serial Number D1 value / V Offset Diff / V 0 28 82 1 30 85 2 34 86 3 37 88 4 41 89 5 43 92 6 47 93 7 50 95 8 54 96 9 58 97 10 62 98 11 66 99 12 70 100 13 75 100 14 79 101 15 84 101 16 89 101 17 94 101 18 99 101 19 104 101 20 109 101 21 114 101 22 120 100 23 126 99 24 131 99 25 138 97 26 143 97 27 150 95 28 156 94 29 163 92 30 169 91

[0059] For example, if the effective value D1 calculated according to the AD sampling processing method of this scheme is 28, then the offset can be found to be 82 by looking up the table, and the actual value D0 = 28 + 82 = 110.

[0060] For example, if the effective value D1 calculated according to the AD sampling processing method of this scheme is 40, then by looking up the table, we can see that when the effective value D1 is 40, it is located in the [37, 41] partition of the D1 value. Therefore, the offset Diff corresponding to the effective value D1 at this time is (88+89) / 2 = 88.5. At this time, by default, the value after the decimal point is discarded in the MCU's calculation (common MCU specifications do not have the ability to round, and choose to directly erase the decimal places), so the offset Diff is 88, and the actual value D0 = 40+88 = 128.

[0061] Furthermore, the AD sampling processing method for AC voltage described above was verified using a frequency converter as the signal source. In this case, the voltage output by the frequency converter is the most accurate true value D0'. The electronic device's program executes the AD sampling method described above to obtain the calculated actual value D0. The error between D0' and D0 is compared, i.e., δ = ABS(D0 - D0') / D0', where ABS is the symbol for the absolute value function in an Excel spreadsheet. The results are as follows:

[0062]

[0063] Meanwhile, the present invention also provides an AD sampling processing system based on periodic variable signals.

[0064] The AD sampling processing system based on periodic variable signals is controlled using the AD sampling processing method based on periodic variable signals from any of the above embodiments.

[0065] The aforementioned AD sampling system based on a periodic variable signal performs a sum-of-squares operation on the sampled values ​​dx collected within one period T0 of the variable signal, followed by averaging at preset time intervals T1. This sum-of-squares averaging method can be used to measure signal power, yielding results with very small oscillation amplitudes when the input power remains constant. Therefore, this method eliminates the need to consider factors such as DC bias, full-wave or half-wave characteristics, or voltage division ratios. A relatively constant value, the effective value D1, can be obtained while maintaining constant input power. The offset Diff is then mapped from the effective value D1 using a lookup table, resulting in the actual value of the periodic variable signal, D0 = D1 + Diff. This design eliminates the need for the MCU in electronic devices to perform calculations based on preset algorithms from different hardware circuits when executing AD sampling tasks, thus reducing computational load and improving reliability.

[0066] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0067] The above embodiments merely illustrate preferred implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the invention. 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, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention should be determined by the appended claims.

Claims

1. An AD sampling processing method based on a periodic variable signal, characterized in that, Including the following steps: S10: Perform AD sampling on the periodic variable signal; wherein, the periodic variable signal is sampled once at intervals of Δt to obtain the sampled value dx; wherein, Δt=(T0 / N1), T0 is the period of change of the periodic variable signal, and N1 is a positive integer; S20: SUM(∑dx) is obtained by summing the squares of the sampled values ​​dx collected within one period T0 of the periodic variable signal. 2 ); S30: Calculate SUM(∑dx) within the interval T1. 2 The effective value D1 is obtained by averaging; where T1 = N2 * T0, and N2 is a positive integer; S40: Find the offset Diff mapped to the effective value D1 in step S30 from the preset mapping table of effective value D1-offset Diff, then the actual value of the periodic variable signal D0 = D1 + Diff. The method for obtaining the mapping table of the effective value D1 and the offset Diff includes the following steps: S01: The frequency converter provides a signal source for electronic equipment and performs AD sampling processing; S02: Gradually adjust the output signal of the frequency converter to the electronic equipment according to the preset signal strength interval and record the actual value D0' at each adjustment; at the same time, execute steps S10, S20 and S30 to obtain the effective value D1 corresponding to each actual value D0', calculate the difference between each effective value D1 and the corresponding actual value D0', and obtain the offset Diff = D0' - D1. S03: Establish and archive the mapping table between valid value D1 and offset Diff; Furthermore, in step S40, if the current valid value D1 does not have a corresponding value in the preset mapping table of valid value D1-offset Diff, then the partition in the mapping table of valid value D1-offset Diff where the current valid value D1 is located is found, and the offset Diff corresponding to the two endpoints of the partition where the current valid value D1 is located is averaged and output as the offset Diff corresponding to the current valid value D1.

2. The AD sampling processing method based on a periodic variable signal according to claim 1, characterized in that, In step S10, if the number of bits in the AD sampling is greater than 8, the sampled value dx is right-shifted so that the number of bits in the sampled value dx does not exceed 8.

3. The AD sampling processing method based on a periodic variable signal according to claim 1, characterized in that, In step S30, N2 takes the value of a positive integer not less than 2.

4. The AD sampling processing method based on a periodic variable signal according to claim 1, characterized in that, In step S10, the periodic variable signal is sampled by an AD converter using a timer.

5. An AD sampling and processing system based on a periodic variable signal, characterized in that, The control is performed using the AD sampling processing method based on periodic variable signals as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • TIADC system DC bias and gain error calibration method and device

    CN112087232A

  • Ac current measuring circuit

    JP2003254999A