Communication method for multi-loop electric energy meter, multi-loop electric energy meter and electronic device
By setting a periodic timer and dynamically adjusting the receiving buffer in a multi-circuit energy meter, the problem of data frame dropping due to limited buffer capacity was solved, thus achieving stability and reliability of data communication.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DELIXI GROUP INSTRUMENT CO LTD
- Filing Date
- 2026-03-31
- Publication Date
- 2026-06-09
AI Technical Summary
During data communication, multi-circuit energy meters suffer from data frame loss due to the limited capacity of the host receiving buffer. As the host continuously sends data, the host needs to process it synchronously, which causes data frames to be discarded, resulting in the inability to execute commands issued by the host.
By setting a periodic timer in the host, the timing duration is determined according to the target communication rate and the capacity of the receive buffer. The remaining space in the buffer is detected. When it is close to full, the host computer suspends data transmission and processes the received data to release space. Data transmission is resumed when the buffer is restored, thus realizing dynamic adjustment of the receive buffer.
This reduces the risk of data frames being dropped, improves the reliability of the communication process, and ensures the normal execution of commands issued by the host computer.
Smart Images

Figure CN122179387A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic meter technology, and in particular to a communication method for a multi-circuit energy meter, a multi-circuit energy meter, and an electronic device. Background Technology
[0002] Multi-loop energy meters are widely used in scenarios such as power metering, energy consumption monitoring, power distribution management, and electricity information collection to collect, process, and output electrical parameters from multiple loops. With the continuous expansion of application scenarios, in addition to performing basic metering functions, multi-loop energy meters typically need to interact with a host computer and work with multiple internal acquisition units or functional modules to achieve data reading, status configuration, and result reporting. Therefore, multi-loop energy meters usually involve frequent data communication processes during operation, and their communication stability and data transmission reliability have a significant impact on the overall performance of the device.
[0003] In related technologies, multi-loop energy meters typically communicate with a host computer via a master unit, which handles data reception, buffering, parsing, and data exchange with multiple slave units. Since the host-side receive buffer capacity is usually limited, in actual use of multi-loop energy meters, the host computer may continuously send multiple sets of data within a certain time period. The host needs to perform corresponding data processing tasks while receiving the data. When the data sent by the host computer is concentrated, the communication rate is high, or the host-side processing tasks are numerous, data backlog, increased buffer usage, and untimely subsequent data processing may occur on the host receiving side. This can lead to incomplete data reception, decreased communication stability, abnormal command execution, or insufficient reliability of data exchange.
[0004] Therefore, in the communication process of multi-circuit energy meters, due to the limited capacity of the host receiving buffer and the need for the host to process data synchronously while the host continuously sends data, the data frames sent by the host are easily discarded, which in turn causes the commands issued by the host to fail to execute normally, becoming an urgent problem to be solved. Summary of the Invention
[0005] This application provides a communication method for multi-circuit energy meters, a multi-circuit energy meter, and an electronic device to solve the problem in the prior art where, when the host computer continuously sends data, the host computer also needs to process the data synchronously, which easily leads to the data frames sent by the host computer being discarded, thereby causing the commands issued by the host computer to fail to execute normally.
[0006] In a first aspect, this application provides a communication method for a multi-circuit energy meter, the multi-circuit energy meter including a master unit and multiple slave units, the master unit communicating with a host computer and the multiple slave units respectively, the method including: The first timing duration corresponding to the periodic timer is determined based on the target communication rate and the capacity of the host's receive buffer; wherein, the target communication rate is the rate at which the host computer sends data to the host. Upon receiving the first byte sent by the host computer, the periodic timer is started; When the periodic timer reaches the first timing duration, it is determined whether the first remaining space of the receiving buffer is less than or equal to the first threshold. If the first remaining space is less than or equal to the first threshold, a first message is sent to the host computer to cause the host computer to suspend sending data to the host computer. The received data in the receive buffer is processed; Determine whether the second remaining space of the receive buffer is greater than a second threshold; wherein the second threshold is greater than the first threshold; If the second remaining space is greater than the second threshold, a second message is sent to the host computer to enable the host computer to resume sending data to the host.
[0007] In one possible design, processing the received data in the receive buffer includes: The received data is segmented according to the start-of-frame and end-of-frame symbols to obtain multiple complete data frames. For each of the plurality of complete data frames, a frame sequence number is added to the frame header of the complete data frame, and a preset character is added to the frame tail of the complete data frame; The frame start symbol, address field, data length, checksum and frame end symbol in the complete data frame are deleted to obtain the compressed data frame; Update the number of used bytes in the receive buffer according to the compressed data frame to free up space in the receive buffer.
[0008] In one possible design, after updating the number of used bytes in the receive buffer according to the compressed data frame to free up space in the receive buffer, the method further includes: The compressed data frame is identified based on the frame number and the preset character. The frame type, data identifier, and data field in the compressed data frame are parsed to obtain the parsing result; Based on the parsing result, the corresponding data processing operation is performed; wherein, the data processing operation is either the host interacting with the corresponding slave, or the data processing operation is the host returning the processing result to the host computer.
[0009] In one possible design, the frame structure of the complete data frame includes a frame start symbol, an address field, a data length, a frame type, a data identifier, a data field, a checksum, and a frame end symbol.
[0010] In one possible design, determining the first timing duration corresponding to the periodic timer based on the target communication rate and the capacity of the host's receive buffer includes: According to the serial communication format, the total number of bits transmitted for a single byte of data is determined, including start bit, data bits, parity bit and stop bit; The transmission duration of a single byte of data is determined based on the target communication rate and the total number of bits to be transmitted. The transmission duration corresponding to the first threshold is determined based on the number of bytes corresponding to the first threshold and the transmission duration of the single byte data. The first timing duration is determined based on the transmission duration corresponding to the first threshold, and the first timing duration is less than the transmission duration corresponding to the first threshold.
[0011] In one possible design, after determining whether the first remaining space in the receive buffer is less than a first threshold, the method further includes: If the first remaining space is greater than the first threshold, the period timer is restarted, and the step of determining whether the first remaining space of the receiving buffer is less than or equal to the first threshold is repeated when the period timer reaches the first timing duration.
[0012] In one possible design, after determining whether the second remaining space of the receive buffer is greater than the second threshold, the method further includes: If the second remaining space is less than or equal to the second threshold, the step of processing the received data in the receive buffer is repeated.
[0013] In one possible design, the first message is an XOFF control message, and the second message is an XON control message.
[0014] Secondly, this application provides a multi-circuit energy meter, including a master unit and multiple slave units, wherein the master unit communicates with a host computer and the multiple slave units respectively; The host is used to perform the method described in the first aspect or various possible designs of the first aspect.
[0015] Thirdly, this application provides an electronic device, including: a memory and at least one processor; The memory stores computer-executed instructions; The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the method described in the first aspect or various possible designs of the first aspect.
[0016] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed, implement the method described in the first aspect or various possible designs of the first aspect.
[0017] Fifthly, this application provides a computer program product, which includes computer program code that, when run on a computer, causes the computer to implement the method described in the first aspect or various possible designs of the first aspect.
[0018] In a sixth aspect, this application provides a chip, comprising: an interface circuit and a logic circuit, wherein the interface circuit is configured to receive signals from other chips outside the chip and transmit them to the logic circuit, or to send signals from the logic circuit to other chips outside the chip, and the logic circuit is configured to implement the method described in the first aspect or various possible designs of the first aspect.
[0019] This application provides a communication method for a multi-loop energy meter, the multi-loop energy meter itself, and an electronic device. In this communication method, a first timing duration corresponding to a periodic timer is determined based on the target communication rate and the host's receive buffer capacity. The periodic timer is started when the first byte sent by the host computer is received, enabling the host to monitor the receive buffer status in a timely manner during continuous data transmission. When the first remaining space in the receive buffer is detected to be less than or equal to a first threshold, a first message is sent to the host computer to pause data transmission, thereby controlling subsequent data input in advance when the receive buffer is nearing full capacity. Simultaneously, the received data in the receive buffer is processed to release receive buffer space. When the second remaining space in the receive buffer is greater than a second threshold, a second message is sent to the host computer to resume data transmission. This application achieves dynamic adjustment of the receive buffer status through the coordination of pausing and resuming transmission, avoiding the passive discarding of subsequent data frames after the receive buffer is full, thereby reducing the risk of data frames sent by the host computer being discarded and ensuring that commands issued by the host computer can be normally received and executed by the host. Attached Figure Description
[0020] Figure 1 A circuit block diagram of a multi-loop energy meter and a host computer provided in this application embodiment; Figure 2A flowchart illustrating a communication method for a multi-circuit energy meter provided in an embodiment of this application; Figure 3 A flowchart illustrating another communication method for a multi-circuit energy meter provided in this application embodiment; Figure 4 A flowchart illustrating another communication method for a multi-circuit energy meter provided in this application embodiment; Figure 5 A flowchart illustrating another communication method for a multi-circuit energy meter provided in this application embodiment; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0022] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims and drawings of this application are intended to cover non-exclusive inclusion.
[0023] The term "embodiment" as used herein means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of the phrase "embodiment" in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0024] In this article, the term "and / or" simply describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists, A and B can exist simultaneously, and B exists. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0025] Furthermore, the terms "first," "second," etc., in the specification and claims of this application or in the aforementioned drawings are used to distinguish different objects rather than to describe a specific order, and may explicitly or implicitly include one or more of the features.
[0026] In the description of this application, unless otherwise stated, "multiple" and "at least two" mean two or more (including two), and similarly, "multiple groups" and "at least two groups" mean two or more (including two groups).
[0027] In the description of this application, it should be noted that, unless otherwise explicitly specified and limited, the terms "connected" and "linked" should be interpreted broadly. For example, "connected" or "linked" can refer not only to a physical connection, but also to an electrical connection or a signal connection. For instance, it can be a direct connection, i.e., a physical connection, or an indirect connection through at least one intermediate component, as long as the circuit is connected. It can also refer to the internal connection between two components. A signal connection can refer not only to a signal connection through a circuit, but also to a signal connection through a medium, such as radio waves. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.
[0028] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. It should be noted that, unless otherwise specified, different technical features in this application can be combined with each other.
[0029] In a multi-circuit energy meter system, the master unit typically reserves a certain amount of space as a data receiving buffer, for example, 1KB. A number of slave units are usually cascaded below the master unit. Data reading and parameter setting of the slave units are usually achieved through communication between the master unit and the host computer. Therefore, the master unit in the system undertakes the functions of data reception, forwarding, and processing.
[0030] In practical applications, when the communication baud rate between the host computer and the main computer is 115200bps, and the host computer continuously sends data to the main computer, the main computer needs to process the received data while simultaneously receiving the data sent by the host computer. In related technologies, when the main computer's receive buffer is full, it typically automatically discards subsequent data frames sent by the host computer until the main computer has finished processing some data frames and freed up space in the receive buffer before continuing to receive data frames sent by the host computer. This approach can easily lead to the discarding of data frames sent by the host computer, resulting in commands issued by the host computer failing to execute correctly.
[0031] To address the problems existing in related technologies, this application provides a communication method for multi-loop energy meters. First, a first timing duration corresponding to a periodic timer is determined based on the target communication rate between the host computer and the main unit, and the capacity of the main unit's receiving buffer. Second, the periodic timer is started when the main unit receives the first byte sent by the host computer, and the remaining space in the receiving buffer is checked when the periodic timer reaches the corresponding first timing duration. When the remaining space in the receiving buffer is detected to be less than or equal to a first threshold, a first message for pausing data transmission is sent to the host computer to prevent the host computer from continuing to send data to the main unit. Simultaneously, the received data in the receiving buffer is processed to reduce the occupancy of the receiving buffer. Finally, when the remaining space in the receiving buffer recovers to a level greater than a second threshold, a second message for resuming data transmission is sent to the host computer, thereby enabling the host computer to resume sending data to the main unit. The method provided in this application can control the host computer's data transmission when the main unit's receiving buffer is close to full capacity, and release buffer space by processing the received data, thereby reducing the risk of data frames sent by the host computer being discarded, improving the reliability of the multi-loop energy meter communication process, and ensuring the normal execution of commands issued by the host computer.
[0032] Next, through some specific embodiments and accompanying drawings, this application will describe in detail how it solves the problem that data frames sent by the host computer during the communication process of the above-mentioned multi-circuit energy meter are easily discarded, which in turn leads to the inability of commands issued by the host computer to be executed normally.
[0033] This application provides a communication method for multi-circuit energy meters. Figure 1 A circuit block diagram of a multi-loop energy meter and a host computer provided for embodiments of this application is shown below. Figure 1 As shown, the multi-circuit energy meter 10 includes a master unit 11 and multiple slave units 12. The master unit 11 communicates with the host computer 20 and the multiple slave units 12 respectively.
[0034] The host computer 20 is used to send control commands, configuration parameters and / or data read requests to the host computer 11, and to receive the processing results returned by the host computer 11.
[0035] The host 11 is used to receive data sent by the host computer 20, cache, parse and process the received data, and interact with the corresponding slave 12 based on the parsing results, or return the processing results to the host computer 20.
[0036] Multiple slave devices 12 are used to respond to control or read requests from the host 11 and return corresponding data or status information to the host 11.
[0037] In practical applications, when the host computer 20 continuously sends data to the host computer 11, the host computer 11 needs to process the received data while receiving it, and also interact with multiple slave computers 12. Since the host computer 11 typically has a limited-capacity receive buffer, if the data in the receive buffer continues to increase and processing is not timely, subsequent data reception anomalies or even data frame loss can easily occur. Therefore, the communication method provided in this application primarily optimizes the data communication process between the host computer 11 and the host computer 20 to improve the communication reliability of the multi-loop energy meter 10 in scenarios with continuous data input.
[0038] Figure 2 This is a flowchart illustrating a communication method for a multi-circuit energy meter, provided as an embodiment of this application. Figure 2 As shown, the communication method includes S201 to S208, and S201 to S208 will be described in detail below.
[0039] It should be noted that the execution subject of the communication method provided in this application embodiment is the host in the multi-circuit energy meter.
[0040] S201. The host determines the first timing duration corresponding to the periodic timer based on the target communication rate and the capacity of the host's receive buffer.
[0041] The target communication rate is the rate at which the host computer sends data to the host computer.
[0042] It should be noted that the target communication rate reflects how fast the host computer sends data to the host computer. The capacity of the receive buffer reflects the amount of space the host computer can use to temporarily store received data.
[0043] Determining the first timing duration by using the target communication rate and the capacity of the receive buffer allows the first timing duration to match the actual data reception process, thus enabling the host to promptly detect changes in the status of the receive buffer during continuous data input.
[0044] The first timing duration is used to characterize the time interval during which the host checks the remaining space in the receive buffer.
[0045] It should be noted that by setting the first timing duration, the host can detect the status of the receiving buffer at a preset period during the process of receiving data sent by the host computer, thereby providing a basis for subsequent judgment on whether the remaining space of the receiving buffer has reached the preset conditions.
[0046] S202. When the host receives the first byte sent by the host computer, it starts the periodic timer.
[0047] The host starts timing from the first byte received from the host computer, so that the timing start of the periodic timer is consistent with the actual data reception process. This allows the subsequent reception buffer status detection based on the periodic timer to more accurately reflect the buffer occupancy during the current data reception process.
[0048] Specifically, once the host computer receives the first byte of the data stream sent by the host computer, it considers the current round of data reception to have begun and starts a periodic timer. During the periodic timer's operation, the host computer can continue to send data to the host computer, while the host computer receives data and writes it into the receive buffer, while waiting for the periodic timer to reach its first duration.
[0049] S203. When the host's periodic timer reaches the first timing duration, it determines whether the first remaining space in the receive buffer is less than or equal to the first threshold.
[0050] When the periodic timer reaches the first countdown duration, the host checks the first remaining space in the current receive buffer to determine whether the current receive buffer is approaching the preset congestion state, thus providing a basis for whether to control the host computer to suspend data transmission.
[0051] The first remaining space represents the remaining capacity in the receive buffer that can still be used to receive data at the current detection time.
[0052] In some embodiments, the first remaining space can be represented in bytes, for example, the first remaining space can be represented as the number of available bytes remaining in the current receive buffer.
[0053] Specifically, the host can determine the first remaining space based on the total capacity of the receive buffer and the number of bytes currently used. For example, the host can count the number of bytes currently occupied in the receive buffer in real time, and subtract the number of bytes currently occupied from the total number of bytes corresponding to the total capacity of the receive buffer to obtain the first remaining space.
[0054] In other embodiments, the first remaining space may also be represented by the number of remaining storage units, the percentage of remaining capacity, or other similar methods. Any resource that can characterize the remaining resources in the current receive buffer that are still available for receiving data can be used as the first remaining space in this application.
[0055] The first threshold is the threshold used to trigger the host computer to pause data transmission.
[0056] In some embodiments, the first threshold may be represented in bytes, for example, the first threshold may be represented as the minimum number of remaining available bytes reserved in the receive buffer.
[0057] It should be noted that the first threshold is not limited to being represented by the number of bytes. In other embodiments, it can also be represented by the number of remaining storage units, the percentage of remaining capacity, or other methods that can characterize the lower limit of the remaining resources in the receive buffer.
[0058] In practice, the first remaining space and the first threshold are represented in the same way, which allows the host to directly compare the size relationship between the first remaining space and the first threshold, thus simplifying the judgment process. When the first remaining space is represented in bytes, the first threshold is also represented in bytes; when the first remaining space is represented as a percentage of remaining capacity, the first threshold is also represented in the corresponding proportion or percentage.
[0059] When the host detects that the first remaining space is less than or equal to the first threshold, it considers that the remaining space in the current receive buffer is insufficient to safely receive subsequent incoming data, and the host's receive buffer is nearing full capacity. If the host computer continues to send data to the host, the risk of subsequent data frames being dropped will significantly increase. Therefore, when the first remaining space is detected to be less than or equal to the first threshold, the host executes the method steps shown in S204, entering the subsequent data transmission control process to cause the host computer to suspend sending data to the host.
[0060] S204. The host computer sends a first message to the host computer to cause the host computer to pause sending data to the host computer.
[0061] The first message is used to instruct the host computer to pause sending data to the host computer.
[0062] It should be noted that after receiving the first message from the host computer, the host computer pauses sending subsequent data to the host computer. This allows the host computer to process the received data in the receive buffer even when the data stream is temporarily interrupted, thus creating conditions for the host computer to release the receive buffer space.
[0063] In some embodiments, the first message may be implemented using a preset control character, a preset control frame, or other message format capable of indicating a pause in transmission to the host computer. Any message that enables the host computer to pause data transmission to the host computer upon receiving the first message can be used as the first message in this application.
[0064] In this embodiment, the host does not send the first message to the host computer only after the receive buffer is completely full. Instead, it sends the first message in advance when the remaining space in the receive buffer drops to a preset lower limit (first threshold). Using this method, the host can promptly notify the host computer to pause data transmission when the remaining space in the receive buffer is insufficient. This avoids further congestion of the receive buffer caused by the host computer continuously sending data, thereby reducing the risk of data frames being discarded and improving the communication reliability of the multi-loop energy meter 10 in continuous data input scenarios.
[0065] Conversely, when the first remaining space is greater than the first threshold, it indicates that the receiving buffer still has relatively sufficient available space. At this time, there is no need to trigger the host computer to pause data transmission, and the host executes the method steps shown in S208.
[0066] In some embodiments, S208, the periodic timer is restarted, and the steps shown in S203 are repeated.
[0067] It should be noted that when the first remaining space is greater than the first threshold, the host continues to receive data sent by the host computer, restarts the periodic timer, and re-checks the remaining space of the receive buffer when the next first timeout period arrives, so as to continuously monitor the status of the receive buffer.
[0068] In this embodiment, the host can periodically track the status of the receiving buffer during the continuous data transmission process of the host computer, so that when the remaining space of the receiving buffer drops below the first threshold, the corresponding data transmission control process can be entered in a timely manner.
[0069] S205. The host processes the received data in the receive buffer.
[0070] It should be noted that after the host computer sends the first message to the host computer, although the host computer pauses sending data to the host, the host's receive buffer still contains the received data. Therefore, the host processes the received data to reduce the occupancy of the receive buffer and create conditions for subsequent data reception.
[0071] The host processes the received data in the receive buffer, which may include operations such as organizing, identifying, segmenting, compressing, parsing, and / or updating the buffer occupancy status. By processing the received data in the receive buffer, the host can release some of the occupied space, thereby increasing the remaining space in the receive buffer. This allows the host computer to continue sending data to the host when the second remaining space in the receive buffer exceeds a second threshold.
[0072] S206. The host determines whether the second remaining space in the receive buffer is greater than the second threshold.
[0073] The second remaining space refers to the remaining capacity of the receive buffer that can still be used to receive data after the aforementioned data processing is completed.
[0074] After processing the received data in the receive buffer, the host further determines whether the second remaining space in the current receive buffer is greater than the second threshold, so as to determine whether the available space in the receive buffer has been restored to a level that allows the host computer to continue sending data to the host.
[0075] It should be noted that the representation of the second remaining space and the second threshold is the same as that of the first remaining space and the first threshold described above, and will not be repeated in this embodiment.
[0076] The second threshold is greater than the first threshold.
[0077] By setting the second threshold to be greater than the first threshold, different judgment criteria can be applied to the conditions for pausing transmission and resuming transmission. This avoids the host frequently sending the first and second messages to the host computer when the remaining space in the receive buffer fluctuates around a single threshold, which helps to improve the stability of the communication control process.
[0078] In this embodiment, when the second remaining space is greater than the second threshold, it indicates that after the host processes the received data, the host's receive buffer has recovered relatively sufficient available space and is ready to continue receiving data sent by the host computer. Therefore, the host executes the method steps shown in step S207.
[0079] S207. Send a second message to the host computer to enable the host computer to resume sending data to the host computer.
[0080] The second message is used to instruct the host computer to resume sending data to the host.
[0081] It should be noted that after receiving the second message, the host computer can resume sending subsequent data to the host. In this way, the host can promptly notify the host computer to restart data transmission when the remaining space in the receive buffer meets the preset requirement (second threshold), thereby ensuring that the communication process can continue while avoiding continuous congestion in the receive buffer.
[0082] In some embodiments, the second message may be implemented using a preset control character, a preset control frame, or other message format capable of representing the resumption of transmission to the host computer. Any message that enables the host computer to resume sending data to the host computer after receiving the second message can be used as the second message in this application.
[0083] In this embodiment, the host does not immediately allow the host computer to resume data transmission as soon as the receive buffer is no longer congested. Instead, it sends the second message only after the remaining space in the receive buffer has recovered to a sufficient level. This approach helps avoid the host frequently sending pause and resume transmission messages to the host computer when the remaining space in the receive buffer fluctuates within a low range, thereby improving the stability of the communication control process.
[0084] Furthermore, it should be noted that after sending the second message to the host computer, the host computer re-enters the receive buffer status detection process based on a periodic timer, so that it can continue to monitor the status of the receive buffer after the host computer resumes sending data. Thus, the host computer can dynamically adjust the status of the receive buffer by coordinating pause and resume transmission control in scenarios where the host computer is continuously sending data.
[0085] Conversely, when the second remaining space is less than or equal to the second threshold, it indicates that the available space in the current receive buffer has not yet recovered to the preset requirement. If the host computer is allowed to resume sending data at this time, the receive buffer may still quickly fill up again, increasing the risk of data frames being dropped. Therefore, when the second remaining space is less than or equal to the second threshold, the host repeats the method steps shown in S205 to continue processing the received data in the receive buffer to further release the receive buffer space until the second remaining space meets the preset requirement.
[0086] This application provides a communication method for a multi-loop energy meter. First, a first timing duration corresponding to a periodic timer is determined based on the target communication rate and the host's receiving buffer capacity. Second, the periodic timer is started when the first byte sent by the host computer is received, enabling the host to monitor the receiving buffer status according to a timing rhythm adapted to the current communication rate and buffer capacity while the host computer continuously sends data. This avoids passively discovering data congestion only after the receiving buffer is full. Further, when the periodic timer reaches the first timing duration, it is determined whether the first remaining space in the receiving buffer is less than or equal to a first threshold. When the first remaining space is less than or equal to the first threshold, a first message is sent to the host computer to cause the host computer to pause sending data to the host. This allows for advance control of subsequent input data when the remaining space in the receiving buffer is insufficient but not completely exhausted. This reduces the congestion exacerbated by subsequent data being written to the receive buffer. Simultaneously, the host processes the received data in the receive buffer, releasing previously occupied space and gradually restoring its available space. Finally, it checks if the second remaining space in the receive buffer is greater than a second threshold. If the second remaining space is greater than the second threshold, a second message is sent to the host computer to allow the host computer to resume sending data to the host. Since the second threshold is greater than the first threshold, the host only allows the host computer to resume sending data after the remaining space in the receive buffer has recovered to a relatively sufficient level. This avoids immediately resuming transmission when the receive buffer space has just slightly recovered, which would quickly bring the congestion back to a near-congestion state. It also allows the pause and resumption of transmission to work together, enabling the host to dynamically adjust the state of the receive buffer in scenarios with continuous data input. The method provided in this application does not allow subsequent data frames to be discarded after the receive buffer is full. Instead, it pauses the host computer's transmission when the receive buffer is nearly full, processes the received data to restore the receive buffer space, and allows the host computer to continue transmitting after the receive buffer space is restored. Therefore, the method provided in this application can reduce the risk of data frames sent by the host computer being discarded, thereby ensuring that the commands issued by the host computer can be received and executed normally by the host.
[0087] In the above embodiment, the host needs to process the received data in the receive buffer. The specific process of the host processing the received data in the receive buffer will be described in detail below.
[0088] Figure 3 This is a flowchart illustrating another communication method for multi-circuit energy meters provided in an embodiment of this application. Figure 3As shown, in one possible embodiment, the method steps shown in S205 can be implemented by S2051 to S2054, which are described in detail below.
[0089] S2051. The received data is segmented according to the start-of-frame symbol and the end-of-frame symbol to obtain multiple complete data frames.
[0090] In one possible embodiment, the frame structure of a complete data frame includes a frame start symbol, an address field, a data length, a frame type, a data identifier, a data field, a checksum, and a frame end symbol.
[0091] Among them, the frame start symbol is used to indicate the start position of the data frame, the frame end symbol is used to indicate the end position of the data frame, the address field is used to indicate the address information corresponding to the data frame, the data length is used to indicate the length of the valid data in the data frame, the frame type is used to indicate the category to which the current data frame belongs, the data identifier is used to indicate the specific data item corresponding to the data frame, the data field is used to carry the actual business data, and the checksum is used to perform integrity verification on the data frame.
[0092] It should be noted that in the host's receive buffer, the data from the host computer is usually written in the form of a continuous byte stream. Therefore, before processing the received data, the host first needs to identify the boundary positions of each data frame, so as to divide the continuous buffered data into complete data frames that can be processed independently.
[0093] In one possible embodiment, the host can determine the boundaries of a single data frame by detecting preset start-of-frame and end-of-frame symbols.
[0094] Specifically, the host can search for the position corresponding to the start-of-frame symbol in the received data and continue searching for the matching end-of-frame symbol. After detecting the complete start-of-frame and end-of-frame symbol boundaries, the data between them is identified as a complete data frame. In this way, the host can extract multiple complete data frames from the continuous data in the receive buffer, so that each complete data frame can be processed separately.
[0095] S2052. For each complete data frame in a plurality of complete data frames, add a frame sequence number to the frame header of the complete data frame and add a preset character to the frame tail of the complete data frame.
[0096] The frame sequence number is used to represent the order information or identification information of the corresponding complete data frame.
[0097] It should be noted that the frame sequence number can be written in byte form to the header of the complete data frame, for example, by writing a one-byte sequence number identifier.
[0098] By adding different frame sequence numbers to different complete data frames, the host can identify the correspondence between different compressed data frames during subsequent processing, avoiding the problem of being unable to distinguish different data frames after the original frame header (frame start character), address field, length field and other fields are deleted.
[0099] Among them, the preset characters are used to represent the boundary markers at the end of the compressed data frame.
[0100] It should be noted that the preset character can be a pre-agreed character or control value. As long as it can be used to characterize the tail boundary of the compressed data frame, it can be used as the preset character in this application.
[0101] For example, the default character is 0x20.
[0102] By adding a preset character to the end of the complete data frame, the host can determine the boundary range and end position of the compressed data frame by combining the frame number and the preset character when recognizing and parsing the compressed data frame later.
[0103] S2053. Delete the frame start symbol, address field, data length, checksum and frame end symbol from the complete data frame to obtain the compressed data frame.
[0104] The start-of-frame character, address field, data length, checksum, and end-of-frame character are mainly used for functions such as boundary identification, address identification, length identification, and integrity verification of complete data frames. In scenarios where the receive buffer is nearly full and buffer space needs to be released first, the host can reduce the space occupied by a single data frame in the receive buffer by deleting the above fields.
[0105] In this embodiment, before the host performs the deletion of the start-of-frame character, address field, data length, checksum, and end-of-frame character, it has already segmented the continuous data using the method steps shown in S2051, and added a frame sequence number and a preset character to the frame header and tail of the complete data frame using the method steps shown in S2052. Therefore, in subsequent processing, the compressed data frame can still be identified and its boundaries confirmed based on the frame sequence number and the preset character. In other words, deleting the start-of-frame character, address field, data length, checksum, and end-of-frame character does not completely render the compressed data frame unprocessable. Instead, by introducing a new marking method, the basic identification capabilities required for subsequent processing are retained while reducing cache usage.
[0106] Furthermore, after the complete data frame is deleted, the content retained in the compressed data frame includes the frame sequence number, frame type, data identifier, data field, and preset characters. Since the frame type, data identifier, and data field are usually directly related to subsequent business processing, retaining the frame type, data identifier, and data field in the compressed data frame is beneficial for the host to continue performing corresponding data processing operations based on the compressed data frame.
[0107] S2054. Update the number of used bytes in the receive buffer according to the compressed data frame to free up space in the receive buffer.
[0108] It should be noted that before the deletion process is performed on the complete data frame, the receive buffer records the space occupied by the original complete data frame; after the deletion process is performed on the complete data frame, the space occupied by a single data frame is reduced, so it is necessary to update the number of used bytes in the receive buffer synchronously to reflect the actual space occupied after the data frame compression process.
[0109] Specifically, the host can adjust the number of used bytes in the receive buffer based on the difference between the number of bytes occupied by the complete data frame before compression and the number of bytes occupied by the data frame after compression. For example, after determining the number of bytes reduced after compression of a complete data frame, the host can subtract the reduced number of bytes from the current number of used bytes in the receive buffer to obtain the updated number of used bytes. By updating the number of used bytes in the receive buffer, the host can increase the second remaining space in the receive buffer accordingly, thereby freeing up buffer resources available for subsequent data reception.
[0110] It's important to note that freeing up space in the receive buffer doesn't mean deleting compressed data frames from the receive buffer. Instead, it means compressing received data to reduce its footprint in the receive buffer, thus freeing up space that was originally occupied by complete data frames. In this way, the host can quickly increase the available capacity of the receive buffer without directly discarding received data.
[0111] This application embodiment reduces the space occupied by a single data frame in the receiving buffer by segmenting and compressing the received data in the receiving buffer, and releases the available capacity of the receiving buffer. This can quickly alleviate the congestion of the receiving buffer without directly discarding the received data, reduce the risk of subsequent data frames being discarded, thereby improving the communication reliability of multi-loop energy meters and ensuring the normal execution of commands issued by the host computer.
[0112] In the above embodiment, the host needs to release space in the receive buffer. The specific process of the host further releasing space in the receive buffer will be described in detail below.
[0113] Figure 4 This is a flowchart illustrating another communication method for a multi-circuit energy meter provided in an embodiment of this application. Figure 4 As shown, in one possible embodiment, after the method step shown in S2054, the method further includes S2055 to S2057, which are described in detail below.
[0114] S2055. Based on the frame sequence number and preset characters, the compressed data frame is identified.
[0115] It should be noted that each compressed data frame has a frame sequence number and preset characters. The host can determine the boundaries of the compressed data frame based on the preset characters and identify the corresponding compressed data frame based on the frame sequence number, thereby achieving the differentiation and identification of multiple compressed data frames. In this way, even if the frame start character, address field, data length, checksum, and frame end character in the original complete data frame have been deleted, the host can still effectively identify the compressed data frame.
[0116] It should be noted that the host's identification of compressed data frames is not limited to determining whether compressed data frames exist, but also includes determining the boundary positions, order relationships, and corresponding identifiers of compressed data frames.
[0117] S2056. Parse the frame type, data identifier, and data field in the compressed data frame to obtain the parsing result.
[0118] In the compressed data frame, the frame type, data identifier, and data fields are information directly related to subsequent business processing. The host extracts the frame type, data identifier, and data fields from the compressed data frame according to the pre-agreed data frame format and parses and processes them accordingly.
[0119] For example, the host can determine whether the current compressed data frame belongs to a data read request, parameter setting request, status reporting data, or other types of data frame based on the frame type; determine the specific data object, function object, or parameter object corresponding to the compressed data frame based on the data identifier; and extract the valid data content carried in the current compressed data frame based on the data field.
[0120] The host can obtain the corresponding parsing results by parsing the frame type, data identifier, and data fields. The parsing results are used to indicate what data processing operation the host should perform subsequently, as well as the objects and content involved in that data processing operation.
[0121] The parsing results may include, but are not limited to: the service type corresponding to the current compressed data frame, the target data object, the target slave object, the specific parameter content, the read request content, the set request content, and the data content to be returned.
[0122] S2057. Perform the corresponding data processing operation based on the parsing result.
[0123] Among them, the data processing operation is either the host and the corresponding slave interacting with each other, or the host returning the processing result to the host computer.
[0124] In one embodiment, when the parsing result indicates that the current compressed data frame corresponds to service content that requires the host to initiate a read, set, query, or control request to a certain slave device, the host can send a read instruction, parameter setting instruction, or status query instruction to the corresponding slave device according to the parsing result, and receive the data or status information returned by the corresponding slave device.
[0125] In another embodiment, when the parsing result indicates that the current compressed data frame corresponds to service content that the host needs to report back to the host computer, the host can return the corresponding processing result to the host computer based on the parsing result. For example, the host can return data obtained from the corresponding slave device, the host's processing result on the relevant data, or the current service execution result to the host computer, thereby completing the corresponding data reporting or result feedback.
[0126] It should be noted that the data processing operation is not limited to the two forms mentioned above. Any processing action that is performed based on the parsing result and corresponds to the current compressed data frame can be used as the data processing operation in this application.
[0127] This application embodiment, after the receive buffer space is released, continues to identify the compressed data frame based on the frame sequence number and preset characters, and parses the frame type, data identifier and data field in it to perform corresponding data processing operations. This ensures that the compressed data frame can still be identified and used normally, which not only ensures that the data after the receive buffer space is released can continue to participate in subsequent business processing, but also takes into account the needs of receive buffer space optimization and normal data interaction.
[0128] In the above embodiment, the host needs to determine the first timing duration corresponding to the periodic timer based on the target communication rate and the capacity of the host's receive buffer. Next, the specific process by which the host determines the first timing duration corresponding to the periodic timer based on the target communication rate and the capacity of the host's receive buffer will be described in detail.
[0129] Figure 5 This is a flowchart illustrating another communication method for a multi-circuit energy meter provided in an embodiment of this application. Figure 5 As shown, in one possible embodiment, the method steps shown in S201 can be implemented by S2011 to S2014, which are described in detail below.
[0130] S2011. Determine the total number of bits transmitted for a single byte of data according to the serial communication format.
[0131] During serial communication, when a byte of data is transmitted over the physical link, it typically includes not only the data bits of that byte itself, but also a start bit, a parity bit, and a stop bit. Therefore, to accurately calculate the time required for a single byte of data transmission, it is necessary to first determine the total number of bits transmitted for that single byte of data.
[0132] The total number of bits transmitted includes start bits, data bits, parity bits, and stop bits.
[0133] It should be noted that the host can determine the complete bit composition corresponding to each byte of data transmitted based on the serial communication protocol parameters used.
[0134] For example, in one possible embodiment, the serial communication format may use 1 start bit, 8 data bits, 1 parity bit and 1 stop bit, in which case the total number of bits transmitted for a single byte of data is 11 bits.
[0135] It should be noted that this application is not limited to the exemplary serial communication format described above. In other embodiments, if the start bit, data bit, parity bit, and stop bit settings in the serial communication format are different, the host can also determine the corresponding total number of bits to be transmitted based on the actual serial communication format used.
[0136] S2012. Determine the transmission duration of a single byte of data based on the target communication rate and the total number of bits to be transmitted.
[0137] Specifically, the host can divide the total number of bits transmitted for a single byte of data by the target communication rate to obtain the transmission duration of the single byte of data. The transmission duration of a single byte of data can be expressed in microseconds, milliseconds, or other time units.
[0138] For example, when the target communication rate is 115200bps and the total number of bits transmitted for a single byte of data is 11, the host can determine that the transmission time of a single byte of data is approximately 11 / 115200≈95 microseconds.
[0139] S2013. Determine the transmission duration corresponding to the first threshold based on the number of bytes corresponding to the first threshold and the transmission duration of a single byte of data.
[0140] The first threshold is used to characterize the level of remaining space in the receive buffer at which a pause in transmission control should be triggered. When the first threshold is represented in bytes, the host can further calculate the transmission duration corresponding to the number of bytes corresponding to the first threshold under the current communication conditions, thereby obtaining the transmission duration corresponding to the first threshold.
[0141] Specifically, the host can multiply the number of bytes corresponding to the first threshold by the transmission time of a single byte of data to obtain the transmission time corresponding to the first threshold. The transmission time corresponding to the first threshold can be understood as the time required to transmit the amount of data corresponding to the first threshold at the current target communication rate. By obtaining the transmission time corresponding to the first threshold, the host can further determine the setting range of the first timing duration of the periodic timer.
[0142] For example, when the number of bytes corresponding to the first threshold is 100 bytes and the transmission time of a single byte of data is approximately 95 microseconds, the host can determine that the transmission time corresponding to the first threshold is approximately 100 × 95 microseconds = 9.5 milliseconds.
[0143] S2014. Based on the transmission duration corresponding to the first threshold, determine the first timing duration, wherein the first timing duration is less than the transmission duration corresponding to the first threshold.
[0144] It should be noted that the host does not start detection only when the first remaining space in the receive buffer exactly drops to the first threshold. Instead, by setting the first timing duration of the periodic timer to be less than the transmission duration corresponding to the first threshold, the host can perform the detection operation in advance before the remaining space in the receive buffer actually approaches the first threshold.
[0145] By setting the first timing duration to be less than the transmission duration corresponding to the first threshold, the host can more promptly grasp the changes in the remaining space of the receive buffer during the continuous data transmission from the host computer. This prevents the receive buffer from becoming full before the judgment is completed due to late detection. In other words, by making the first timing duration less than the transmission duration corresponding to the first threshold, the host can reserve a certain detection and control margin during the continuous writing of data into the receive buffer, thereby improving the timeliness of subsequent triggering of pause transmission control.
[0146] For example, when the transmission duration corresponding to the first threshold is approximately 9.5 milliseconds, the host can set the first timing duration to 9 milliseconds. Thus, when the periodic timer reaches 9ms, the host can check the first remaining space in the receive buffer, which is more conducive to timely detection of congestion risks in the receive buffer before the receive buffer space further decreases and to initiating subsequent control procedures.
[0147] This embodiment of the application determines the first timing duration of the periodic timer based on the serial communication format, the target communication rate, and the amount of data corresponding to the first threshold. This ensures that the first timing duration matches the actual data transmission process and is less than the transmission duration corresponding to the first threshold. As a result, the host can perform timely detection before the remaining space in the receiving buffer approaches the first threshold. This improves the timeliness of receiving buffer status monitoring and provides a more effective time basis for pausing subsequent data transmission from the host computer, reducing the risk of data frames being discarded due to detection lag.
[0148] In the above embodiment, the host needs to send a first message and a second message to the host computer. The specific forms of the first and second messages will be described in detail below.
[0149] In one possible embodiment, the first message is an XOFF control message and the second message is an XON control message.
[0150] When the host detects that the first remaining space in the receive buffer is less than or equal to the first threshold, it immediately sends an XOFF control message to the host computer to instruct the host computer to pause sending data to the host. At the same time, the host can also record that it is currently in the "flow control pause" state, which indicates that the host has issued a pause sending instruction to the host computer, and the host computer will pause sending subsequent data to the host computer until the flow control pause state is lifted.
[0151] When the host detects that the second remaining space in the receive buffer is greater than the second threshold, it immediately sends an XON control message to the host computer to instruct the host computer to resume sending data to the host computer. At the same time, the host clears the previously recorded "flow control pause" state to indicate that the host computer can receive data sent by the host computer normally.
[0152] The XOFF control message can be represented by the preset control character 0xFF, and the XON control message can be represented by the preset control character 0xFE. It should be noted that XOFF and XON control messages are preferably sent as independent flow control messages, rather than as data field content within ordinary service data frames. In other words, XOFF and XON control messages are used to characterize the flow control meaning between the communicating parties, and their purpose is to control the data transmission behavior of the host computer, rather than being part of the payload data in ordinary service data frames.
[0153] Furthermore, to avoid conflicts between the data field content in ordinary business data frames and flow control messages, in some embodiments, if there is a data value in the data field that is the same as the control character corresponding to the XOFF control message or XON control message, the data value of the XOFF control message and XON control message can be escaped.
[0154] For example, when the XOFF control message is represented by 0xFF and the XON control message is represented by 0xFE, if the data field of the service data frame contains 0xFF or 0xFE, the XOFF control message and the XON control message can be escaped using a preset escape character.
[0155] In one embodiment, 0xFD can be used as an escape character, with 0xFDFE representing an XON control message and 0xFDFF representing an XOFF control message. This method can prevent the host or upper-level computer from misidentifying the data content in the service data frame as flow control messages, thereby improving the accuracy and reliability of the communication process.
[0156] In one possible embodiment, after the host computer receives the first message sent by the host computer, the host computer starts a pause timer. When the pause timer reaches the second duration and the host computer still has not received the second message sent by the host computer, the host computer actively sends a frame of test data to the host computer to detect whether the host computer has the ability to receive data again.
[0157] The second timing duration is the duration for which the pause timer is activated. This second timing duration can be set by the system administrator, and this embodiment does not impose any specific limitations on it. For example, the second timing duration could be 200 milliseconds.
[0158] After the host computer sends the first message to the host computer, if the host computer fails to send the second message to resume data transmission in a timely manner due to an abnormality, system crash, or other reasons, the host computer will remain in a suspended transmission state indefinitely. By setting a pause timer, it is possible to avoid the host computer from stopping data transmission for a long time due to host abnormalities, and also to avoid long-term communication interruptions caused by the loss of the second message during transmission, thereby improving the reliability of communication control between the host computer and the host computer.
[0159] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 6 As shown, the electronic device 600 provided in this embodiment includes a memory 601 and a processor 602.
[0160] The memory 601 can be a separate physical unit, connected to the processor 602 via a bus 603. Alternatively, the memory 601 and processor 602 can be integrated and implemented in hardware. The memory 601 stores program instructions, which the processor 602 calls to execute the operations performed by the host in any of the above method embodiments.
[0161] Optionally, when some or all of the methods in the above embodiments are implemented by software, the electronic device 600 may also include only the processor 602. A memory 601 for storing programs is located outside the electronic device 600, and the processor 602 is connected to the memory via circuits / wires to read and execute the programs stored in the memory. The processor 602 may be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and an NP. The processor 602 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0162] The memory 601 may include volatile memory, such as random-access memory (RAM); the memory may also include non-volatile memory, such as flash memory, hard disk drive (HDD) or solid-state drive (SSD); the memory may also include a combination of the above types of memory.
[0163] For example, this application provides a chip including: an interface circuit and a logic circuit. The interface circuit is used to receive signals from other chips outside the chip and transmit them to the logic circuit, or to send signals from the logic circuit to other chips outside the chip. The logic circuit is used to perform the operations performed by the host in the above method embodiments.
[0164] For example, this application provides a computer-readable storage medium storing computer program instructions thereon, which are executed by the processor of an electronic device to cause the electronic device to perform the operations performed by the host in the above method embodiments.
[0165] For example, this application provides a computer program product that, when run on an electronic device, causes the electronic device to perform the operations performed by the host in the above method embodiments.
[0166] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A communication method for a multi-circuit energy meter, the multi-circuit energy meter comprising a master unit and multiple slave units, the master unit communicating with a host computer and the multiple slave units respectively, characterized in that, The method includes: The first timing duration corresponding to the periodic timer is determined based on the target communication rate and the capacity of the host's receive buffer; wherein, the target communication rate is the rate at which the host computer sends data to the host. Upon receiving the first byte sent by the host computer, the periodic timer is started; When the periodic timer reaches the first timing duration, it is determined whether the first remaining space of the receiving buffer is less than or equal to the first threshold. If the first remaining space is less than or equal to the first threshold, a first message is sent to the host computer to cause the host computer to suspend sending data to the host computer. The received data in the receive buffer is processed; Determine whether the second remaining space of the receive buffer is greater than a second threshold; wherein the second threshold is greater than the first threshold; If the second remaining space is greater than the second threshold, a second message is sent to the host computer to enable the host computer to resume sending data to the host.
2. The method according to claim 1, characterized in that, The processing of the received data in the receiving buffer includes: The received data is segmented according to the start-of-frame and end-of-frame symbols to obtain multiple complete data frames. For each of the plurality of complete data frames, a frame sequence number is added to the frame header of the complete data frame, and a preset character is added to the frame tail of the complete data frame; The frame start symbol, address field, data length, checksum and frame end symbol in the complete data frame are deleted to obtain the compressed data frame; Update the number of used bytes in the receive buffer according to the compressed data frame to free up space in the receive buffer.
3. The method according to claim 2, characterized in that, After updating the number of used bytes in the receive buffer according to the compressed data frame to free up space in the receive buffer, the method further includes: The compressed data frame is identified based on the frame number and the preset character. The frame type, data identifier, and data field in the compressed data frame are parsed to obtain the parsing result; Based on the parsing result, the corresponding data processing operation is performed; wherein, the data processing operation is either the host interacting with the corresponding slave, or the data processing operation is the host returning the processing result to the host computer.
4. The method according to claim 2, characterized in that, The complete data frame structure includes a frame start symbol, an address field, a data length, a frame type, a data identifier, a data field, a checksum, and a frame end symbol.
5. The method according to claim 1, characterized in that, Determining the first timing duration corresponding to the periodic timer based on the target communication rate and the capacity of the host's receive buffer includes: According to the serial communication format, the total number of bits transmitted for a single byte of data is determined, including start bit, data bits, parity bit and stop bit; The transmission duration of a single byte of data is determined based on the target communication rate and the total number of bits to be transmitted. The transmission duration corresponding to the first threshold is determined based on the number of bytes corresponding to the first threshold and the transmission duration of the single byte data. The first timing duration is determined based on the transmission duration corresponding to the first threshold, and the first timing duration is less than the transmission duration corresponding to the first threshold.
6. The method according to claim 1, characterized in that, After determining whether the first remaining space in the receive buffer is less than a first threshold, the method further includes: If the first remaining space is greater than the first threshold, the period timer is restarted, and the step of determining whether the first remaining space of the receiving buffer is less than or equal to the first threshold is repeated when the period timer reaches the first timing duration.
7. The method according to claim 1, characterized in that, After determining whether the second remaining space of the receive buffer is greater than the second threshold, the method further includes: If the second remaining space is less than or equal to the second threshold, the step of processing the received data in the receive buffer is repeated.
8. The method according to claim 1, characterized in that, The first message is an XOFF control message, and the second message is an XON control message.
9. A multi-circuit energy meter, characterized in that, The multi-circuit energy meter includes a master unit and multiple slave units, and the master unit communicates with a host computer and the multiple slave units respectively; The host is used to execute the method according to any one of claims 1 to 8.
10. An electronic device, characterized in that, include: Memory and at least one processor; The memory stores computer-executed instructions; The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Case former with pivotal engagement roller assemblies
US20060247113A1