A Method and Device for Outputting Electric Energy Pulses of an Electric Energy Metering Chip
Through the timer capture and comparison output function, the problem of insufficient output frequency of the SoC chip is solved, and the high-frequency pulse frequency multiplication output of the power metering chip under different power conditions is realized, ensuring the accuracy and real-timeness of the power metering.
Patent Information
- Application Number
- CN202310855385.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-12
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2043-07-12
AI Technical Summary
The frequency of the power pulses output by the SoC chip in the existing power meters is low and cannot meet the high frequency requirements. Especially when the power is frequently pulsing, the high frequency pulses output by the MCU are difficult to accurately reflect the power consumption in real time.
Through the timer input capture and comparison output function, the rising edge of the low-frequency pulse of the SoC output is captured, the number of high-frequency pulses is calculated, and the frequency doubling is performed during the low-frequency pulse period to ensure that the number of high-frequency pulses and the number of low-frequency pulses meet the multiple relationship.
The frequency range of power pulse output of SoC chips is broadened to ensure that the number of high-frequency pulses and the number of low-frequency pulses are in line with the multiple relationship when the power is stable or changed, and the accurate output of high-frequency pulses is achieved.
Smart Images

Figure CN117092580B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electric energy meter verification, and particularly to a method and device for outputting electric energy pulses of an electric energy metering chip. Background Art
[0002] In the design of electric energy meters and standard meters, the electric energy metering SoC chip is specially designed to calculate various electrical parameters and output electric energy pulses, and the MCU is used to read the electrical parameters calculated by the SoC chip and process upper-layer services such as storage, interaction, and communication. However, the frequency of the electric energy pulses directly output by the SoC is relatively low, not reaching 50 kHz or even higher 100 kHz. In cases where higher-frequency pulses are required, if the electric energy pulses output by the SoC are discarded and the power values read by the MCU are used to calculate and output high-frequency pulses, when the power remains constant, the high-frequency pulses output by the MCU can accurately reflect the power consumption in real time. However, when the power fluctuates frequently, due to the communication frequency of the MCU reading the electrical parameters of the SoC, it is difficult for the high-frequency electric energy pulses output by the MCU to accurately reflect the power consumption at this time in real time. Summary of the Invention
[0003] To solve the above technical problems, the embodiments of the present invention provide a method and system for outputting electric energy pulses of an electric energy metering chip. By using the input capture and compare output functions of a timer, the interval of the low-frequency pulses output by the SoC is timed, and the high-frequency pulses that have been output are counted, ensuring that whether the power is stable or changing, the number of high-frequency electric energy pulses and the number of low-frequency pulses satisfy a multiple relationship, achieving the effect of frequency doubling the relatively low-frequency electric energy pulses output by the electric energy metering SoC chip and broadening the frequency range of the electric energy pulses output by the SoC.
[0004] The first aspect of the embodiments of the present invention provides a method for outputting electric energy pulses of an electric energy metering chip, the method comprising:
[0005] Capturing the rising edge of the electric energy pulse in real time, wherein the rising edge is captured through the capture mode of the first timer;
[0006] Determining whether the rising edge is captured. If the rising edge is not captured, the low-frequency pulse period is obtained according to the time difference between the rising edges within a continuous preset number of times, and the number of high-frequency pulses within the low-frequency pulse period is calculated according to the high-frequency pulse count value. Pulses are output and counted within the low-frequency pulse period by using the second timer according to the number of high-frequency pulses to obtain a new high-frequency pulse count value;
[0007] When the count value of the new high-frequency pulse reaches the preset condition, stop outputting pulses. When the count value of the new high-frequency pulse does not reach the preset condition, continue to output pulses and capture a new rising edge for judgment to obtain an updated high-frequency pulse count value. Repeat this step until the updated high-frequency pulse count value reaches the preset condition, and then stop outputting pulses.
[0008] Implementing this embodiment, the rising edge of the power pulse is captured through the capture mode of the first timer, and it is judged whether the rising edge is captured. If the rising edge is not captured, the low-frequency pulse period is obtained according to the time difference between the rising edges within a continuous preset number of times, and the number of high-frequency pulses within the low-frequency pulse period is calculated according to the high-frequency pulse count value. According to the number of high-frequency pulses, the second timer is used to output pulses and count within the low-frequency pulse period to obtain a new high-frequency pulse count value. When the new high-frequency pulse count value reaches the preset condition, stop outputting pulses. When the new high-frequency pulse count value does not reach the preset condition, continue to output pulses and capture a new rising edge for judgment to obtain an updated high-frequency pulse count value. Repeat this step until the updated high-frequency pulse count value reaches the preset condition, and then stop outputting pulses. This method can time the pulses output by the power measurement by using the timer input capture and compare output functions, and count the already output high-frequency pulses, so that the number of high-frequency power pulses and the number of low-frequency pulses both satisfy the multiple relationship, achieving the effect of frequency doubling the lower-frequency power pulses output by the power measurement SoC chip and broadening the frequency range of the power pulse output of the SoC.
[0009] In a possible implementation manner of the first aspect, obtaining the low-frequency pulse period according to the time difference between the rising edges within a continuous preset number of times is specifically as follows:
[0010] Obtain the first time according to the time of the rising edge of the power pulse captured for the Nth time;
[0011] Obtain the second time according to the time of the rising edge of the power pulse captured for the (N + 1)th time;
[0012] Take the time difference between the first time and the second time as the low-frequency pulse period.
[0013] In a possible implementation manner of the first aspect, calculating the number of high-frequency pulses within the low-frequency pulse period according to the high-frequency pulse count value is specifically as follows:
[0014] Obtain the number of high-frequency pulses within the low-frequency pulse period according to the high-frequency pulse count value and the frequency doubling multiple. The specific calculation formula is:
[0015] m t =(n + m t-1 ) - m1
[0016] where mt-1 represents the number of remaining high-frequency pulses that have not been output during the previous low-frequency pulse period, m t represents the number of remaining high-frequency pulses that have not been output during the current low-frequency pulse period, (n + m t-1 ) represents the number of high-frequency pulses that need to be output during the current low-frequency pulse period, n is the multiple of frequency doubling, and m1 represents the high-frequency pulse count value during the low-frequency pulse period.
[0017] In a possible implementation manner of the first aspect, when the new high-frequency pulse count value reaches a preset condition, the pulse output is stopped. Specifically:
[0018] When the new high-frequency pulse count value is greater than or equal to the preset number of high-frequency pulse outputs during the low-frequency pulse period, the pulse output is stopped. Among them, the preset condition formula is:
[0019] m2 ≥ (n + m t-1 )
[0020] where m2 represents the new high-frequency pulse count value, and (n + m t-1 ) represents the preset number of high-frequency pulse outputs during the low-frequency pulse period.
[0021] The second aspect of the embodiments of the present invention provides an electric energy metering chip electric energy pulse output device, and the device includes:
[0022] An acquisition module, configured to capture the rising edge of the electric energy pulse in real time, where the rising edge is captured through the capture mode of the first timer;
[0023] A judgment module, configured to judge whether the rising edge is captured. If the rising edge is not captured, the low-frequency pulse period is obtained according to the time difference between the rising edges within a continuous preset number of times, and the number of high-frequency pulses within the low-frequency pulse period is calculated according to the high-frequency pulse count value. Pulses are output within the low-frequency pulse period by using the second timer and counted to obtain a new high-frequency pulse count value. When the new high-frequency pulse count value reaches a preset condition, the pulse output is stopped. If the new high-frequency pulse count value does not reach the preset condition, the pulse output continues and a new rising edge is captured for judgment to obtain an updated high-frequency pulse count value. This step is repeated until the updated high-frequency pulse count value reaches the preset condition and the pulse output is stopped.
[0024] In a possible implementation manner of the second aspect, obtaining the low-frequency pulse period according to the time difference between the rising edges within a continuous preset number of times, specifically:
[0025] According to the time of the rising edge of the electric energy pulse captured for the Nth time, the first time is obtained;
[0026] Obtain a second time according to the time of the rising edge of the electric energy pulse captured for the (N + 1)-th time;
[0027] Take the time difference obtained from the first time and the second time as the low-frequency pulse period.
[0028] In a possible implementation manner of the second aspect, calculate the number of high-frequency pulses within the low-frequency pulse period according to the high-frequency pulse count value, specifically:
[0029] Obtain the number of high-frequency pulses within the low-frequency pulse period according to the high-frequency pulse count value and the frequency multiplication factor. The specific calculation formula is:
[0030] m t =(n + m t-1 ) - m1
[0031] where m t-1 represents the number of remaining unoutput high-frequency pulses within the previous low-frequency pulse period, m t represents the number of remaining unoutput high-frequency pulses within the current low-frequency pulse period, (n + m t-1 ) represents the number of high-frequency pulses to be output within the current low-frequency pulse period, n is the frequency multiplication factor, and m1 represents the high-frequency pulse count value within the low-frequency pulse period.
[0032] In a possible implementation manner of the second aspect, when the new high-frequency pulse count value reaches a preset condition, stop outputting pulses, specifically:
[0033] When the new high-frequency pulse count value is greater than or equal to the preset high-frequency pulse output quantity within the low-frequency pulse period, stop outputting pulses. The specific formula is:
[0034] m2 ≥ (n + m t-1 )
[0035] where m2 represents the new high-frequency pulse count value, and (n + m t-1 ) represents the preset high-frequency pulse output quantity within the low-frequency pulse period.
[0036] A third aspect of the embodiments of the present invention provides a terminal device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements the method for outputting electric energy pulses of an electric energy metering chip as shown in the embodiments of the present invention.
[0037] A fourth aspect of the embodiments of the present invention provides a computer-readable storage medium, and the computer-readable storage medium stores a computer-executable program, and the computer-executable program is used to enable a computer to execute the steps of the method for outputting electric energy pulses of an electric energy metering chip as shown in the embodiments of the present invention.
[0038] The present invention captures the rising edge of the power pulse through the capture mode of the first timer, and judges in real time whether the rising edge is captured. If the rising edge is not captured, the low-frequency pulse period is obtained according to the time difference between the rising edges within a continuous preset number of times, and the number of high-frequency pulses within the low-frequency pulse period is calculated according to the high-frequency pulse count value. According to the number of high-frequency pulses, the second timer is used to output pulses within the low-frequency pulse period and count them to obtain a new high-frequency pulse count value. When the new high-frequency pulse count value reaches the preset condition, the pulse output is stopped. When the new high-frequency pulse count value does not reach the preset condition, the pulse is continuously output and a new rising edge is captured for judgment to obtain an updated high-frequency pulse count value. This step is repeated until the updated high-frequency pulse count value reaches the preset condition, and then the pulse output is stopped. This method can time the pulses output by the power measurement by using the input capture and compare output functions of the timer, and count the high-frequency pulses that have been output, so that the number of high-frequency power pulses and the number of low-frequency pulses both satisfy the multiple relationship, achieving the effect of frequency doubling the lower-frequency power pulses output by the power measurement SoC chip and broadening the frequency range of the power pulse output of the SoC. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 : A flowchart showing an embodiment of the method for outputting power pulses of a power measurement chip provided by the present invention;
[0040] Figure 2 : A flowchart showing the TIM1 setting and interrupt processing during MCU frequency doubling in an embodiment of the method for outputting power pulses of a power measurement chip provided by the present invention;
[0041] Figure 3 : A flowchart showing the TIM2 setting and interrupt processing during MCU frequency doubling in an embodiment of the method for outputting power pulses of a power measurement chip provided by the present invention;
[0042] Figure 4 : A schematic diagram of the device structure of another embodiment of the method for outputting power pulses of a power measurement chip provided by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0043] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0044] Embodiment 1
[0045] Please refer to Figure 1, which is a schematic flowchart of an embodiment of the electric energy pulse output method of the electric energy metering chip provided by the embodiment of the present invention, includes steps S11 to S12, and the specific steps are as follows:
[0046] S11. Capture the rising edge of the electric energy pulse in real time, where the rising edge is captured through the capture mode of the first timer.
[0047] In this embodiment, by using the timer input capture function of the MCU, the rising edge of the pulse is captured. First, initialize and set a certain comparison / capture channel of the MCU timer TIM1 to the input capture mode, and hardware-connect it to the electric energy pulse output port of the SoC to capture the rising edge of the low-frequency electric energy pulse of the SoC.
[0048] S12. Determine whether the rising edge is captured. If the rising edge is not captured, obtain the low-frequency pulse period according to the time difference between the rising edges within a continuous preset number of times, and calculate the number of high-frequency pulses within the low-frequency pulse period according to the high-frequency pulse count value. Output pulses within the low-frequency pulse period and count them by using the second timer to obtain a new high-frequency pulse count value. If the new high-frequency pulse count value reaches the preset condition, stop outputting pulses. If the new high-frequency pulse count value does not reach the preset condition, continue to output pulses and capture a new rising edge for judgment to obtain an updated high-frequency pulse count value, and repeat this step until the updated high-frequency pulse count value reaches the preset condition, then stop outputting pulses.
[0049] In a preferred embodiment, obtaining the low-frequency pulse period according to the time difference between the rising edges within a continuous preset number of times is specifically:
[0050] Obtain the first time according to the time of the rising edge of the electric energy pulse captured for the Nth time;
[0051] Obtain the second time according to the time of the rising edge of the electric energy pulse captured for the (N + 1)th time;
[0052] Take the time difference between the first time and the second time as the low-frequency pulse period.
[0053] In a preferred embodiment, calculating the number of high-frequency pulses within the low-frequency pulse period according to the high-frequency pulse count value is specifically:
[0054] Obtain the number of high-frequency pulses within the low-frequency pulse period according to the high-frequency pulse count value and the frequency multiplication factor. The specific calculation formula is:
[0055] m t =(n + m t-1 ) - m1
[0056] where m t-1Indicates the number of high-frequency pulses remaining unoutput in the previous low-frequency pulse period, m t Indicates the number of high-frequency pulses remaining unoutput in the current low-frequency pulse period, (n + m t-1 ) Indicates the number of high-frequency pulses to be output in the current low-frequency pulse period, n is the multiple of frequency doubling, and m1 represents the high-frequency pulse count value in the low-frequency pulse period.
[0057] In a preferred embodiment, when the new high-frequency pulse count value reaches a preset condition, the pulse output is stopped. Specifically:
[0058] When the new high-frequency pulse count value is greater than or equal to the preset high-frequency pulse output quantity in the low-frequency pulse period, the pulse output is stopped. Among them, the preset condition formula is:
[0059] m2 ≥ (n + m t-1 )
[0060] Among them, m2 represents the new high-frequency pulse count value, and (n + m t-1 ) represents the preset high-frequency pulse output quantity in the low-frequency pulse period.
[0061] In this embodiment, as Figure 2 shown, Figure 2 is a schematic diagram of the TIM1 setting and interrupt processing flow when the MCU performs frequency doubling. Set a certain comparison / capture channel of the MCU timer TIM1 to the input capture mode, capture the rising edge of the SoC low-frequency power pulse in real time, and determine whether the rising edge is captured. If the rising edge is captured and an interrupt occurs, then according to the time difference between the rising edges within a continuous preset number of times, the low-frequency pulse period is obtained, and then the number of high-frequency pulses remaining unoutput in the previous low-frequency pulse period is calculated. According to the high-frequency pulse count value, the number of high-frequency pulses in the low-frequency pulse period is calculated. The specific calculation formula is:
[0062] m t = (n + m t-1 ) - m1
[0063] Among them, m t-1 represents the number of high-frequency pulses remaining unoutput in the previous low-frequency pulse period, m t represents the number of high-frequency pulses remaining unoutput in the current low-frequency pulse period, (n + m t-1 ) represents the number of high-frequency pulses to be output in the current low-frequency pulse period, n is the multiple of frequency doubling, and m1 represents the high-frequency pulse count value in the low-frequency pulse period.
[0064] As Figure 3 shown, Figure 3Schematic diagram of TIM2 setting and interrupt handling when the MCU is frequency - doubled. Set another timer TIM2's comparison output channel to output pulses within the low - frequency pulse period and count them. If the pulse count value is greater than or equal to the preset high - frequency pulse output quantity within the low - frequency pulse period before the rising edge of the next original power pulse arrives, the timer TIM2 stops outputting pulses. The specific formula is:
[0065] m2≥(n + m t-1 )
[0066] Where m2 represents the new high - frequency pulse count value, and (n + m t-1 ) represents the preset high - frequency pulse output quantity within the low - frequency pulse period.
[0067] If the pulse count value does not reach the preset condition, continue to output pulses, capture the new rising edge for judgment to obtain the updated high - frequency pulse count value, and repeat this step until the updated high - frequency pulse count value reaches the preset condition, then stop outputting pulses.
[0068] It should be noted that SoC is the abbreviation of System on Chip, called a system - level chip, and also known as a system - on - a - chip. It means it is a product, an integrated circuit with a specific purpose, which contains a complete system and all the content of the embedded software.
[0069] As an example of this embodiment, first, set a certain comparison / capture channel of the MCU timer TIM1 to the input capture mode, which is hardware - connected to the power pulse output port of the SoC to capture the rising edge of the pulse;
[0070] Second, define a variable T1, whose value is the time difference between two consecutive rising edges, that is, the period value of the low - frequency pulse;
[0071] Third: Define a loop - updated variable m, whose value is (n + m)-m1, where n is the multiple of frequency doubling, m1 is the high - frequency pulse count value after frequency doubling within each low - frequency pulse period. The meaning of m is the number of remaining un - output high - frequency pulses in the previous low - frequency pulse period, and the meaning of (n + m) is the number of high - frequency pulses to be output within the current low - frequency pulse period;
[0072] Fourth: Set another timer TIM2's comparison output channel to output (n + m) pulses within the subsequent T1 time;
[0073] Fifth: Count the frequency - doubled pulses output. If m1 is equal to (n + m) before the rising edge of the next original power pulse arrives, then TIM2 stops outputting pulses; otherwise, continue to output.
[0074] The present invention has the following beneficial effects:
[0075] By using the input capture and compare output functions of the MCU timer, the interval of low-frequency pulses output by the SoC is timed, and the high-frequency pulses that have been output are counted. It is ensured that whether the power is stable or changing, the number of high-frequency power pulses and the number of low-frequency pulses satisfy a multiple relationship, achieving the effect of frequency doubling the lower-frequency power pulses output by the power metering SoC chip and broadening the frequency range of the power pulse output of the SoC.
[0076] Embodiment 2
[0077] Correspondingly, referring to Figure 4 , Figure 4 FIG. is a device for outputting power pulses of a power metering chip provided by the present invention. As shown in the figure, the device for outputting power pulses of the power metering chip includes: an acquisition module 401 for capturing the rising edge of the power pulse in real time, where the rising edge is captured through the capture mode of the first timer;
[0078] A judgment module 402 for judging whether the rising edge is captured. If the rising edge is not captured, the low-frequency pulse period is obtained according to the time difference between the rising edges within a continuous preset number of times, and the number of high-frequency pulses within the low-frequency pulse period is calculated according to the high-frequency pulse count value. According to the number of high-frequency pulses, the second timer outputs pulses within the low-frequency pulse period and counts them to obtain a new high-frequency pulse count value. When the new high-frequency pulse count value reaches the preset condition, the pulse output is stopped. If the new high-frequency pulse count value does not reach the preset condition, the pulse is continuously output and a new rising edge is captured for judgment to obtain an updated high-frequency pulse count value. This step is repeated until the updated high-frequency pulse count value reaches the preset condition, and then the pulse output is stopped.
[0079] In a preferred embodiment, obtaining the low-frequency pulse period according to the time difference between the rising edges within a continuous preset number of times is specifically:
[0080] Obtaining the first time according to the time of the rising edge of the power pulse captured for the Nth time;
[0081] Obtaining the second time according to the time of the rising edge of the power pulse captured for the (N + 1)th time;
[0082] Taking the time difference between the first time and the second time as the low-frequency pulse period.
[0083] In a preferred embodiment, calculating the number of high-frequency pulses within the low-frequency pulse period according to the high-frequency pulse count value is specifically:
[0084] Calculating the number of high-frequency pulses within the low-frequency pulse period according to the high-frequency pulse count value and the frequency doubling multiple. The specific calculation formula is:
[0085] mt =(n + m t-1 ) - m1
[0086] Wherein, m t-1 represents the number of high - frequency pulses remaining un - output in the previous low - frequency pulse period, m t represents the number of high - frequency pulses remaining un - output in the current low - frequency pulse period, (n + m t-1 ) represents the number of high - frequency pulses to be output in the current low - frequency pulse period, n is the multiple of frequency multiplication, and m1 represents the high - frequency pulse count value in the low - frequency pulse period.
[0087] In a preferred embodiment, when the new high - frequency pulse count value reaches a preset condition, the pulse output is stopped. Specifically:
[0088] When the new high - frequency pulse count value is greater than or equal to the preset high - frequency pulse output quantity in the low - frequency pulse period, the pulse output is stopped. The specific formula is:
[0089] m2≥(n + m t-1 )
[0090] Wherein, m2 represents the new high - frequency pulse count value, and (n + m t-1 ) represents the preset high - frequency pulse output quantity in the low - frequency pulse period.
[0091] In a preferred embodiment, a terminal device provided by the present invention includes: a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements the electric energy pulse output method of the electric energy metering chip as shown in Embodiment 1 of the present invention.
[0092] In a preferred embodiment, a computer - readable storage medium provided by the present invention stores a computer - executable program, and the computer - executable program is used to make a computer execute the steps of the electric energy pulse output method of the electric energy metering chip as shown in Embodiment 1 of the present invention.
[0093] The more detailed working principle and step - by - step process of this embodiment can, but are not limited to, refer to the relevant records of Embodiment 1.
[0094] In summary, implementing the embodiments of the present invention has the following beneficial effects:
[0095] The rising edge of the power pulse is captured through the capture mode of the first timer, and it is judged whether the rising edge is captured. If the rising edge is not captured, the low-frequency pulse period is obtained according to the time difference between the rising edges within a continuous preset number of times, and the number of high-frequency pulses within the low-frequency pulse period is calculated according to the high-frequency pulse count value. According to the number of high-frequency pulses, the second timer is used to output pulses within the low-frequency pulse period and count them to obtain a new high-frequency pulse count value. If the new high-frequency pulse count value reaches the preset condition, the pulse output is stopped. If the new high-frequency pulse count value does not reach the preset condition, the pulse is continuously output and a new rising edge is captured for judgment to obtain an updated high-frequency pulse count value. This step is repeated until the updated high-frequency pulse count value reaches the preset condition, and then the pulse output is stopped. This method can time the pulses output by the power measurement by using the input capture and compare output functions of the timer, and count the high-frequency pulses that have been output, so that the number of high-frequency power pulses and the number of low-frequency pulses both satisfy the multiple relationship, achieving the effect of frequency doubling the lower-frequency power pulses output by the power measurement SoC chip and broadening the power pulse output frequency range of the SoC.
[0096] In the specific embodiments described above, the purpose, technical solutions, and beneficial effects of the present invention have been further described in detail. It should be understood that the above are only specific embodiments of the present invention and are not used to limit the protection scope of the present invention. In particular, for those skilled in the art, any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for the electrical energy pulse output of an electrical energy metering chip, characterized in that, Including: Real-time capture the rising edge of the electrical energy pulse, where the rising edge is captured through the capture mode of the first timer; Determine whether the rising edge is captured. If the rising edge is not captured, obtain the low-frequency pulse period according to the time difference between the rising edges within a continuous preset number of times, and calculate the number of high-frequency pulses within the low-frequency pulse period according to the high-frequency pulse count value. Output pulses within the low-frequency pulse period using the second timer according to the number of high-frequency pulses and perform counting to obtain a new high-frequency pulse count value. If the new high-frequency pulse count value reaches the preset condition, stop outputting pulses. If the new high-frequency pulse count value does not reach the preset condition, continue to output pulses and capture a new rising edge for judgment to obtain an updated high-frequency pulse count value, and repeat this step until the updated high-frequency pulse count value reaches the preset condition and then stop outputting pulses. Among them, the high-frequency pulse is calculated by the MCU by reading the power value of the SoC chip; The calculating the number of high-frequency pulses within the low-frequency pulse period according to the high-frequency pulse count value specifically is: Obtain the number of high-frequency pulses within the low-frequency pulse period according to the high-frequency pulse count value and the frequency multiplication factor, and the cyclic update formula is: m t = (n + m t-1 ) - m1 where m t-1 represents the number of high-frequency pulses remaining unoutput in the previous low-frequency pulse period, and m t represents the number of high-frequency pulses remaining unoutput in the current low-frequency pulse period, (n + m t-1 ) represents the number of high-frequency pulses to be output in the current low-frequency pulse period, n is the multiple of frequency multiplication, and m1 represents the high-frequency pulse count value in the low-frequency pulse period.
2. The method for outputting electrical energy pulses of an electrical energy metering chip as claimed in claim 1, wherein, The obtaining the low-frequency pulse period according to the time difference between the rising edges within a continuous preset number of times specifically is: Obtain the first time according to the time of the rising edge of the electrical energy pulse captured for the Nth time; Obtain the second time according to the time of the rising edge of the electrical energy pulse captured for the (N + 1)th time; Take the time difference between the first time and the second time as the low-frequency pulse period.
3. A method for outputting electrical energy pulses of an electrical energy metering chip according to claim 1, characterized in that, When the new high-frequency pulse count value reaches the preset condition, stop outputting pulses specifically is: When the new high-frequency pulse count value is greater than or equal to the preset number of high-frequency pulse outputs within the low-frequency pulse period, stop outputting pulses, where the preset condition formula is: m2≥(n+m t-1 ) Among them, m2 represents the new high-frequency pulse count value, and (n + m t-1 ) represents the preset high-frequency pulse output quantity within the low-frequency pulse period.
4. An electric energy pulse output device for an electric energy metering chip, characterized in that, Including: An acquisition module for real-time capturing the rising edge of the electrical energy pulse, where the rising edge is captured through the capture mode of the first timer; A judgment module for judging whether the rising edge is captured. If the rising edge is not captured, obtain the low-frequency pulse period according to the time difference between the rising edges within a continuous preset number of times, and calculate the number of high-frequency pulses within the low-frequency pulse period according to the high-frequency pulse count value. Output pulses within the low-frequency pulse period using the second timer according to the number of high-frequency pulses and perform counting to obtain a new high-frequency pulse count value. If the new high-frequency pulse count value reaches the preset condition, stop outputting pulses. If the new high-frequency pulse count value does not reach the preset condition, continue to output pulses and capture a new rising edge for judgment to obtain an updated high-frequency pulse count value, and repeat this step until the updated high-frequency pulse count value reaches the preset condition and then stop outputting pulses; The calculating the number of high-frequency pulses within the low-frequency pulse period according to the high-frequency pulse count value specifically is: Obtain the number of high-frequency pulses within the low-frequency pulse period according to the high-frequency pulse count value and the frequency multiplication factor, and the cyclic update formula is: m t = (n + m t-1 ) - m1 where m t-1 represents the number of high-frequency pulses remaining unoutput in the previous low-frequency pulse period, and m t represents the number of high-frequency pulses remaining unoutput in the current low-frequency pulse period, (n + m t-1 ) represents the number of high-frequency pulses to be output in the current low-frequency pulse period, n is the multiple of frequency multiplication, and m1 represents the high-frequency pulse count value in the low-frequency pulse period.
5. The electric energy pulse output device of the electric energy metering chip according to claim 4, characterized in that, Obtaining a low-frequency pulse period according to the time difference between the rising edges within a continuous preset number of times, specifically: Obtaining a first time according to the time of the rising edge of the power pulse captured for the Nth time; Obtaining a second time according to the time of the rising edge of the power pulse captured for the (N + 1)th time; Taking the time difference obtained from the first time and the second time as the low-frequency pulse period.
6. The electric energy pulse output device of the electric energy metering chip according to claim 4, wherein, When the new high-frequency pulse count value reaches a preset condition, stop outputting pulses, specifically: When the new high-frequency pulse count value is greater than or equal to the preset high-frequency pulse output quantity within the low-frequency pulse period, stop outputting pulses, and the specific formula is: m2≥(n+m t-1 ) Wherein, m2 represents the new high-frequency pulse count value, and (n + m t-1 ) represents the preset high-frequency pulse output quantity within the low-frequency pulse period.
7. A terminal device, characterized in that, Including: A memory for storing a computer program; A processor for implementing the power pulse output method of the power metering chip according to any one of claims 1 to 3 when executing the computer program.
8. A storage medium, characterized in that, A computer program is stored on the storage medium, and when the computer program is executed by the processor, the steps of the power pulse output method of the power metering chip according to any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
High-precision calibration method based on ATT7022E metering chip
CN104035062A
Three-phase meter metering method and device
CN107748347A