Packet loss rate determination method and device, equipment, storage medium and program product

By adding custom frame sequence numbers to data packets in the LoRa network and using a sliding window to calculate the packet loss rate, the problem of low accuracy of packet loss rate in the existing technology is solved, and a more accurate packet loss rate determination is achieved.

CN121771069APending Publication Date: 2026-03-31SHENZHEN RUIKE HUILIAN TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

In LoRa networks, existing technologies suffer from low accuracy in calculating packet loss rates because some data packets sent by the transmitter are not included in the packet loss rate statistics.

Method used

When sending data packets at the sending end, a custom frame sequence number is added to the data packets for which packet loss rate statistics are required. At the receiving end, these frame sequence numbers are added to a sliding window, and the packet loss rate is calculated using the frame sequence numbers in the sliding window.

Benefits of technology

It improves the accuracy of packet loss rate by ensuring that only data packets included in the packet loss rate statistics have custom frame sequence numbers, thus avoiding errors in packet loss rate calculation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121771069A_ABST
    Figure CN121771069A_ABST
Patent Text Reader

Abstract

The invention provides a packet loss rate determination method and device, equipment, a storage medium and a program product, and relates to the technical field of computers. The method comprises the steps that a current data packet is received, a media access control (MAC) effective load of the current data packet comprises a current self-defined frame number of the current data packet, and the current data packet is a data packet participating in packet loss rate statistics; adding the current custom frame serial number into the sliding window; obtaining a reference custom frame number in the sliding window, wherein the reference custom frame number is a custom frame number which participates in packet loss rate statistics for the first time in the sliding window; and determining the packet loss rate according to the current custom frame number and the reference custom frame number. According to the scheme, the user-defined frame number is added in the data packet participating in the packet loss rate statistics, so that the problem of inaccurate packet loss rate determination is effectively avoided, the packet loss rate of the data packet currently received by the receiving end can be accurately determined through the user-defined frame number in the sliding window, and the accuracy of determining the packet loss rate is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device, storage medium, and program product for determining packet loss rate. Background Technology

[0002] In large-scale, wide-coverage IoT communications, long-range wireless communication technology (LoRa) is often used, and the communication quality of LoRa networks can be evaluated by the packet loss rate.

[0003] In related technologies, when the sending end transmits data packets, it typically adds a frame sequence number to the frame counter field of the Media Access Control (MAC) header. Correspondingly, the receiving end can calculate the packet loss rate based on the frame sequence number in the MAC header of the data packet. However, in practical applications, all data packets sent by the sending end carry a frame sequence number, but some data packets sent by the sending end are not included in the packet loss rate statistics. Therefore, when the receiving end calculates the packet loss rate based on the frame sequence number in the MAC header of the data packet, the calculated packet loss rate will be incorrect. In other words, the accuracy of determining the packet loss rate in related technologies is relatively low. Summary of the Invention

[0004] This application provides a method, apparatus, device, storage medium, and program product for determining packet loss rate, in order to solve the problem of low accuracy in determining packet loss rate.

[0005] In a first aspect, embodiments of this application provide a method for determining packet loss rate, comprising:

[0006] Receive the current data packet, wherein the Media Access Control (MAC) payload of the current data packet includes the current custom frame sequence number of the current data packet, and the current data packet is a data packet that participates in packet loss rate statistics;

[0007] Add the current custom frame number to the sliding window;

[0008] Obtain a reference custom frame number in the sliding window. The reference custom frame number is the first custom frame number in the sliding window that participates in the packet loss rate statistics.

[0009] The packet loss rate is determined based on the current custom frame number and the reference custom frame number.

[0010] In one possible implementation, obtaining the reference custom frame number in the sliding window includes:

[0011] Determine the starting time for packet loss rate statistics;

[0012] Determine the historical reception time corresponding to the first custom frame sequence number in the sliding window;

[0013] Based on the start time and the historical reception time, obtain the reference custom frame sequence number in the sliding window.

[0014] In one possible implementation, obtaining a reference custom frame sequence number in the sliding window based on the start time and the historical reception time includes:

[0015] Determine whether the start time is earlier than or equal to the historical reception time;

[0016] If so, the first custom frame number in the sliding window is determined as the reference custom frame number;

[0017] If not, then based on the start time and the reception time corresponding to each custom frame sequence number in the sliding window, obtain the reference custom frame sequence number in the sliding window.

[0018] In one possible implementation, obtaining a reference custom frame sequence number in the sliding window based on the start time and the reception time corresponding to each custom frame sequence number in the sliding window includes:

[0019] In order from front to back, determine the relationship between the receiving time corresponding to the custom frame sequence number in the sliding window and the starting time;

[0020] The custom frame number in the sliding window whose first reception time is later than or equal to the start time is determined as the reference custom frame number.

[0021] In one possible implementation, before receiving the current data packet, the following is also included:

[0022] Get packet loss rate statistics instruction, the packet loss rate statistics instruction is used to request packet loss rate statistics, and the current data packet is any data packet received after getting the packet loss rate statistics instruction;

[0023] According to the packet loss rate statistics instruction, delete the custom frame sequence number in the sliding window;

[0024] Obtaining the reference custom frame number in the sliding window includes:

[0025] The first custom frame number in the sliding window is determined as the reference custom frame number.

[0026] In one possible implementation, adding the current custom frame number to the sliding window includes:

[0027] Obtain the window state of the sliding window, wherein the window state is either full or not full;

[0028] Based on the window state, the current custom frame number is added to the sliding window.

[0029] In one possible implementation, adding the current custom frame number to the sliding window based on the window state includes:

[0030] If the window state is in the incomplete state, then the current custom frame number is added to the first free storage slot of the sliding window;

[0031] If the window is in the full state, the first custom frame number in the sliding window will be deleted, each custom frame number in the sliding window will be moved forward one position, and the current custom frame number will be added to the last storage position of the sliding window.

[0032] In one possible implementation, determining the packet loss rate based on the current custom frame number and the reference custom frame number includes:

[0033] Based on the current custom frame sequence number and the reference custom frame sequence number, determine the first number of data packets to be received;

[0034] The second number of data packets actually received is determined based on the number of custom frame numbers that exist between the current custom frame number and the reference custom frame number.

[0035] The packet loss rate is determined based on the first quantity and the second quantity.

[0036] In one possible implementation, determining a first number of data packets to be received based on the current custom frame sequence number and the reference custom frame sequence number includes:

[0037] Determine the difference between the current custom frame number and the reference custom frame number;

[0038] Add 1 to the difference to obtain the first quantity.

[0039] In one possible implementation, a second number of data packets actually received is determined based on the number of custom frame numbers existing between the current custom frame number and the reference custom frame number, including:

[0040] Determine a third number of custom frame numbers that exist between the current custom frame number and the reference custom frame number;

[0041] Add 2 to the third quantity to obtain the second quantity.

[0042] In one possible implementation, the method further includes:

[0043] Obtain the initial data packet to be sent;

[0044] Determine the current custom frame number and update it according to a preset rule to obtain the target frame number;

[0045] The target frame sequence number is added to the MAC payload of the initial data packet to obtain the target data packet;

[0046] Send the target data packet and update the current custom frame sequence number to the target frame sequence number.

[0047] In one possible implementation, the method further includes:

[0048] Obtain the packet loss rate for multiple communication nodes located in different locations;

[0049] Based on the packet loss rate of the plurality of communication nodes, a target communication node is determined among the plurality of communication nodes, wherein the packet loss rate of the target communication node is less than or equal to a first threshold.

[0050] The location of the target communication node is determined as the target location, which is the location where the communication node is to be deployed.

[0051] In one possible implementation, the method is applied to a testing device; the method further includes:

[0052] Obtain the overall packet loss rate of multiple communication nodes obtained by testing the test device at multiple locations;

[0053] Based on the overall packet loss rate of multiple communication nodes obtained by the test device at multiple locations, a target location is determined among the multiple locations. The overall packet loss rate obtained by the test device at the target location is less than or equal to a second threshold. The target location is the location where the gateway is to be deployed.

[0054] Secondly, embodiments of this application provide a device for determining packet loss rate, including a receiving module, a first adding module, a first acquiring module, and a determining module, wherein...

[0055] The receiving module is used to receive the current data packet, wherein the Media Access Control (MAC) payload of the current data packet includes the current custom frame sequence number of the current data packet, and the current data packet is a data packet that participates in packet loss rate statistics;

[0056] The first adding module is used to add the current custom frame number to the sliding window;

[0057] The first acquisition module is used to acquire a reference custom frame number in the sliding window, wherein the reference custom frame number is the first custom frame number in the sliding window that participates in the packet loss rate statistics;

[0058] The determining module is used to determine the packet loss rate based on the current custom frame sequence number and the reference custom frame sequence number.

[0059] In one possible implementation, the first acquisition module is specifically used for:

[0060] Determine the starting time for packet loss rate statistics;

[0061] Determine the historical reception time corresponding to the first custom frame sequence number in the sliding window;

[0062] Based on the start time and the historical reception time, obtain the reference custom frame sequence number in the sliding window.

[0063] In one possible implementation, the first acquisition module is specifically used to: determine whether the start time is earlier than or equal to the historical reception time;

[0064] If so, the first custom frame number in the sliding window is determined as the reference custom frame number;

[0065] If not, then based on the start time and the reception time corresponding to each custom frame sequence number in the sliding window, obtain the reference custom frame sequence number in the sliding window.

[0066] In one possible implementation, the first acquisition module is specifically used for:

[0067] In order from front to back, determine the relationship between the receiving time corresponding to the custom frame sequence number in the sliding window and the starting time;

[0068] The custom frame number in the sliding window whose first reception time is later than or equal to the start time is determined as the reference custom frame number.

[0069] In one possible implementation, the device further includes a deletion module.

[0070] The deletion module is used to: obtain a packet loss rate statistics instruction before receiving the current data packet, the packet loss rate statistics instruction is used to request packet loss rate statistics, the current data packet is any data packet received after obtaining the packet loss rate statistics instruction; and delete the custom frame sequence number in the sliding window according to the packet loss rate statistics instruction.

[0071] The first acquisition module is specifically used to determine the first custom frame number in the sliding window as the reference custom frame number.

[0072] In one possible implementation, the first adding module is specifically used for:

[0073] Obtain the window state of the sliding window, wherein the window state is either full or not full;

[0074] Based on the window state, the current custom frame number is added to the sliding window.

[0075] In one possible implementation, the first adding module is specifically used for:

[0076] If the window state is in the incomplete state, then the current custom frame number is added to the first free storage slot of the sliding window;

[0077] If the window is in the full state, the first custom frame number in the sliding window will be deleted, each custom frame number in the sliding window will be moved forward one position, and the current custom frame number will be added to the last storage position of the sliding window.

[0078] In one possible implementation, the determining module is specifically used for:

[0079] Based on the current custom frame sequence number and the reference custom frame sequence number, determine the first number of data packets to be received;

[0080] The second number of data packets actually received is determined based on the number of custom frame numbers that exist between the current custom frame number and the reference custom frame number.

[0081] The packet loss rate is determined based on the first quantity and the second quantity.

[0082] In one possible implementation, the determining module is specifically used for:

[0083] Determine the difference between the current custom frame number and the reference custom frame number;

[0084] Add 1 to the difference to obtain the first quantity.

[0085] In one possible implementation, the determining module is specifically used for:

[0086] Determine a third number of custom frame numbers that exist between the current custom frame number and the reference custom frame number;

[0087] Add 2 to the third quantity to obtain the second quantity.

[0088] In one possible implementation, the device further includes a second acquisition module, an update module, a second addition module, and a sending module, wherein,

[0089] The second acquisition module is used to acquire the initial data packet to be sent;

[0090] The update module is used to determine the current custom frame number and update the current custom frame number according to a preset rule to obtain the target frame number;

[0091] The second adding module is used to add the target frame sequence number to the MAC payload of the initial data packet to obtain the target data packet;

[0092] The sending module is used to send the target data packet and update the current custom frame sequence number to the target frame sequence number.

[0093] In one possible implementation, the apparatus further includes a first testing module, wherein the first testing module is specifically used for:

[0094] Obtain the packet loss rate for multiple communication nodes located in different locations;

[0095] Based on the packet loss rate of the plurality of communication nodes, a target communication node is determined among the plurality of communication nodes, wherein the packet loss rate of the target communication node is less than or equal to a first threshold.

[0096] The location of the target communication node is determined as the target location, which is the location where the communication node is to be deployed.

[0097] In one possible implementation, the apparatus further includes a second testing module, wherein the second testing module is specifically used for:

[0098] Obtain the overall packet loss rate of multiple communication nodes obtained by testing the test device at multiple locations;

[0099] Based on the overall packet loss rate of multiple communication nodes obtained by the test device at multiple locations, a target location is determined among the multiple locations. The overall packet loss rate obtained by the test device at the target location is less than or equal to a second threshold. The target location is the location where the gateway is to be deployed.

[0100] Thirdly, embodiments of this application provide an electronic device, including: at least one processor and a memory; the memory stores computer execution instructions; the at least one processor executes the computer execution instructions stored in the memory, causing the at least one processor to perform the packet loss rate determination method as described in the first aspect and various possible designs of the first aspect.

[0101] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions. When a processor executes the computer-executable instructions, it implements the packet loss rate determination method described in the first aspect and various possible designs of the first aspect.

[0102] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the method for determining the packet loss rate as described in the first aspect and various possible designs of the first aspect.

[0103] The packet loss rate determination method, apparatus, device, storage medium, and program product provided in this application involve adding a custom frame sequence number to the packet loss rate statistics packet when the sending end sends a data packet. Correspondingly, after the receiving end receives the data packet, it adds the custom frame sequence number in the data packet to a sliding window and calculates the packet loss rate based on the frame sequence number in the sliding window. Since the custom frame sequence number is only included in the data packets participating in the packet loss rate statistics, the problem of inaccurate packet loss rate determination is avoided. Furthermore, the custom frame sequence number in the sliding window is the most recently received data packet by the receiving end. The packet loss rate of the currently received data packet can be accurately determined by the custom frame sequence number in the sliding window, thus improving the accuracy of packet loss rate determination. Attached Figure Description

[0104] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0105] Figure 1 A schematic diagram of a system architecture provided for an embodiment of this application;

[0106] Figure 2 Another system architecture diagram provided for an embodiment of this application;

[0107] Figure 3 This is a flowchart illustrating a method for determining packet loss rate provided in an embodiment of this application;

[0108] Figure 4 A schematic diagram of a sliding window provided in an embodiment of this application;

[0109] Figure 5A schematic diagram of another sliding window provided in an embodiment of this application;

[0110] Figure 6 A flowchart illustrating the method for determining a reference custom frame number provided in an embodiment of this application;

[0111] Figure 7 A flowchart illustrating another method for determining packet loss rate provided in an embodiment of this application;

[0112] Figure 8A A schematic diagram illustrating the addition of a custom frame number, provided as an embodiment of this application;

[0113] Figure 8B This is a schematic diagram illustrating another method for adding custom frame numbers, as provided in an embodiment of this application.

[0114] Figure 9 A schematic diagram illustrating the process of sending data packets provided in an embodiment of this application;

[0115] Figure 10 An apparatus for determining packet loss rate is provided in an embodiment of this application;

[0116] Figure 11 A schematic diagram of another packet loss rate determination device provided in an embodiment of this application;

[0117] Figure 12 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0118] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0119] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0120] To facilitate understanding, the following will be combined with... Figures 1-2 The system architecture applicable to the embodiments of this application will be described.

[0121] Figure 1 This is a schematic diagram of a system architecture provided for an embodiment of this application. Please refer to [link / reference]. Figure 1It includes multiple communication nodes 101 and test equipment 102.

[0122] Communication node 101 and test device 102 can communicate via LoRa. Communication node 101 can be a LoRa node. For example, a LoRa node can be a temperature sensor, humidity sensor, etc.

[0123] The testing device 102 can test the packet loss rate of each communication node 101 and determine the location for deploying communication nodes based on the packet loss rate of each communication node 101. For example, it can determine to deploy communication nodes at locations with lower packet loss rates. The testing device can also test the packet loss rate of each communication node 101 at different locations and determine the location for deploying a gateway based on the packet loss rate obtained by the testing device at different locations. For example, if the testing device obtains the lowest packet loss rate at location 1, a gateway can be deployed at location 1.

[0124] Figure 2 This is a schematic diagram of another system architecture provided for an embodiment of this application. Please refer to [link / reference]. Figure 2 It includes multiple communication nodes 201, gateway 202 and server 203.

[0125] Communication node 201 and gateway 202 can communicate via LoRa. Communication node 201 can be a LoRa node. For example, a LoRa node can be a temperature sensor, humidity sensor, etc.

[0126] Communication node 201 can send the collected data to gateway 202, which can then forward the data to server 203. During the communication process, gateway 202 can perform packet loss rate statistics for each communication node 201.

[0127] In related technologies, when the sending end transmits data packets, it typically adds a frame sequence number to the frame counter field of the Media Access Control (MAC) header. Correspondingly, the receiving end can calculate the packet loss rate based on the frame sequence number in the MAC header of the data packet. However, in practical applications, all data packets sent by the sending end carry a frame sequence number, but some data packets sent by the sending end are not included in the packet loss rate statistics. Therefore, when the receiving end calculates the packet loss rate based on the frame sequence number in the MAC header of the data packet, the calculated packet loss rate will be incorrect. In other words, the accuracy of determining the packet loss rate in related technologies is relatively low.

[0128] For example, in practical applications, the sending end may send MAC command messages to the receiving end. MAC command messages cause the frame sequence number to increase; however, MAC command messages are invisible to the application layer and are not included in packet loss rate statistics. Consequently, when the receiving end performs packet loss rate statistics, the sending of MAC command messages by the sending end may cause the frame sequence numbers in the data packets received by the receiving end to be discontinuous, leading to an incorrectly calculated packet loss rate.

[0129] For example, in practical applications, when the amount of user data to be sent is large, it may be divided into two data packets for transmission. The first data packet carries MAC-related information, and the second data packet carries user data. Each of these two data packets carries a frame sequence number. However, when performing packet loss rate statistics, only the second data packet is included in the statistics, which will lead to an incorrect packet loss rate calculation.

[0130] To address the aforementioned technical issues, in this embodiment, when sending data packets, the sending end adds a custom frame sequence number to the packet loss rate statistics packet. Correspondingly, after receiving the data packet, the receiving end adds the custom frame sequence number from the data packet to a sliding window and calculates the packet loss rate based on the frame sequence number in the sliding window. Since only data packets participating in the packet loss rate statistics include the custom frame sequence number, the problem of inaccurate packet loss rate determination is avoided. Furthermore, the custom frame sequence number in the sliding window is the most recently received data packet by the receiving end. By using the custom frame sequence number in the sliding window, the packet loss rate of the currently received data packet by the receiving end can be accurately determined, improving the accuracy of packet loss rate determination.

[0131] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0132] Figure 3 This is a flowchart illustrating a method for determining packet loss rate provided in an embodiment of this application. Please refer to [link / reference]. Figure 3 As shown, the method may include the following steps:

[0133] S301, Receive the current data packet.

[0134] The execution subject of this application embodiment can be an electronic device or a packet loss rate determination device installed in the electronic device. The packet loss rate determination device can be implemented by software or by a combination of software and hardware. The electronic device can be a gateway, testing equipment, etc.

[0135] The MAC payload of the current data packet includes the current custom frame number. The current data packet is one that participates in packet loss rate statistics; for example, the current data packet may carry business data.

[0136] The current data packet includes a MAC payload, which in turn includes a current custom frame sequence number. Optionally, the MAC payload may include a custom frame sequence number field, which carries the current custom frame sequence number.

[0137] In practical applications, the range of custom frame sequence numbers can be set according to actual needs. For example, in uplink messages, the custom frame sequence number occupies 2 bytes, and the value of the custom frame sequence number can be 1-65535; in downlink messages, the custom frame sequence number occupies one and a half bytes (12 bits), and the value of the custom frame sequence number can be 1-4095.

[0138] Optionally, when the sending end sends a data packet, if it is determined that the data packet is one that needs to be included in the packet loss rate statistics, the sending end adds a custom frame sequence number field to the data packet and adds the current custom frame sequence number to the custom frame sequence number field to obtain the current data packet, and then sends the current data packet to the receiving end.

[0139] For example, initially, the custom frame sequence number can be 1. Each time the sending end sends a data packet that participates in the packet loss rate statistics, it adds the latest custom frame sequence number to the data packet and increments the current custom frame sequence number by 1. If the current custom frame sequence number reaches the preset maximum value, the custom frame sequence number is set to 1.

[0140] S302. Add the current custom frame number to the sliding window.

[0141] Below, in conjunction with Figure 4 The sliding window will be explained.

[0142] Figure 4 This is a schematic diagram of a sliding window provided in an embodiment of this application. Please refer to [link / reference]. Figure 4 The sliding window consists of a header and a tail, and its length is N (where N is an integer greater than 1). This means the sliding window contains N storage bits, which are used to store N custom frame numbers. In practical applications, starting from the header, custom frame numbers are added sequentially to each storage bit of the sliding window.

[0143] The current custom frame number can be added to the sliding window in the following way: get the window state of the sliding window, and add the custom frame number to the sliding window according to the window state, which is either full or not full.

[0144] If all storage slots in a sliding window are occupied, the window state of the sliding window is full. For example, if a sliding window has 100 storage slots, and all 100 storage slots are occupied, then the sliding window is considered full.

[0145] If there are unoccupied storage slots in a sliding window, the window state is considered incomplete. For example, if a sliding window has 100 storage slots, and data is stored in the first 20 slots but not in the last 80 slots, then the sliding window is considered incomplete.

[0146] Optionally, if the window is not full, the current custom frame number is added to the first free storage slot of the sliding window; if the window is full, the first custom frame number in the sliding window is deleted, each custom frame number in the sliding window is shifted forward one position, and the current custom frame number is added to the last storage slot of the sliding window.

[0147] For example, assuming the sliding window has 100 storage slots, if data is stored in the first 20 storage slots and not in the last 80 storage slots, the current custom frame number is added to the 21st storage slot; if all 100 storage slots of the sliding window have stored data, the data in the 1st storage slot is deleted, the data in the other storage slots is shifted forward one position, and the current custom frame number is added to the 100th storage slot.

[0148] S303. Obtain the reference custom frame number in the sliding window.

[0149] The reference custom frame number is the first custom frame number in the sliding window that participates in the packet loss rate statistics. The reference custom frame number is the custom frame number that needs to be referenced when calculating the packet loss rate.

[0150] In practical applications, packet loss rate statistics can be performed multiple times as needed, with each statistics session lasting for a certain period. For example, packet loss rate statistics can be performed between 8:00 AM and 10:00 AM daily; or they can be triggered by the user. After each packet loss rate analysis session, or before the next analysis, the sliding window can be cleared, or it can remain open. The method for obtaining the reference custom frame number within the sliding window differs depending on the situation, including the following two scenarios:

[0151] Scenario 1: Clear the sliding window before performing packet loss rate statistics.

[0152] In this case, when performing packet loss rate statistics this time, the custom frame number from the last packet loss rate statistics will not be present in the sliding window. Therefore, the first custom frame number in the sliding window can be determined as the reference custom frame number.

[0153] Optionally, a packet loss rate statistics instruction will be received before the packet loss rate statistics are performed. After receiving the packet loss rate statistics instruction, the custom frame number in the sliding window can be deleted to clear the sliding window.

[0154] Scenario 2: Do not clear the sliding window before performing packet loss rate statistics.

[0155] In this scenario, when packet loss rate statistics begin, the sliding window may contain custom frame numbers stored in the same window from the previous packet loss rate statistics period. To avoid errors in packet loss rate calculations, the custom frame numbers stored in the sliding window from the previous packet loss rate statistics period should not be referenced during packet loss rate calculations.

[0156] In the initial stage of this packet loss rate statistics, the sliding window may contain the custom frame sequence number from the last packet loss rate statistics. In this case, the first custom frame sequence number stored in the sliding window during this packet loss rate statistics should be determined as the reference custom frame sequence number.

[0157] Below, in conjunction with Figure 5 The reference custom frame sequence number is explained.

[0158] Figure 5 This is a schematic diagram of another sliding window provided in an embodiment of this application. Please refer to... Figure 5 Suppose that when the packet loss rate was last calculated, frame numbers 53, 54 and 55 were stored in the sliding window. If a custom frame number 86 is added to the sliding window at the start of this packet loss rate calculation, then the custom frame number 86 will be used as the reference.

[0159] After a period of time, the custom frame number from the last packet loss rate statistics may no longer exist in the sliding window. In this case, the first custom frame number in the sliding window can be used as the reference custom frame number.

[0160] S304. Determine the packet loss rate based on the current custom frame number and the reference custom frame number.

[0161] The packet loss rate can be determined as follows: Based on the current custom frame sequence number and the reference custom frame sequence number, determine the first number of data packets to be received; based on the number of custom frame sequence numbers between the current custom frame sequence number and the reference custom frame sequence number, determine the second number of data packets actually received; and based on the first and second numbers, determine the packet loss rate.

[0162] The difference between the first quantity and the second quantity can be obtained, and the ratio of this difference to the first quantity can be determined as the packet loss rate.

[0163] For example, assuming the first quantity is 100 and the second quantity is 80, the packet loss rate is 20% ((100-20) / 100).

[0164] In this embodiment, when the sending end sends a data packet, it adds a custom frame sequence number to the packet loss rate statistics packet. Correspondingly, after the receiving end receives the data packet, it adds the custom frame sequence number in the data packet to the sliding window and calculates the packet loss rate based on the frame sequence number in the sliding window. Since only the data packets participating in the packet loss rate statistics include the custom frame sequence number, the problem of inaccurate packet loss rate determination is avoided. Furthermore, the custom frame sequence number in the sliding window is the data packet most recently received by the receiving end. The packet loss rate of the data packet currently received by the receiving end can be accurately determined through the custom frame sequence number in the sliding window, thus improving the accuracy of packet loss rate determination.

[0165] Based on any of the above embodiments, the following, in conjunction with Figure 6 Taking the case where the sliding window is not cleared before the packet loss rate statistics are performed (case 2 in S303) as an example, the process of determining the reference custom frame number will be explained.

[0166] Figure 6 This is a flowchart illustrating the method for determining a reference custom frame number provided in an embodiment of this application. Please refer to... Figure 6 The method may include:

[0167] S601. Determine the starting time for packet loss rate statistics.

[0168] The start time refers to the moment when packet loss rate statistics are performed. For example, if the packet loss rate statistics are to be performed between 8:00 and 10:00, then 8:00 is the start time.

[0169] S602. Determine the historical reception time corresponding to the first custom frame sequence number in the sliding window.

[0170] The first custom frame number is the custom frame number in the first storage bit of the sliding window.

[0171] The historical reception time is the reception time of the data packet corresponding to the first custom frame sequence number.

[0172] In practical applications, after receiving a data packet used for packet loss rate statistics, the reception time of the data packet can be recorded, and this reception time, along with the custom frame sequence number in the data packet, can be stored in a preset storage space. Correspondingly, the corresponding historical reception time can be retrieved from this preset storage space based on the first custom frame sequence number.

[0173] S603. Determine whether the start time is earlier than or equal to the historical reception time.

[0174] If so, then execute S604.

[0175] If not, then execute S605.

[0176] S604. Determine the first custom frame number in the sliding window as the reference custom frame number.

[0177] If the start time is earlier than or equal to the historical reception time, it means that the first custom frame number in the sliding window is the custom frame number used for this packet loss rate statistics. In this case, the first custom frame number in the sliding window can be determined as the reference custom frame number.

[0178] S605. In order from front to back, determine the relationship between the receiving time and the start time corresponding to the custom frame sequence number in the sliding window.

[0179] If the start time is later than the historical reception time, it means that the first custom frame number in the sliding window is the custom frame number from the last packet loss rate statistics. In this case, starting from the second custom frame number in the sliding window, the reception time and start time corresponding to each custom frame number in the sliding window can be compared sequentially to determine the reference custom frame number in the sliding window.

[0180] S606. The custom frame number in the sliding window whose first reception time is later than or equal to the start time is determined as the reference custom frame number.

[0181] Optionally, the reference custom frame number can be determined in the following way:

[0182] If the reception time corresponding to the second custom frame number is later than or equal to the start time, then the second custom frame number is determined as the reference custom frame number; if the reception time corresponding to the second custom frame number is earlier than the start time, then the relationship between the reception time corresponding to the third custom frame number and the start time is determined.

[0183] If the reception time corresponding to the third custom frame number is later than or equal to the start time, then the third custom frame number is determined as the reference custom frame number; if the reception time corresponding to the third custom frame number is earlier than the start time, then the relationship between the reception time corresponding to the fourth custom frame number and the start time is determined.

[0184] This process continues until the sliding window first finds a custom frame number whose reception time is later than or equal to the start time, at which point the custom frame number is designated as the reference custom frame number.

[0185] exist Figure 6In the illustrated embodiment, the sliding window is not cleared before the packet loss rate statistics are performed. Figure 6 The method shown in the embodiment can avoid referring to the custom frame sequence number from the previous packet loss rate calculation when performing packet loss rate statistics, thereby avoiding the situation of incorrect packet loss rate determination and improving the accuracy of packet loss rate determination.

[0186] Based on any of the above embodiments, the following, in conjunction with Figure 7 The process of determining the packet loss rate will be explained in further detail.

[0187] Figure 7 This is a flowchart illustrating another method for determining packet loss rate provided in an embodiment of this application. Please refer to... Figure 7 The method may include:

[0188] S701, Receive the first data packet.

[0189] The Media Access Control (MAC) payload of the first data packet includes the first custom frame sequence number of the first data packet, and the first data packet is a data packet that participates in the packet loss rate statistics.

[0190] The execution process of S701 can be found in S301, and will not be repeated here.

[0191] S702, Get the window state of the sliding window.

[0192] The window status is either full or not full.

[0193] S703. Based on the window state, add the first custom frame number to the sliding window.

[0194] Optionally, if the window is not full, the current custom frame number is added to the end of the sliding window; if the window is full, the first custom frame number in the sliding window is deleted, each custom frame number in the sliding window is shifted forward one position, and the current custom frame number is added to the end of the sliding window.

[0195] Below, in conjunction with Figures 8A-8B The process of adding the first custom frame number in the sliding window is explained.

[0196] Figure 8A This is a schematic diagram illustrating the addition of a custom frame number, provided as an embodiment of this application. Please refer to... Figure 8A Assuming the existing custom frame numbers in the sliding window are 3, 4, 5, 7, and the first custom frame number to be added to the sliding window is 8, since the window state of the sliding window is not full, the first custom frame number 8 is added to the 5th storage position of the sliding window.

[0197] Figure 8B This is a schematic diagram illustrating another method for adding custom frame numbers, provided in an embodiment of this application. Please refer to... Figure 8B If the sliding window is in a full state, delete the first custom frame number in the sliding window, and move the second and subsequent custom frame numbers one position forward in sequence. The last storage position can be freed up. If the first custom frame number 80 needs to be stored in the sliding window, then the first custom frame number 80 is stored in the last storage position.

[0198] S704. Obtain the reference custom frame number in the sliding window.

[0199] The reference custom frame number is the first custom frame number in the sliding window that participates in the packet loss rate statistics.

[0200] Optionally, if the sliding window is cleared before the packet loss rate statistics are performed, the first custom frame number in the sliding window can be determined as the reference custom frame number.

[0201] If the sliding window was not cleared before this packet loss rate calculation, you can refer to... Figure 6 The embodiment shown determines a reference custom frame number.

[0202] S705. Determine the first number of data packets to be received based on the first custom frame sequence number and the second custom frame sequence number.

[0203] The first quantity can be determined as follows: determine the difference between the current custom frame number and the reference custom frame number, and add 1 to the difference to obtain the first quantity.

[0204] For example, assuming the current custom frame number is 88 and the reference custom frame number is 20, then the first quantity is 69 (88-20+1).

[0205] S706. Determine the number of custom frame numbers present in the sliding window.

[0206] The number of custom frame numbers in the sliding window can be determined based on the state of the sliding window. If the sliding window is full, the length of the sliding window is determined to be the number of custom frame numbers in the sliding window; if the sliding window is not full, the custom frame numbers in the sliding window are counted to obtain the total number of custom frame numbers in the sliding window.

[0207] S707. Determine the second number of data packets actually received based on the number of custom frame numbers that exist between the current custom frame number and the reference custom frame number.

[0208] The second quantity can be determined as follows: determine the third quantity of custom frame numbers that exist between the current custom frame number and the reference custom frame number, and add 2 to the third quantity to obtain the second quantity.

[0209] For example, in a sliding window, suppose there are 30 custom frame numbers between the current custom frame number and the reference custom frame number, then the second number is 32 (30+2).

[0210] S708. Determine the packet loss rate based on the first quantity and the second quantity.

[0211] Specifically, the difference between the first quantity and the second quantity can be obtained, and the ratio of this difference to the first quantity can be determined as the packet loss rate.

[0212] In this embodiment, when the receiving end receives a data packet, after determining that the data packet is one of the data packets participating in the packet loss rate statistics, it adds the custom frame sequence number in the data packet to the end of the sliding window according to the state of the sliding window, obtains the number of custom frame sequence numbers existing in the sliding window, and calculates the packet loss rate based on the other custom frame sequence numbers in the sliding window. Since only data packets participating in the packet loss rate statistics include custom frame sequence numbers, the problem of inaccurate packet loss rate determination is avoided. Furthermore, the custom frame sequence number in the sliding window is the data packet most recently received by the receiving end. The packet loss rate of the data packet currently received by the receiving end can be accurately determined through the custom frame sequence number in the sliding window, thus improving the accuracy of packet loss rate determination.

[0213] Figure 9 This is a schematic diagram illustrating the data packet transmission process provided in an embodiment of this application. Please refer to [link / reference]. Figure 9 The method may include:

[0214] S901, Obtain the initial data packet to be sent.

[0215] The initial data packet refers to the data packet that is included in the packet loss rate statistics and is yet to be sent.

[0216] S902. Determine the current custom frame number and update it according to the preset rules to obtain the target frame number.

[0217] The current custom frame sequence number can be the custom frame sequence number added to the data packet when the data packet was sent last time.

[0218] The default rule can be: each time a custom frame number is added to a data packet, the current custom frame number is incremented by 1. Correspondingly, the target frame number is the current custom frame number incremented by 1.

[0219] S903. Add the target frame sequence number to the MAC payload of the initial data packet to obtain the target data packet.

[0220] A custom frame sequence number field can be added to the initial data packet, and the target frame sequence number can be added to the custom frame sequence number field to obtain the target data packet.

[0221] S904. Send the target data packet and update the current custom frame sequence number to the target frame sequence number.

[0222] In this embodiment, when sending a data packet, the sending end updates the current custom frame sequence number according to a preset rule, obtains the target frame sequence number, and adds the target frame sequence number to the data packets participating in the packet loss rate statistics to obtain the target data packet. The sending end then sends the target data packet to the receiving end. Since only the data packets participating in the packet loss rate statistics include the custom frame sequence number, the problem of inaccurate packet loss rate determination is avoided.

[0223] Based on any of the above embodiments, in actual application, the deployment location of communication nodes may have a certain impact on the packet loss rate. In order to ensure that the packet loss rate is low in actual application, testing can be conducted to select a location with a low packet loss rate for deploying communication nodes.

[0224] Optionally, the testing device can obtain the packet loss rate of multiple communication nodes, which are located in different locations; based on the packet loss rate of the multiple communication nodes, a target communication node is determined among the multiple communication nodes, and the packet loss rate of the target communication node is less than or equal to a first threshold; the location of the target communication node is determined as the target location, which is the location where the communication node to be deployed is located.

[0225] For example, assuming there are 20 communication nodes located in 20 different locations, the test device can communicate with these 20 nodes to determine the packet loss rate for each node. Based on the packet loss rate of each node, the device selects communication nodes whose packet loss rate is less than a first threshold. Let's say 5 communication nodes are selected; then the locations of these 5 nodes are designated as target locations. During subsequent deployment of communication nodes, these target locations can be used to further reduce packet loss during communication.

[0226] Based on any of the above embodiments, in practical applications, the deployment location of the gateway may affect the packet loss rate during communication. To ensure a low packet loss rate in practical applications, testing can be conducted to select a location with a low packet loss rate for gateway deployment.

[0227] Optionally, the test device can obtain the overall packet loss rate of multiple communication nodes tested at multiple locations; based on the overall packet loss rate of multiple communication nodes tested at multiple locations, a target location is determined among the multiple locations, and the overall packet loss rate obtained by the test device at the target location is less than or equal to a second threshold, and the target location is the location where the gateway is to be deployed.

[0228] The average packet loss rate of multiple communication nodes can be determined as the overall packet loss rate. Alternatively, the overall packet loss rate can be measured by the number of communication nodes with a packet loss rate below a certain threshold.

[0229] For example, the testing equipment can perform packet loss rate tests at 10 locations, thus obtaining 10 overall packet loss rates. If the overall packet loss rate at 3 locations is less than or equal to a second threshold, these 3 locations can be identified as target locations. During subsequent gateway deployment, the gateway can be deployed at one of these 3 locations, thereby reducing the packet loss rate during communication.

[0230] Figure 10 For a schematic diagram of a packet loss rate determination device provided in an embodiment of this application, please refer to [link / reference]. Figure 10 The packet loss rate determination device 100 includes a receiving module 1001, a first adding module 1002, a first acquiring module 1003, and a determining module 1004, wherein...

[0231] The receiving module 1001 is used to receive the current data packet, wherein the media access control (MAC) payload of the current data packet includes the current custom frame sequence number of the current data packet, and the current data packet is a data packet that participates in packet loss rate statistics;

[0232] The first adding module 1002 is used to add the current custom frame number to the sliding window;

[0233] The first acquisition module 1003 is used to acquire a reference custom frame number in the sliding window, wherein the reference custom frame number is the first custom frame number in the sliding window that participates in the packet loss rate statistics;

[0234] The determining module 1004 is used to determine the packet loss rate based on the current custom frame sequence number and the reference custom frame sequence number.

[0235] The packet loss rate determination device provided in this application embodiment can execute the method shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0236] In one possible implementation, the first acquisition module 1003 is specifically used for:

[0237] Determine the starting time for packet loss rate statistics;

[0238] Determine the historical reception time corresponding to the first custom frame sequence number in the sliding window;

[0239] Based on the start time and the historical reception time, obtain the reference custom frame sequence number in the sliding window.

[0240] In one possible implementation, the first acquisition module 1003 is specifically used for:

[0241] Determine whether the start time is earlier than or equal to the historical reception time;

[0242] If so, the first custom frame number in the sliding window is determined as the reference custom frame number;

[0243] If not, then based on the start time and the reception time corresponding to each custom frame sequence number in the sliding window, obtain the reference custom frame sequence number in the sliding window.

[0244] In one possible implementation, the first acquisition module 1003 is specifically used for:

[0245] In order from front to back, determine the relationship between the receiving time corresponding to the custom frame sequence number in the sliding window and the starting time;

[0246] The custom frame number in the sliding window whose first reception time is later than or equal to the start time is determined as the reference custom frame number.

[0247] Figure 11 This is a schematic diagram of another packet loss rate determination device provided in an embodiment of this application. Figure 10 Based on the illustrated embodiments, please refer to Figure 11 The packet loss rate determination device may further include a deletion module 1005, wherein,

[0248] The deletion module 1005 is used to: obtain a packet loss rate statistics instruction before receiving the current data packet, the packet loss rate statistics instruction being used to request packet loss rate statistics, the current data packet being any data packet received after obtaining the packet loss rate statistics instruction; and delete a custom frame sequence number in the sliding window according to the packet loss rate statistics instruction.

[0249] The first acquisition module 1003 is specifically used to determine the first custom frame number in the sliding window as the reference custom frame number.

[0250] In one possible implementation, the first adding module 1002 is specifically used for:

[0251] Obtain the window state of the sliding window, wherein the window state is either full or not full;

[0252] Based on the window state, the current custom frame number is added to the sliding window.

[0253] In one possible implementation, the first adding module 1002 is specifically used for:

[0254] If the window state is in the incomplete state, then the current custom frame number is added to the first free storage slot of the sliding window;

[0255] If the window is in the full state, the first custom frame number in the sliding window will be deleted, each custom frame number in the sliding window will be moved forward one position, and the current custom frame number will be added to the last storage position of the sliding window.

[0256] In one possible implementation, the determining module 1004 is specifically used for:

[0257] Based on the current custom frame sequence number and the reference custom frame sequence number, determine the first number of data packets to be received;

[0258] The second number of data packets actually received is determined based on the number of custom frame numbers that exist between the current custom frame number and the reference custom frame number.

[0259] The packet loss rate is determined based on the first quantity and the second quantity.

[0260] In one possible implementation, the determining module 1004 is specifically used for:

[0261] Determine the difference between the current custom frame number and the reference custom frame number;

[0262] Add 1 to the difference to obtain the first quantity.

[0263] In one possible implementation, the determining module 1004 is specifically used for:

[0264] Determine a third number of custom frame numbers that exist between the current custom frame number and the reference custom frame number;

[0265] Add 2 to the third quantity to obtain the second quantity.

[0266] In one possible implementation, the device further includes a second acquisition module 1005, an update module 1006, a second addition module 1007, and a sending module 1008, wherein,

[0267] The second acquisition module 1005 is used to acquire the initial data packet to be sent;

[0268] The update module 1006 is used to determine the current custom frame number and update the current custom frame number according to a preset rule to obtain the target frame number;

[0269] The second adding module 1007 is used to add the target frame sequence number to the MAC payload of the initial data packet to obtain the target data packet;

[0270] The sending module 1008 is used to send the target data packet and update the current custom frame sequence number to the target frame sequence number.

[0271] In one possible implementation, the device further includes a first test module 1009, wherein the first test module 1009 is specifically used for:

[0272] Obtain the packet loss rate for multiple communication nodes located in different locations;

[0273] Based on the packet loss rate of the plurality of communication nodes, a target communication node is determined among the plurality of communication nodes, wherein the packet loss rate of the target communication node is less than or equal to a first threshold.

[0274] The location of the target communication node is determined as the target location, which is the location where the communication node is to be deployed.

[0275] In one possible implementation, the device further includes a second test module 1010, wherein the second test module 1010 is specifically used for:

[0276] Obtain the overall packet loss rate of multiple communication nodes obtained by testing the test device at multiple locations;

[0277] Based on the overall packet loss rate of multiple communication nodes obtained by the test device at multiple locations, a target location is determined among the multiple locations. The overall packet loss rate obtained by the test device at the target location is less than or equal to a second threshold. The target location is the location where the gateway is to be deployed.

[0278] The packet loss rate determination device provided in this application embodiment can execute the method shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0279] Figure 12 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 12As shown, the electronic device 120 may include: a transceiver 1201, a processor 1202, and a memory 1203.

[0280] Processor 1202 executes computer execution instructions stored in memory, causing processor 1202 to perform the scheme in the above embodiments. Processor 1202 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0281] The memory 1203 is connected to the processor 1202 via the system bus and completes communication between them. The memory 1203 is used to store computer program instructions.

[0282] Transceiver 1201 can be used to obtain the task to be run and its configuration information.

[0283] The system bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The system bus can be divided into address bus, data bus, control bus, etc. For ease of representation, only one thick line is used in the diagram, but this does not indicate that there is only one bus or one type of bus. Transceivers are used to enable communication between database access devices and other computers (e.g., clients, read-write libraries, and read-only libraries). Memory may include random access memory (RAM) and may also include non-volatile memory.

[0284] The electronic device can be a test device or a gateway.

[0285] This application also provides a chip for executing instructions, which is used to execute the technical solutions shown in the above embodiments.

[0286] This application also provides a computer-readable storage medium storing computer instructions that, when executed on a computer, cause the computer to perform the technical solutions shown in the above embodiments.

[0287] This application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium, and when the at least one processor executes the computer program, it can implement the technical solutions shown in the above embodiments.

[0288] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or modules, and may be electrical, mechanical, or other forms.

[0289] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to implement the solution of this embodiment according to actual needs.

[0290] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The unit composed of the above modules can be implemented in hardware or in the form of hardware plus software functional units.

[0291] The integrated modules described above, implemented as software functional modules, can be stored in a computer-readable storage medium. These software functional modules, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods of the various embodiments of this application.

[0292] It should be understood that the aforementioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.

[0293] The memory may include high-speed RAM, and may also include non-volatile storage (NVM), such as at least one disk storage device, and may also be a USB flash drive, external hard drive, read-only memory, disk or optical disc, etc.

[0294] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0295] The aforementioned storage medium can be implemented from any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium can be any available medium accessible to general-purpose or special-purpose computers.

[0296] An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Alternatively, the storage medium can be an integral part of the processor. The processor and storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and storage medium can exist as discrete components in an electronic control unit or main control device.

[0297] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0298] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A method for determining packet loss rate, characterized in that, include: Receive the current data packet, wherein the Media Access Control (MAC) payload of the current data packet includes the current custom frame sequence number of the current data packet, and the current data packet is a data packet that participates in packet loss rate statistics; Add the current custom frame number to the sliding window; Obtain a reference custom frame number in the sliding window. The reference custom frame number is the first custom frame number in the sliding window that participates in the packet loss rate statistics. The packet loss rate is determined based on the current custom frame number and the reference custom frame number.

2. The method according to claim 1, characterized in that, Obtaining the reference custom frame number in the sliding window includes: Determine the starting time for packet loss rate statistics; Determine the historical reception time corresponding to the first custom frame sequence number in the sliding window; Based on the start time and the historical reception time, obtain the reference custom frame sequence number in the sliding window.

3. The method according to claim 2, characterized in that, Based on the start time and the historical reception time, obtain the reference custom frame sequence number in the sliding window, including: Determine whether the start time is earlier than or equal to the historical reception time; If so, the first custom frame number in the sliding window is determined as the reference custom frame number; If not, then based on the start time and the reception time corresponding to each custom frame sequence number in the sliding window, obtain the reference custom frame sequence number in the sliding window.

4. The method according to claim 3, characterized in that, Based on the start time and the reception time corresponding to each custom frame sequence number in the sliding window, the reference custom frame sequence number is obtained in the sliding window, including: In order from front to back, determine the relationship between the receiving time corresponding to the custom frame sequence number in the sliding window and the starting time; The custom frame number in the sliding window whose first reception time is later than or equal to the start time is determined as the reference custom frame number.

5. The method according to claim 1, characterized in that, Before receiving the current data packet, it also includes: Get packet loss rate statistics instruction, the packet loss rate statistics instruction is used to request packet loss rate statistics, and the current data packet is any data packet received after getting the packet loss rate statistics instruction; According to the packet loss rate statistics instruction, delete the custom frame sequence number in the sliding window; Obtaining the reference custom frame number in the sliding window includes: The first custom frame number in the sliding window is determined as the reference custom frame number.

6. The method according to any one of claims 1-5, characterized in that, Adding the current custom frame number to the sliding window includes: Obtain the window state of the sliding window, wherein the window state is either full or not full; Based on the window state, the current custom frame number is added to the sliding window.

7. The method according to claim 6, characterized in that, Based on the window state, the current custom frame number is added to the sliding window, including: If the window state is in the incomplete state, then the current custom frame number is added to the first free storage slot of the sliding window; If the window is in the full state, the first custom frame number in the sliding window will be deleted, each custom frame number in the sliding window will be moved forward one position, and the current custom frame number will be added to the last storage position of the sliding window.

8. The method according to any one of claims 1-7, characterized in that, Determining the packet loss rate based on the current custom frame number and the reference custom frame number includes: Based on the current custom frame sequence number and the reference custom frame sequence number, determine the first number of data packets to be received; The second number of data packets actually received is determined based on the number of custom frame numbers that exist between the current custom frame number and the reference custom frame number. The packet loss rate is determined based on the first quantity and the second quantity.

9. The method according to claim 8, characterized in that, Based on the current custom frame sequence number and the reference custom frame sequence number, determine the first number of data packets to be received, including: Determine the difference between the current custom frame number and the reference custom frame number; Add 1 to the difference to obtain the first quantity.

10. The method according to claim 8 or 9, characterized in that, The second number of data packets actually received is determined based on the number of custom frame numbers existing between the current custom frame number and the reference custom frame number, including: Determine a third number of custom frame numbers that exist between the current custom frame number and the reference custom frame number; Add 2 to the third quantity to obtain the second quantity.

11. The method according to any one of claims 1-10, characterized in that, The method further includes: Obtain the initial data packet to be sent; Determine the current custom frame number and update it according to a preset rule to obtain the target frame number; The target frame sequence number is added to the MAC payload of the initial data packet to obtain the target data packet; Send the target data packet and update the current custom frame sequence number to the target frame sequence number.

12. The method according to any one of claims 1-11, characterized in that, The method further includes: Obtain the packet loss rate for multiple communication nodes located in different locations; Based on the packet loss rate of the plurality of communication nodes, a target communication node is determined among the plurality of communication nodes, wherein the packet loss rate of the target communication node is less than or equal to a first threshold. The location of the target communication node is determined as the target location, which is the location where the communication node is to be deployed.

13. The method according to any one of claims 1-12, characterized in that, The method is applied to a testing device; the method further includes: Obtain the overall packet loss rate of multiple communication nodes obtained by testing the test device at multiple locations; Based on the overall packet loss rate of multiple communication nodes obtained by the test device at multiple locations, a target location is determined among the multiple locations. The overall packet loss rate obtained by the test device at the target location is less than or equal to a second threshold. The target location is the location where the gateway is to be deployed.

14. A device for determining packet loss rate, characterized in that, It includes a receiving module, a first adding module, a first acquiring module, and a determining module, wherein, The receiving module is used to receive the current data packet, wherein the Media Access Control (MAC) payload of the current data packet includes the current custom frame sequence number of the current data packet, and the current data packet is a data packet that participates in packet loss rate statistics; The first adding module is used to add the current custom frame number to the sliding window; The first acquisition module is used to acquire a reference custom frame number in the sliding window, wherein the reference custom frame number is the first custom frame number in the sliding window that participates in the packet loss rate statistics; The determining module is used to determine the packet loss rate based on the current custom frame sequence number and the reference custom frame sequence number.

15. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1 to 13.

16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 13.

17. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1 to 13.