An efficient variable group packing method and system

By setting a threshold length in PLC variable communication and distinguishing between Class A and Class B variables, and grouping packets in turn, the bandwidth waste caused by message length limitations is solved, and efficient communication is achieved.

CN116260549BActive Publication Date: 2025-12-16SHANGHAI FLEXEM TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310120985.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-15
Publication Date
2025-12-16
Estimated Expiration
2043-02-15

AI Technical Summary

Technical Problem

Existing technologies in PLC variable communication suffer from bandwidth waste and low communication efficiency due to message length limitations, failing to maximize the transmission capacity of each message.

Method used

By setting a threshold length, variables are divided into Class A variables (less than the threshold length) and Class B variables (greater than or equal to the threshold length). During packet assembly, entries are taken from Class B and Class A variables in turn to form a message until the maximum message length is reached.

Benefits of technology

By maximizing message length utilization, the number of messages is reduced, communication efficiency is improved, and bandwidth waste is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116260549B_ABST
    Figure CN116260549B_ABST
Patent Text Reader

Abstract

The application relates to an efficient variable grouping method and system, which comprises the following steps: obtaining the message length occupied by a variable to be grouped when the variable to be grouped requests registration; setting the variable to be grouped as a class A variable smaller than a threshold length or a class B variable greater than or equal to the threshold length according to the message length; and taking entries from the class B variable and the class A variable in turn to form a message by grouping until the message reaches the maximum message length, which indicates that the current message grouping is completed. Through the technical scheme, the application can maximize the use of the length of the message to carry as much information as possible, reduce the number of messages, improve the communication efficiency of the message, and reduce the bandwidth waste caused by different variables in communication.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of electronic communication, in particular to an efficient variable packet grouping method and system. BACKGROUND

[0002] The communication protocol of the PLC variable label can read multiple variables of different lengths at a time, but due to the limitation of the total length of the message, a large amount of information cannot be transmitted through one message. The existing technology generally adopts a sequential arrangement method, that is, the variables are arranged in the order of variable request and the message length is accumulated. Once the maximum length is exceeded, the packet grouping is completed for the last variable, and the latest variable is communicated in the next packet.

[0003] Fully using each message can help improve the speed of message communication. When transmitting messages in the above-mentioned manner, the number of bytes occupied by each variable is irregular and there is a difference in size, so it is not possible to maximize the use of the length of each message. When the remaining space is large and the next variable cannot be loaded, the traditional method is to stop loading, so that the remaining space cannot be used, resulting in waste of bandwidth. SUMMARY

[0004] In order to reduce the bandwidth waste caused by different variables in communication, the present application provides an efficient variable packet grouping method and system.

[0005] The efficient variable packet grouping method and system provided by the present application adopt the following technical solutions:

[0006] An efficient variable packet grouping method comprises:

[0007] Obtaining the message length occupied by the variable to be grouped when the variable request to be grouped is registered;

[0008] According to the message length, the variable to be grouped is set as a class A variable smaller than a threshold length or a class B variable greater than or equal to the threshold length;

[0009] When grouping, the entries are alternately taken from the class B variable and the class A variable to form a message, and the grouping of the current message is completed when the message reaches the maximum message length.

[0010] By adopting the technical scheme, the message length occupied by the to-be-grouped variable is obtained when the to-be-grouped variable request is registered, so that the message length occupied by different to-be-grouped variables can be identified; the to-be-grouped variable is set as a class A variable smaller than a threshold length or a class B variable greater than or equal to the threshold length according to the message length, so that the difference between the class A variable and the class B variable is distinguished, and different grouping manners and grouping sequences can be set for the class A variable and the class B variable respectively; when grouping is performed, entries are alternately obtained from the class B variable and the class A variable to form a message, and the current message grouping is completed when the message reaches a maximum message length, so that the length of the message can be maximally utilized to carry as much information as possible, the number of messages is reduced, the communication efficiency of the message is improved, and the bandwidth waste caused by different variables in communication is reduced.

[0011] Optionally, the setting of the to-be-grouped variable as the class A variable smaller than the threshold length or the class B variable greater than or equal to the threshold length according to the message length comprises:

[0012] Setting the threshold for distinguishing variables according to requirements;

[0013] Comparing the message length of the to-be-grouped variable with the threshold;

[0014] When the message length of the to-be-grouped variable is smaller than the threshold, the to-be-grouped variable is set as the class A variable;

[0015] When the message length of the to-be-grouped variable is greater than or equal to the threshold, the to-be-grouped variable is set as the class B variable.

[0016] By adopting the technical scheme, the threshold for measuring and distinguishing the to-be-grouped variable can be set, and the to-be-grouped variable is divided into the corresponding class A variable and class B variable according to the threshold.

[0017] Optionally, the threshold is set as one fourth of the maximum message length.

[0018] Optionally, the class A variable is the to-be-grouped variable that cannot be split, and the class B variable is the to-be-grouped variable that can be split.

[0019] By adopting the technical scheme, the corresponding grouping manner can be set according to the difference between the class A variable and the class B variable.

[0020] Optionally, when grouping is performed, entries are alternately obtained from the class B variable and the class A variable to form a message, and the current message grouping is completed when the message reaches a maximum message length, comprising:

[0021] In the process of packet assembly, alternately take entries from the B-type variables and the A-type variables;

[0022] When all entries in the AB list of the B-type entries and the A-type entries have been taken, then draw the corresponding B-type entries and A-type entries from the remaining list with entries.

[0023] By using the above technical solution, the corresponding B-type entries and A-type entries can be stored through multiple AB lists, and the maximum packet length packet assembly can be performed through the B-type variable and A-type variable alternately packet assembly mode, thereby increasing the use efficiency of the packet.

[0024] Optionally, in the process of packet assembly, alternately taking entries from the B-type variables and the A-type variables comprises:

[0025] Firstly, place the entry in the B-type variable at the front of the alternative AB list in the packet, and first determine whether the packet is filled;

[0026] When the first determination result is that the packet is filled, fill the next packet according to whether there are remaining entries in the B-type variable;

[0027] When the first determination result is that the packet is not filled, fill the A-type variable according to whether the remaining space of the packet can fill the next A-type variable.

[0028] By using the above technical solution, the first determination of whether to fill can be made in the process of filling the packet by the B-type variable, and the corresponding filling of the A-type packet or the sending of the packet can be performed according to the determination result, so as to meet the demand of maximizing the packet length as much as possible.

[0029] Optionally, when the first determination result is that the packet is filled, filling the next packet according to whether there are remaining entries in the B-type variable comprises:

[0030] When the first determination result is that the packet is filled, secondly determine whether there are remaining entries in the B-type variable;

[0031] When the second determination result is that there are remaining entries in the B-type variable, fill the remaining entries on the B-type variable in the next packet, and then fill the A-type variable;

[0032] When there is remaining space in the next packet after filling the A-type variable, continue to fill the next B-type variable and sequentially fill until the maximum packet length is reached.

[0033] By adopting the technical scheme, when the first judgment result is that the filling is full, it is judged whether the B-type variable still has a corresponding entry, and the filling of the B-type variable and the A-type variable in the next packet is performed according to the judgment result.

[0034] Optionally, when the first judgment result is that the filling is not full, the filling of the A-type variable is performed according to whether the remaining space of the packet can fill the next A-type variable.

[0035] When the first judgment result is that the filling is not full, it is secondly judged whether the remaining space of the packet can fill the next A-type variable.

[0036] When the second judgment result is that the remaining space of the packet cannot fill the A-type variable, it indicates that the packet reaches the maximum packet length, and the filling of the entry is stopped.

[0037] When the second judgment result is that the remaining space of the packet can fill the A-type variable, the entry in the A-type variable is filled into the packet.

[0038] After the filling of the A-type variable is completed, it is thirdly judged whether the packet reaches the maximum packet length, and the filling of the next B-type variable is performed according to the judgment result.

[0039] By adopting the technical scheme, when the first judgment result is that the filling is not full, corresponding judgment is performed, so as to fill the A-type variable, to maximize each packet in the packet length, increase the information carried by the packet, and reduce the number of packets.

[0040] An efficient variable packet assembling system comprises:

[0041] A packet length acquisition module is configured to acquire a packet length occupied by a variable to be packed when the variable to be packed requests registration.

[0042] A variable setting module is configured to set the variable to be packed as an A-type variable smaller than a threshold length or a B-type variable greater than or equal to the threshold length according to the packet length.

[0043] A packet assembling module is configured to take entries from the B-type variable and the A-type variable in turn to assemble packets and form a packet when packet assembling is performed, until the packet reaches the maximum packet length, which indicates that the current packet assembling is completed.

[0044] By adopting the technical scheme, the message length obtaining module sets the to-be-packetized variable as a class A variable smaller than a threshold length or a class B variable larger than or equal to the threshold length according to the message length; the variable setting module sets the to-be-packetized variable as a class A variable smaller than a threshold length or a class B variable larger than or equal to the threshold length according to the message length; and the packetizing module alternately obtains entries from the class B variable and the class A variable to packetize and form a message until the message reaches a maximum message length, indicating that the current message packetizing is completed, so that the length of the message can be maximally utilized to carry as much information as possible, the number of messages is reduced, the communication efficiency of the message is improved, and bandwidth waste caused by different variables in communication is reduced.

[0045] In summary, the present application includes at least one of the following beneficial technical effects:

[0046] In summary, the present application includes at least one of the following beneficial technical effects: BRIEF DESCRIPTION OF DRAWINGS

[0047] Figure 1 is a flow chart of one embodiment of a high-efficiency variable packetizing method of the present application;

[0048] Figure 2 is a flow chart of one embodiment of a high-efficiency variable packetizing method of the present application;

[0049] Figure 3 is a flow chart of one embodiment of a high-efficiency variable packetizing method of the present application;

[0050] Figure 4 is a flow chart of one embodiment of a high-efficiency variable packetizing method of the present application;

[0051] Figure 5 is a flow chart of one embodiment of a high-efficiency variable packetizing method of the present application;

[0052] Figure 6is a flow chart of one embodiment of a high-efficiency variable grouping method according to an embodiment of the present application.

[0053] Figure 7 is a structural diagram of one embodiment of a high-efficiency variable grouping system according to an embodiment of the present application. DETAILED DESCRIPTION

[0054] The present application will be further described in detail below with reference to the accompanying drawings.

[0055] In order to reduce the bandwidth waste caused by different variables in communication, the present application provides a high-efficiency variable grouping method and system.

[0056] Embodiment one: the present embodiment discloses a high-efficiency variable grouping method, referring to Figure 1 , comprising:

[0057] S110, obtaining the message length occupied by the variable to be grouped when the variable to be grouped requests registration.

[0058] It should be noted that, in contrast to constants such as time, bytes, etc. that are not changed during the running process of the PLC, the variable to be grouped is data that can be modified during the running process of the PLC. Almost all data in the PLC control system is dynamic, such as temperature, pressure, and variables for controlling industrial production equipment.

[0059] When the variable to be grouped needs to be transmitted to other devices, the variable to be grouped first needs to be registered and stored, i.e. registered in the PLC variable table. The variable to be grouped is stored and represented in the PLC variable table through an absolute address. The absolute address does not represent the actual physical signal meaning of the variable to be grouped.

[0060] It should also be noted that when the PLC communicates, it uses a corresponding communication protocol for message transmission. The variable tag is a relatively new communication protocol, including Codesys, Befor, ABB, OMRON, etc. PLCs of companies have this type of protocol. The characteristic of the variable tag protocol is that a group of variables with different lengths are combined and read in one message, and the corresponding values of all these variables are obtained through one reply to improve communication efficiency. Different protocols specify the maximum number of bytes per message, and the maximum number of bytes of different protocols is different, such as 512 bytes or 1024 bytes.

[0061] S120, setting the variable to be grouped as a class A variable smaller than a threshold length or a class B variable greater than or equal to the threshold length according to the message length.

[0062] It should be noted that the threshold length is set according to the demand, and the demand is the demand for dividing the to-be-grouped variable. In other embodiments, it can also be set to a value close to one fourth, such as eight thirds and one fifth, etc. However, since the computer is a binary operation, it is meaningless to set it to one half, because the to-be-grouped variable includes a larger array and a smaller string. The size of the array can even be larger than the maximum length of the message, and the size of the string can only be a few bytes. Therefore, in the present embodiment, the threshold is set to one fourth of the maximum message length according to the demand. It is convenient to split the larger to-be-grouped variable, that is, to set the to-be-grouped variable larger than one fourth of the maximum length as a B-type variable, and to set the to-be-grouped variable smaller than one fourth of the maximum length as an A-type variable. For example, there are two to-be-grouped variables of 70 bytes and 4 bytes, respectively. The to-be-grouped variable of 70 bytes is an array, and the to-be-grouped variable of 4 bytes is set as a string. The string cannot be split, but the array can be split. Therefore, the to-be-grouped variable of 70 bytes is set as a B-type variable, and the to-be-grouped variable of 4 bytes is set as an A-type variable. Further, the A-type variable is set as a non-splittable to-be-grouped variable, and the B-type variable is set as a splittable to-be-grouped variable, so that the A-type variable is convenient to fill the space left after the B-type variable is set.

[0063] S130, in the grouping, the entries are taken from the B-type variable and the A-type variable in turn to form a message, until the message reaches the maximum message length, indicating that the current message grouping is completed.

[0064] In the grouping, the entries taken from the B-type variable and the A-type variable in turn are put into the message to form a message, for example, in filling a message, the corresponding entry is first taken from the B-type variable and put into the message, then the corresponding entry is taken from the A-type variable and put into the message, then the corresponding entry is taken from the B-type variable and put into the message, until the message reaches the maximum message length, indicating that the current message grouping is completed. After the grouping is completed, the message can be sent. Then another message is still grouped in a polling manner, so that the maximum message length is used to the greatest extent, and the communication efficiency is improved.

[0065] It can be understood that, since the entries in the A-type variables are short and cannot be split, and the B-type variables are long and can be split, the polling manner in the embodiment is to start from the B-type variables and poll in the order of BABABA…, and other polling manners can also be used in other embodiments, such as starting from the A-type variables, polling in the order of ABABAB…, or in the order of BAABBA, and the like. The actual polling manner is set according to the types of the to-be-packetized variables generated in the PLC working process, and different polling manners can also be set in advance and selected by the PLC at different times, and the polling manner suitable for the PLC can also be generated according to the to-be-packetized variables generated by the PLC, so as to improve the efficiency of the PLC in transmitting messages, maximize the use of the length of the message to carry as much information as possible, reduce the number of messages, improve the communication efficiency of the messages, and reduce the bandwidth waste caused by different variables in communication.

[0066] The implementation principle of the efficient variable packetization method in the embodiment of the application is as follows: the length of a message occupied by a to-be-packetized variable is obtained when the to-be-packetized variable requests registration, so that the length of the message occupied by different to-be-packetized variables can be identified; the to-be-packetized variable is set as an A-type variable smaller than a threshold length or a B-type variable greater than or equal to the threshold length according to the length of the message, so that the difference between the A-type variable and the B-type variable is distinguished, and different packetization manners and packetization sequences can be set for the A-type variable and the B-type variable respectively; when packetization is performed, entries are alternately taken from the B-type variable and the A-type variable for packetization to form a message, until the message reaches a maximum message length, indicating that the current message packetization is completed, so that the length of the message can be maximally used to carry as much information as possible, the number of messages is reduced, the communication efficiency of the messages is improved, and the bandwidth waste caused by different variables in communication is reduced.

[0067] Referring to Figure 2 , the to-be-packetized variable is set as an A-type variable smaller than a threshold length or a B-type variable greater than or equal to the threshold length according to the length of the message, comprising:

[0068] S210, setting a threshold for distinguishing variables according to requirements;

[0069] S220, comparing the length of a message of a to-be-packetized variable with the threshold;

[0070] S230, when the length of the message of the to-be-packetized variable is smaller than the threshold, the to-be-packetized variable is set as an A-type variable;

[0071] S240, when the length of the message of the to-be-packetized variable is greater than or equal to the threshold, the to-be-packetized variable is set as a B-type variable.

[0072] It should be noted that the threshold for variable differentiation is set according to the demand, which is the demand for the best differentiation effect. The threshold for variable differentiation is not a fixed threshold according to the actual situation, but can be adjusted so that it can be adjusted according to the actual working condition of the PLC when performing variable differentiation. And when performing variable differentiation, the A-type variable is a to-be-packed variable less than the threshold, and the A-type variable is a to-be-packed variable that cannot be split, and the B-type variable is a to-be-packed variable greater than the threshold, and the B-type variable can be split. Therefore, the difference between the A-type variable and the B-type variable is not only the difference in size, but also the difference in whether it can be split. When there is a to-be-packed variable greater than the threshold and cannot be split, the to-be-packed variable is also an A-type variable. When there is a to-be-packed variable less than the threshold but can be split, the to-be-packed variable is also a B-type variable. Only in the normal state, the A-type variable is generally a string, and the length of the string is generally small, and the B-type variable is generally an array or a larger variable.

[0073] Referring to Figure 3 When packing, the entries are taken from the B-type variable and the A-type variable in turn to pack and form a message, until the message reaches the maximum message length, indicating that the current message packing is complete, including:

[0074] S310, when packing, entries are taken from the B-type variable and the A-type variable in turn;

[0075] S320, when all entries in the AB list storing B-type entries and A-type entries have been taken, the corresponding B-type entries and A-type entries are extracted from the remaining list with entries.

[0076] It should be noted that, as mentioned above, the AB list is a PLC variable table for storing B-type variables and A-type variables, and the AB list stores entries related to B-type variables and A-type variables. Therefore, in this embodiment, when the entries in the AB list have been extracted, the extraction is performed from the remaining PLC variable table with entries, that is, the extraction is performed from the remaining AB list with entries.

[0077] Referring to Figure 4 When packing, entries are taken from the B-type variable and the A-type variable in turn, including:

[0078] S410, first, the entry in the most front B-type variable in the candidate AB list is placed in the message, and the message is judged for the first time whether it is filled.

[0079] It can be understood that since the B-type variable can be a sentence or a longer string, the size of the B-type variable can exceed the maximum packet length of 256 bytes when the B-type variable is filled into the packet for the first time, so it is necessary to determine whether the packet is filled full when the B-type variable is filled for the first time. There are three possibilities when the B-type variable is filled, which are less than the maximum packet length, equal to the maximum packet length, and greater than the maximum packet length, including not filled full, just filled full, and filled full with the B-type variable still having entries not filled.

[0080] S420, when the first judgment result is that it has been filled full, the next packet is filled according to whether the B-type variable still has remaining entries.

[0081] It should be noted that when the B-type variable fills the packet full for the first time, there are two possibilities corresponding to just filled full and filled full with the B-type variable still having entries, and the next packet needs to be filled according to whether the B-type variable still has remaining entries. When the entries on the B-type variable are just filled full of the maximum packet length, the next packet is still starting to fill the B-type variable, so that the variable filling of each packet always starts from the B-type, and the A-type packet is filled after the B-type packet is filled full. When the B-type variable still has remaining entries after being filled full, the remaining entries are first filled in the next packet, and then the A-type variable is filled to perform polling of the B-type variable and the A-type variable.

[0082] S430, when the first judgment result is that it is not filled full, the A-type variable is filled according to whether the remaining space of the packet can fill the next A-type variable.

[0083] When the B-type variable does not fill the packet full, there is a possibility that the packet still has remaining space, which can be filled with the A-type packet when the remaining space is large, but it is not convenient to fill the A-type packet when the remaining space is small. The A-type packet belongs to an internal entry and cannot be split, so the filling of the A-type packet also needs to consider the remaining space after filling the B-type packet.

[0084] Embodiment Two:

[0085] Referring to Figure 5 When the first judgment result is that it has been filled full, the next packet is filled according to whether the B-type variable still has remaining entries, including:

[0086] S510, when the first judgment result is that it has been filled full, the second time determines whether the B-type variable still has remaining entries.

[0087] S520, when the second judging result is that there are still remaining entries of the B-type variable, then the remaining entries of the B-type variable are filled in the next packet, and then the A-type variable is filled;

[0088] S530, when there is still remaining space in the next packet after filling the A-type variable, the next B-type variable is continuously filled, and the filling is sequentially performed until the maximum packet length is reached.

[0089] It should be noted that when the first judging result is that the filling is full, the size of the B-type variable can be 256 bytes which is the same as the maximum packet length, or can be greater than the maximum packet length, that is, greater than 256 bytes, and it is necessary to judge whether there are still remaining entries of the B-type variable to be filled.

[0090] At this time, the second judgment is performed to judge whether there are still remaining entries of the B-type variable, when there are still remaining entries, the remaining entries of the B-type variable are filled in the next packet, so that the B-type variable can be completely transmitted with the transmission of the next packet. After filling the remaining entries of the B-type variable, the A-type variable is polled for filling, and when the second judgment is that there is no next entry of the B-type variable, the filling of the entries in the next packet is still performed from the next B-type variable in the next packet in the polling manner of the B-type variable and the A-type variable.

[0091] It can be understood that when the entries in the A-type variable are filled in the next packet, there are two cases: there is still remaining space in the next packet, and the next packet is just filled. When there is still remaining space in the next packet, the filling of the next B-type variable is performed, and since the B-type variable can be split, the remaining space after filling the A-type variable can be filled by splitting the next B-type variable.

[0092] Embodiment Three

[0093] Referring to Figure 6 When the first judging result is that the filling is not full, the filling of the A-type variable is performed according to whether the remaining space of the packet can fill the next A-type variable, including:

[0094] S610, when the first judging result is that the filling is not full, the second judgment is performed on whether the remaining space of the packet can fill the next A-type variable;

[0095] S620, when the second judging result is that the remaining space of the packet cannot fill the A-type variable, it means that the packet reaches the maximum packet length, and the filling of the entries is stopped;

[0096] S630, when the second judging result is that the remaining space of the packet can fill the A-type variable, the entries in the A-type variable are filled into the packet;

[0097] S640, after filling the A-type variable, judging for the third time whether the packet reaches the maximum packet length and performing the next B-type variable filling according to the judgment result.

[0098] It should be noted that when the first judgment result is not filled, it means that the size of the B-type variable is smaller than the size of the maximum packet length when filling for the first time, but how much is still measured according to the actual size of the B-type variable, such as the maximum packet length is 256 bytes, the packet length of the A-type variable is 4 bytes, and the packet length of the B-type variable is 253 bytes, at this time, the B-type variable is filled into the packet, at this time, the remaining space of the packet is 3 bytes, which is smaller than the size of the A-type variable, and the A-type packet cannot be filled, at this time, the packet with 3 bytes of remaining space is sent out.

[0099] When the packet length of the B-type variable is 70 bytes, which is greater than one fourth of the maximum packet length, and the maximum packet length of the A-type variable is 60 bytes, at this time, the B-type packet is filled into the packet, and the remaining space can continue to fill the A-type variable, after filling the A-type variable, the packet is judged for the third time whether it reaches the maximum packet length, and according to the above example, the filling is completed and the maximum packet length is not reached, at this time, the next B-type variable is polled for filling.

[0100] It can be understood that when the next B-type variable is filled in the packet, the method followed is still the efficient variable packet grouping method in the present application, which is based on the above-mentioned embodiment one, embodiment two and embodiment three, and the purpose is to form the maximum packet length as much as possible when filling each packet. Referring to different embodiments in the present application, only when the packet is all A-type packet and cannot be filled in one packet length, the packet utilization rate is insufficient, otherwise the packet length is all full, that is, it reaches the maximum packet length, which maximally reduces the number of packets, thereby greatly improving the communication efficiency.

[0101] Another embodiment of the present application also discloses an efficient variable packet grouping system, which adopts the above-mentioned efficient variable packet grouping method, comprising:

[0102] A packet length acquisition module is configured to acquire the packet length occupied by the to-be-grouped variable when the to-be-grouped variable request is registered.

[0103] A variable setting module is configured to set the to-be-grouped variable as an A-type variable smaller than a threshold length or a B-type variable greater than or equal to the threshold length according to the packet length.

[0104] A packet grouping module is configured to take turns to obtain entries from the B-type variable and the A-type variable to form a packet when grouping, and the packet grouping is completed when the packet reaches the maximum packet length.

[0105] The above are all preferred embodiments of the present application, and do not limit the protection scope of the present application, so that: all equivalent changes made according to the structure, shape, principle of the present application should be covered in the protection scope of the present application.

Claims

1. An efficient variable group packing method, characterized in that, The method comprises the following steps: acquiring the length of the packet occupied by the to-be-grouped variable when the to-be-grouped variable is registered; setting the to-be-grouped variable as a class-A variable smaller than a threshold length or a class-B variable larger than or equal to the threshold length according to the length of the packet; when grouping, alternately taking entries from the class-B variable and the class-A variable to group and form a packet, until the packet reaches the maximum packet length, indicating that the current packet grouping is completed.

2. The efficient variable group packing method of claim 1, wherein, The step of setting the to-be-grouped variable as a class-A variable smaller than a threshold length or a class-B variable larger than or equal to the threshold length according to the length of the packet comprises the following steps: setting the threshold for grouping variable according to the requirement; comparing the length of the packet of the to-be-grouped variable with the threshold; when the length of the packet of the to-be-grouped variable is smaller than the threshold, setting the to-be-grouped variable as a class-A variable; when the length of the packet of the to-be-grouped variable is larger than or equal to the threshold, setting the to-be-grouped variable as a class-B variable.

3. The efficient variable group packing method according to claim 1 or 2, characterized in that, The threshold is set as one fourth of the maximum packet length.

4. The method of claim 2, wherein, The class-A variable is the to-be-grouped variable that cannot be split, and the class-B variable is the to-be-grouped variable that can be split.

5. The efficient variable group packing method according to claim 2 or 4, characterized in that, The step of, when grouping, alternately taking entries from the class-B variable and the class-A variable to group and form a packet, until the packet reaches the maximum packet length, indicating that the current packet grouping is completed, comprises the following steps: when grouping, alternately taking entries from the class-B variable and the class-A variable; when all the entries in the AB list storing the class-B entries and the class-A entries have been taken, extracting the corresponding class-B entries and class-A entries from the AB list with remaining entries.

6. The efficient variable group packing method of claim 5, wherein, The step of, when grouping, alternately taking entries from the class-B variable and the class-A variable, comprises the following steps: firstly, placing the entry in the class-B variable at the front of the candidate AB list in the packet, and judging whether the packet is filled up for the first time; when the result of the first-time judgment is that the packet is filled up, filling the next packet according to whether there are remaining entries in the class-B variable; when the result of the first-time judgment is that the packet is not filled up, filling the class-A variable according to whether the remaining space of the packet can be filled with the next class-A variable.

7. The efficient variable group packing method of claim 6, wherein, The step of, when the result of the first-time judgment is that the packet is filled up, filling the next packet according to whether there are remaining entries in the class-B variable, comprises the following steps: when the result of the first-time judgment is that the packet is filled up, judging whether there are remaining entries in the class-B variable for the second time; when the result of the second-time judgment is that there are remaining entries in the class-B variable, filling the remaining entries in the class-B variable in the next packet, and then filling the class-A variable; when there is remaining space in the next packet after filling the class-A variable, continuing to fill the next class-B variable and sequentially filling until the maximum packet length is reached.

8. The efficient variable group packing method of claim 6, wherein, The step of, when the result of the first-time judgment is that the packet is not filled up, filling the class-A variable according to whether the remaining space of the packet can be filled with the next class-A variable, comprises the following steps: When the first judgment result is that the packet is not filled, the second judgment is whether the remaining space of the packet can be filled with the next A-type variable; When the second judgment result is that the remaining space of the packet cannot be filled with the A-type variable, it indicates that the packet reaches the maximum packet length, and the filling of the entry is stopped; When the second judgment result is that the remaining space of the packet can be filled with the A-type variable, the entry in the A-type variable is filled into the packet; After the filling of the A-type variable is completed, the third judgment is whether the packet reaches the maximum packet length, and the filling of the next B-type variable is performed according to the judgment result.

9. A high performance variable group packet system characterized by, The method of any one of claims 1-8, comprising: a packet length obtaining module, configured to obtain the packet length occupied by the to-be-packetized variable when the to-be-packetized variable requests registration; a variable setting module, configured to set the to-be-packetized variable as an A-type variable smaller than a threshold length or a B-type variable larger than or equal to the threshold length according to the packet length; a packetizing module, configured to, when packetizing, alternately take entries from the B-type variable and the A-type variable to packetize and form a packet, until the packet reaches the maximum packet length, indicating that the current packet packetizing is completed.

Citation Information

Patent Citations

  • Data processing method and device, electronic equipment and storage medium

    CN111224967A

  • Message forwarding method and device and electronic equipment

    CN112585914A