Method, device and equipment for detecting amplitude and frequency of power supply
By designing hardware processing circuits and microprocessor algorithms, the circuit design was simplified, costs were reduced, and errors were avoided, enabling high-precision detection of AC power supply parameters.
Patent Information
- Application Number
- CN202511142419.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-15
- Publication Date
- 2025-11-11
AI Technical Summary
Existing AC power supply parameter detection solutions have complex hardware circuits, suffer from frequency measurement errors, and are costly.
The AC signal is processed by a first attenuation circuit, an addition circuit, a second attenuation circuit, and a filtering circuit. Combined with a microprocessor algorithm, the frequency spectrum and amplitude spectrum are obtained through Fourier transform, eliminating the need for a voltage comparator and a discrete ADC module.
It simplifies circuit design, reduces production costs, avoids errors caused by comparator threshold voltage drift, and achieves high-precision detection of power supply amplitude and frequency.
Smart Images

Figure CN120928033A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of power supply parameter detection technology, and in particular to a method, apparatus and equipment for detecting power supply amplitude and frequency. Background Technology
[0002] On-site, accurate detection of AC power parameters is crucial for ensuring the safe operation of equipment. Current mainstream detection solutions employ a three-stage signal processing architecture: first, a linear transformer converts the AC signal into a safe 0-3V signal; this signal is then separated by an analog channel, and the frequency detection branch generates a square wave pulse using a voltage comparator, which is then used to calculate the frequency via a microprocessor input capture function; the amplitude detection branch requires an external bipolar analog-to-digital converter (ADC) chip, along with an RC filter network, to achieve RMS conversion. However, this architecture has two significant drawbacks: first, the complex hardware circuitry and comparator threshold drift can lead to frequency measurement errors; second, the discrete ADC module increases the production cost of the device. Summary of the Invention
[0003] This invention provides a method, apparatus, and equipment for detecting power supply amplitude and frequency, which solves the problems of high cost and measurement error in AC power supply parameter detection.
[0004] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows: This invention provides a method for detecting power supply amplitude and frequency, comprising: The power signal obtained by the AC current under test passing through the first attenuation circuit, the addition circuit, the second attenuation circuit, and the filtering circuit is acquired. Based on the power signal, the first array of data and frequency resolution are obtained; The first array of data is restored to obtain the second array of data; Add Hanning windows and flat top windows to the second array of data respectively to obtain the third array of data and the fifth array of data; Based on the third array data and the fifth array data, the frequency spectrum and amplitude spectrum are obtained; The power supply frequency is obtained based on the frequency spectrum and frequency resolution. The power supply amplitude is obtained based on the amplitude spectrum.
[0005] Optionally, the power signal obtained by the AC current under test passing through the first attenuation circuit, the addition circuit, the second attenuation circuit, and the filtering circuit includes: The AC current under test is processed by a first attenuation circuit to obtain a first signal; the AC current under test has the same frequency as the first signal. The first signal is processed by an adder circuit to obtain the second signal; The second signal is processed by the second attenuation circuit to obtain the third signal; The third signal is processed by a filtering circuit to obtain a power signal.
[0006] Optionally, the third signal is processed by a filtering circuit to obtain a power supply signal, including: The low-frequency noise in the third signal is filtered out by a high-pass filter to obtain the intermediate signal; The power signal is obtained by filtering out high-frequency noise in the intermediate signal using a low-pass filter.
[0007] Optionally, based on the power signal, a first array of data and a frequency resolution are obtained, including: The sampled values of the power signal are stored in an array to obtain the first array data; The frequency resolution is obtained based on the sampling frequency and the number of sampling points of the power signal.
[0008] Optionally, the first array of data is subjected to signal reconstruction to obtain a second array of data, including: according to The first array of data is restored to obtain the second array of data; in, This is the data for the second array; This represents the number of sampling points; represents the sampled values of the analog-to-digital converter in the first array of data; k is the resolution of the analog-to-digital converter; This is the reference voltage value for the analog-to-digital converter; The voltage value added to the adder circuit; It is the product of the attenuation ratios of the first attenuation circuit and the second attenuation circuit.
[0009] Optionally, Hanning windows and flat-top windows are applied to the second array of data to obtain the third and fifth arrays of data, including: Add a Hanning window to the second array of data to obtain the third array of data; Add a flat-top window to the second array of data to obtain the fifth array of data.
[0010] Optionally, based on the third array of data and the fifth array of data, the frequency spectrum and amplitude spectrum are obtained, including: Perform a Fast Fourier Transform on the third array of data to obtain the frequency spectrum; Perform a Fast Fourier Transform on the fifth array of data to obtain the amplitude spectrum.
[0011] This invention also provides a power supply amplitude and frequency detection device, comprising: The acquisition module is used to acquire the power signal obtained by the AC power under test passing through the first attenuation circuit, the addition circuit, the second attenuation circuit, and the filtering circuit; The processing module is configured to: obtain a first array of data and a frequency resolution based on the power signal; perform signal restoration on the first array of data to obtain a second array of data; apply Hanning windows and flat-top windows to the second array of data to obtain a third array of data and a fifth array of data; obtain a frequency spectrum and an amplitude spectrum based on the third array of data and the fifth array of data; obtain the power frequency based on the frequency spectrum and the frequency resolution; and obtain the power amplitude based on the amplitude spectrum.
[0012] This invention also provides a computing device, including: a processor and a memory storing a computer program, wherein the computer program, when run by the processor, executes the above-described method.
[0013] This invention also provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the above-described method.
[0014] The technical solution of the present invention has at least the following effects: The above-described solution of the present invention acquires the power signal obtained by the AC power under test through a first attenuation circuit, an addition circuit, a second attenuation circuit, and a filtering circuit; obtains a first array of data and a frequency resolution based on the power signal; performs signal restoration on the first array of data to obtain a second array of data; applies Hanning windows and flat-top windows to the second array of data to obtain a third array of data and a fifth array of data; obtains a frequency spectrum and an amplitude spectrum based on the third array of data and the fifth array of data; obtains the power frequency based on the frequency spectrum and the frequency resolution; and obtains the power amplitude based on the amplitude spectrum. This eliminates the use of a voltage comparator and a discrete ADC module, thereby simplifying the circuit design, reducing production costs, and avoiding errors caused by comparator threshold voltage drift, achieving high-precision detection of power amplitude and frequency. Attached Figure Description
[0015] Figure 1 This is a flowchart of the power supply amplitude and frequency detection method provided in the embodiments of the present invention; Figure 2 This is a detection circuit diagram provided in an embodiment of the present invention; Figure 3 This is a flowchart of the microprocessor algorithm provided in an embodiment of the present invention; Figure 4 This is a structural diagram of the power amplitude and frequency detection device provided in an embodiment of the present invention; Figure 5This is a schematic diagram of the structure of the computing device provided in an embodiment of the present invention. Detailed Implementation
[0016] Exemplary embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this invention will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
[0017] like Figure 1 and Figure 3 As shown, an embodiment of the present invention proposes a method for detecting power supply amplitude and frequency, comprising: Step 11: Obtain the power signal obtained by the AC power under test passing through the first attenuation circuit, the addition circuit, the second attenuation circuit, and the filtering circuit; Step 12: Obtain the first array of data and frequency resolution based on the power signal; Step 13: Perform signal restoration on the first array of data to obtain the second array of data; Step 14: Add Hanning windows and flat top windows to the second array data respectively to obtain the third array data and the fifth array data; Step 15: Obtain the frequency spectrum and amplitude spectrum based on the third array data and the fifth array data; Step 16: Obtain the power supply frequency based on the frequency spectrum and frequency resolution; Step 17: Obtain the power supply amplitude based on the amplitude spectrum.
[0018] In this embodiment, the first attenuation circuit is responsible for converting the AC power under test into a weak signal of the same frequency, preventing subsequent circuits from being damaged due to excessive input signals, and adjusting the signal to a range suitable for processing by subsequent circuits; the adder circuit can add the input signal to other specific signals, and is responsible for converting bipolar signals into unipolar signals; the second attenuation circuit is responsible for further attenuating the single-ended signal, ensuring that the output voltage does not exceed the reference voltage of the microprocessor's built-in A / D (Analog-to-Digital) converter; the filter circuit is responsible for filtering out low-frequency noise and high-frequency noise, allowing only signals within a specific frequency range to pass through, thereby obtaining a stable and pure signal; therefore, the AC power under test can form a power signal that can be acquired and processed by the microprocessor after passing through the first attenuation circuit, the adder circuit, the second attenuation circuit, and the filter circuit.
[0019] The first array of data consists of a series of discrete data points obtained after digitally sampling the power signal. Each data point is a power signal sample value, and a total of N values are sampled, resulting in an array with N sample values. According to the hardware conversion principle, the first array of data is the sampled value obtained after hardware processing. To obtain the true power signal, the first array of data needs to undergo signal restoration processing to obtain the second array of data. In spectrum analysis, the flat-top window is suitable for high-precision amplitude calculation, while the Hanning window has better frequency characteristics. Therefore, the flat-top window and the Hanning window are used respectively to weight the second array of data, resulting in the third array of data for frequency measurement and the fifth array of data for amplitude measurement. A fast Fourier transform is performed on the third and fifth arrays of data to obtain the frequency spectrum and amplitude spectrum, respectively. Using the frequency spectrum, the index corresponding to the maximum value of each element is found, and then... The power supply frequency is further obtained, where, It is the power supply frequency. It is the index corresponding to the maximum value of an element in the frequency spectrum. It is frequency resolution; by analyzing the amplitude spectrum, find the maximum value of each element in the amplitude spectrum, and then... Further, the power amplitude is obtained, where, It is the power supply amplitude. It is the maximum value of the elements in the amplitude spectrum, k is the resolution of the built-in A / D converter, and is an inherent value of the microprocessor. The reference voltage value for the built-in A / D converter is [value], and the value is an inherent value of the microprocessor. That is the resistance value of the first resistor. This is the resistance value of the second resistor.
[0020] This technical solution simplifies complex hardware circuits by designing hardware processing circuits and microprocessor algorithms, thereby reducing power supply detection errors and compressing detection costs.
[0021] like Figure 2 As shown, in an optional embodiment of the present invention, step 11 may include: Step 111: The AC current under test is processed by the first attenuation circuit to obtain a first signal; the AC current under test has the same frequency as the first signal. Step 112: Process the first signal using an adder circuit to obtain the second signal; Step 113: The second signal is processed by the second attenuation circuit to obtain the third signal; Step 114: Process the third signal through a filtering circuit to obtain a power signal, including: filtering out low-frequency noise in the third signal through a high-pass filter to obtain an intermediate signal; and filtering out high-frequency noise in the intermediate signal through a low-pass filter to obtain a power signal.
[0022] In this embodiment, step 111, the first attenuation circuit, represented by S1, includes a voltage transformer, a first resistor R1 located at the signal input terminal, and a second resistor R2 located at the signal output terminal. The second resistor R2 is grounded. The amplitude of the first signal voltage after processing by the first attenuation circuit is then... Step 112: The adder circuit, represented by S2, includes a third resistor R3 at the signal input terminal, a fifth resistor R5 connected to the second end of the third resistor R3, a fourth resistor R4 connected to the connection point of the second end of the third resistor R3 and the first end of the fifth resistor R5, and an operational amplifier U1. The first end of the fifth resistor R5 is connected to the inverting input terminal of the operational amplifier U1, and the second end of the fifth resistor R5 is connected to the output terminal of the operational amplifier U1. The non-inverting input terminal of the operational amplifier U1 is grounded, forming a feedback circuit. Simultaneously, the resistance values of the third resistor R3, the fourth resistor R4, and the fifth resistor R5 are equal. To ensure that the output terminal always has a single-ended signal, the voltage amplitude at the input terminal of the fourth resistor R4 needs to be greater than the voltage amplitude at the input terminal of the third resistor R3. At this time, the second signal voltage amplitude output by the adder circuit is... Step 113: The second attenuation circuit, represented by S3, includes a sixth resistor R6 at the signal input terminal and a seventh resistor R7 whose first end is connected to the second end of the sixth resistor R6. The second end of the seventh resistor R7 is grounded. The sixth resistor R6 and the seventh resistor R7 form a voltage divider circuit to attenuate the input signal. The third signal voltage amplitude after passing through the second attenuation circuit... Step 114, the filtering circuit, represented by S4, includes a high-pass filter composed of a first capacitor C1 and an eighth resistor R8, and a low-pass filter composed of a ninth resistor R9 and a second capacitor C2, based on the lowest frequency. The high-pass filter can filter out The following low-frequency noise is used to obtain an intermediate signal, based on the highest frequency. The low-pass filter can filter out The above high-frequency noise is thus eliminated, resulting in a power signal with noise interference removed. Among them, The measured voltage amplitude; The amplitude of the first signal voltage; It is the applied voltage amplitude in the adder circuit; The amplitude of the second signal voltage; The third signal voltage amplitude; This represents the resistance value of the first resistor; This represents the resistance value of the second resistor; This represents the resistance value of the sixth resistor; This represents the resistance value of the seventh resistor; This represents the resistance value of the first resistor; This represents the resistance value of the second resistor; This is the capacitance value of the first capacitor; This is the capacitance value of the second capacitor.
[0023] In an optional embodiment of the present invention, step 12 may include: Step 121: Store the sampled values of the power signal into an array to obtain the first array data; Step 122: Obtain the frequency resolution based on the sampling frequency and number of sampling points of the power signal.
[0024] In this embodiment, the microprocessor is represented by S5. In step 121, the microprocessor acquires the power signal through its built-in A / D converter and stores the sampled values into an array to obtain the first array data. In step 122, according to The frequency resolution is obtained, and the frequency measurement accuracy can be effectively improved by increasing the number of sampling points. Here, N is the number of sampling points; n is the sampled value of the microprocessor's built-in A / D converter. Frequency resolution; The sampling frequency.
[0025] In an optional embodiment of the present invention, step 13 may include: Step 131, according to The first array of data is restored to obtain the second array of data; in, This is the data for the second array; This represents the number of sampling points; represents the sampled values of the analog-to-digital converter in the first array of data; k is the resolution of the analog-to-digital converter; This is the reference voltage value for the analog-to-digital converter; The voltage value added to the adder circuit; It is the product of the attenuation ratios of the first attenuation circuit and the second attenuation circuit.
[0026] In this embodiment, according to the hardware conversion principle, the first array of data is a sampled value obtained after hardware circuit processing, and is not the actual power signal. To obtain the actual power signal, it is necessary to restore the signal of the first array of data by performing the inverse operation of the signal processing circuit on the first array of data to obtain the second array of data. , Where N is the number of sampling points; n is the sampled value of the built-in A / D converter in the first array of data; k is the resolution of the built-in A / D converter, which is an inherent value of the microprocessor; The reference voltage value for the built-in A / D converter is , and the value is inherent to the microprocessor. The voltage value added to the adding circuit, It is the product of the attenuation ratios of the first attenuation circuit and the second attenuation circuit, i.e. , This represents the resistance value of the first resistor. This represents the resistance value of the second resistor. This represents the resistance value of the sixth resistor. This represents the resistance value of the seventh resistor.
[0027] In an optional embodiment of the present invention, step 14 may include: Step 141: Add a Hanning window to the second array of data to obtain the third array of data; Step 142: Add a flat-top window to the second array data to obtain the fifth array data.
[0028] In this embodiment, in the field of spectrum analysis, the flat-top window is suitable for high-precision amplitude calculation, while the Hanning window has better frequency characteristics. Therefore, in practical applications, the flat-top window is used for power supply amplitude calculation, and the Hanning window is used for power supply frequency calculation. In step 141, the sampled value data in the second array data is subjected to a Hanning window, according to... The intermediate frequency data is obtained, and N intermediate frequency data are stored in an array to obtain the third array data. In step 142, a flat-top window is added to the sampled value data in the second array data, according to... , Obtain the intermediate amplitude data, store N intermediate amplitude data into an array, and obtain the fifth array data. .in, It is the intermediate frequency data, which is the element value of the third array data; is the intermediate amplitude data, which is the element value of the fifth array data; m is the element value of the second array data; N is the number of sampling points.
[0029] In an optional embodiment of the present invention, step 15 may include: Step 151: Perform a fast Fourier transform on the third array of data to obtain the frequency spectrum; Step 152: Perform a fast Fourier transform on the fifth array of data to obtain the amplitude spectrum.
[0030] In this embodiment, according to The frequency spectrum was obtained. ,according to The amplitude spectrum was obtained. ;in, Frequency spectrum; Amplitude spectrum; It is the third array of data; This is the fifth array of data; N is the number of sampling points, which is the number of elements in the third array of data; x is the original index of the third array of data, ranging from... p is the original index of the third array data, and its range is... j is the imaginary unit; e is a constant; y is the original index of the frequency spectrum array, ranging from... ; q is the original index of the amplitude spectrum array, ranging from .
[0031] A specific embodiment of the power amplitude and frequency detection method provided in this invention is as follows: Step 1: The AC current under test is processed by the first attenuation circuit to obtain a first signal, the voltage amplitude of which is then... The first signal is processed by an adder circuit to obtain a second signal, the voltage amplitude of which is... The second signal is processed by a second attenuation circuit to obtain a third signal, wherein the voltage amplitude of the third signal is... The third signal is processed by a filtering circuit to obtain a power supply signal, specifically based on the lowest frequency. The high-pass filter can filter out The following low-frequency noise is used to obtain an intermediate signal, based on the highest frequency. The low-pass filter can filter out The above high-frequency noise is thus eliminated, resulting in a power signal with noise interference removed. Among them, The measured voltage amplitude; The amplitude of the first signal voltage; It is the applied voltage amplitude in the adder circuit; The amplitude of the second signal voltage; The third signal voltage amplitude; This represents the resistance value of the first resistor; This represents the resistance value of the second resistor; This represents the resistance value of the sixth resistor; This represents the resistance value of the seventh resistor; This represents the resistance value of the first resistor; This represents the resistance value of the second resistor; This is the capacitance value of the first capacitor; This is the capacitance value of the second capacitor.
[0032] Step 2: The microprocessor acquires the power signal through its built-in A / D converter and stores the sampled values into an array to obtain the first array of data. ;according to The frequency resolution is obtained, and the frequency measurement accuracy can be effectively improved by increasing the number of sampling points. Here, N is the number of sampling points; n is the sampled value of the microprocessor's built-in A / D converter. Frequency resolution; The sampling frequency.
[0033] Step 3: Perform signal restoration on the first array of data. Then, perform the inverse operation of the signal processing circuit on the first array of data to obtain the second array of data. , Where N is the number of sampling points; n is the sampled value of the built-in A / D converter in the first array of data; k is the resolution of the built-in A / D converter, which is an inherent value of the microprocessor; The reference voltage value for the built-in A / D converter is , and the value is inherent to the microprocessor. The voltage value added to the adding circuit, It is the product of the attenuation ratios of the first attenuation circuit and the second attenuation circuit, i.e. , This represents the resistance value of the first resistor. This represents the resistance value of the second resistor. This represents the resistance value of the sixth resistor. This represents the resistance value of the seventh resistor.
[0034] Step 4: Apply a Hanning window to the sampled values in the second array, based on... The intermediate frequency data is obtained, and N intermediate frequency data are stored in an array to obtain the third array data. Add a flat-top window to the sampled values in the second array, based on... , Obtain the intermediate amplitude data, store N intermediate amplitude data into an array, and obtain the fifth array data. .in, It is the intermediate frequency data, which is the element value of the third array data; is the intermediate amplitude data, which is the element value of the fifth array data; m is the element value of the second array data; N is the number of sampling points.
[0035] Step 5, according to The frequency spectrum was obtained. ,according to The amplitude spectrum was obtained. ;in, Frequency spectrum; Amplitude spectrum; It is the third array of data; This is the fifth array of data; N is the number of sampling points, which is the number of elements in the third array of data; x is the original index of the third array of data, ranging from... p is the original index of the third array data, and its range is... j is the imaginary unit; e is a constant; y is the original index of the frequency spectrum array, ranging from... ; q is the original index of the amplitude spectrum array, ranging from .
[0036] Step 6: Find the index corresponding to the maximum value of an element in the frequency spectrum, based on... The power supply frequency is further obtained; where, It is the power supply frequency; It is the index corresponding to the maximum value of an element in the frequency spectrum; It refers to frequency resolution.
[0037] Step 7: Find the maximum value of each element in the amplitude spectrum, based on... The power amplitude is further obtained; among which, It is the power supply amplitude; It is the maximum value of the elements in the amplitude spectrum; k is the resolution of the built-in A / D converter, which is an inherent value of the microprocessor; The reference voltage value for the built-in A / D converter is , and the value is inherent to the microprocessor. This is the resistance value of the first resistor; This is the resistance value of the second resistor.
[0038] The present invention proposes a power supply amplitude and frequency detection method, which reduces the use of circuit components and lowers the detection cost by designing hardware processing circuits and microprocessor algorithms, and achieves accurate detection of power supply amplitude and frequency.
[0039] like Figure 4 As shown, this embodiment of the invention also provides a power amplitude and frequency detection device 40, comprising: The acquisition module 41 is used to acquire the power signal obtained by the AC power under test passing through the first attenuation circuit, the addition circuit, the second attenuation circuit and the filtering circuit; Processing module 42 is configured to: obtain a first array of data and a frequency resolution based on the power signal; perform signal restoration on the first array of data to obtain a second array of data; apply Hanning windows and flat top windows to the second array of data to obtain a third array of data and a fifth array of data; obtain a frequency spectrum and an amplitude spectrum based on the third array of data and the fifth array of data; obtain the power frequency based on the frequency spectrum and the frequency resolution; and obtain the power amplitude based on the amplitude spectrum.
[0040] Optionally, module 41 is specifically used for: The AC current under test is processed by a first attenuation circuit to obtain a first signal; the AC current under test has the same frequency as the first signal. The first signal is processed by an adder circuit to obtain the second signal; The second signal is processed by the second attenuation circuit to obtain the third signal; The third signal is processed by a filtering circuit to obtain a power signal.
[0041] Optionally, the third signal is processed by a filtering circuit to obtain a power supply signal, including: The low-frequency noise in the third signal is filtered out by a high-pass filter to obtain the intermediate signal; The power signal is obtained by filtering out high-frequency noise in the intermediate signal using a low-pass filter.
[0042] Optionally, processing module 42 is specifically used for: The sampled values of the power signal are stored in an array to obtain the first array data; The frequency resolution is obtained based on the sampling frequency and the number of sampling points of the power signal.
[0043] Optionally, the processing module 42 is also specifically used for: according to The first array of data is restored to obtain the second array of data; in, This is the data for the second array; This represents the number of sampling points; represents the sampled values of the analog-to-digital converter in the first array of data; k is the resolution of the analog-to-digital converter; This is the reference voltage value for the analog-to-digital converter; The voltage value added to the adder circuit; It is the product of the attenuation ratios of the first attenuation circuit and the second attenuation circuit.
[0044] Optionally, Hanning windows and flat-top windows are applied to the second array of data to obtain the third and fifth arrays of data, including: Add a Hanning window to the second array of data to obtain the third array of data; Add a flat-top window to the second array of data to obtain the fifth array of data.
[0045] Optionally, based on the third array of data and the fifth array of data, the frequency spectrum and amplitude spectrum are obtained, including: Perform a Fast Fourier Transform on the third array of data to obtain the frequency spectrum; Perform a Fast Fourier Transform on the fifth array of data to obtain the amplitude spectrum.
[0046] It should be noted that this device is a device corresponding to the above method. All implementation methods in the above method embodiments are applicable to this embodiment and can achieve the same technical effect.
[0047] like Figure 5 As shown, this embodiment of the invention also provides a computing device 50, including a processor 51, a memory 52, and a program or instructions stored in the memory 52 and executable on the processor 51. When the program or instructions are executed by the processor 51, they implement the various processes of the above-described power amplitude and frequency detection method embodiments and achieve the same technical effects. To avoid repetition, they will not be described again here. It should be noted that the computing device in this embodiment of the invention includes the above-described mobile electronic devices and non-mobile electronic devices.
[0048] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0049] Those skilled in the art will 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.
[0050] In the embodiments provided by this invention, it should be understood that the disclosed apparatus 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 through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0051] 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.
[0052] In addition, the functional units in the various embodiments of the present invention 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.
[0053] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a portion 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 of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0054] Furthermore, it should be noted that in the apparatus and method of the present invention, it is obvious that the components or steps can be decomposed and / or recombined. These decompositions and / or recombinations should be considered equivalent solutions of the present invention. Moreover, the steps performing the above series of processes can naturally be executed in the order described, but are not necessarily required to be executed in chronological order; some steps can be executed in parallel or independently of each other. Those skilled in the art will understand that all or any step or component of the method and apparatus of the present invention can be implemented in any computing device (including processors, storage media, etc.) or network of computing devices, in hardware, firmware, software, or a combination thereof. This is something that those skilled in the art can achieve by using their basic programming skills after reading the description of the present invention.
[0055] Therefore, the object of the present invention can also be achieved by running a program or a set of programs on any computing device. The computing device can be a known general-purpose device. Therefore, the object of the present invention can also be achieved simply by providing a program product containing program code for implementing the method or apparatus. That is, such a program product also constitutes the present invention, and the storage medium storing such a program product also constitutes the present invention. Obviously, the storage medium can be any known storage medium or any storage medium developed in the future. It should also be noted that in the apparatus and method of the present invention, it is obvious that the components or steps can be decomposed and / or recombined. These decompositions and / or recombinations should be considered equivalent to the present invention. Furthermore, the steps for performing the above series of processes can naturally be performed in the order described, but are not necessarily required to be performed in chronological order. Some steps can be performed in parallel or independently of each other.
[0056] The above are preferred embodiments of the present invention. It should be noted that, for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for detecting power supply amplitude and frequency, characterized in that, include: The power signal obtained by the AC current under test passing through the first attenuation circuit, the addition circuit, the second attenuation circuit, and the filtering circuit is acquired. Based on the power signal, the first array of data and frequency resolution are obtained; The first array of data is restored to obtain the second array of data; Add Hanning windows and flat top windows to the second array of data respectively to obtain the third array of data and the fifth array of data; Based on the third array data and the fifth array data, the frequency spectrum and amplitude spectrum are obtained; The power supply frequency is obtained based on the frequency spectrum and frequency resolution. The power supply amplitude is obtained based on the amplitude spectrum.
2. The power supply amplitude and frequency detection method according to claim 1, characterized in that, The power signal obtained by acquiring the AC power under test after passing through the first attenuation circuit, the addition circuit, the second attenuation circuit, and the filtering circuit includes: The AC current under test is processed by a first attenuation circuit to obtain a first signal; the AC current under test has the same frequency as the first signal. The first signal is processed by an adder circuit to obtain the second signal; The second signal is processed by the second attenuation circuit to obtain the third signal; The third signal is processed by a filtering circuit to obtain a power signal.
3. The power supply amplitude and frequency detection method according to claim 2, characterized in that, The third signal is processed by a filtering circuit to obtain a power supply signal, including: The low-frequency noise in the third signal is filtered out by a high-pass filter to obtain the intermediate signal; The power signal is obtained by filtering out high-frequency noise in the intermediate signal using a low-pass filter.
4. The power supply amplitude and frequency detection method according to claim 1, characterized in that, Based on the power signal, a first array of data and a frequency resolution are obtained, including: The sampled values of the power signal are stored in an array to obtain the first array data; The frequency resolution is obtained based on the sampling frequency and the number of sampling points of the power signal.
5. The power supply amplitude and frequency detection method according to claim 1, characterized in that, The first array of data is used for signal reconstruction to obtain the second array of data, which includes: according to The first array of data is restored to obtain the second array of data; in, This is the data for the second array; This represents the number of sampling points; represents the sampled values of the analog-to-digital converter in the first array of data; k is the resolution of the analog-to-digital converter; This is the reference voltage value for the analog-to-digital converter; The voltage value added to the adder circuit; It is the product of the attenuation ratios of the first attenuation circuit and the second attenuation circuit.
6. The power supply amplitude and frequency detection method according to claim 1, characterized in that, Applying Hanning and flat-top windows to the second array of data respectively yields the third and fifth arrays, including: Add a Hanning window to the second array of data to obtain the third array of data; Add a flat-top window to the second array of data to obtain the fifth array of data.
7. The power supply amplitude and frequency detection method according to claim 1, characterized in that, Based on the third array data and the fifth array data, the frequency spectrum and amplitude spectrum are obtained, including: Perform a Fast Fourier Transform on the third array of data to obtain the frequency spectrum; Perform a Fast Fourier Transform on the fifth array of data to obtain the amplitude spectrum.
8. A power supply amplitude and frequency detection device, characterized in that, The power amplitude and frequency detection device includes: The acquisition module is used to acquire the power signal obtained by the AC power under test passing through the first attenuation circuit, the addition circuit, the second attenuation circuit, and the filtering circuit; The processing module is configured to: obtain a first array of data and a frequency resolution based on the power signal; perform signal restoration on the first array of data to obtain a second array of data; apply Hanning windows and flat-top windows to the second array of data to obtain a third array of data and a fifth array of data; obtain a frequency spectrum and an amplitude spectrum based on the third array of data and the fifth array of data; obtain the power frequency based on the frequency spectrum and the frequency resolution; and obtain the power amplitude based on the amplitude spectrum.
9. A computing device, characterized in that, include: A processor, a memory storing a computer program, wherein the computer program, when executed by the processor, performs the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The system stores instructions that, when executed on a computer, cause the computer to perform the method as described in any one of claims 1 to 7.