A multi-scene device communication method based on a smart internet-of-things electric energy meter and an electric energy meter
By generating metering fingerprints and selecting the primary communication bearer, the problems of insufficient transmission scheduling adaptability and switching reliability of electricity meters in multi-scenario device communication are solved, realizing the self-synchronization transmission control and improved communication stability of electricity meters.
Patent Information
- Application Number
- CN202610632041.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-09
- Publication Date
- 2026-06-23
AI Technical Summary
In the process of communication between devices in multiple scenarios, existing electricity meters fail to deeply integrate electrical characteristics with communication scheduling, resulting in insufficient real-time transmission, communication success rate and switching reliability. It is difficult to balance the adaptability of transmission scheduling under different business scenarios and the reliability of dynamic switching of communication bearers.
By acquiring voltage and current sampling sequences, the phase anchor point and scene number are determined, the total harmonic distortion rate of voltage, the total harmonic distortion rate of current, the harmonic amplitude and the equivalent impedance amplitude are calculated, a metering fingerprint is generated, and a time slot seed is derived by combining the in-table counter, the primary and backup communication bearers are selected, messages are sent and the bearers are switched under the handover conditions.
It achieves a stable representation of the current electrical state, improves the accuracy of transmission time slot determination, reduces the probability of transmission collisions, and improves the real-time performance of message transmission and the stability of communication.
Smart Images

Figure CN122259950A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electricity meter communication technology, and in particular to a multi-scenario device communication method and electricity meter based on smart IoT electricity meters. Background Technology
[0002] With the continuous development of smart grids and electricity information collection systems, smart IoT energy meters are no longer limited to traditional energy metering functions. They are gradually taking on multiple tasks, including event reporting, fee control execution, frozen data transmission, status monitoring, and remote interaction. Existing energy meter communication methods typically revolve around timed meter reading, fixed-bearer communication, and simple retransmission mechanisms, combined with event registers, metering status registers, and measurement data to complete basic communication control. Simultaneously, the energy meter side has the capability to acquire and analyze voltage sampling sequences, current sampling sequences, zero-crossing, harmonic amplitude, and impedance characteristics. This provides a foundation for further utilizing metering-side electrical characteristics for communication scheduling, message transmission, and acknowledgment verification.
[0003] However, existing technologies often fail to deeply integrate the electrical characteristics collected in real time by the electricity meter with the communication scheduling process during multi-scenario device communication. They often adopt uniform delay parameters, fixed transmission strategies, or single bearer selection methods, making it difficult to balance real-time transmission, communication success rate, and switching reliability in different scenarios such as alarms, fee control, freezing, and meter reading. At the same time, existing solutions do not adequately consider the dynamic updating of communication bearer status, the switching basis after receipt verification, and the session continuity during cross-bearer retransmission, which can easily lead to problems such as transmission conflicts, inaccurate bearer selection, poor receipt matching reliability, and difficulty in completing stable message delivery within the limited waiting time. Summary of the Invention
[0004] In view of the aforementioned existing problems, the present invention is proposed.
[0005] Therefore, this invention provides a multi-scenario device communication method based on smart IoT energy meters to solve the problems of poor adaptability of transmission scheduling under different business scenarios and insufficient reliability of dynamic switching of communication bearers in existing technologies.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0007] In a first aspect, the present invention provides a multi-scenario device communication method based on a smart IoT energy meter, comprising: acquiring voltage sampling sequences and current sampling sequences; determining a phase anchor point based on voltage zero crossover and the start point of disturbance events; determining a scenario number based on an event register and metering status; extracting an integer fundamental period window centered on the phase anchor point; calculating the total harmonic distortion rate of voltage, the total harmonic distortion rate of current, harmonic amplitude, and equivalent impedance amplitude to generate a metering fingerprint; and deriving a time slot seed by combining the meter's internal counter; configuring the time slot length and maximum waiting delay according to the scenario number; determining the transmission time slot and transmission time based on the metering fingerprint and time slot seed; selecting a primary communication bearer and a backup communication bearer based on the bearer status table; and sending a message; generating a session token; verifying it based on the receipt digest; updating the bearer status table based on the verification; and switching to the backup communication bearer and retransmitting the message when the switching conditions are met.
[0008] As a preferred embodiment of the multi-scenario device communication method based on a smart IoT energy meter according to the present invention, the determination of the phase anchor point includes: sampling voltage and current based on the sampling rate to obtain voltage sampling sequences and current sampling sequences; determining the voltage sampling sequence for rising edge zero crossover, recording the corresponding zero crossover sampling point number, and determining the fundamental period sample number by the difference between the sampling point numbers of two adjacent rising edges; calculating the effective voltage value within a sliding window, judging disturbance events based on the effective voltage value, and determining the sampling point number of the starting point of the disturbance event; aligning the sampling point number of the starting point of the disturbance event to no earlier than the minimum zero crossover sampling point number to obtain the phase anchor point sampling point number.
[0009] As a preferred embodiment of the multi-scenario device communication method based on smart IoT energy meters described in this invention, the determination of the scenario number includes: reading an event set from an event register and reading a metering status set from a metering status register; mapping the event set and the metering status set to scenario numbers according to scenario coding rules; the scenario coding rules include: when the event set includes any anti-theft event, the scenario number is determined to be an alarm scenario; otherwise, when the metering status set has a circuit breaker or circuit breaker execution process or execution result update, the scenario number is determined to be a prepaid scenario; otherwise, when the freeze flag is set or the freeze time is reached, the scenario number is determined to be a frozen scenario; otherwise, the scenario number is determined to be a meter reading scenario.
[0010] As a preferred embodiment of the multi-scenario device communication method based on smart IoT energy meters described in this invention, the metering fingerprint includes: extracting an original window from the voltage sampling sequence and the current sampling sequence centered on the phase anchor point, and correcting the original window to an integer fundamental period window according to the number of fundamental period samples; performing synchronous sampling discrete Fourier calculation on the voltage and current sampling values within the integer fundamental period window to obtain the fundamental amplitude and the amplitudes of each harmonic; calculating the total harmonic distortion rate of voltage and the total harmonic distortion rate of current based on the amplitudes of the second to the highest harmonic and the fundamental amplitude; obtaining harmonic characteristic quantities based on the ratio of the harmonic amplitude to the fundamental amplitude, and obtaining the equivalent impedance amplitude based on the ratio of the fundamental voltage amplitude to the fundamental current amplitude; quantizing the total harmonic distortion rate of voltage, the total harmonic distortion rate of current, the harmonic characteristic quantities, and the equivalent impedance amplitude, and performing a concatenation hash operation in conjunction with the phase anchor point and the scenario number to generate the metering fingerprint.
[0011] As a preferred embodiment of the multi-scenario device communication method based on smart IoT energy meters described in this invention, the time slot seed includes: obtaining the current count value of the monotonically increasing counter within the meter, and obtaining the meter identifier and the meter key; concatenating the meter identifier and the current count value in descending order to obtain a seed input string; performing a message authentication code operation on the seed input string using the meter key to obtain the time slot seed; after the time slot seed is generated, incrementally updating the monotonically increasing counter within the meter, and using the time slot seed as input data for sending time slot mapping.
[0012] As a preferred embodiment of the multi-scenario device communication method based on smart IoT energy meters described in this invention, the determination of the transmission time slot and transmission time includes: reading the corresponding time slot length and maximum waiting delay from the parameter table according to the scenario number, and calculating the number of selectable transmission time slots according to the maximum waiting delay and time slot length; concatenating the metering fingerprint and time slot seed and performing a hash modulo operation to obtain the transmission time slot; using the phase anchor point as the scheduling starting point, calculating the transmission start sampling point sequence number according to the transmission time slot, time slot length, and sampling rate, and calculating the end sampling point sequence number according to the maximum waiting delay and sampling rate; obtaining the average round-trip delay, interaction success rate, and consecutive failure count corresponding to each communication bearer, calculating the comprehensive cost value of each communication bearer, and determining the communication bearer with the smallest comprehensive cost value as the primary communication bearer, and determining the communication bearer with the second smallest comprehensive cost value as the backup communication bearer; and sending a message through the primary communication bearer when the transmission start sampling point sequence number is reached.
[0013] As a preferred embodiment of the multi-scenario device communication method based on smart IoT energy meters described in this invention, the message transmission includes: upon reaching the transmission start sampling point sequence number, acquiring the scenario number, phase anchor sampling point sequence number, transmission time slot, metering fingerprint, and business data to construct a message to be transmitted; calling the transmission interface of the primary communication bearer to write the message to be transmitted into the corresponding transmission buffer and triggering the first round of transmission; starting a receipt waiting timer after each transmission, and determining that the transmission was successful if an acknowledgment message corresponding to this transmission is received within the receipt waiting time; if no acknowledgment message is received within the receipt waiting time, determining the retry transmission time according to the sub-backoff step size, and performing a retry transmission through the primary communication bearer within the maximum number of retry attempts; when the primary communication bearer still fails to complete the transmission acknowledgment within the maximum number of retry attempts, or the remaining time from the current time to the end sampling point sequence number is insufficient to support the next retry by the primary communication bearer, switching to the backup communication bearer to retransmit the message to be transmitted.
[0014] As a preferred embodiment of the multi-scenario device communication method based on smart IoT energy meters described in this invention, the session token includes: obtaining the meter identifier, meter key, metering fingerprint, phase anchor sampling point sequence number, and current session sequence number; concatenating the meter identifier, time slot seed, metering fingerprint, phase anchor sampling point sequence number, and current session sequence number in the order of the fields; and performing a message authentication code operation based on the concatenated fields using the meter key as the key to obtain the session token.
[0015] As a preferred embodiment of the multi-scenario device communication method based on smart IoT energy meters described in this invention, the receipt digest includes: receiving receipt data and parsing to obtain a receipt random number, a receipt session sequence number, a receipt bearer identifier, and a receipt digest; matching the receipt session sequence number and the receipt bearer identifier with the current session sequence number and the current sending communication bearer, respectively; after successful matching, calculating the expected receipt digest based on the current session token, the current sending communication bearer, the receipt random number, and the current session sequence number, and comparing the expected receipt digest with the received receipt digest for receipt verification; when receipt verification is successful, updating the average round-trip time and interaction success rate corresponding to the current sending communication bearer, and clearing the consecutive failure count; when receipt verification fails or an invalid receipt is received, reducing the interaction success rate corresponding to the current sending communication bearer, and incrementing the consecutive failure count; when the consecutive failure count reaches the switching failure threshold, or the remaining available sending time is less than the number of safe waiting samples, or receipt verification fails, switching the backup communication bearer to the current sending communication bearer, regenerating the session token based on the updated session sequence number, and retransmitting the message.
[0016] Secondly, this invention provides a multi-scenario device communication energy meter based on a smart IoT energy meter, comprising: an anchor point scenario module, responsible for acquiring voltage sampling sequences and current sampling sequences, determining phase anchor points based on voltage zero crossover and disturbance event start points, and determining scenario numbers based on event registers and metering status; a fingerprint seeding module, responsible for extracting integer fundamental period windows centered on phase anchor points, calculating voltage total harmonic distortion, current total harmonic distortion, harmonic amplitude, and equivalent impedance amplitude, generating metering fingerprints, and deriving time slot seeds in conjunction with the meter's internal counter; a time slot transmission module, responsible for configuring time slot length and maximum waiting delay based on scenario numbers, determining transmission time slots and transmission times based on metering fingerprints and time slot seeds, selecting primary and backup communication bearers in conjunction with a bearer status table, and sending messages; and a verification and switching module, responsible for generating session tokens, verifying them based on receipt digests, updating the bearer status table based on verification, and switching to the backup communication bearer and retransmitting messages when switching conditions are met.
[0017] The beneficial effects of this invention are as follows: By generating a metering fingerprint using the total harmonic distortion rate of voltage, the total harmonic distortion rate of current, harmonic amplitude, and equivalent impedance amplitude, a stable characterization of the current electrical state is achieved, thereby improving the accuracy of transmission time slot determination; by determining the transmission time slot and transmission time based on the scenario number, metering fingerprint, and time slot seed, self-synchronous transmission control under multiple scenarios is realized, thereby reducing the probability of transmission collisions and improving the real-time performance of message transmission; by autonomously selecting the primary and backup communication bearers and switching and retransmitting messages when switching conditions are met, dynamic switching of communication bearers is realized, thereby improving the message transmission success rate and communication stability. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a flowchart of a multi-scenario device communication method based on a smart IoT energy meter.
[0020] Figure 2 This is a schematic diagram of the system structure of a multi-scenario device communication energy meter based on a smart IoT energy meter.
[0021] Figure 3 A flowchart for calculating the comprehensive cost of communication bearers.
[0022] Figure 4 A flowchart for switching communication bearers.
[0023] Figure 5 This is a comparison chart of message transmission success rates across multiple service scenarios.
[0024] Figure 6 This is a comparison chart of average transmission latency under different concurrency levels. Detailed Implementation
[0025] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0026] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0027] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.
[0028] Reference Figures 1-6 This is one embodiment of the present invention, which provides a multi-scenario device communication method based on a smart IoT energy meter, including the following steps:
[0029] S1. Obtain the voltage sampling sequence and current sampling sequence, determine the phase anchor point based on the voltage zero crossover and the start point of the disturbance event, and determine the scene number based on the event register and metering status.
[0030] Furthermore, the energy meter reads parameters such as sampling rate, rated voltage, voltage drop threshold coefficient, cycle count threshold, and period anchor interval from the parameter table, and writes the sampling rate into the sampling control register of the analog-to-digital converter, so that the analog-to-digital converter can synchronously sample the voltage channel and the current channel at the sampling rate.
[0031] Among them, the priority of parameter table values is fixed: parameters issued by the main site take priority, followed by factory default parameters.
[0032] After completing the sampling configuration, the energy meter continuously acquires voltage and current sampling sequences through synchronous sampling and writes them into the ring buffer.
[0033] At the same time, the electricity meter adds a sampling point number to each sampling point, so that the voltage sampling sequence and the current sampling sequence are aligned in the same sampling point number coordinate system.
[0034] Furthermore, the energy meter performs voltage zero-crossover detection on the voltage sampling sequence, obtains the zero-crossover sampling point number, and estimates the number of fundamental period samples.
[0035] Specifically, the electricity meter performs a moving average filter on the voltage sampling sequence to suppress noise, and records the corresponding zero-crossing sampling point number when the filtered voltage sampling value shows a sign flip and meets the rising edge zero-crossing condition.
[0036] After obtaining the sampling point number of two consecutive rising edges zero crossings, the energy meter calculates the number of sampling points between two adjacent rising edges zero crossings as the fundamental frequency period sample number.
[0037] Among them, the number of fundamental frequency period samples is used to characterize the length of the current power grid fundamental frequency period in the sampling point number field.
[0038] After obtaining the number of fundamental frequency period samples, the electricity meter locates the starting point of the disturbance event in the voltage sampling sequence.
[0039] Specifically, the electricity meter calculates the effective voltage value based on the voltage sampling sequence according to a fixed window length, and constructs a disturbance criterion based on the threshold ratio between the effective voltage value and the rated voltage.
[0040] When the effective voltage value is lower than the threshold ratio of the rated voltage and the current low threshold state continuously reaches the cycle count threshold, the energy meter determines that a disturbance event has occurred, and determines the starting sampling point number of the window that first meets the disturbance criterion as the starting sampling point number of the disturbance event.
[0041] Meanwhile, the energy meter continuously monitors the event flags in the event register. When any event flag in the event register is set, the energy meter determines the sampling point number corresponding to the moment the event flag is set as the sampling point number of the starting point of the disturbance event.
[0042] It should be noted that the product of the voltage drop threshold coefficient and the rated voltage is used as the threshold ratio of the rated voltage. The voltage drop threshold coefficient is obtained by the master station uniformly configuring and sending it to the parameter table according to the statistical characteristics of the distribution network voltage fluctuation in the area where the electricity meter is installed. If it is not sent, the factory default coefficient is used. The value range is usually 0.7~0.9, preferably 0.8 or 0.85. The cycle count threshold is obtained by the master station uniformly setting and sending it to the parameter table according to the statistical characteristics of the short-time voltage fluctuation in the distribution network. If the sent parameter is not received, the electricity meter calls the factory default cycle count threshold. The value range is usually 2~10 power frequency cycles.
[0043] Furthermore, after determining the sampling point number of the starting point of the disturbance event, the energy meter performs phase anchor point alignment determination.
[0044] Specifically, the energy meter searches the recorded sequence of zero-crossover sampling points for the smallest zero-crossover sampling point number that satisfies the condition of "not earlier than the sampling point number of the start of the disturbance event", and determines the smallest zero-crossover sampling point number as the phase anchor sampling point number, so that the phase anchor sampling point number serves as a common reference point for the metering fingerprint calculation window and the self-synchronizing slot scheduling.
[0045] If the energy meter does not detect any disturbance event within the observation period, the energy meter shifts the number of sampling points corresponding to the cycle interval of the periodic anchor point backward based on the current zero-crossing sampling point number, thereby generating a periodic anchor point. The periodic anchor point is then determined as the sampling point number of the phase anchor point to support periodic communication scheduling in a disturbance-free scenario.
[0046] Furthermore, after determining the phase anchor sampling point sequence number, the energy meter acquires the metering status and performs normalized coding.
[0047] Specifically, the electricity meter reads the metering status register to obtain the metering status set.
[0048] The metering status set includes time synchronization status, power supply status, and fee control execution status.
[0049] Among them, the time synchronization status is used to indicate whether time synchronization has been completed and the level of time synchronization deviation; the power supply status is used to indicate mains power supply, capacitor-maintained power supply after power failure or power restoration; the fee control execution status is used to indicate whether there is a circuit breaker or circuit breaker action and the execution result.
[0050] The electricity meter maps metering status information to metering status codes, which are then used in conjunction with event information from the event register for scenario determination.
[0051] The electricity meter reads the event register to obtain the event set.
[0052] The event set includes events such as opening the cover, strong magnetism, reverse current, loss of voltage, phase loss, power restoration, power failure, and the results of fee control actions.
[0053] The scene number is determined based on the set of measurement states and the set of events, according to the scene coding rules.
[0054] The scenario coding rules are as follows: when the event set includes any anti-theft event such as opening the cover, strong magnetism, reverse current, or bypass, the electricity meter determines the scenario number as an alarm scenario; otherwise, when the metering status information indicates that there is a circuit breaker or circuit breaker command execution process or execution result update, the electricity meter determines the scenario number as a prepaid control scenario; otherwise, when the current time reaches the freeze point or the freeze flag is set, the electricity meter determines the scenario number as a freeze scenario; otherwise, the electricity meter determines the scenario number as a periodic meter reading scenario.
[0055] The electricity meter writes the scene number and phase anchor sampling point sequence number into the record to be sent.
[0056] S2. By extracting an integer fundamental period window centered on the phase anchor point, the total harmonic distortion rate of voltage, the total harmonic distortion rate of current, the harmonic amplitude, and the equivalent impedance amplitude are calculated to generate a metering fingerprint, and a time slot seed is derived by combining it with the in-table counter.
[0057] Furthermore, the energy meter extracts the original calculation window from the voltage sampling sequence and the current sampling sequence, centered on the phase anchor sampling point number.
[0058] It should be noted that, in order to ensure that the subsequent harmonic analysis is based on the complete fundamental period, the electricity meter does not directly use the original calculation window, but first performs integer fundamental period constraint processing on the original calculation window based on the number of fundamental period samples obtained.
[0059] In the specific processing, the energy meter first calculates the total number of sampling points covered by the original calculation window, and then compares the total number of sampling points with the number of fundamental frequency period samples to determine the maximum integer number of fundamental frequency periods that the original calculation window can fully accommodate. Based on this, the energy meter corrects the window length finally used for fingerprint calculation to the total number of sampling points corresponding to the integer number of fundamental frequency periods, and redetermines the starting sampling point sequence number of the fingerprint calculation window so that the phase anchor point is always located within the final fingerprint calculation window.
[0060] By constraining the original calculation window with integer fundamental period, the spectral leakage problem caused by the mismatch between the window length and the fundamental period is avoided, thereby improving the stability and repeatability of the subsequent harmonic feature extraction results.
[0061] Furthermore, after obtaining the integer fundamental period window, the energy meter performs synchronous sampling discrete Fourier calculations on the voltage sampling sequence and current sampling sequence within the window to extract the harmonic components of each order.
[0062] Specifically, the electricity meter calculates the cumulative values of the corresponding cosine and sine bases for each harmonic order, and synthesizes the voltage harmonic amplitude and current harmonic amplitude of the order based on the cumulative values of the cosine and sine bases.
[0063] For any order Voltage number The real part coefficient of the second harmonic is denoted as The imaginary part coefficient is denoted as , represented as:
[0064] ;
[0065] ;
[0066] in, Indicates the voltage sampling sequence at the 1st Correlation coefficients on the orthogonal basis of second harmonic cosines Indicates the voltage sampling sequence at the 1st Correlation coefficients on the sinusoidal orthogonal basis of the second harmonics This represents the voltage acquisition sequence. Indicates the harmonic order. This represents the total number of sampling points in the fingerprint calculation window. This indicates the current sampling point number participating in the calculation. This indicates the starting sampling point number of the fingerprint calculation window. Represents the first voltage sampling sequence Voltage sample values at each sampling point This indicates the number of fundamental frequency periodic samples.
[0067] Among them, the current is the first The real part coefficient of the second harmonic is denoted as The imaginary part coefficient is denoted as , represented as:
[0068] ;
[0069] ;
[0070] in, Indicates the current sampling sequence at the 1st Correlation coefficients on the orthogonal basis of second harmonic cosines Indicates the current sampling sequence at the 1st Correlation coefficients on the sinusoidal orthogonal basis of the second harmonics Indicates the current acquisition sequence. Represents the first current sampling sequence The current sample value at each sampling point.
[0071] Based on the obtained correlation coefficients, the electricity meter calculates the voltage of the first voltage level. The amplitude and current of the first harmonic The amplitude of the second harmonic is expressed as:
[0072] ;
[0073] ;
[0074] in, , Indicates the amplitude of the fundamental voltage. Indicates the amplitude of the fundamental current. Indicates the voltage level Second harmonic amplitude Indicates the current number Second harmonic amplitude.
[0075] It should be noted that the fundamental voltage amplitude is used to characterize the dominant intensity of the fundamental voltage component within the window, the fundamental current amplitude is used to characterize the dominant intensity of the fundamental current component within the window, and the amplitudes of each higher harmonic are used to reflect the current load status, grid distortion, and disturbance propagation characteristics.
[0076] Based on the acquired harmonic amplitudes, the electricity meter calculates the total harmonic distortion rate of voltage and the total harmonic distortion rate of current.
[0077] The ratio of the mean square root of the second harmonic to the highest participating harmonic to the fundamental voltage amplitude is used as the total harmonic distortion rate of voltage; the ratio of the mean square root of the second harmonic to the highest participating harmonic to the fundamental current amplitude is used as the total harmonic distortion rate of current.
[0078] Furthermore, the amplitude ratios of the second and third harmonics to the fundamental frequency are selected as harmonic characteristic quantities, and are respectively denoted as the amplitude ratio of the second harmonic of voltage, the amplitude ratio of the third harmonic of voltage, the amplitude ratio of the second harmonic of current, and the amplitude ratio of the third harmonic of current.
[0079] The electricity meter calculates the equivalent impedance amplitude based on the fundamental voltage amplitude and the fundamental current amplitude, that is, the ratio of the fundamental voltage amplitude to the fundamental current amplitude is used as the equivalent impedance amplitude.
[0080] The equivalent impedance magnitude is used to characterize the equivalent electrical characteristics of the load access state near the current phase anchor point on the grid side.
[0081] Finally, the energy meter quantizes the total harmonic distortion of voltage, total harmonic distortion of current, voltage second harmonic amplitude ratio, voltage third harmonic amplitude ratio, current second harmonic amplitude ratio, current third harmonic amplitude ratio, and equivalent impedance amplitude according to the quantization step size to obtain discrete characteristic quantities.
[0082] For any continuous feature quantity, mapping the continuous feature quantity to an integer code value with a specified step size is represented as:
[0083] ;
[0084] in, Representing characteristic quantity The quantized value obtained after performing quantization processing This represents the original feature quantity to be quantized. Representing characteristic quantity The corresponding quantization step size.
[0085] It should be noted that the quantization step size corresponding to the feature quantity adopts a feature-based setting method. The step size of different feature quantities can be selected separately according to the historical fluctuation range and discrimination sensitivity. The default is not uniform, and the configuration is preferentially issued remotely by the master station. When the master station has not configured it, the energy meter will automatically determine it according to the preset rules.
[0086] After the quantization results are generated, the electricity meter concatenates the discrete feature quantities, the phase anchor sampling point sequence number, and the scene number according to a fixed field order, and performs a hash operation on the concatenated result to generate a metering fingerprint.
[0087] It should be noted that the metrological fingerprint is a joint summary of harmonic characteristics, impedance characteristics, and scene information within an integer fundamental period window near the phase anchor point; therefore, the metrological fingerprint not only retains the key characterization of the current electrical state, but also avoids the data redundancy problem caused by directly transmitting the original sampling sequence.
[0088] Furthermore, to ensure the consistency of the encoding structure of metering fingerprints generated in different batches, the electricity meter uniformly uses fixed-byte length encoding for all data involved in the splicing, and writes it into the input string in strict accordance with the field order before performing hash operations.
[0089] Furthermore, while generating the metering fingerprint, the energy meter also extracts the quantized values of total harmonic distortion (THD) of voltage, total harmonic distortion (THD) of current, and equivalent impedance amplitude from the quantized features, and splices the extracted quantized values in a fixed order to form an operation and maintenance summary.
[0090] The operation and maintenance summary does not replace the metering fingerprint, but serves as a compact feature record that reflects the harmonic state and load state near the current phase anchor point. It is used for subsequent communication anomaly tracing, bearer status updates, and master station parameter optimization.
[0091] Because the operation and maintenance summary uses quantified discrete features, it can retain key operational status information while controlling the length of additional records, thus avoiding excessive storage and transmission overhead.
[0092] After completing the generation of metering fingerprints and operation and maintenance summaries, the electricity meter further derives time slot seeds by combining the in-meter counter.
[0093] Specifically, the electricity meter reads the current value of the monotonically increasing counter inside the meter, and at the same time reads the meter identifier and the meter key. Then, based on the meter identifier, the meter counter, and the meter key, it performs message authentication code calculation to generate a time slot seed.
[0094] The time slot seed is used for subsequent time slot mapping, so it is required to maintain distinguishability in different communication rounds of the same energy meter and not to repeat for a long time due to fixed input.
[0095] Therefore, after generating the current time slot seed, the energy meter increments its internal counter once to ensure that the time slot seed generated in the next communication round is different from the current one, thereby avoiding fixed collisions caused by consecutive communication rounds falling into the same transmission time slot.
[0096] Finally, the electricity meter writes the generated metering fingerprint, maintenance summary, and time slot seed into the communication record.
[0097] S3. Configure the time slot length and maximum waiting delay according to the scenario number, determine the transmission time slot and transmission time based on the metering fingerprint and time slot seed, and select the primary communication bearer and backup communication bearer in combination with the bearer status table before sending the message.
[0098] Furthermore, after obtaining the scenario number, the electricity meter reads the scheduling parameters corresponding to the current scenario from the parameter table based on the scenario number.
[0099] The scheduling parameters read include at least the slot length, maximum waiting delay, acknowledgment waiting time, sub-backoff step size, and maximum number of retries.
[0100] Among them, the time slot length is used to limit the time interval between adjacent candidate transmission time slots in the current scenario; the maximum waiting delay is used to limit the maximum allowed time between when a message enters the scheduling and when it must complete the transmission confirmation in the current scenario; the acknowledgment waiting time is used to limit the maximum time to wait for the receiver's confirmation information after each message transmission; the sub-backoff step size is used to limit the retransmission interval within the current time slot period when no acknowledgment is received; and the maximum number of retries is used to limit the maximum number of retries in a single round of transmission.
[0101] After reading the scenario scheduling parameters, the energy meter determines the number of selectable transmission time slots for the current scenario based on the maximum waiting delay and time slot length corresponding to the current scenario.
[0102] Specifically, the electricity meter divides the maximum waiting delay by the time slot length and rounds down the result to obtain the total number of selectable transmission time slots.
[0103] If the calculation result is less than one, the total number of selectable transmission slots will be forcibly corrected to one to ensure that there is at least one valid transmission slot in the current scenario.
[0104] Furthermore, after determining the number of selectable transmission time slots, the energy meter concatenates the metering fingerprint and time slot seed in sequential order, performs a hash operation on the concatenation result, and then modulo the hash result with the total number of selectable transmission time slots to obtain the transmission time slot number for the current round.
[0105] Specifically, the hash result is moduloed by the total number of optional transmission slots and incremented by 1 to obtain the current round transmission slot number located between 1 and the total number of optional transmission slots. This number is used to represent the candidate transmission slot position that the current message should occupy.
[0106] It should be noted that since the metering fingerprint characterizes the electrical features within an integer fundamental period window near the phase anchor point, and the time slot seed is derived from the meter's internal counter, the transmission time slot numbers obtained by different energy meters or the same energy meter in different transmission rounds are usually different. This enables self-synchronized distributed transmission within a shared waiting interval without relying on centralized scheduling.
[0107] After obtaining the transmission time slot number, the energy meter uses the phase anchor sampling point sequence number as the scheduling starting point, and calculates the transmission start sampling point sequence number by combining the transmission time slot number, time slot length and sampling rate.
[0108] Specifically, the electricity meter converts the time slot offset corresponding to the transmission time slot number into a sampling point offset, and adds it to the phase anchor sampling point sequence number to determine the start time of the first round of message transmission.
[0109] At the same time, the electricity meter also determines the cutoff sampling point number based on the maximum waiting delay and sampling rate, which is used to characterize the latest time when the current message must be sent and confirmed.
[0110] The starting sampling point number is used to drive the first round of subsequent message transmission, while the ending sampling point number is used to determine whether the remaining time is sufficient to continue the current transmission strategy during the transmission process. Together, they constitute the time boundary of the current message transmission schedule.
[0111] Furthermore, after determining the transmission time, the energy meter reads the bearer status table to obtain the status parameters corresponding to each communication bearer.
[0112] For each communication bearer, the bearer status table records at least the average round-trip time, the success rate of interaction, and the number of consecutive failures.
[0113] Among them, the average round-trip time is used to characterize the recent interaction response speed of the communication bearer; the interaction success rate is used to characterize the recent availability of the communication bearer; and the consecutive failure count is used to characterize whether the communication bearer is in a continuous abnormal state.
[0114] Subsequently, the electricity meter, in conjunction with the communication methods that are already enabled and whose links have been initialized, constructs a set of candidate communication bearers. Only communication bearers that currently have the ability to send are included in the subsequent selection range, so as to avoid mistakenly including communication bearers that are not ready in the sorting process.
[0115] Furthermore, after constructing the candidate communication bearer set, the energy meter calculates the comprehensive cost value for each communication bearer in the candidate communication bearer set, combining the average round-trip time, interaction success rate, and consecutive failure count.
[0116] Specifically, the electricity meter first performs benchmarking on the average round-trip time delay and consecutive failure count, then multiplies them by their respective weights. Simultaneously, the success rate is converted into a failure risk term, which is then weighted and summed with the aforementioned two terms to obtain the comprehensive cost value, expressed as:
[0117] ;
[0118] in, Indicates comprehensive value. Indicates the reference delay. Indicates the average round-trip time. Indicates the success rate of the interaction. Indicates the baseline failure count. Indicates the consecutive failure count. , , These represent the latency weight, success rate weight, and failure count weight, respectively. .
[0119] It should be noted that the latency weight is determined by normalizing the average round-trip latency and real-time requirements of the business scenario obtained from the historical communication process of different communication bearers, and is sent from the master station to the electricity meter as a communication scheduling parameter. The value range is usually between 0 and 1, preferably between 0.2 and 0.6. The success rate weight is determined by normalizing the distribution based on the importance of communication stability to scheduling after statistically analyzing the ratio of the number of successful message interactions to the total number of interactions for each communication bearer within the statistical period. The value range is usually between 0 and 1, preferably between 0.2 and 0.6. The failure count weight is determined by statistically analyzing the impact of continuous transmission failures of communication bearers on the overall communication reliability and calibrating it in conjunction with historical network operation data. The value range is usually between 0 and 1, preferably between 0.1 and 0.4.
[0120] It should be noted that the smaller the overall cost value, the more suitable the corresponding communication bearer is as the transmission path for the current round at the current moment.
[0121] Furthermore, after obtaining the comprehensive cost value of each candidate communication bearer, the energy meter sorts all candidate communication bearers in ascending order of comprehensive cost value, and determines the communication bearer with the smallest comprehensive cost value as the primary communication bearer, and the communication bearer with the second smallest comprehensive cost value as the backup communication bearer.
[0122] The primary communication bearer is used to prioritize the transmission of the current message, while the backup communication bearer is used to take over the transmission when the primary communication bearer fails to transmit or is close to the deadline.
[0123] If there is only one valid communication bearer in the current candidate communication bearer set, the electricity meter will use the only valid communication bearer as the primary communication bearer and mark the backup communication bearer as vacant. In this case, the subsequent transmission process will only perform retries within the primary communication bearer and will not perform cross-bearer switching.
[0124] After determining the primary and backup communication bearers, the energy meter constructs the message to be sent based on the current scenario number, phase anchor sampling point sequence number, transmission time slot number, metering fingerprint, and business data.
[0125] The business data includes at least one of the following: event summary, status data, or measurement data.
[0126] It should be noted that, in order to ensure that the receiving end can restore and verify the scheduling source of the current message, the energy meter writes scheduling-related fields such as the scenario number, phase anchor sampling point sequence number, and transmission time slot number into the message header.
[0127] When the starting sampling point number is reached, the energy meter calls the sending interface corresponding to the primary communication bearer, writes the message to be sent into the sending buffer of the current communication bearer, and triggers the sending control process to execute the first round of message sending.
[0128] After the first round of message transmission is completed, the electricity meter starts the receipt waiting process and monitors whether it receives the confirmation information corresponding to this message within the receipt waiting time range.
[0129] If a matching confirmation is received within the receipt waiting time, the electricity meter determines that the transmission was successful and ends the transmission process for the current round.
[0130] If no confirmation is received within the acknowledgment waiting period, the electricity meter will not immediately abandon the current primary communication bearer, but will arrange to retransmit within the current time slot period according to the sub-backoff step size.
[0131] Specifically, the electricity meter uses the initial transmission time as a reference, and successively postpones the subsequent retry time according to the sub-backoff step size, and calls the primary communication bearer to send the same message again when each retry time is reached.
[0132] The retry process is executed cyclically within the maximum number of retries. Once a confirmation message is successfully received after any retry, the current round of sending process ends.
[0133] It should be noted that the sub-backoff step size is determined by proportional calculation based on the time slot length corresponding to the current scenario and the statistical value of the average round-trip delay of the communication bearer. In a preferred embodiment, the sub-backoff step size is a value between 20 milliseconds and 100 milliseconds, such as 50 milliseconds, which is used to arrange message retry transmission within the same transmission time slot period in order to avoid communication bearer congestion caused by overly dense continuous transmission.
[0134] Furthermore, when the primary communication bearer fails to complete the transmission confirmation within the maximum number of retries, or when the current sampling point sequence number is close to the cutoff sampling point sequence number, and the remaining time is insufficient to support the complete transmission and acknowledgment waiting process of the next primary communication bearer, the energy meter triggers cross-bearer switching.
[0135] The electricity meter sets the backup communication bearer as the new transmission communication bearer based on the backup communication bearer already determined in the current dispatch record, and retransmits the message to be sent through the backup communication bearer.
[0136] It should be noted that, in order to ensure the reliability of the handover decision, the energy meter calculates the number of remaining sampling points between the current time and the cutoff sampling point, and compares the number of remaining sampling points with the number of sampling points required for a complete acknowledgment waiting process; when the number of remaining sampling points is less than the waiting requirement, or the primary communication bearer has exceeded the maximum number of retries, cross-bearer handover is immediately performed; in this way, the waiting delay is effectively avoided due to repeated attempts on low success rate communication bearers, thereby increasing the probability of message delivery within the maximum waiting delay range.
[0137] After completing the first round of transmission, retrying transmission within the time slot, or switching transmission across bearers, the energy meter writes the scheduling and transmission results of this round into the pending processing record.
[0138] The records to be processed include at least the transmission time slot number, the transmission start sampling point number, the end sampling point number, the primary communication bearer, and the backup communication bearer.
[0139] S4. Generate a session token, verify it based on the receipt digest, update the bearer status table based on the verification, and switch to the backup communication bearer and retransmit the message when the switching conditions are met.
[0140] Furthermore, after entering the current message transmission confirmation stage, the electricity meter reads the meter identifier, the meter key, and the current value of the local session sequence number register, and at the same time reads the metering fingerprint, the phase anchor sampling point sequence number, the transmission time slot, the primary communication bearer, and the content of the message to be sent.
[0141] Among them, the meter identifier is used to uniquely identify the current electricity meter; the meter key is used to complete the authentication calculation of the session token and the receipt digest; the session sequence number is used to distinguish different transmission rounds and prevent confusion between messages or receipts from different rounds.
[0142] The electricity meter uses the meter identifier, metering fingerprint, phase anchor sampling point sequence number, transmission time slot, primary communication bearer, and message digest to be sent to form the current session context.
[0143] After establishing the current session context, the energy meter reads the initial value of the current session sequence number from the local session sequence number register and generates a session sequence number based on the current transmission type.
[0144] When the current transmission is the first transmission of the same message on the same communication bearer, the energy meter increments the current session sequence number once based on the initial value of the current session sequence number to obtain the session sequence number for this round.
[0145] When the current message is retried within the same time slot on the same communication bearer, the energy meter retains the current session sequence number.
[0146] When the current transmission is a cross-bearer retransmission triggered by switching to the backup communication bearer, the energy meter increments the original session sequence number again to form a new session sequence number.
[0147] It should be noted that in this way, repeated transmissions within the same communication bearer can be identified as the same transmission round, while retransmissions across bearers are identified as new transmission instances, thereby ensuring that the receiving end can accurately distinguish the communication rounds under different transmission paths.
[0148] After the session sequence number is generated, the energy meter generates a session token based on the meter identifier, time slot seed, metering fingerprint, phase anchor sampling point sequence number, and session sequence number.
[0149] Specifically, the electricity meter uses a fixed byte length to encode the meter identifier, time slot seed, metering fingerprint, phase anchor sampling point sequence number, and session sequence number, and concatenates them in the order of the fields from front to back. Then, the meter uses the internal key to perform message authentication code calculation on the concatenated result to obtain a session token.
[0150] The session token is used to bind the current transmission to a specific energy meter, a specific phase anchor point, a specific metering fingerprint, and a specific session round, thereby ensuring that the subsequent receipt authentication process can accurately match the current transmission instance.
[0151] Furthermore, after the session token is generated, the energy meter constructs a transmission message carrying the session token.
[0152] Specifically, the electricity meter writes the scenario number, phase anchor sampling point number, transmission time slot, session sequence number, metering fingerprint, operation and maintenance summary, and session token in the message header, and writes the event summary and status data in the message payload area.
[0153] After the message assembly is completed, the energy meter extracts the message digest of the currently sent message and saves the message digest as the matching basis for this round of sending instances, so that it can verify whether the receipt does indeed correspond to the sent message in this round when the receipt arrives.
[0154] After the primary communication bearer completes the message transmission, the energy meter initiates the receipt waiting process and continuously listens for receipt data during the receipt waiting period.
[0155] When the receipt data is received, the electricity meter first parses the receipt fields and extracts the receipt random number, receipt session sequence number, receipt bearer identifier, and receipt summary.
[0156] Subsequently, the electricity meter compares the receipt session sequence number with the current session sequence number, and compares the receipt bearer identifier with the primary communication bearer used for the current transmission.
[0157] If the receipt session sequence number is inconsistent with the current session sequence number, or if the receipt bearer identifier is inconsistent with the current sending bearer, the energy meter will determine the current receipt as an invalid receipt and will not use the current receipt as the basis for successful transmission in this round.
[0158] Furthermore, for valid receipts, the energy meter calculates the expected receipt digest based on the current session token, the current primary communication bearer identifier, the receipt random number, and the session sequence number.
[0159] Specifically, the electricity meter concatenates the current session token, the current primary communication bearer identifier, the receipt random number, and the session sequence number in a fixed order from front to back, and uses the key in the meter to perform message authentication code calculation to obtain the expected receipt digest.
[0160] The electricity meter compares the received receipt digest with the expected receipt digest calculated locally, byte by byte.
[0161] When both are completely consistent, the electricity meter determines that the current round of verification is successful; when any bytes of the two are inconsistent, the electricity meter determines that the current round of verification is unsuccessful.
[0162] After receiving the verification result, the energy meter updates the status parameters corresponding to the primary communication bearer in the bearer status table according to the verification result.
[0163] The bearer status table stores at least the average round-trip time, interaction success rate, and consecutive failure count for each communication bearer.
[0164] When the receipt verification is successful, the energy meter records the successful round-trip time corresponding to the completion of the current round of transmission and reception confirmation, and updates the average round-trip time of the primary communication bearer using a sliding fusion method; at the same time, the energy meter uses the result of this round of interaction as a successful sample, performs a successful update on the interaction success rate of the primary communication bearer, and clears the consecutive failure count of the primary communication bearer to zero.
[0165] When the receipt verification fails or an invalid receipt is received, the energy meter does not include the current round of interaction in the success delay. Instead, it treats the result of the current round of interaction as a failure sample, performs a failure update on the interaction success rate of the primary communication bearer, and adds a failure unit to the original consecutive failure count. When the failure type is determined to be an authentication failure, the energy meter performs a weighted increment on the consecutive failure count to speed up the degradation processing of abnormal communication bearers.
[0166] It should be noted that by continuously updating the average round-trip time, interaction success rate, and consecutive failure count, the bearer status table can dynamically reflect the current link quality status of each communication bearer.
[0167] It should be noted that authentication failure refers to a failure in which any authentication verification item in the receipt message fails, such as the identity identifier, key digest, message authentication code, digital signature, or session token, or a failure to establish a trusted communication relationship in this round of interaction due to authentication timeout or authentication rejection.
[0168] Furthermore, after the bearer status table is updated, the energy meter generates switching criterion parameters to determine whether the current primary communication bearer is still suitable to continue undertaking the message sending task in this round.
[0169] Specifically, the electricity meter calculates the remaining available transmission time based on the cutoff sampling point number and the sampling point number corresponding to the current processing time, so as to represent the remaining time budget that can be used from the current time to the transmission cutoff time.
[0170] Furthermore, the electricity meter reads the switching failure threshold and the minimum number of safe waiting samples from the parameter table.
[0171] The minimum safe waiting sample number is used to characterize the minimum sampling point budget required to complete a complete send confirmation process. It is usually determined by the receipt waiting time and the sampling rate. That is, the maximum receipt waiting time after a single send is used as the sampling time window, and the number of sampling points that can be obtained in the current time window is converted and rounded according to the sampling rate to obtain the minimum safe waiting sample number.
[0172] It should be noted that after the switching criteria parameters are formed, the energy meter determines whether the switching conditions are met based on the consecutive failure count, the remaining available transmission time, and the receipt authentication result. The switching failure threshold is written into the parameter table after statistically calibrating the number of consecutive failures of each communication bearer in historical operation. The value range is usually 2 to 5, and preferably 3.
[0173] When the consecutive failure count of the primary communication bearer reaches or exceeds the handover failure threshold, it indicates that the current primary communication bearer is in a continuous abnormal state.
[0174] When the remaining available transmission time is less than the minimum number of safe wait samples required to execute a complete transmission acknowledgment, it indicates that even if the current primary communication bearer is retained, it will be difficult to complete the acknowledgment of this round of messages before the deadline.
[0175] When the receipt digest and the expected receipt digest are inconsistent, it indicates that there is a risk of receipt authentication failure in the current communication bearer.
[0176] If any of the above conditions are met, the electricity meter will determine that the switching conditions have been met.
[0177] If none of the above conditions are met, the electricity meter will maintain its current primary communication bearer and continue to perform subsequent retries within the current bearer or terminate the current transmission process within the allowable range.
[0178] Furthermore, when the switching conditions are met, the electricity meter will switch the backup communication bearer to the new transmission communication bearer and generate a new session sequence number before retransmitting across the bearer.
[0179] The energy meter recalculates a new session token based on the meter identifier, time slot seed, metering fingerprint, phase anchor sampling point sequence number, and new session sequence number. It then replaces the corresponding fields in the original message header with the new session sequence number and the new session token, and finally calls the sending interface of the backup communication bearer to retransmit the message.
[0180] Finally, after the cross-bearing switching and retransmission are completed, the electricity meter records the results of this round of processing.
[0181] The processing results for this round include at least the valid session sequence number for this round, the primary communication bearer, the backup communication bearer, the receipt verification result, the average round-trip latency update value, the interaction success rate update value, the consecutive failure count update value, and the handover reason code.
[0182] The electricity meter writes the updated load status parameters back to the load status table and writes the processing results of this round to the local record area.
[0183] In this embodiment, as Figure 5The figure shows a comparison of message transmission success rates across multiple service scenarios. As can be seen from the figure, in four typical service categories—daily meter reading, freeze reporting, fee control execution, and alarm events—the message transmission success rate of this solution is higher than that of the traditional solution. The improvement is even more significant in high-priority, real-time scenarios such as fee control execution and alarm events. This indicates that this solution can more accurately control the sending timing based on the service characteristics, self-synchronization status, and channel occupancy in different scenarios, thereby reducing message collisions, duplicate transmissions, and link congestion. Figure 5 The data results show that this solution can not only improve the reliability of data delivery in complex communication environments, but also enhance the communication stability of electricity meters during multi-scenario switching, and has good engineering application value.
[0184] In this embodiment, as Figure 6 The figure shows a comparison of average transmission latency under different concurrency scales. As can be seen from the figure, as the number of concurrently connected energy meters increases from 50 to 300, the average transmission latency of the traditional solution continues to rise, indicating that the traditional solution is easily affected by the fixed delay mechanism and the accumulation of transmission conflicts under high concurrency conditions. In contrast, the average transmission latency of this solution is significantly lower than that of the traditional solution under all concurrency scales, and the growth trend is relatively slow, indicating that this solution can dynamically adjust the message transmission rhythm according to the communication status between devices and the distribution of time slot resources, thereby improving transmission coordination. Figure 6 The data results verify that this solution has better real-time response capabilities under conditions of concurrent communication of multiple devices, and can effectively reduce the latency degradation caused by network congestion.
[0185] This embodiment also provides a multi-scenario device communication energy meter based on a smart IoT energy meter, including: an anchor point scenario module, responsible for acquiring voltage sampling sequences and current sampling sequences, determining phase anchor points based on voltage zero crossover and disturbance event start points, and determining scenario numbers based on event registers and metering status; a fingerprint seeding module, responsible for extracting integer fundamental period windows centered on phase anchor points, calculating total harmonic distortion of voltage, total harmonic distortion of current, harmonic amplitude, and equivalent impedance amplitude, generating metering fingerprints, and deriving time slot seeds in combination with the meter's internal counter; a time slot transmission module, responsible for configuring time slot length and maximum waiting delay based on scenario numbers, determining transmission time slots and transmission times based on metering fingerprints and time slot seeds, selecting primary and backup communication bearers based on the bearer status table, and sending messages; and a verification and switching module, responsible for generating session tokens, verifying them based on receipt digests, updating the bearer status table based on verification, and switching to the backup communication bearer and retransmitting messages when switching conditions are met.
[0186] In summary, this invention generates a metering fingerprint by measuring the total harmonic distortion (THD) of voltage, the THD of current, harmonic amplitude, and equivalent impedance amplitude, thereby achieving a stable characterization of the current electrical state and improving the accuracy of transmission time slot determination. By determining the transmission time slot and transmission time based on the scenario number, metering fingerprint, and time slot seed, it achieves self-synchronous transmission control in multiple scenarios, thereby reducing the probability of transmission collisions and improving the real-time performance of message transmission. By autonomously selecting the primary and backup communication bearers and switching and retransmitting messages when switching conditions are met, it achieves dynamic switching of communication bearers, thereby improving the message transmission success rate and communication stability.
[0187] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A multi-scenario device communication method based on a smart IoT energy meter, characterized in that, include: Obtain voltage and current sampling sequences, determine phase anchor points based on voltage zero crossover and disturbance event start points, and determine scene numbers based on event registers and metering status; By extracting an integer fundamental period window centered on the phase anchor point, the total harmonic distortion rate of voltage, total harmonic distortion rate of current, harmonic amplitude, and equivalent impedance amplitude are calculated to generate a metering fingerprint, which is then combined with the in-table counter to derive the time slot seed. Configure the time slot length and maximum waiting delay according to the scenario number, determine the transmission time slot and transmission time based on the metering fingerprint and time slot seed, and select the primary communication bearer and backup communication bearer in combination with the bearer status table before sending the message; Generate a session token, verify it based on the receipt digest, update the bearer status table based on the verification, and switch to the backup communication bearer and retransmit the message when the switching conditions are met.
2. The multi-scenario device communication method based on a smart IoT energy meter as described in claim 1, characterized in that, The determination of the phase anchor point includes: Voltage and current are sampled based on the sampling rate to obtain voltage sampling sequences and current sampling sequences; The voltage sampling sequence is subjected to voltage zero-crossing determination at the rising edge, the corresponding zero-crossing sampling point number is recorded, and the number of fundamental period samples is determined by the difference between the sampling point numbers of two adjacent rising edges. Within the sliding window, the effective voltage value is calculated, and based on the effective voltage value, a disturbance event is judged to determine the sampling point number of the starting point of the disturbance event. Align the sampling point number of the starting point of the disturbance event to a number no earlier than the minimum zero-crossover sampling point number, and obtain the sampling point number of the phase anchor point.
3. The multi-scenario device communication method based on a smart IoT energy meter as described in claim 1, characterized in that, The determined scene number includes: Read the event set from the event register and the metering status set from the metering status register; Map the event set and the metering status set to scene numbers according to the scene coding rules; The scenario coding rule includes determining the scenario number as an alarm scenario when the event set includes any anti-electricity theft event; Otherwise, when the metering status set has an execution process or execution result update of circuit breaker or circuit breaker, the scenario number is determined to be a fee control scenario; Otherwise, when the freeze flag is set or the freeze time is reached, the scene number is determined to be a frozen scene; Otherwise, the scene number is determined to be the meter reading scene.
4. The multi-scenario device communication method based on a smart IoT energy meter as described in claim 2 or 3, characterized in that, The measurement fingerprint includes: The original window is extracted from the voltage sampling sequence and the current sampling sequence with the phase anchor point as the center, and the original window is corrected into an integer fundamental period window according to the number of fundamental period samples. Perform synchronous sampling discrete Fourier transform calculations on the voltage and current sample values within the integer fundamental period window to obtain the fundamental amplitude and the amplitudes of each harmonic. Based on the amplitudes of the second to the highest harmonic and the fundamental frequency, calculate the total harmonic distortion of voltage and the total harmonic distortion of current, respectively. Harmonic characteristic quantities are obtained based on the ratio of the order harmonic amplitude to the fundamental amplitude, and the equivalent impedance amplitude is obtained based on the ratio of the fundamental voltage amplitude to the fundamental current amplitude. The total harmonic distortion rate of voltage, total harmonic distortion rate of current, harmonic characteristic quantities and equivalent impedance amplitude are quantified, and combined with phase anchor points and scene numbers for concatenation hash operation to generate metering fingerprints.
5. The multi-scenario device communication method based on a smart IoT energy meter as described in claim 1, characterized in that, The time slot seed includes: Get the current count value of the monotonically increasing counter in the table, and get the meter identifier and the key in the table; Concatenate the meter identifier and the current count value in descending order to obtain the seed input string; perform message authentication code operation on the seed input string using the key in the table to obtain the time slot seed; After the time slot seed is generated, the monotonically increasing counter in the table is incremented and updated, and the time slot seed is used as the input data for the transmission time slot mapping.
6. The multi-scenario device communication method based on a smart IoT energy meter as described in claim 3, characterized in that, The determination of the transmission time slot and transmission time includes: Read the corresponding time slot length and maximum waiting delay from the parameter table according to the scenario number, and calculate the number of optional transmission time slots based on the maximum waiting delay and the time slot length; The metering fingerprint and time slot seed are concatenated and a hash modulo operation is performed to obtain the transmission time slot; Using the phase anchor point as the scheduling starting point, the starting sampling point number is calculated based on the transmission time slot, time slot length, and sampling rate, and the ending sampling point number is calculated based on the maximum waiting delay and sampling rate. Obtain the average round-trip time, interaction success rate, and consecutive failure count for each communication bearer, calculate the comprehensive cost value of each communication bearer, and determine the communication bearer with the smallest comprehensive cost value as the primary communication bearer and the communication bearer with the second smallest comprehensive cost value as the backup communication bearer. When the starting sampling point sequence number is reached, a message is sent through the primary communication bearer.
7. The multi-scenario device communication method based on a smart IoT energy meter as described in claim 6, characterized in that, The transmitted message includes: When the starting sampling point sequence number is reached, the scene number, phase anchor sampling point sequence number, transmission time slot, metering fingerprint and business data are obtained to construct the message to be sent. The send interface of the primary communication bearer is called to write the message to be sent into the corresponding send buffer and trigger the first round of sending; After each transmission, a receipt waiting timer is started. If a confirmation message corresponding to this transmission is received within the receipt waiting time, the transmission is considered successful. If no acknowledgment is received within the acknowledgment waiting time, the retry time is determined according to the sub-backoff step size, and the retry is performed through the primary communication bearer within the maximum number of retries. If the primary communication bearer fails to complete the transmission confirmation within the maximum number of retries, or if the remaining time from the current moment to the cutoff sampling point is insufficient to support the next retry of the primary communication bearer, the system switches to the backup communication bearer to retransmit the message to be sent.
8. The multi-scenario device communication method based on a smart IoT energy meter as described in claim 1, characterized in that, The session token includes: Obtain the meter identifier, meter key, meter fingerprint, phase anchor sampling point sequence number, and current session sequence number; The meter identifier, time slot seed, metering fingerprint, phase anchor sampling point sequence number, and current session sequence number are concatenated in the order of the fields. The session token is obtained by performing a message authentication code operation based on the concatenated fields, using the key in the table as the key.
9. The multi-scenario device communication method based on a smart IoT energy meter as described in claim 8, characterized in that, The receipt summary includes: Receive receipt data and parse it to obtain the receipt random number, receipt session sequence number, receipt bearer identifier, and receipt digest; Match the receipt session sequence number and receipt bearer identifier with the current session sequence number and the current sent communication bearer, respectively; After a successful match, the expected receipt digest is calculated based on the current session token, the current sent communication bearer, the receipt random number, and the current session sequence number. The expected receipt digest is then compared with the received receipt digest for receipt verification. When the receipt verification is successful, update the average round-trip time and interaction success rate corresponding to the current sending communication bearer, and clear the consecutive failure count to zero; When the receipt verification fails or an invalid receipt is received, the success rate of the interaction corresponding to the current sending communication bearer is reduced, and the consecutive failure count is incremented. When the consecutive failure count reaches the switching failure threshold, or the remaining available transmission time is less than the number of safe waiting samples, or the receipt verification fails, the backup communication bearer is switched to the current transmission communication bearer, and the session token is regenerated based on the updated session sequence number before the message is retransmitted.
10. A multi-scenario device communication energy meter based on a smart IoT energy meter, based on the multi-scenario device communication method based on a smart IoT energy meter according to any one of claims 1 to 9, characterized in that, include: The anchor point scenario module is responsible for acquiring voltage and current sampling sequences, determining phase anchor points based on voltage zero crossover and disturbance event start points, and determining scenario numbers based on event registers and metering status. The fingerprint seeding module is responsible for extracting integer fundamental period windows centered on the phase anchor point, calculating the total harmonic distortion rate of voltage, total harmonic distortion rate of current, harmonic amplitude, and equivalent impedance amplitude, generating a metering fingerprint, and deriving time slot seeds by combining the in-table counter. The time slot transmission module is responsible for configuring the time slot length and maximum waiting delay according to the scenario number, determining the transmission time slot and transmission time based on the metering fingerprint and time slot seed, and selecting the primary communication bearer and backup communication bearer in combination with the bearer status table before sending the message. The verification and switching module is responsible for generating session tokens, verifying them based on the receipt digest, updating the bearer status table based on the verification, and switching to the backup communication bearer and retransmitting the message when the switching conditions are met.
