Modbus-based grouping method, apparatus, communication system, and storage medium

By grouping Modbus requests, the continuity of request addresses and the consistency of functions processed by slave devices are ensured, which solves the problems of low efficiency and high error rate in traditional Modbus communication and achieves efficient data transmission and processing.

CN122247785APending Publication Date: 2026-06-19BEIJING HONEST TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING HONEST TECHNOLOGY CO LTD
Filing Date
2025-08-18
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Traditional Modbus communication suffers from efficiency bottlenecks when dealing with a large number of devices and data acquisition, especially due to the increased communication error rate caused by discontinuous register addresses.

Method used

By identifying request characteristics, initial grouping is performed based on slave device identifiers and functions to be executed, followed by secondary grouping based on register address continuity to form a target request set. This ensures that adjacent request addresses are continuous, optimizes request length and frequency, and reduces network load and error rate.

Benefits of technology

It improves the efficiency and success rate of Modbus communication, reduces network complexity, and optimizes memory access speed and data processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122247785A_ABST
    Figure CN122247785A_ABST
Patent Text Reader

Abstract

This disclosure relates to the field of computer technology, specifically to a Modbus-based grouping method, apparatus, communication system, and storage medium. The Modbus-based grouping method includes: determining multiple requests to be processed; determining the request characteristics of each request, including the identifier of the slave device receiving the request, the function to be executed, and the register information to be accessed; grouping the multiple requests based on the slave device identifier and the function to be executed for each request to obtain multiple intermediate request sets; and further grouping the requests in each intermediate request set based on the register information corresponding to each request in each intermediate request set to obtain at least one target request set corresponding to each intermediate request set. This can reduce the complexity of network communication, ensure communication success rate, and thus help optimize memory access speed and efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more specifically to a Modbus-based packet method, a Modbus-based packet device, a Modbus-based communication system, and a computer-readable storage medium. Background Technology

[0002] In the field of industrial automation, the Modbus protocol serves as a fundamental standard for device communication, widely used for data exchange between PLCs, sensors, instruments, and other devices. With the development of the Internet of Things (IoT), the number of devices and the scale of data acquisition are constantly expanding, and traditional Modbus communication methods are facing efficiency bottlenecks. Among related technologies, batch read technology based on Modbus mainly merges register requests with consecutive physical addresses into a single batch request for subsequent processing. However, register addresses may be discontinuous due to the distribution of functional modules, leading to invalid address requests and increasing the communication error rate. Summary of the Invention

[0003] To overcome the problems existing in related technologies, an exemplary embodiment of this disclosure provides a Modbus-based grouping method, comprising: determining multiple requests to be processed, wherein the multiple requests are sent by at least one master station device; determining the request characteristics of each request, the request characteristics including the identifier of the slave device receiving the request, the function to be executed, and the register information to be accessed; grouping the multiple requests based on the slave device identifier and the function to be executed corresponding to each request to obtain multiple intermediate request sets, wherein all requests in the intermediate request sets have the same slave device identifier and the function to be executed; and further grouping the requests in each intermediate request set based on the register information corresponding to each request in each intermediate request set to obtain at least one target request set corresponding to each intermediate request set, wherein the register addresses corresponding to adjacent requests in the target request set are consecutive addresses.

[0004] In some embodiments, based on the register information corresponding to each request in each intermediate request set, the requests in each intermediate request set are grouped a second time to obtain at least one target request set corresponding to each intermediate request set, including: determining the address information of the register corresponding to each request based on the register information corresponding to each request in the intermediate request set; dividing two requests with adjacent address gaps less than or equal to a gap threshold into the same group based on the address information of the register corresponding to each request, and dividing two requests with adjacent address gaps greater than the gap threshold into different groups; and obtaining at least one target request set corresponding to the intermediate request set in response to the completion of the division of all requests in the intermediate request set.

[0005] In some embodiments, the method further includes: determining the request length of a corresponding request based on the register information of each request; determining the total request length of the target request set based on the request length of each request in the target request set; determining the maximum request length based on the device characteristics of the slave device corresponding to the target request set; and adjusting the target request set based on the comparison result between the total request length and the maximum request length to obtain at least one target request subset.

[0006] In some embodiments, based on the comparison result of the total request length of the target request set and the maximum request length, the target request set is adjusted to obtain at least one optimized request subset, including: in response to the total request length of the target request set being less than or equal to the maximum request length, the target request set is maintained; in response to the total request length of the target request set being greater than the maximum request length, the target request set is split to obtain multiple target request subsets, wherein the total request length of the target request subsets is less than or equal to the maximum request length.

[0007] In some embodiments, the target request set is split to obtain multiple target request subsets, including: determining an optimal split point based on the request length of each request in the target request set and the maximum request length; splitting the target request set according to the optimal split point to obtain multiple candidate request subsets; stopping the splitting in response to the total request length of each candidate request subset being less than or equal to the maximum request length, and using the multiple candidate request subsets as multiple target request subsets; and performing a bisection process on the target candidate request subsets in response to the existence of a target candidate request subset with a total request length greater than the maximum request length, until a target request subset with a total request length less than or equal to the maximum supported request length is obtained, and using other candidate request subsets with a total request length less than or equal to the maximum request length as target request subsets.

[0008] In some embodiments, the method further includes: tracking the processing status of each target request subset; and optimizing the adjacent address gap or optimizing the request sending frequency of the master station device corresponding to each target request subset based on the processing status of each target request subset.

[0009] In some embodiments, the processing status includes the error rate of request anomalies and the average duration of response time. Based on the processing status of each target request subset, the adjacent address gap is optimized or the request sending frequency of the master station device corresponding to each target request subset is optimized respectively, including: optimizing the adjacent address gap in response to the error rate of request anomalies of the target request subset being greater than a first threshold; optimizing the request sending frequency of the master station device corresponding to the target request subset in response to the average duration of response time of the target request subset being greater than a duration threshold.

[0010] In some embodiments, the processing status also includes the number of connection interruptions, optimizing the adjacent address gap or optimizing the request sending frequency of the master device corresponding to each target request subset based on the processing status of each target request subset, and further includes: stopping sending requests to the slave device corresponding to the target request subset in response to the number of connection interruptions of the target request subset being greater than a second threshold.

[0011] In some embodiments, the method further includes: periodically optimizing the device characteristics of the slave device corresponding to each target request set based on the processing status of each target request set.

[0012] In some embodiments, based on the processing status of each target request set, the device characteristics of the slave device corresponding to each target request set are periodically optimized, including: determining the device type of the slave device corresponding to each target request set; and periodically optimizing the device characteristics of multiple slave devices with the same device type based on the device type and the processing status of each target request set.

[0013] Secondly, this disclosure also provides a Modbus-based grouping device, comprising: a first determining module, configured to determine multiple requests to be processed, wherein the multiple requests are sent by at least one master station device; a second determining module, configured to determine the request characteristics of each request, the request characteristics including the identifier of the slave device receiving the request, the function to be executed, and the register information to be accessed; a first grouping module, configured to group the multiple requests based on the slave device identifier and the function to be executed corresponding to each request, to obtain multiple intermediate request sets, wherein all requests in the intermediate request sets have the same slave device identifier and function to be executed; and a second grouping module, configured to perform secondary grouping of the requests in each intermediate request set based on the register information corresponding to each request in each intermediate request set, to obtain at least one target request set corresponding to each intermediate request set, wherein the register addresses corresponding to adjacent requests in the target request set are consecutive addresses.

[0014] Thirdly, this disclosure also provides a Modbus-based communication system, including: a memory and a processor, the memory and the processor being interconnected, the memory storing computer instructions, and the processor executing the computer instructions to perform the Modbus-based grouping method provided in any of the above aspects.

[0015] Fourthly, this disclosure also provides a computer-readable storage medium storing a program for performing the Modbus-based grouping method provided in any of the above aspects.

[0016] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure.

[0017] The technical solutions provided by the embodiments of this disclosure can include the following beneficial effects: According to the Modbus-based grouping method provided by this disclosure, multiple requests are grouped based on the continuity of the slave device corresponding to the request, the function to be processed, and the register address to be accessed. This ensures that in the same batch of requests, each request needs to be processed by the same slave device, and the function to be processed is the same. The register addresses corresponding to adjacent requests are also continuous, which can reduce the complexity of network communication. When batch processing is performed through the corresponding slave device, it can be processed at one time, reducing network load and ensuring communication success rate, thereby helping to optimize memory access speed and efficiency. Attached Figure Description

[0018] This disclosure can be better understood by describing exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, in which:

[0019] Figure 1 This is a schematic diagram of a Modbus-based grouping method flow according to an exemplary embodiment of a public document;

[0020] Figure 2 This is a schematic diagram of a Modbus-based grouping method flow according to another exemplary embodiment disclosed;

[0021] Figure 3 This is a schematic diagram of a Modbus-based grouping method according to yet another exemplary disclosed invention;

[0022] Figure 4 This is a schematic diagram of a Modbus-based grouping method flow according to another exemplary embodiment disclosed;

[0023] Figure 5 This is a schematic block diagram of a Modbus-based communication system illustrated in an exemplary embodiment of a published document;

[0024] Figure 6 This is a schematic block diagram of a Modbus-based grouping device according to an exemplary embodiment disclosed in a book.

[0025] Figure 7 This is a schematic block diagram of a Modbus-based communication system illustrated according to another exemplary embodiment disclosed. Detailed Implementation

[0026] The following describes specific embodiments of this disclosure. It should be noted that, in order to provide a concise description, this specification cannot exhaustively describe all features of the actual embodiments. It should be understood that, in the actual implementation of any embodiment, just as in any engineering or design project, various specific decisions are often made to achieve the developer's specific goals and to meet system-related or business-related constraints, and this can change from one embodiment to another. Furthermore, it is understood that although the efforts made in this development process may be complex and lengthy, for those skilled in the art related to the content disclosed in this disclosure, changes in design, manufacturing, or production based on the technical content disclosed in this disclosure are merely conventional technical means and should not be construed as insufficient content of this disclosure.

[0027] Unless otherwise defined, the technical or scientific terms used in this disclosure shall have the ordinary meaning understood by one of ordinary skill in the art to which this disclosure pertains. The terms “first,” “second,” and similar terms used in this disclosure do not indicate any order, quantity, or importance, but are merely used to distinguish different components. The terms “a” or “one,” etc., do not indicate a quantity limitation, but rather indicate the presence of at least one. The terms “comprising,” “including,” etc., mean that the element or object preceding “comprising” or “including” encompasses the elements or objects listed following “comprising” or “including” and their equivalents, and do not exclude other elements or objects. The terms “connected,” “linked,” etc., are not limited to physical or mechanical connections, nor are they limited to direct or indirect connections.

[0028] In related technologies, the Modbus-based batch read technology mainly merges register requests with consecutive physical addresses into a single batch request for subsequent processing. However, register addresses may be discontinuous due to the distribution of functional modules, and requests from different function codes cannot be merged. This can lead to an increased communication error rate when processing the merged batch requests due to invalid addresses.

[0029] To address the aforementioned problems, an exemplary embodiment of this disclosure provides a Modbus-based grouping method. For example... Figure 1 As shown, this Modbus-based grouping method may include the following steps:

[0030] Step S110: Identify the multiple requests to be processed.

[0031] A Modbus network includes master and slave devices. The master device sends requests, and the slave device responds to the requests sent by the master device. For example, the master device can be a controller or computer, responsible for sending instructions and reading data; the slave device can be a sensor, actuator, or other industrial device, responsible for responding to the master's instructions and returning data.

[0032] To improve communication efficiency, multiple requests to be processed in the Modbus network are identified. These multiple requests are sent by at least one master station device. That is, multiple requests can be sent by the same master station device or by multiple master station devices. These multiple requests can be collected simultaneously or accumulated over a period of time without being restricted.

[0033] Step S120: Determine the request characteristics of each request.

[0034] To facilitate better segmentation of requests, request characteristics are defined for each request to ensure the effectiveness of batch processing during subsequent grouping. These request characteristics may include, but are not limited to, the slave device identifier, the function to be executed, and the register information to be accessed. The register information to be accessed may include the starting address of the register and the number of requests. In some examples, request characteristics also include the importance level of the data involved in the request and the real-time requirements for processing the request. In other examples, feature vectors are used to represent the request characteristics for easier determination. For example, feature vector = [S,F,A,N,D,P], where S represents the slave device identifier, F represents the function code of the function to be executed (e.g., 03H (read holding register), 04H (read input register)), A represents the starting address of the register, N represents the number of registers requested, D represents the importance level of the data involved in the request (e.g., level 1-5), and P represents the real-time requirements for processing the request (e.g., high, medium, or low).

[0035] Step S130: Based on the slave device identifier and the function to be executed for each request, multiple requests are grouped and processed to obtain multiple intermediate request sets.

[0036] To improve the efficiency of batch processing for each slave device, requests are grouped based on their corresponding slave device identifiers, ensuring that multiple requests within the same set are processed by the same slave device. However, since different pending functions cannot be processed together, when grouping requests corresponding to the same slave device, the pending functions are also considered. This groups requests corresponding to the same slave device and with the same pending functions into the same set, resulting in multiple intermediate request sets. In other words, for the same intermediate request set, all requests have the same slave device identifier and pending function.

[0037] Step S140: Based on the register information corresponding to each request in each intermediate request set, the requests in each intermediate request set are grouped a second time to obtain at least one target request set corresponding to each intermediate request set.

[0038] In the process of batch processing requests, to improve communication efficiency and reduce the number of communications and waiting time, the continuity of the register addresses corresponding to each request in the same intermediate request set is checked. This allows the requests to be sorted according to their corresponding register addresses, and multiple requests with consecutive register addresses are grouped into the same set, thus obtaining at least one target request set. That is, adjacent requests in the target request set have consecutive register addresses.

[0039] Since the register addresses corresponding to each request are consecutive in the target request set, the network load can be reduced and the request processing logic can be simplified when the target request set is sent to the corresponding slave device for batch processing. This can effectively avoid errors that may occur due to address jumps and ensure the success rate of communication.

[0040] According to the Modbus-based grouping method provided in this disclosure, multiple requests are grouped based on the continuity of the corresponding slave device, the function to be processed, and the register address to be accessed. This ensures that all requests in the same batch of requests require processing by the same slave device, have the same function to be processed, and that the register addresses corresponding to adjacent requests are also continuous. This reduces the complexity of network communication. When batch processing is performed through the corresponding slave device, it can be processed at once, reducing network load and ensuring communication success rate, thereby helping to optimize memory access speed and efficiency.

[0041] In some embodiments, step S140 above may include the following steps:

[0042] Step a1: Determine the address information of the register corresponding to each request based on the register information corresponding to each request in the intermediate request set.

[0043] For the intermediate request set, to minimize processing time and communication frequency, the address information of the registers corresponding to each request is determined based on the register information of each request in the intermediate request set, thereby determining the memory range to be accessed by each request. For example, the register information may include the starting address of the register to be accessed and the number of registers required. Then, based on the starting address and the number of registers, the ending address of the register can be determined, and thus the address information of the register corresponding to the request can be determined based on the starting address and the ending address.

[0044] Step a2: Based on the address information of the register corresponding to each request, two requests with adjacent address gaps less than or equal to the gap threshold are grouped into the same group, and two requests with adjacent address gaps greater than the gap threshold are grouped into different groups.

[0045] To determine whether the register addresses to be accessed corresponding to each request are consecutive, a gap threshold is pre-determined. This gap threshold can be understood as the maximum error that would be considered as the adjacency of two register addresses. Based on the address information of the registers corresponding to each request, the start and end addresses of the registers corresponding to each request can be determined. The adjacent address gap between the start address of each request's register and the end address of the registers corresponding to other requests is then determined. If the adjacent address gap is less than or equal to the gap threshold, the register addresses to be accessed corresponding to the two requests are considered consecutive, and thus they are grouped into the same group. If the adjacent address gap is greater than the gap threshold, the register addresses to be accessed corresponding to the two requests are considered non-consecutive, and thus they are grouped into different groups.

[0046] Step a3: In response to the completion of the partitioning of all requests in the intermediate request set, at least one target request set corresponding to the intermediate request set is obtained.

[0047] Once all requests in the intermediate request set have been partitioned, the continuity between the register addresses corresponding to each request is determined. Multiple requests with consecutive register addresses are then grouped together to obtain at least one target request set. That is, if there is a continuity between the register addresses corresponding to each request, the intermediate request set is the target request set. However, if any request contains register addresses that are not consecutive with other register addresses, the request corresponding to that register address is placed in a different set from the requests corresponding to other register addresses, resulting in multiple target request sets. In this case, the multiple target request sets are subsets of the intermediate request set.

[0048] Grouping requests in this way ensures that requests within the same target request set are physically continuous, which helps optimize subsequent data processing and communication, improves data transmission efficiency, and reduces network load.

[0049] In some embodiments, the Modbus-based grouping method described above may further include the following steps:

[0050] Step b1: Determine the request length of the corresponding request based on the register information of each request;

[0051] Step b2: Determine the total request length of the target request set based on the request length of each request in the target request set;

[0052] Step b3: Determine the maximum request length based on the device characteristics of the slave device corresponding to the target request set;

[0053] Step b4: Based on the comparison between the total request length of the target request set and the maximum request length, adjust the target request set to obtain at least one subset of the target requests.

[0054] Specifically, since the number of registers required for each request is not exactly the same, and the number of registers that a slave device can access at one time is limited, the request length of each request register is determined separately in order to determine whether the target request set can be successfully processed by the corresponding slave device in a single communication.

[0055] The total request length of the target request set is obtained by adding the request lengths of each request in the target request set.

[0056] The performance of a slave device can be determined by its device characteristics. These characteristics may include, but are not limited to, the maximum request length for registers that the slave device is allowed to process, the response timeout threshold, the historical error rate of request processing, the recommended request rate, and the priority type of the slave device. Therefore, to determine the maximum request length for registers processed in a single instance by the slave device corresponding to the target request set, this is determined based on the device characteristics of the slave device corresponding to the target request set.

[0057] By comparing the total request length of the target request set with the maximum request length, it is possible to quickly determine whether the corresponding slave device can effectively handle the request set. This allows for timely optimization of the number of requests in the target request set, ensuring that each communication is as efficient as possible without exceeding the capacity of the slave device and guaranteeing the integrity of data transmission.

[0058] In some embodiments, step b4 above may include the following steps:

[0059] Step b41: In response to the total request length of the target request set being less than or equal to the maximum request length, the target request set is maintained.

[0060] Step b42: In response to the total request length of the target request set being greater than the maximum request length, the target request set is split into multiple target request subsets.

[0061] Specifically, if the total request length of the target request set is less than or equal to the maximum request length, it indicates that the target request set can be completely sent in a single communication, thus eliminating the need for splitting the target request set and keeping it unchanged. If the total request length of the target request set is greater than the maximum request length, it indicates that the target request set cannot be completely sent in a single communication. Therefore, to ensure the efficiency of batch processing, the target request set is split so that the resulting subset of target requests can be completely sent in a single communication, thereby ensuring the effectiveness and efficiency of Modbus communication. The total request length of the subset of target requests is less than or equal to the maximum request length.

[0062] In some embodiments, the splitting of the target request set can be performed using a binary search method, and the specific splitting process is as follows:

[0063] Step c1: Determine the optimal split point based on the request length of each request in the target request set and the maximum request length;

[0064] Step c2: Split the target request set according to the optimal split point to obtain multiple candidate request subsets;

[0065] Step c3: In response to the fact that the total request length of each candidate request subset is less than or equal to the maximum request length, stop splitting and treat the multiple candidate request subsets as multiple target request subsets;

[0066] Step c4: In response to the existence of a target candidate request subset with a total request length greater than the maximum request length, perform a binary search on the target candidate request subset until a target request subset with a total request length less than or equal to the maximum supported request length is obtained, and take the other candidate request subsets with a total request length less than or equal to the maximum request length as the target request subset.

[0067] Specifically, to ensure the rationality of grouping and avoid over-splitting, the optimal split point is determined based on the request length of each request in the target request set and the maximum request length, so that the lengths of the subsets obtained after splitting are as close as possible, ensuring the rationality of grouping, while reducing the communication costs and complexity caused by over-splitting.

[0068] The expression used to determine the optimal split point can be:

[0069] Where, N i L represents the request length of the i-th request. max Indicates the maximum request length.

[0070] If the total request length of each candidate request subset is less than or equal to the maximum request length, it indicates that each candidate request subset can be completely sent in a single communication. This allows the splitting to stop, and multiple candidate request subsets can be treated as multiple target request subsets, thus helping to avoid over-splitting.

[0071] If a target candidate request subset exists with a total request length greater than the maximum request length, it indicates that there are still candidate request subsets that cannot be completely sent in a single communication. Therefore, the target candidate request subset needs to be further split until the total request length of each subset obtained after splitting is less than or equal to the maximum supported request length. The splitting then stops, resulting in multiple target request subsets. For example, the target request set contains the following request lengths (in bytes): [100, 150, 200, 250, 300, 350, 400, 450, 500, 550], with a maximum request length of 3000 bytes. First split: Divide the target request set into two candidate request subsets, each containing 5 requests: Candidate request subset 1: [100, 150, 200, 250, 300]; Candidate request subset 2: [350, 400, 450, 500, 550]. Second split: Since the length of candidate request subset 2 exceeds the maximum request length, candidate request subset 2 is designated as the target candidate request subset and split again, resulting in: candidate request subset 2.1: [350, 400, 450]; candidate request subset 2.2: [500, 550]. Finally, candidate request subset 1, candidate request subset 2.1, and candidate request subset 2.2 are obtained. The length of each candidate request subset is less than or equal to the maximum request length. Therefore, candidate request subset 1, candidate request subset 2.1, and candidate request subset 2.2 can be considered as the target request subsets and sent to the slave devices respectively.

[0072] In other embodiments, the method used to split the target request set may include, but is not limited to, uniform partitioning, load balancing, or other partitioning methods, which are not limited here.

[0073] In some other embodiments, the request features also include the importance level of the data involved in the request. Therefore, when performing the splitting process, the data importance level of each request can be combined for division to ensure the integrity of data with high importance level during transmission.

[0074] In some embodiments, such as Figure 2 As shown, this Modbus-based grouping method may further include the following steps:

[0075] Step S150: Track the processing status of each target request subset.

[0076] Because communication anomalies may occur when communicating under a Modbus network, further tracking is needed to determine the processing status of each target request subset. This allows for targeted optimization of the request grouping process based on the processing status of each target request subset, ensuring overall processing efficiency and performance.

[0077] Step S160: Based on the processing status of each target request subset, optimize the gap between adjacent addresses or optimize the request sending frequency of the master station device corresponding to each target request subset.

[0078] Based on the processing status of each target request subset, it can be determined whether any anomalies occurred during the processing of each target request subset. For target request subsets with anomalies, optimization can be performed by adjusting the gaps between adjacent addresses or the device characteristics of the corresponding slave devices to ensure the reliability and stability of subsequent packets.

[0079] For example, by optimizing the gap between adjacent addresses, the gap between adjacent addresses during request packetization can be adjusted, thus optimizing the continuity of register addresses between requests. By optimizing the request sending frequency of the master device corresponding to the target request subset, the stability and responsiveness of the slave device can be enhanced, thereby ensuring the reliability and stability of the overall packetization.

[0080] In some embodiments, the processing parameters may include the error rate of request exceptions and the average response time. Step S160 above may include the following steps:

[0081] Step d1: In response to the error rate of request anomalies in the target request subset exceeding the first threshold, optimize the gap between adjacent addresses;

[0082] Step d2: If the average response time of the target request subset is greater than the duration threshold, then optimize the request sending frequency of the main station device corresponding to the target request subset.

[0083] Specifically, if the error rate of requests to the target request subset exceeds a first threshold, it indicates that multiple errors have occurred during the processing of that target request subset, exceeding the maximum allowable error rate (first threshold). In this case, the adjacent address gap is optimized to adjust the number of requests per communication for the target request subset. This adjustment process may include shortening the maximum request length of the target request subset and increasing the adjacent address gap. The adjacent address gap can be determined based on the average response time of the target request subset, thus ensuring that the slave device has sufficient time to process requests and reducing errors caused by overload. For example, the error rate E... current It can be expressed using the following formula: The average response time of the target request subset can be expressed by the following formula: Among them, T i This represents the response time for the i-th time. The increase in the gap between adjacent addresses is ΔT = α·T. avg Where α is a coefficient, determined based on the impact of response time on the gap between adjacent addresses, and the value of α ranges from (0,1). The process of adjusting the number of requests in a single communication of the target request subset may include: shortening the total request length of the target request subset by 20% based on the total request length of the previous target request subset, and determining the gap threshold for the current target request subset based on the increase in the gap between adjacent addresses and the previous gap threshold when determining the gap between adjacent addresses. This is done by adjusting the total request length of the target request subset and the current gap threshold to reduce the error rate of the corresponding slave device in processing the target request subset.

[0084] If the average response time to the target request subset exceeds a duration threshold, it indicates that when batch processing multiple requests within the target request subset, the response time exceeds the maximum allowable delayed response time (duration threshold). In this case, the request sending frequency of the master device corresponding to the target request subset is optimized. By adjusting the request sending frequency of the master device, the number of requests processed by the slave devices is reduced, increasing the resources available for processing the target request subset, thereby improving response capability. The frequency adjustment process can be represented by the following formula: Among them, R rate β represents the current request frequency, and β represents the magnitude of a single frequency reduction, where β > 0.

[0085] In other embodiments, the processing may further include the number of connection interruptions. The above-described S1100 may further include: in response to the number of connection interruptions for the target request subset exceeding a second threshold, stopping the transmission of requests to the slave device corresponding to the target request subset. Specifically, if the number of connection interruptions for the target request subset exceeds the second threshold, it indicates that the slave device corresponding to the target request subset is offline. Therefore, to save resources, the transmission of requests to the slave device corresponding to the target request subset is stopped, thereby reducing unnecessary communication overhead and potential security risks.

[0086] In some embodiments, the Modbus-based grouping method may further include: periodically optimizing the device characteristics of the slave device corresponding to each target request set based on the processing status of each target request set, so as to make the division of the target request sets more reasonable, better ensure the reliability of communication, and improve the overall system's response performance in processing requests.

[0087] In some application scenarios, the Modbus-based grouping method provided in this disclosure can be executed when the system is offline. By storing multiple defined target request sets in a configuration file, the configuration file is loaded when each device in the system is powered on, and each target request set is sent to the corresponding slave device, enabling the slave device to perform batch processing. For the offline grouping mode, the device characteristics of the slave device corresponding to each target request set are periodically optimized. This can be done by performing an optimization check every hour, and then performing targeted optimization when necessary, which can ensure the reliability of offline grouping. For example, through the scheduled task module, when the scheduled task is triggered, the core communication metrics of the slave device in the past hour are extracted from the system's data storage module (such as the device feature library and historical communication logs). These metrics include: error rate, average response time, and group execution efficiency. The collected performance metrics are compared with the pre-configured parameter thresholds of the slave device. If the metrics do not exceed the limits, it means that the current pre-configured parameters are still suitable for the device's communication status and do not need to be updated. The original grouping parameters can continue to be used. If the metrics exceed the limits, it means that the pre-configured parameters no longer match the actual needs, and the grouping strategy update process is triggered (such as adjusting the group length, request interval, address gap threshold, etc.).

[0088] In other application scenarios, the Modbus-based grouping method provided in this disclosure can be executed while the system is online. After obtaining multiple target request sets, the processing status of each target request set is tracked, and targeted optimizations are performed based on the processing status of each target request set. Since it is online grouping, the device characteristics of the slave device corresponding to each target request set are periodically optimized. This optimization check can be performed every few minutes (e.g., every 5 minutes) to make the current grouping situation more suitable for the current Modbus network environment of the system, which helps to improve the communication success rate and enhance the reliability of the system.

[0089] In some embodiments, the periodic optimization process may include: determining the device type of the slave device corresponding to each target request set; and periodically optimizing the device characteristics of multiple slave devices with the same device type based on the device type and the processing status of each target request set.

[0090] Specifically, because different devices have varying real-time data processing requirements and different levels of importance for the data to be communicated, multiple devices in the system can be pre-classified according to their characteristics to determine the corresponding device type for each device in order to allocate resources rationally. During the optimization process, optimization based on device type simplifies maintenance, improves management efficiency, and helps ensure the overall reliability and stability of the system. For example, device types can include critical devices or general devices. Critical devices may include, but are not limited to, PLCs and DCS controllers, while general devices may include, but are not limited to, sensors and instruments. Since the data involved in critical devices is relatively important and requires real-time data processing, requests from critical devices can be processed using online grouping. Periodic optimization according to the corresponding online grouping cycle helps ensure that requests from critical devices can adapt to changes in real time, thereby improving the system's response speed and efficiency and simplifying the complexity of manual maintenance. For general devices, offline configuration can be used for grouping and processing, followed by periodic optimization according to the corresponding offline grouping cycle. This reduces configuration time, improves work efficiency, makes maintenance work more centralized and orderly, and facilitates management and monitoring.

[0091] In some application scenarios, equipment types can be aligned based on the importance level (D) of the business data. For example, if the importance level of the business data to be processed is D=5, the corresponding equipment type is core production equipment (downtime directly affects the production line); if the importance level of the business data to be processed is D=1, the corresponding equipment type is auxiliary monitoring equipment (faults have minimal impact on production). Equipment types can also be categorized based on business type, such as production control (PLC, drivers), data monitoring (sensors, instruments), and safety assurance (emergency stop modules, firewalls). Equipment types can also be categorized based on real-time requirements (P). For example, if the real-time requirement P=high, the corresponding equipment type is motion control equipment (requiring millisecond-level response); if the real-time requirement P=low, the corresponding equipment type is periodic statistical equipment (minute-level refresh is sufficient).

[0092] When optimizing, performance metrics can be calculated hierarchically, with performance metrics calculated separately for each type of device, and then weighted aggregation is used to determine the overall system performance metrics. This includes:

[0093] (1) Classification-level performance indicators: Core indicators are calculated independently for each type of device (expandable as needed), including: classification system efficiency and classification resource utilization. The classification system efficiency is determined as follows: Classification system efficiency_i = (Number of registers successfully transmitted by device of type i / Total number of registers requested by device of type i) * 100%. The classification resource utilization is determined as follows: Classification resource utilization_i = (Actual communication time of device of type i / Total running time) * 100%.

[0094] (2) By using a weighted average, the classification-level indicators (classification system efficiency and classification resource utilization) are aggregated into a global indicator for evaluating the overall system performance, thus reflecting the differences in the impact of different categories of equipment. Taking "overall system efficiency" as an example: Where n represents the total number of device types, W i This represents the weight of the i-th type of device. For example, the core production class W. i =0.5, auxiliary monitoring type W i =0.1, and the specific weight value can be configured according to the importance of the business.

[0095] In some examples, during the optimization process, a sliding window mechanism can be used to update device characteristic parameters to adapt to the communication characteristics of different types of devices. The relevant formula is as follows: L max (t+1)=γ·L max (t)+(1-γ)·L optimal ; among which, L optimal This represents the maximum valid length of the most recently successfully requested device of type i, and γ is the forgetting factor (default 0.8, which can be adjusted according to the type).

[0096] In some examples, during parameter configuration, core production equipment, due to its high real-time requirements, can be configured with a smaller L_max,i (to avoid timeouts caused by large groups); while auxiliary monitoring equipment, due to its high tolerance for latency, can be configured with a larger L_max,i (for example, to reduce the total number of communications by merging requests).

[0097] The periodic optimization process can involve periodically processing data in the order of classification evaluation, global aggregation, and strategy adjustment. This avoids a "one-size-fits-all" approach to global optimization, ensuring the communication reliability and real-time performance of core devices. Different types of devices can dynamically adjust parameters according to their own characteristics, which helps improve the overall resource utilization of the system. Moreover, classification-level performance indicators allow maintenance personnel to quickly identify "which type of device is slowing down the system," accelerating root cause analysis and improving maintenance efficiency.

[0098] In some application scenarios, when system resources are scarce, priority can be given to optimizing strategies for critical equipment. In other application scenarios, as equipment operates, the importance level of the data to be processed can be updated. The formula for updating the data importance level can be as follows:

[0099] In some optional application scenarios, for offline grouping, the processing procedure can be as follows: Figure 3As shown, the process includes: identifying multiple requests to be processed, and then grouping requests corresponding to the same slave device into the same set based on the request characteristics of each request. For all requests in this set, the requests are further divided according to the functions to be executed by each request, resulting in multiple intermediate request sets. Then, the register addresses corresponding to each request in each intermediate request set are further divided based on their continuity, resulting in at least one target request set. For each target request set, the length is optimized according to the maximum request length allowed for a single communication access to the registers of the corresponding slave device, resulting in at least one target request subset corresponding to each target request set.

[0100] After determining multiple target request subsets, these subsets can be stored in a configuration file. Then, when the system starts, the configuration file can be loaded to process multiple requests in each target request subset in batches.

[0101] In other alternative application scenarios, for online grouping, the processing can be as follows: Figure 4 The process includes: identifying multiple requests to be processed; then, based on the request characteristics of each request, grouping requests corresponding to the same slave device and having the same function to be executed into the same set, resulting in multiple intermediate request sets. Next, the continuity of the register addresses corresponding to each request in each intermediate request set is checked; requests with continuous register addresses are grouped into the same set, while requests with non-contiguous register addresses are grouped into different sets, thus obtaining at least one target request set. The total request length of each target request set is determined. Based on the comparison between the total request length of each target request set and the maximum request length allowed for a single communication access to the register of the corresponding slave device, it is determined whether the corresponding target request set needs to be split. If splitting is required, the target request set is split using a binary search method, resulting in multiple target request subsets. If splitting is not required, the target request set is retained and considered a target request subset. Multiple target request subsets are sent, and the error rate of each target request subset is tracked. It is determined whether the error rate of each target request subset is greater than a first threshold. If it is greater than the first threshold, the splitting of the target request subsets is optimized. If it is not greater than the first threshold, the next target request subset is processed in batches.

[0102] Based on the same inventive concept, this disclosure also provides a Modbus-based communication system, such as... Figure 5As shown, the Modbus-based communication system includes a packet engine 210, a communication interface 220, and a storage module 230. The packet engine 210 includes a feature extractor 211, a 3D packetizer 212, a length optimizer 213, and an error recovery unit 214. The communication interface 220 includes a master station device 221 and a device connection pool 222. The data storage module 230 includes a device feature library 231 and historical communication logs 232.

[0103] Feature extractor 211 can be used to extract features from multiple requests to be processed, determining the request feature vector of each request. Three-dimensional grouper 212 can be used to group requests based on their request feature vectors, obtaining multiple target request sets. Length optimizer 213 can be used to determine the maximum request length based on the device characteristics of the slave devices corresponding to the target request sets, and then optimize the length based on the comparison between the total request length of the target request sets and the maximum request length, obtaining at least one target request subset. Error recovery unit 214 can be used to adjust the parameters of three-dimensional grouper 212 when errors occur during the processing of target request subsets, ensuring the integrity and efficiency of data communication. It can also be used to report abnormal events in the processing of target request subsets to the historical communication log 232 for storage, enabling subsequent targeted maintenance.

[0104] The master station device 221 can be used to generate Modbus request messages based on a defined subset of target requests, and the device connection pool 222 can be used to manage the connection resources between the master station device 221 and the slave devices to ensure the success rate of request processing.

[0105] Key data generated during communication can be persisted to the data storage module 230, providing data support for subsequent optimization. Specifically, the device feature library 231 can store dynamic feature parameters of each slave device for parameter self-learning and grouping strategy updates; the historical communication log 232 can record the request content, response results, and error types of each communication, providing historical evidence for subsequent periodic performance evaluations (such as system efficiency and resource utilization) and root cause analysis.

[0106] Based on the same inventive concept, this disclosure also provides a Modbus-based grouping device. For example... Figure 6 As shown, the Modbus-based packet device 300 includes:

[0107] The first determining module 310 is used to determine multiple requests to be processed, wherein the multiple requests are sent by at least one master station device;

[0108] The second determining module 320 is used to determine the request characteristics of each request, including the slave device identifier receiving the request, the function to be executed, and the register information to be accessed.

[0109] The first grouping module 330 is used to group multiple requests based on the slave device identifier and the function to be executed corresponding to each request, to obtain multiple intermediate request sets, wherein all requests in the intermediate request sets have the same slave device identifier and the function to be executed.

[0110] The second grouping module 340 is used to perform secondary grouping of the requests in each intermediate request set based on the register information corresponding to each request in each intermediate request set, so as to obtain at least one target request set corresponding to each intermediate request set, wherein the register addresses corresponding to adjacent requests in the target request set are consecutive addresses.

[0111] In some embodiments, the second grouping module 340 may include: a first determining unit, configured to determine the address information of the register corresponding to each request based on the register information corresponding to each request in the intermediate request set; a first processing unit, configured to group two requests with adjacent address gaps less than or equal to a gap threshold into the same group and two requests with adjacent address gaps greater than the gap threshold into different groups based on the address information of the register corresponding to each request; and a second processing unit, configured to obtain at least one target request set corresponding to the intermediate request set in response to the completion of the division of all requests in the intermediate request set.

[0112] In some embodiments, the Modbus-based grouping device 300 may further include: a third determining module, configured to determine the request length of a corresponding request based on the register information of each request; a fourth determining module, configured to determine the total request length of the target request set based on the request length of each request in the target request set; a fifth determining module, configured to determine the maximum request length based on the device characteristics of the slave device corresponding to the target request set; and a first optimizing module, configured to adjust the target request set based on the comparison result between the total request length of the target request set and the maximum request length, to obtain at least one target request subset.

[0113] In some embodiments, the first optimization module may include: a third processing unit, configured to maintain the target request set if the total request length of the target request set is less than or equal to the maximum request length; and a fourth processing unit, configured to split the target request set to obtain multiple target request subsets if the total request length of the target request set is greater than the maximum request length, wherein the total request length of the target request subsets is less than or equal to the maximum request length.

[0114] In some embodiments, the fourth processing unit may include: a first execution unit, configured to determine an optimal splitting point based on the request length of each request in the target request set and the maximum request length; a first splitting unit, configured to split the target request set according to the optimal splitting point to obtain multiple candidate request subsets; a second execution unit, configured to stop splitting in response to the total request length of each candidate request subset being less than or equal to the maximum request length, and to take the multiple candidate request subsets as multiple target request subsets; and a third execution unit, configured to perform a binary search on the target candidate request subset in response to the existence of a target candidate request subset with a total request length greater than the maximum request length, until a target request subset with a total request length less than or equal to the maximum supported request length is obtained, and to take other candidate request subsets with a total request length less than or equal to the maximum request length as target request subsets.

[0115] In some embodiments, the Modbus-based grouping device 300 may further include: a status confirmation module, used to track the processing status of each target request subset; and a second optimization module, used to optimize the adjacent address gap or optimize the request sending frequency of the master station device corresponding to each target request subset based on the processing status of each target request subset.

[0116] In some embodiments, the processing conditions include the error rate of request anomalies and the average duration of response time. The second optimization module may include: a fourth execution unit, used to optimize the gap between adjacent addresses in response to the error rate of request anomalies of the target request subset being greater than a first threshold; and a fifth execution unit, used to optimize the request sending frequency of the master station device corresponding to the target request subset in response to the average duration of response time of the target request subset being greater than a duration threshold.

[0117] In some embodiments, the processing status also includes the number of connection interruptions, and the second optimization module may further include: a sixth execution unit, configured to stop sending requests to the slave device corresponding to the target request subset in response to the number of connection interruptions of the target request subset being greater than a second threshold.

[0118] In some embodiments, the Modbus-based grouping device 300 may further include: a third optimization module, used to periodically optimize the device characteristics of the slave device corresponding to each target request set based on the processing status of each target request set.

[0119] In some embodiments, the third optimization module may include: a sixth determining module, configured to determine the device type of the slave device corresponding to each target request set; and a fifth processing unit, configured to periodically optimize the device characteristics of multiple slave devices with the same device type based on the device type and the processing status of each target request set.

[0120] Regarding the Modbus-based grouping device in the above embodiments, the specific manner in which each module performs its operations has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0121] Based on the same inventive concept, such as Figure 7 As shown, one embodiment of this disclosure provides a Modbus-based communication system 400. The Modbus-based communication system includes one or more processors 410, a memory 420, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other using different buses and can be mounted on a common motherboard or otherwise installed as needed. The processor can process instructions executed within the Modbus-based communication system, including instructions stored in or on memory to display graphical information of a GUI on an external input / output device (such as a display device coupled to the interface). In some alternative embodiments, multiple processors and / or multiple buses can be used with multiple memories and multiple memory sets, if desired. Similarly, multiple Modbus-based communication systems can be connected, each device providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 7 Take a processor 410 as an example.

[0122] Processor 410 may be a central processing unit, a network processor, or a combination thereof. Processor 410 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.

[0123] The memory 420 stores instructions executable by at least one processor 410 to cause the at least one processor 410 to perform the Modbus-based grouping method shown in the above embodiments.

[0124] The memory 420 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the Modbus-based communication system. Furthermore, the memory 420 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 420 may optionally include memory remotely located relative to the processor 410, which can be connected to the Modbus-based communication system via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0125] The memory 420 may include volatile memory, such as random access memory; the memory 420 may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 420 may also include a combination of the above types of memory.

[0126] The Modbus-based communication system also includes an input device 430 and an output device 440. The processor 410, memory 420, input device 430, and output device 440 can be connected via a bus or other means. Figure 7 Taking the example of a connection between China and Israel via a bus.

[0127] Input device 430 can receive input numerical or character information, and generate key signal inputs related to user settings and function control of the Modbus-based communication system, such as a touchscreen, keypad, mouse, trackpad, touchpad, joystick, one or more mouse buttons, trackball, joystick, etc. Output device 440 may include display devices, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibration motors). The aforementioned display devices include, but are not limited to, liquid crystal displays, light-emitting diodes, displays, and plasma displays. In some alternative embodiments, the display device may be a touchscreen.

[0128] Based on the same inventive concept, this disclosure also provides a computer-readable storage medium storing a program for executing the Modbus-based grouping method of any of the foregoing embodiments.

[0129] This disclosure uses specific terms to describe embodiments of the present disclosure. Terms such as "an embodiment," "one embodiment," and / or "some embodiments" refer to a particular feature, structure, or characteristic associated with at least one embodiment of the present disclosure. Therefore, it should be emphasized and noted that references to "an embodiment," "one embodiment," or "an alternative embodiment" in different locations throughout this specification do not necessarily refer to the same embodiment. Furthermore, certain features, structures, or characteristics in one or more embodiments of the present disclosure can be appropriately combined.

[0130] In the context of this disclosure, unless the context clearly indicates otherwise, the words "a," "an," "an," and / or "the" do not specifically refer to the singular and may also include the plural. Generally speaking, the terms "comprising" and "including" only indicate the inclusion of expressly identified steps and elements, which do not constitute an exclusive list, and the method or apparatus may also include other steps or elements.

[0131] Similarly, it should be noted that, in order to simplify the description of this disclosure and thus aid in the understanding of one or more embodiments, the foregoing description of embodiments of this disclosure may sometimes combine multiple features into a single embodiment, drawing, or description thereof. However, this disclosure method does not imply that the subject matter of this disclosure requires more features than the features claimed. In fact, the embodiments contain fewer features than all the features of the single embodiments disclosed above.

[0132] The basic concepts have been described above. It is obvious that the above disclosure is merely illustrative and does not constitute a limitation of this disclosure. Although not explicitly stated herein, various modifications, improvements, and corrections may be made to this disclosure by those skilled in the art. Such modifications, improvements, and corrections are suggested in this disclosure and therefore remain within the spirit and scope of the embodiments of this disclosure.

Claims

1. A Modbus-based grouping method, comprising: Identify multiple requests to be processed, wherein the multiple requests are sent by at least one master station device; The request characteristics of each request are determined, including the identifier of the slave device receiving the request, the function to be executed, and the register information to be accessed; Based on the slave device identifier corresponding to each request and the function to be executed, the multiple requests are grouped to obtain multiple intermediate request sets, wherein the slave device identifier and the function to be executed are the same for all requests in the intermediate request sets; Based on the register information corresponding to each request in each intermediate request set, the requests in each intermediate request set are grouped a second time to obtain at least one target request set corresponding to each intermediate request set, wherein the register addresses corresponding to adjacent requests in the target request set are consecutive addresses.

2. The Modbus-based grouping method according to claim 1, wherein, The step of performing secondary grouping of the requests in each intermediate request set based on the register information corresponding to each request in each intermediate request set to obtain at least one target request set corresponding to each intermediate request set includes: Based on the register information corresponding to each request in the intermediate request set, determine the address information of the register corresponding to each request; Based on the address information of the register corresponding to each request, two requests with an adjacent address gap less than or equal to the gap threshold are grouped into the same group, and two requests with an adjacent address gap greater than the gap threshold are grouped into different groups; In response to the completion of the partitioning of all requests in the intermediate request set, at least one target request set corresponding to the intermediate request set is obtained.

3. The Modbus-based grouping method according to claim 2, wherein, The method further includes: Based on the register information for each request, the request length of the corresponding request is determined; The total request length of the target request set is determined based on the request length of each request in the target request set. The maximum request length is determined based on the device characteristics of the slave devices corresponding to the target request set; Based on the comparison between the total request length and the maximum request length of the target request set, the target request set is adjusted to obtain at least one target request subset.

4. The Modbus-based grouping method according to claim 3, wherein, The step of adjusting the target request set based on the comparison result between the total request length and the maximum request length of the target request set to obtain at least one optimized request subset includes: If the total request length of the target request set is less than or equal to the maximum request length, then the target request set is maintained. In response to the total request length of the target request set being greater than the maximum request length, the target request set is split into multiple target request subsets, wherein the total request length of the target request subsets is less than or equal to the maximum request length.

5. The Modbus-based grouping method according to claim 4, wherein, The process of splitting the target request set to obtain multiple target request subsets includes: The optimal segmentation point is determined based on the request length of each request in the target request set and the maximum request length; The target request set is split according to the optimal split point to obtain multiple candidate request subsets; In response to the fact that the total request length of each of the candidate request subsets is less than or equal to the maximum request length, the splitting is stopped, and the multiple candidate request subsets are taken as multiple target request subsets; In response to the existence of a target candidate request subset with a total request length greater than the maximum request length, the target candidate request subset is subjected to a binary search until a target request subset with a total request length less than or equal to the maximum supported request length is obtained, and other candidate request subsets with a total request length less than or equal to the maximum request length are taken as the target request subset.

6. The Modbus-based grouping method according to any one of claims 3-5, wherein, The method further includes: The processing status of each of the aforementioned target request subsets is tracked separately; Based on the processing status of each of the target request subsets, optimize the adjacent address gaps or optimize the request sending frequency of the master station device corresponding to each of the target request subsets.

7. The Modbus-based grouping method according to claim 6, wherein, The processing status includes the error rate of request anomalies and the average response time. Based on the processing status of each target request subset, optimizing the adjacent address gap or optimizing the request sending frequency of the main station device corresponding to each target request subset includes: If the error rate of the request anomaly in the target request subset exceeds a first threshold, the adjacent address gap is optimized. If the average duration of the response duration of the target request subset is greater than a duration threshold, then the request sending frequency of the main station device corresponding to the target request subset is optimized.

8. The Modbus-based grouping method according to claim 7, wherein, The processing status also includes the number of connection interruptions. Optimizing the adjacent address gap or optimizing the request sending frequency of the master station device corresponding to each target request subset based on the processing status of each target request subset further includes: In response to the number of connection interruptions in the target request subset exceeding a second threshold, the sending of the request to the slave device corresponding to the target request subset is stopped.

9. The Modbus-based grouping method according to claim 1, wherein, The method further includes: Based on the processing status of each target request set, the device characteristics of the slave device corresponding to each target request set are periodically optimized.

10. The Modbus-based grouping method according to claim 9, wherein, The process of periodically optimizing the device characteristics of the slave device corresponding to each target request set based on the processing status of each target request set includes: Determine the device type of the slave device corresponding to each of the target request sets; Based on the device type and the processing status of each target request set, the device characteristics of multiple slave devices with the same device type are periodically optimized.

11. A Modbus-based packet switching device, comprising: The first determining module is used to determine multiple requests to be processed, wherein the multiple requests are sent by at least one master station device; The second determining module is used to determine the request characteristics of each of the requests, the request characteristics including the identifier of the slave device receiving the request, the function to be executed, and the register information to be accessed; The first grouping module is used to group the multiple requests based on the slave device identifier corresponding to each request and the function to be executed, to obtain multiple intermediate request sets, wherein the slave device identifier and the function to be executed corresponding to all requests in the intermediate request sets are the same; The second grouping module is used to perform secondary grouping of the requests in each intermediate request set based on the register information corresponding to each request in each intermediate request set, to obtain at least one target request set corresponding to each intermediate request set, wherein the register addresses corresponding to adjacent requests in the target request set are consecutive addresses.

12. A Modbus-based communication system, comprising: A memory and a processor are communicatively connected, the memory storing computer instructions, and the processor executing the computer instructions to perform the Modbus-based grouping method according to any one of claims 1-10.

13. A computer-readable storage medium storing a program for performing the Modbus-based grouping method according to any one of claims 1-10.