AC / DC signal detection method, electronic equipment and storage medium

By using preset sampling frequencies and digital calculations to identify AC and DC signal types, the problems of long detection cycles and complex algorithms in existing technologies are solved, and fast and stable signal detection is achieved, making it suitable for resource-constrained scenarios.

CN120761697APending Publication Date: 2025-10-10XIAN MEGMEET ELECTRICAL CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510907413.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-01
Publication Date
2025-10-10

AI Technical Summary

Technical Problem

The AC and DC signal detection methods in the prior art have long detection cycles and complex algorithm structures, and cannot effectively prevent power failure or fluctuations in the output voltage caused by input type switching.

Method used

A preset sampling frequency is used to obtain a set number of voltage amplitudes in the input signal to be detected. The voltage mean and DC energy value are obtained through mean calculation. The DC energy value and total energy value are used to determine the AC and DC signal types. Digital calculation methods are used to eliminate the influence of signal amplitude, and only addition, multiplication and comparison operations are required.

Benefits of technology

It achieves fast AC and DC signal type recognition, improves algorithm robustness and power supply stability, is suitable for resource-constrained scenarios, supports high sampling rate signals, and avoids output voltage fluctuations caused by input type switching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120761697A_ABST
    Figure CN120761697A_ABST
Patent Text Reader

Abstract

The invention discloses an AC / DC signal detection method, electronic equipment and a storage medium. The AC / DC signal detection method comprises the following steps: acquiring a set number of voltage amplitudes in a to-be-detected input signal by adopting a preset sampling frequency; carrying out mean value calculation on the set number of voltage amplitudes to obtain a voltage mean value; multiplying the set number by the square value of the voltage mean value to obtain a direct current energy value; performing cumulative summation on the square value of each voltage amplitude to obtain a total energy value; and determining the AC / DC signal type of the to-be-detected input signal by using the DC energy value and the total energy value. Through the above mode, the AC / DC signal detection method eliminates the influence of the signal amplitude on the judgment result through a digital calculation means, improves the robustness of the algorithm, and achieves the rapid detection of the AC / DC voltage, thereby being capable of effectively avoiding the power failure or fluctuation of the output voltage caused by the switching of the input types, and improving the power supply stability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of signal detection technology, and in particular to an AC / DC signal detection method, an electronic device, and a storage medium. Background Art

[0002] Nowadays, as power supply scenarios become more and more diverse, power conversion and regulation methods are also becoming more and more diverse. In particular, power conversion circuits involving different input types usually need to be matched with different control modes. For example, when the power input of the power conversion circuit has two different input types, AC input and DC input, in order to adapt to different input types to control the power conversion circuit, it is necessary to first identify its input type. Especially after the input type changes, it is necessary to quickly identify and quickly switch the control strategy to ensure the stability of the power output. In short, the switching of input types is not allowed to cause power failure or fluctuation of the output voltage.

[0003] However, most of the solutions for detecting AC and DC signals in related technologies use voltage zero-crossing judgment or voltage variance judgment, which have long detection cycles and complex algorithm structures. Obviously, they cannot effectively prevent output voltage from losing power or fluctuating due to input type switching. Summary of the Invention

[0004] The main technical problem solved by this application is to provide an AC / DC signal detection method, an electronic device and a storage medium, which simplifies the control logic and can solve the problems of the AC / DC signal detection method in the prior art, such as long detection cycle, complex algorithm structure, and inability to effectively avoid power failure or fluctuation of the output voltage due to input type switching.

[0005] In order to solve the above technical problems, a technical solution adopted in the present application is: to provide an AC / DC signal detection method, wherein the AC / DC signal detection method includes: using a preset sampling frequency to obtain a set number of voltage amplitudes in the input signal to be detected; performing average calculation on the set number of voltage amplitudes to obtain a voltage mean; multiplying the set number by the square of the voltage mean to obtain a DC energy value; performing cumulative sum calculation on the square value of each voltage amplitude to obtain a total energy value; and using the DC energy value and the total energy value to determine the AC / DC signal type of the input signal to be detected.

[0006] Among them, using the DC energy value and the total energy value to determine the AC / DC signal type of the input signal to be detected includes: subtracting the DC energy value from the total energy value to obtain the alternating energy value; dividing the alternating energy value by the total energy value to obtain a first energy ratio; detecting whether the first energy ratio is greater than a first set threshold; if the first energy ratio is greater than the first set threshold, determining that the input signal to be detected is an AC signal.

[0007] The steps of the AC / DC signal detection method include: if the first energy ratio is not greater than a first set threshold, detecting whether the first energy ratio is less than a second set threshold; if the first energy ratio is less than the second set threshold, determining that the input signal to be detected is a DC signal.

[0008] The step of dividing the alternating energy value by the total energy value to obtain the first energy ratio includes: dividing the alternating energy value by the total energy value to obtain an initial energy ratio; and normalizing the initial energy ratio to obtain the first energy ratio.

[0009] Among them, using the DC energy value and the total energy value to determine the AC / DC signal type of the input signal to be detected includes: dividing the DC energy value by the total energy value to obtain a second energy ratio; detecting whether the second energy ratio is greater than a third set threshold; if the second energy ratio is greater than the third set threshold, determining that the input signal to be detected is an AC signal; if the second energy ratio is not greater than the third set threshold, detecting whether the second energy ratio is less than a fourth set threshold; if the second energy ratio is less than the fourth set threshold, determining that the input signal to be detected is a DC signal.

[0010] Among them, the step of using a preset sampling frequency to obtain a set number of voltage amplitudes in the input signal to be detected includes: using the preset sampling frequency to obtain a set number of voltage instantaneous values ​​in the input signal to be detected; performing a first-order recursive filtering operation on each voltage instantaneous value to obtain a set number of voltage amplitudes.

[0011] Among them, the step of obtaining a set number of voltage amplitudes in the input signal to be detected using a preset sampling frequency includes: obtaining the input signal to be detected; converting the input signal to be detected into a digital input signal; obtaining a set number of voltage amplitudes in the digital input signal using a preset sampling frequency; wherein the length of the data window obtained by dividing the set number by the preset sampling frequency is greater than or equal to the signal period of the input signal to be detected.

[0012] After the step of determining the AC / DC signal type of the input signal to be detected by using the DC energy value and the total energy value, the method further includes: sending the first control signal or the second control signal to the power conversion circuit in response to the currently determined AC / DC signal type.

[0013] To solve the above technical problems, another technical solution adopted in this application is: to provide an electronic device, wherein the electronic device includes a memory and a processor coupled to each other, and the processor is used to execute program instructions stored in the memory to implement the AC / DC signal detection method as described in any one of the above items.

[0014] To solve the above technical problems, another technical solution adopted in the present application is: providing a computer-readable storage medium having program instructions stored thereon, wherein when the program instructions are executed by a processor, any of the above AC and DC signal detection methods is implemented.

[0015] The beneficial effects of the present application are: different from the existing technology, the AC / DC signal detection method provided by the present application obtains a set number of voltage amplitudes in the input signal to be detected by adopting a preset sampling frequency, calculates the average of the set number of voltage amplitudes to obtain the voltage average, and multiplies the set number by the square of the voltage average to obtain the DC energy value, and accumulates and sums the square values ​​of each voltage amplitude to obtain the total energy value, so as to use the DC energy value and the total energy value to determine the AC / DC signal type of the input signal to be detected, thereby being able to eliminate the influence of the signal amplitude on the judgment result through digital calculation means and improve the robustness of the algorithm; and only requires addition, multiplication and comparison operations, the calculation complexity is linear order, the calculation complexity is low, and it is suitable for resource-constrained scenarios; the time consumption of a single judgment is linearly related to the number of sampling points, can support high sampling rate signals, and has high real-time performance; the detection speed of AC / DC voltages is also fast, thereby effectively avoiding power failure or fluctuation of the output voltage caused by input type switching, thereby improving the power supply stability. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present application. Those skilled in the art can also derive other drawings based on these drawings without inventive work, among which: Figure 1 This is a flow chart of the first embodiment of the AC / DC signal detection method of the present application; Figure 2 This is a structural diagram of an embodiment of an AC / DC signal detection circuit and a power conversion circuit of the present application; Figure 3 yes Figure 1 A schematic flow chart of an implementation method of S11; Figure 4 yes Figure 1 A schematic flow chart of another embodiment of S11; Figure 5 yes Figure 1 A schematic flow chart of an embodiment of S15; Figure 6 yes Figure 5 A schematic flow chart of an implementation method of S1512; Figure 7 yes Figure 1 A schematic flow chart of another embodiment of S15; Figure 8 This is a schematic structural diagram of an embodiment of the electronic device of the present application; Figure 9 It is a structural diagram of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION

[0017] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0018] The terms "first," "second," and "third" in this application 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 identified. Therefore, features specified as "first," "second," or "third" may explicitly or implicitly include at least one of such features. In the description of this application, "plurality" means at least two, for example, two, three, etc., unless otherwise specifically defined. All directional designations (such as up, down, left, right, front, back, etc.) in the embodiments of this application are intended only to illustrate the relative positional relationships and movement of components in a specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional designations will also change accordingly. Furthermore, the terms "including," "having," and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed, or may optionally include other steps or elements inherent to such process, method, product, or apparatus.

[0019] Reference herein to an "embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it refer to independent or alternative embodiments that are mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0020] The present application is described in detail below with reference to the accompanying drawings and implementation methods.

[0021] Please refer to Figure 1 , Figure 1This is a flow chart of the first embodiment of the AC / DC signal detection method of the present application. Specifically, it may include the following steps: S11: Acquire a set number of voltage amplitudes in the input signal to be detected using a preset sampling frequency.

[0022] Specifically, a suitable sampling frequency, i.e., a preset sampling frequency, is set according to the rated frequency of the AC signal in the input signal to be detected, so as to uniformly sample the instantaneous voltage value of the input signal to be detected using the preset sampling frequency, thereby obtaining a data sequence x[n] of a set number of voltage amplitudes (n is the difference between 0 and the set number minus 1).

[0023] It is worth noting that the preset sampling frequency must satisfy the Nyquist sampling theorem, that is, when the input signal to be detected is 50Hz (hertz) / 60Hz AC power, the preset sampling frequency should be no less than 100Hz / 120Hz. For example, if 360 points are sampled in one power frequency cycle of the input signal to be detected, the sampling frequency is 18kHz (kilohertz).

[0024] The Nyquist sampling theorem (also known as the Shannon sampling theorem) is a core theory in the field of signal processing. It states that in order to restore an analog signal without distortion, the sampling frequency must be greater than or equal to twice the highest frequency of the signal. It was perfected by Nyquist, Shannon, and others and is widely used in the fields of communications and digital signal processing.

[0025] In some embodiments, a data window of length N (i.e., a set number) is selected, such as a sliding window or a fixed length. The length of the data window must cover at least one entire power frequency cycle of the input signal to be detected, so that the input signal to be detected can be sampled using the data window. The length of the data window can be 200-1000, and is preferably 360, but this application does not limit this.

[0026] In some embodiments, signal sampling of the input signal to be detected can be performed in real time, such as using a data window with a length of 360 and a preset sampling frequency of 18kHz to perform signal sampling of the input signal to be detected in real time. Alternatively, a time length can be set for each interval, such as 0.1ms (milliseconds) - 1ms, to perform signal sampling of the input signal to be detected once at any reasonable interval length. This application does not limit this.

[0027] S12: Calculate the average of a set number of voltage amplitudes to obtain a voltage average.

[0028] The set number of voltage amplitudes obtained by the current sampling, that is, the data sequence x[n], is averaged, that is, the voltage mean of the input signal to be detected within the data window is calculated. , as an estimate of the DC component: ; in, is the mean voltage, and N is the set number.

[0029] It is worth noting that the voltage average value obtained by averaging the input signal to be detected is , which actually expands the energy of the mean part into equivalent total energy in the entire sequence, which can be understood as the low-frequency / DC component of the input signal to be detected.

[0030] S13: Multiply the set quantity by the square of the voltage average value to obtain the DC energy value.

[0031] Based on voltage average Calculate DC energy value : ; It is worth noting that the DC energy value It can be understood as the energy proportion of the quantified DC component.

[0032] S14: accumulating and summing the square values ​​of each voltage amplitude to obtain a total energy value.

[0033] Calculate the total energy of the data sequence x[n] : ; It is worth noting that the total energy value Reflects the overall energy distribution of the input signal to be detected. This is the square sum energy representation of discrete signals and conforms to the application of Parseval's theorem in the time domain.

[0034] Parseval's theorem is a core theorem in signal processing and Fourier analysis. It states that the total energy of a signal in the time domain is equal to the sum of the energies of its frequency components in its frequency domain representation, i.e., energy conservation. This theorem applies to both continuous and discrete signals and embodies the unitary property of the Fourier transform. It is widely used in fields such as communications and image processing.

[0035] S15: Determine the AC / DC signal type of the input signal to be detected using the DC energy value and the total energy value.

[0036] It is understandable that when calculating the DC energy value and total energy value After that, the signal type can be determined by comparing the relationship between the two energy values. For example, by setting the judgment condition, the DC energy value and total energy value When the DC energy value is equal, it is determined that all the energy of the input signal to be detected comes from the DC component and is a pure DC signal; Close to 0, total energy value When it is greater than 0, it is determined that the DC component in the input signal to be detected is close to zero, there is AC energy, and it is a pure AC signal; when the DC energy value is Greater than 0, total energy value Greater than DC energy value When , it is determined that the input signal to be detected has DC offset and AC fluctuation, and is an AC-DC mixed signal; in addition, the DC energy value can also be specifically Large and total energy value The comparison between the ratio and the set ratio coefficient, or the total energy value Subtract DC energy value The difference between the obtained value and the total energy value The ratio between them is compared with the set ratio coefficient to determine whether the input signal to be detected is a DC signal or an AC signal, which is not limited in this application.

[0037] The above scheme eliminates the influence of signal amplitude on the judgment result through digital calculation, thereby improving the robustness of the algorithm; and no hardware filter is required, and AC / DC separation judgment can be completed by relying only on sampling and numerical calculations; it has strong real-time performance and can be used for online monitoring or fast signal classification in embedded systems; it only requires addition, multiplication and comparison operations, and the calculation complexity is linear order, with low calculation complexity, which is suitable for resource-constrained scenarios; the time consumption of a single judgment is linearly related to the number of sampling points, and can support high sampling rate signals with high real-time performance; the detection speed of AC / DC voltage is also fast, which can effectively avoid the output voltage from power failure or fluctuation caused by input type switching, thereby improving power supply stability; it is suitable for signal type recognition tasks in various application scenarios, especially suitable for resource-constrained embedded systems or industrial control occasions that require fast response.

[0038] Furthermore, in one embodiment, after the above S15 , the method may further include: sending the first control signal or the second control signal to the power conversion circuit 31 in response to the currently determined AC / DC signal type.

[0039] Please continue reading Figure 2 , Figure 2 It is a structural diagram of an embodiment of an AC / DC signal detection circuit and a power conversion circuit of the present application.

[0040] It is understandable that the AC / DC signal detection method in this embodiment is specifically applied to the following Figure 2The switch control of the power conversion circuit 31 shown in the figure, the AC / DC signal detection circuit 20 is used to couple with the power conversion circuit 31, and the power conversion circuit 31 is coupled to the power circuit 32 and the load circuit 33 to receive the power input provided by the power circuit 32, that is, the input signal to be detected, and is controlled by the AC / DC signal detection circuit 20 to adjust and convert the input signal to be detected, and output it to the load circuit 33 to drive the load circuit 33 to work.

[0041] Among them, the AC / DC signal detection circuit 20 is used to use any AC / DC signal detection method in this article to perform AC / DC signal detection on the power input of the power conversion circuit 31, that is, the input signal to be detected provided by the power circuit 32 to the power conversion circuit 31, and use different control strategies to control the power conversion circuit 31 according to the AC / DC signal type of the currently detected input signal to be detected.

[0042] It is worth noting that the power conversion circuit 31 is specifically a Buck circuit, a boost circuit, a bridge conversion circuit, or other forms of circuit topology, etc., and is any reasonable functional circuit for realizing AC-DC conversion, current / voltage amplitude adjustment, waveform frequency adjustment and other signal conversion. This embodiment does not limit this.

[0043] The AC / DC signal detection circuit 20 may specifically include a control chip, a DSP (Digital Signal Processing) chip, an MCU (Micro Controller Unit) circuit, a CPU (Central Processing Unit), a single-chip microcomputer, a field programmable gate array, a programmable logic device, a discrete gate or transistor logic device, discrete hardware, or any other reasonable circuit unit with a signal processing function, and this application does not limit this.

[0044] Furthermore, the term "coupled" as used herein encompasses both direct and indirect connection methods. Therefore, if a first circuit is described as being coupled to a second circuit, this means that the first circuit may be directly connected to the second circuit via electrical connection, wireless transmission, optical transmission, or other signal connection methods, or may be indirectly connected to the second circuit via other circuits or connection methods.

[0045] Specifically, after detecting and identifying the AC / DC signal type of the input signal to be detected, the AC / DC signal detection circuit 20 is also used to generate a first control signal or a second control signal using a corresponding control program in response to the currently determined AC / DC signal type, so as to send the first control signal or the second control signal to the power conversion circuit 31 to trigger the switching element inside the power conversion circuit 31 to turn on or off, thereby adjusting the output current and / or output voltage output by the power conversion circuit 31 to the load circuit 33.

[0046] Please continue reading Figure 3 , Figure 3 yes Figure 1 In one embodiment, the AC / DC signal detection method of the present application includes, in addition to the above-mentioned S11-S15, further including some more specific steps. Specifically, the above-mentioned S11 may further include the following steps: S1111: Acquire a set number of instantaneous voltage values ​​in the input signal to be detected using a preset sampling frequency.

[0047] Specifically, a preset sampling frequency is used to sample the input signal to be detected in real time to continuously obtain a set number of voltage instantaneous value data sequences. .

[0048] S1112: Perform a first-order recursive filtering operation on each instantaneous voltage value to obtain a set number of voltage amplitudes.

[0049] It is understandable that in order to achieve enhanced noise suppression, each instantaneous voltage value can be low-pass filtered, such as using a first-order recursive filter to obtain a data sequence x[n] of a set number of voltage amplitudes to suppress high-frequency noise and improve judgment accuracy.

[0050] Among them, the first-order recursive filter is an infinite impulse response digital filter, whose core feature is that the current output value depends on the current input and the output value at the previous moment.

[0051] Difference equations: ; in, is the current input sampling value; is the current output sampling value; is the output value at the previous moment; α is the filter coefficient, which determines the cutoff frequency and response speed.

[0052] Please continue reading Figure 4 , Figure 4 yes Figure 1Flowchart of another embodiment of S11 in FIG. In one embodiment, the AC / DC signal detection method of the present application includes, in addition to the above S11-S15, further including some more specific steps. Specifically, the above S11 may further include the following steps: S1121: Obtain an input signal to be detected.

[0053] Specifically, the input signal to be detected is sampled in real time, or the input signal to be detected is sampled once at a set interval, such as any reasonable interval between 0.1ms (milliseconds) and 1ms, and this application does not limit this.

[0054] S1122: Convert the input signal to be detected into a digital input signal.

[0055] In order to facilitate calculation and processing, the input signal to be detected is converted into a digital input signal.

[0056] S1123: Acquire a set number of voltage amplitudes in the digital input signal using a preset sampling frequency.

[0057] The digital input signal is uniformly sampled using a preset sampling frequency to obtain a data sequence x[n] of a set number of voltage amplitudes.

[0058] Please continue reading Figure 5 , Figure 5 yes Figure 1 In one embodiment, the AC / DC signal detection method of the present application includes, in addition to the above S11-S15, further including some more specific steps. Specifically, the above S15 may further include the following steps: S1511: Subtract the DC energy value from the total energy value to obtain the AC energy value.

[0059] Through the total energy value and DC energy value The difference between the two values ​​is the alternating energy value. : ; It is worth noting that the alternating energy value It is the AC component energy extracted from the input signal to be detected.

[0060] S1512: Divide the alternating energy value by the total energy value to obtain a first energy ratio.

[0061] Calculate the alternating energy value and total energy value The first energy ratio R1 is used as the basis for judging the type of AC and DC signals: .

[0062] S1513: Detect whether the first energy ratio is greater than a first set threshold.

[0063] It is understandable that the first set threshold and the second set threshold for distinguishing between AC and DC signal types are set according to an actual application scenario in which the power conversion circuit 31 uses the input signal to be detected to power a load.

[0064] Among them, the first set threshold can be understood as the threshold value at which the AC / DC signal detection circuit 20, when determining that the input signal to be detected is greater than the first set threshold, enables the control strategy corresponding to the AC signal to control the power conversion circuit 31; and the second set threshold is the threshold value at which the AC / DC signal detection circuit 20, when determining that the input signal to be detected is less than the second set threshold, enables the control strategy corresponding to the DC signal to control the power conversion circuit 31.

[0065] In some embodiments, the first set threshold value can be specifically equal to the second set threshold value, such as any one of 0.3-0.7, and preferably 0.5, and actually only one judgment is required; and the first set threshold value can also be greater than the second set threshold value, for example, the first set threshold value is any one of 0.51-0.9, and the second set threshold value is any one of 0.05-0.5, so that the threshold interval between the first set threshold value and the second set threshold value can be used as a hysteresis judgment interval, that is, when it is determined that the first energy ratio R1 is in the hysteresis judgment interval, the previous judgment result is maintained unchanged to wait for another judgment to enhance the anti-interference ability and improve the robustness of the algorithm. This application does not limit this.

[0066] Specifically, it is detected whether the currently acquired first energy ratio R1 is greater than a first set threshold.

[0067] If the first energy ratio R1 is greater than the first set threshold, S1514 is executed; if the first energy ratio R1 is not greater than the first set threshold, S1515 is executed.

[0068] S1514: Determine whether the input signal to be detected is an AC signal.

[0069] When it is determined that the first energy ratio R1 is greater than the first set threshold, it is determined that the currently acquired input signal to be detected is an AC signal.

[0070] S1515: Detect whether the first energy ratio is less than a second set threshold.

[0071] When it is determined that the first energy ratio R1 is not greater than the first set threshold, it is further detected whether the first energy ratio R1 is less than the second set threshold.

[0072] If the first energy ratio R1 is less than the second set threshold, S1516 is executed; if the first energy ratio R1 is not less than the second set threshold, the process returns to S1513 and executes again.

[0073] S1516: Determine whether the input signal to be detected is a DC signal.

[0074] When it is determined that the first energy ratio R1 is less than the second set threshold, it is determined that the currently acquired input signal to be detected is a DC signal.

[0075] In some embodiments, the AC / DC signal detection circuit 20 can also specifically receive control instructions input by the user, or control instructions sent by the host computer, or adjust the first set threshold and / or the second set threshold in response to changes in characteristic parameters of the input signal to be detected to adapt to different application scenarios. This application does not limit this.

[0076] It is understandable that by dynamically adjusting the first set threshold and / or the second set threshold, such as dynamically adjusting the threshold according to the signal-to-noise ratio of the input signal to be detected or the ambient noise level, it is possible to effectively adapt to complex scenarios; and it is also possible to adapt to different application scenarios, such as power monitoring, Internet of Things sensing, etc., by adjusting the data window length and combining the adjustment of the first set threshold and / or the second set threshold; among them, if the second set threshold is set to a smaller value, such as setting the second set threshold to 0.05, it can also effectively identify the weak AC component in the "approximate DC signal", which is suitable for motor control or medical equipment monitoring.

[0077] Please continue reading Figure 6 , Figure 6 yes Figure 5 In one embodiment, the AC / DC signal detection method of the present application includes, in addition to the above-mentioned S1511-S1516, further including some more specific steps. Specifically, the above-mentioned S1512 may further include the following steps: S15121: Divide the alternating energy value by the total energy value to obtain an initial energy ratio.

[0078] Specifically, the alternating energy value Divide by the total energy value Get the initial energy ratio 0, as the basis for judging the type of AC or DC signal: .

[0079] S15122: Normalize the initial energy ratio to obtain a first energy ratio.

[0080] It is understandable that in order to eliminate the influence of signal amplitude on the determination result, the initial energy ratio can be Normalize to get the first energy ratio .

[0081] It's worth noting that normalization is a method for simplifying calculations. There are two forms of normalization: converting numbers to decimals between (0, 1) and converting dimensional expressions to dimensionless ones. This method was primarily developed to facilitate data processing. Mapping data to the 0-1 range is more efficient and effective, and should be considered part of digital signal processing.

[0082] Please continue reading Figure 7 , Figure 7 yes Figure 1 Flowchart of another embodiment of S15 in FIG. In one embodiment, the AC / DC signal detection method of the present application includes, in addition to the above S11-S15, further including some more specific steps. Specifically, the above S15 may further include the following steps: S1521: Divide the DC energy value by the total energy value to obtain a second energy ratio.

[0083] Specifically, by calculating the DC energy value and total energy value The second energy ratio R2 is used as the basis for judging the type of AC and DC signals: .

[0084] S1522: Detect whether the second energy ratio is greater than a third set threshold.

[0085] Similarly, the third set threshold and the fourth set threshold can be set according to the actual application scenario in which the power conversion circuit 31 uses the input signal to be detected to realize load power supply, and can be equal or unequal, and can also be adjusted according to different application scenarios. This application does not limit this.

[0086] Specifically, it is detected whether the second energy ratio R2 is greater than a third set threshold.

[0087] If the second energy ratio R2 is greater than the third set threshold, execute S1523; if the second energy ratio R2 is not greater than the third set threshold, execute S1524.

[0088] S1523: Determine whether the input signal to be detected is an AC signal.

[0089] When it is determined that the second energy ratio R2 is greater than the third set threshold, it is determined that the currently acquired input signal to be detected is an AC signal.

[0090] S1524: Detect whether the second energy ratio is less than a fourth set threshold.

[0091] When it is determined that the second energy ratio R2 is not greater than the third set threshold, it is further detected whether the second energy ratio R2 is less than a fourth set threshold.

[0092] If the second energy ratio R2 is less than the fourth set threshold, execute S1525; if the second energy ratio R2 is not less than the fourth set threshold, return to execute S1522 again.

[0093] S1525: Determine whether the input signal to be detected is a DC signal.

[0094] When it is determined that the second energy ratio R2 is less than the fourth set threshold, it is determined that the currently acquired input signal to be detected is a DC signal.

[0095] See also Figure 8 , Figure 8 The electronic device 40 includes a memory 41 and a processor 42 coupled to each other, and the processor 42 is configured to execute program instructions stored in the memory 41 to implement the steps of any of the above-mentioned AC / DC signal detection method embodiments.

[0096] In a specific implementation scenario, the electronic device 40 may include but is not limited to any reasonable smart terminal such as a computer, a tablet computer, a smart phone, and a smart watch, and this application does not limit this.

[0097] Specifically, the processor 42 is used to control itself and the memory 41 to implement the steps of any of the above-mentioned video display method embodiments. The processor 42 can also be called a CPU (Central Processing Unit). The processor 42 may be an integrated circuit chip with signal processing capabilities. The processor 42 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. In addition, the processor 42 can be implemented by an integrated circuit chip.

[0098] See also Figure 9 , Figure 9is a structural schematic diagram of an embodiment of the computer readable storage medium of the present application. The computer readable storage medium 50 stores program instructions 51 capable of being executed by a processor, and the program instructions 51 are used to implement the steps of any of the AC / DC signal detection method embodiments described above.

[0099] In several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other manners. For example, the above-described device embodiments are merely illustrative, and the division of the modules or units can be different, for example, some features can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the shown or discussed modules can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or other forms.

[0100] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they can be located in one place or distributed on network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the present embodiment.

[0101] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0102] If the integrated unit is realized in the form of 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 solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the methods of the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.

[0103] The beneficial effects of the present application are: different from the existing technology, the AC / DC signal detection method provided by the present application obtains a set number of voltage amplitudes in the input signal to be detected by adopting a preset sampling frequency, calculates the average of the set number of voltage amplitudes to obtain the voltage average, and multiplies the set number by the square of the voltage average to obtain the DC energy value, and accumulates and sums the square values ​​of each voltage amplitude to obtain the total energy value, so as to use the DC energy value and the total energy value to determine the AC / DC signal type of the input signal to be detected, thereby being able to eliminate the influence of the signal amplitude on the judgment result through digital calculation means and improve the robustness of the algorithm; and only requires addition, multiplication and comparison operations, the calculation complexity is linear order, the calculation complexity is low, and it is suitable for resource-constrained scenarios; the time consumption of a single judgment is linearly related to the number of sampling points, can support high sampling rate signals, and has high real-time performance; the detection speed of AC / DC voltages is also fast, thereby effectively avoiding power failure or fluctuation of the output voltage caused by input type switching, thereby improving the power supply stability.

[0104] The above description is only an implementation method of the present application and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the description and drawings of this application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method for detecting AC and DC signals, characterized in that: The AC / DC signal detection method comprises: Acquire a set number of voltage amplitudes in the input signal to be detected using a preset sampling frequency; Performing mean calculation on the set number of voltage amplitudes to obtain a voltage mean; Multiplying the set quantity by the square of the voltage mean value to obtain a DC energy value; Calculating the total energy value by accumulating and summing the square values ​​of each voltage amplitude; The AC / DC signal type of the input signal to be detected is determined using the DC energy value and the total energy value.

2. The AC / DC signal detection method according to claim 1, wherein: The determining the AC / DC signal type of the input signal to be detected by using the DC energy value and the total energy value includes: Subtracting the DC energy value from the total energy value to obtain an AC energy value; Dividing the alternating energy value by the total energy value to obtain a first energy ratio; detecting whether the first energy ratio is greater than a first set threshold; If the first energy ratio is greater than a first set threshold, it is determined that the input signal to be detected is an AC signal.

3. The AC / DC signal detection method according to claim 2, wherein: The steps of the AC / DC signal detection method include: If the first energy ratio is not greater than a first set threshold, detecting whether the first energy ratio is less than a second set threshold; If the first energy ratio is less than the second set threshold, it is determined that the input signal to be detected is a direct current signal.

4. The AC / DC signal detection method according to claim 2, wherein: The step of dividing the alternating energy value by the total energy value to obtain a first energy ratio comprises: Dividing the alternating energy value by the total energy value to obtain an initial energy ratio; The initial energy ratio is normalized to obtain the first energy ratio.

5. The AC / DC signal detection method according to claim 1, wherein: The determining the AC / DC signal type of the input signal to be detected by using the DC energy value and the total energy value includes: Dividing the DC energy value by the total energy value to obtain a second energy ratio; detecting whether the second energy ratio is greater than a third set threshold; If the second energy ratio is greater than a third set threshold, determining that the input signal to be detected is an AC signal; If the second energy ratio is not greater than a third set threshold, detecting whether the second energy ratio is less than a fourth set threshold; If the second energy ratio is less than the fourth set threshold, it is determined that the input signal to be detected is a DC signal.

6. The AC / DC signal detection method according to any one of claims 1 to 5, characterized in that: The step of obtaining a set number of voltage amplitudes in the input signal to be detected using a preset sampling frequency includes: Acquiring the set number of instantaneous voltage values ​​in the input signal to be detected using the preset sampling frequency; A first-order recursive filtering operation is performed on each instantaneous voltage value to obtain the set number of voltage amplitudes.

7. The AC / DC signal detection method according to any one of claims 1 to 5, characterized in that: The step of obtaining a set number of voltage amplitudes in the input signal to be detected using a preset sampling frequency includes: Obtaining the input signal to be detected; Converting the input signal to be detected into a digital input signal; The preset sampling frequency is used to obtain the set number of voltage amplitudes in the digital input signal; wherein, the data window length obtained by dividing the set number by the preset sampling frequency is greater than or equal to the signal period of the input signal to be detected.

8. The AC / DC signal detection method according to any one of claims 1 to 5, characterized in that: After the step of determining the AC / DC signal type of the input signal to be detected by using the DC energy value and the total energy value, the method further includes: In response to the currently determined type of the AC / DC signal, a first control signal or a second control signal is sent to the power conversion circuit.

9. An electronic device, characterized in that: The electronic device includes a memory and a processor coupled to each other, and the processor is configured to execute program instructions stored in the memory to implement the AC / DC signal detection method according to any one of claims 1 to 8.

10. A computer-readable storage medium having program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the AC / DC signal detection method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Alternating current and direct current voltage true virtual value measurement method capable of automatically identifying type of signal

    CN103743944A

  • Electric leakage detection method, device and equipment and computer readable storage medium

    CN117054924A

  • Load control circuit including automatic AC / DC discernment

    US5327016A