A synchronization control method and device of a Modbus master-slave device and a storage medium

By broadcasting a time synchronization signal from the Modbus master without requiring feedback from the slave, and using phase-locked loop (PLL) technology to synchronize the time base of the Modbus master and slave devices, the problem of difficult synchronization control of Modbus devices is solved, achieving precise time synchronization and synchronization control, and improving the user experience.

CN114785442BActive Publication Date: 2026-04-07SHANGHAI BOLIAN ZHIDIAN TECHNOLOGY CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-26
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing Modbus master-slave devices are difficult to synchronize, especially without modifying the Modbus RTU/ASC protocol, which makes time synchronization difficult.

Method used

The Modbus master broadcasts a time synchronization signal that does not require feedback from the slave. The time base of the Modbus master and slave is synchronized using phase-locked loop technology, and synchronization control commands are executed through preset synchronization control signals.

Benefits of technology

It achieves precise time synchronization and synchronization control without modifying the Modbus protocol, improving user experience and device versatility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114785442B_ABST
    Figure CN114785442B_ABST
Patent Text Reader

Abstract

This invention discloses a method, device, and storage medium for synchronous control of Modbus master-slave devices. It utilizes a time synchronization broadcast signal that does not require feedback from the Modbus slave. The slave maintains a time-locked loop based on the broadcast signal. The Modbus slave uses the time signal sent by the Modbus master as the standard time reference for its local timer. Synchronization control commands are executed at a preset time agreed upon by the Modbus master and slave, thus achieving synchronous control. This invention solves the technical problem of difficulty in achieving synchronous control of Modbus master-slave devices in the prior art, and achieves the technical effect of synchronous control of multiple Modbus master-slave devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of distributed control system architecture design technology, and in particular to a synchronization control method, device and storage medium for Modbu master and slave devices. Background Technology

[0002] In modern industrial and commercial electrical equipment, the Modbus-RTU / ASC master-slave control bus has become the most popular electronic controller interface due to its low cost, high reliability, precise control, and wide control range. Through the Modbus master-slave protocol, controllers can communicate with each other and with other devices via a network. Due to the large number of devices used, Modbus has become a universal industrial standard. However, the Modbus-RTU / ASC protocol has limited speed, and the network topology is master-slave. Network synchronization between multiple devices has become a pressing issue.

[0003] Generally, multiple controllers requiring time synchronization use the Ethernet protocol, employing NTP for network time synchronization to achieve multi-machine synchronization. However, devices using the Modbus master-slave protocol, due to their half-duplex physical layer and polling communication sequence, do not inherently support time synchronization between multiple slave devices. This makes synchronization control difficult to implement on Modbus devices. To achieve time synchronization, the Modbus protocol must be modified, which significantly reduces device versatility. Furthermore, because the Modbus protocol's operating principle is not suitable for time synchronization requirements, modifying the Modbus protocol to add time synchronization functionality presents numerous problems in practical use. Summary of the Invention

[0004] This invention provides a method for synchronous control of Modbus master and slave devices to solve the technical problem that existing Modbus master and slave devices are difficult to synchronize, and achieves the technical effect of accurate time synchronization and synchronous control without modifying the Modbus RTU / ASC protocol.

[0005] This invention provides a synchronization control method for Modbus master-slave devices, comprising:

[0006] In response to a time synchronization signal broadcast by the Modbus master that does not require Modbus slave to return information;

[0007] The phase-locked loop is maintained according to the frame start time of the time synchronization signal to synchronize the time base of the Modbus master and the Modbus slave;

[0008] In response to the Modbus master pre-set a synchronization control signal based on the synchronized time base, the Modbus master and the Modbus slave execute synchronization control commands according to the pre-set synchronization control signal.

[0009] Preferably, the step of the Modbus master broadcasting a time synchronization signal that does not require a return message from the Modbus slave also includes:

[0010] The Modbus host obtains standard time;

[0011] The standard time is corrected based on the time required for the Modbus host to send a complete time signal;

[0012] The time synchronization signal that does not require Modbus slave to return information is generated based on the corrected standard time.

[0013] Preferably, the step of correcting the standard time based on the time required for the Modbus host to send a complete timing signal specifically includes:

[0014] The sum of the software path delay and the physical medium transmission delay is taken as the time required for the Modbus host to send a complete timing signal;

[0015] The corrected standard time is the sum of the time required for the Modbus host to send a complete time signal and the standard time.

[0016] Preferably, the step of maintaining a phase-locked loop based on the frame start time of the time synchronization signal to synchronize the time base between the Modbus master and the Modbus slave specifically includes:

[0017] After receiving the time synchronization signal, the slave device offsets the time within the time synchronization signal by the sum of the transmission time, the slave device interrupt response time, and the local time acquired by the slave device.

[0018] The software phase-locked loop is maintained based on the offset time to synchronize the time base of the Modbus master and the Modbus slave.

[0019] Preferably, the step of synchronizing the time base of the Modbus master and the Modbus slave based on the offset time-maintaining software phase-locked loop specifically includes:

[0020] The offset time is compared with the local time, and the loop parameters are adjusted using a loop filter based on the comparison result;

[0021] Based on the adjusted loop parameters, the time base of the Modbus slave is adjusted to achieve synchronization with the time base of the Modbus master.

[0022] Preferably, the adjustment method of the loop filter includes a successive approximation algorithm.

[0023] Preferably, the step of executing a synchronization control command in response to a synchronization control signal from the Modbus host based on a control cycle specifically includes:

[0024] The Modbus master and all Modbus slaves agree to execute synchronization control commands at a future preset time.

[0025] The Modbus master and all Modbus slaves execute synchronization control commands at the preset future time according to their respective time bases.

[0026] The present invention also proposes a Modbus device, the Modbus device comprising: a memory, a processor, and a synchronization control program for Modbus master and slave devices stored in the memory and capable of running on the processor, wherein the synchronization control program for Modbus master and slave devices, when executed by the processor, implements the synchronization control method for Modbus master and slave devices as described above.

[0027] The present invention also proposes a readable storage medium storing a synchronization control program for a Modbus master-slave device, wherein the synchronization control program for the Modbus master-slave device, when executed by a processor, implements the steps of the synchronization control method for the Modbus master-slave device as described above.

[0028] This invention achieves synchronous control by using a time synchronization signal that does not require feedback from the Modbus slave. The slave maintains a phase-locked loop based on the time synchronization signal, and the Modbus slave uses the time signal sent by the Modbus master as the time reference for its local timer. Synchronous control is then achieved by executing synchronous control commands at agreed-upon times between the Modbus master and the Modbus slave. This solves the technical problem of difficulty in achieving synchronous control in existing Modbus devices, ensures accurate synchronous control of Modbus devices, and improves user experience. Attached Figure Description

[0029] Figure 1 This is a flowchart illustrating an embodiment of the automatic task configuration method of the present invention;

[0030] Figure 2 This is a flowchart illustrating another embodiment of the automatic task configuration method of the present invention;

[0031] Figure 3This is a flowchart illustrating another embodiment of the automatic task configuration method of the present invention;

[0032] Figure 4 This is a schematic diagram of the device structure in an embodiment of the present invention. Detailed Implementation

[0033] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.

[0034] Figure 1 A flowchart of a synchronization control method for Modbus master-slave devices provided in an embodiment of the present invention specifically includes:

[0035] S100, in response to the time synchronization signal broadcast by the Modbus master that does not require Modbus slave to return information;

[0036] It should be noted that since the communication between devices in the Modbus protocol only has a half-duplex physical layer and adopts a polling communication method, if the information sent by the master requires a response from the slave, the information returned by each slave to the master will be processed by the master at different times. Furthermore, since the bandwidth of the Modbus protocol is relatively small, when there are many devices, the returned information may cause greater delays. Therefore, this application adopts a time synchronization signal that does not require Modbus slave to return information, so as to ensure that the time when each slave receives the signal is consistent as much as possible.

[0037] S200: Maintain a phase-locked loop according to the frame start time of the time synchronization signal to synchronize the time base of the Modbus master and the Modbus slave;

[0038] It is worth emphasizing that when the phase-locked loop is maintained according to the frame start time of the time synchronization signal, the Modbus slave can adjust the phase of the phase-locked loop based on the standard time in the content of the signal frame and the time difference between receiving the frame header and parsing the content, thereby correcting transmission errors.

[0039] It is important to emphasize that the broadcast message contains the specific time value sent by the master. If the slave device uses this value as its local time base correction value, a communication delay error will occur. This error is related to the communication baud rate and the software delays of the master and slave devices. However, the frame start time of the broadcast message is synchronized across all slave devices.

[0040] It should be noted that a phase-locked loop (PLL) is a negative feedback control system that uses the voltage generated by phase synchronization to tune a voltage-controlled oscillator to generate a target frequency. As a feedback control circuit, it can use a time synchronization signal as an input signal to synchronize it with internal signals, thereby achieving a stable and high-frequency clock signal. This allows the time of the master unit to be synchronized according to the time synchronization signal, and time changes are recorded. In this application, the local time of the slave unit and the standard time of the master unit are locked together through a closed-loop controlled PLL, achieving an error that approaches zero.

[0041] S300, in response to the Modbus master pre-setting a synchronization control signal based on the synchronized time base, the Modbus master and the Modbus slave execute a synchronization control command according to the pre-setting synchronization control signal.

[0042] It is important to emphasize that Modbus slaves can synchronize the content of the time synchronization frame and correct the frame header time to their local clock source. The Modbus slave's clock source is always in the closed-loop correction mode of the phase-locked loop. Once time synchronization is achieved, synchronization control can be agreed upon by sending execution times and commands in advance. The execution times and commands of different slaves can be sent sequentially by the master. In this case, a signal requiring a response from the slave can be used to ensure that the slave has received the synchronization control command.

[0043] The technical solution of this embodiment uses a time synchronization signal that does not require Modbus slaves to return information, thus ensuring that all slaves receive the information simultaneously as much as possible without the slaves returning. Then, the slaves maintain a phase-locked loop according to the time synchronization signal. The Modbus slaves use the time signal sent by the Modbus master as the time reference for their local timers. The time sent by the Modbus master is only used to correct the local time of the Modbus slaves. Synchronous control is achieved by executing synchronous control commands at agreed times between the Modbus master and the Modbus slaves. This solves the technical problem of difficult synchronous control of Modbus devices in the prior art, ensures the accurate realization of synchronous control of Modbus devices, and improves the user experience.

[0044] Reference Figure 2 , Figure 2 This is a flowchart illustrating another embodiment of the automatic task configuration method of the present invention. The synchronization control method for Modbus master-slave devices provided by the present invention further includes the following steps before the step of the Modbus master broadcasting a time synchronization signal that does not require a return message from the Modbus slave:

[0045] S110, The Modbus host acquires the standard time;

[0046] It is easy to understand that since the time synchronization signal needs to include the master time, although the accuracy of the master time does not affect the synchronization control, considering that some devices in the system may need to perform time synchronization through other protocols during use, the Modbus master obtains the standard time to avoid the Modbus master and the synchronized Modbus slaves from having too large a difference from the standard time, which would prevent some slaves that obtain the standard time through other means from achieving synchronization control.

[0047] S120. Correct the standard time according to the time required for the Modbus host to send a complete timing signal;

[0048] It should be noted that since Modbus requires a certain amount of time from the generation of the time synchronization signal to its transmission, this time needs to be taken into account, and the time contained in the time synchronization signal needs to be corrected to ensure that the time contained in the signal received by the slave is as close as possible to the time of the master.

[0049] S130. Generate the time synchronization signal that does not require Modbus slave to return information according to the corrected standard time;

[0050] It is worth emphasizing that, under normal circumstances, this signal includes a broadcast address, function number, time register start address, time register byte length, timestamp, and checksum, etc. In this embodiment, the signal is sent in broadcast mode, and the above information is the information frame of the broadcast.

[0051] Reference Figure 3 , Figure 3 This is a flowchart illustrating another embodiment of the task automatic configuration method of the present invention.

[0052] The steps for correcting the standard time based on the time required for the Modbus host to send a complete time signal specifically include:

[0053] S121. The sum of the software path delay and the physical medium transmission delay is taken as the time required for the Modbus host to send out a complete timing signal;

[0054] It is easy to understand that in this application, the timing signal sent by the Modbus host needs to undergo software path delay and physical medium transmission delay before it is sent by the Modbus host. The software path delay includes the time required to generate a complete timing signal. Under the condition that the computing performance and calculation method are fixed, the magnitude of this delay is consistent and can be obtained through simple experiments. The physical medium delay can be calculated based on the theoretical 3.3us for a 10KM cable.

[0055] S122. The sum of the time required for the Modbus host to send out a complete timing signal and the standard time is used as the corrected standard time;

[0056] It should be noted that the time information contained in the time synchronization signal sent by the Modbus master is the standard time at which the time synchronization signal was sent by the Modbus master, which further improves the accuracy of the standard time obtained by the Modbus slave.

[0057] This embodiment obtains the standard time before sending the signal, making the Modbus master time more accurate and avoiding the problem of synchronization control failure caused by the Modbus slave obtaining the standard time from other sources. Furthermore, by correcting the time information contained in the time synchronization signal sent by the Modbus master to the standard time at which the time synchronization signal was sent by the Modbus master, the technical solution is improved, ensuring the consistency between the time in the time synchronization signal received by the slave and the master time to the greatest extent, and further guaranteeing the time consistency of each slave and the master in executing synchronization control commands.

[0058] Specifically, the step of maintaining a phase-locked loop based on the frame start time of the time synchronization signal to synchronize the time base of the Modbus master and the Modbus slave includes:

[0059] After receiving the time synchronization signal, the slave device offsets the time within the time synchronization signal by the sum of the transmission time, the slave device interrupt response time, and the local time acquired by the slave device.

[0060] It is easy to understand that since it takes a certain amount of time for the signal to be transmitted from the master to the slave and received and synchronized, the slave needs to offset the timestamp after receiving the time synchronization signal. This offset is mainly related to the installation distance, performance and other data of the slave. There are certain differences between the slaves, so this offset needs to be performed on the slave.

[0061] The software phase-locked loop is maintained based on the offset time to synchronize the time base of the Modbus master and the Modbus slave.

[0062] It is worth emphasizing that the slave device also has a local time reference. The accuracy of this reference can be slightly lower. As long as the error is less than the usable range during the next time the master and slave devices perform time synchronization, it can be calibrated to the accurate value. Therefore, the frequency of time synchronization performed by the master device can be set according to the accuracy of the slave device's local time reference. Since the broadcast signal is a signal that the slave device does not need to respond to, it cannot be guaranteed that the slave device receives the signal every time. Therefore, the master device should perform the time synchronization process more than once during the unusable time period after the slave device's local time reference is calibrated.

[0063] Specifically, the steps for synchronizing the time base of the Modbus master and the Modbus slave based on the offset time using a software phase-locked loop include:

[0064] The offset time is compared with the local time, and the loop parameters are adjusted using a loop filter based on the comparison result;

[0065] It is worth emphasizing that the loop filter is a linear low-pass filter used to filter out high-frequency components and noise caused by occasional output timing jitter in the Modbus host. The design of the loop filter is crucial to the operation of the entire phase-locked loop (PLL). It not only filters out high-frequency components, but more importantly, it affects important loop parameters such as phase noise, loop stability, and lock time, significantly impacting the overall performance of the PLL.

[0066] Based on the adjusted loop parameters, the time base of the Modbus slave is adjusted to achieve synchronization with the time base of the Modbus master.

[0067] It should be noted that this step can be understood as synchronizing the local time base of the Modbus slave with the timestamp sent by the Modbus master. The time base of the Modbus slave needs to be based on the timestamp sent by the Modbus master to ensure that the difference between the time bases of all Modbus slaves is minimized.

[0068] It is worth noting that the software phase-locked loop uses a PI controller, which in theory can make the time base on the slave side and the time base on the master side completely synchronized, and the error can be adjusted to 0. In reality, due to the temperature coefficient of the crystal oscillator itself, the accuracy of the local time base is limited. This method can achieve a time accuracy of about 100µs.

[0069] Specifically, the adjustment method of the loop filter includes a successive approximation algorithm.

[0070] It is easy to understand that even if the time difference after each approximation is less than the time difference before the approximation, the value of each approximation is adjusted when the difference becomes negative, and further approximation is performed until the time difference meets the usage requirements.

[0071] Specifically, the steps of executing a synchronization control command in response to a synchronization control signal from the Modbus host based on a control cycle include:

[0072] The Modbus master and all Modbus slaves agree to execute synchronization control commands at a future preset time.

[0073] It should be noted that this synchronization control method works well when the local time difference between each Modbus device is small. When the local time difference between each Modbus device meets the synchronization control requirements, the local time of each Modbus device can be considered to be consistent, and synchronization control can be performed at this time.

[0074] The Modbus master and all Modbus slaves execute synchronization control commands at the preset future time according to their respective time bases.

[0075] It is worth emphasizing that, based on the synchronization scheme, control devices from different manufacturers can be connected to form an industrial network for precise synchronized operation. This enables a Modbus-based full-network synchronized operation, which has significant economic value in widely distributed, low-cost, and highly reliable automated control equipment, such as automatic fountains, production lines, agricultural irrigation, and greenhouse systems.

[0076] This embodiment improves the accuracy of Modbus slave synchronization time and consistency with Modbus master time by disclosing the offset of the received time by the Modbus slave, reduces the difference between the local time of the Modbus master and the Modbus slave, and improves the control effect of synchronization control. At the same time, by disclosing the PI controller and loop filter of the software phase-locked loop, the technical solution is improved and the user experience is enhanced.

[0077] like Figure 4 As shown, Figure 4 This is a schematic diagram of a Modbus device according to another embodiment of the present invention. The Modbus device includes a processor 70, a memory 71, an input device 72, and an output device 73; the number of processors 70 in the Modbus device can be one or more. Figure 4 Taking a processor 70 as an example; the processor 70, memory 71, input device 72, and output device 73 in a Modbus device can be connected via a bus or other means. Figure 4 Taking the example of a connection between China and Israel via a bus.

[0078] The memory 71, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the program instructions corresponding to the synchronization control of the Modbus master-slave devices in this embodiment of the invention. The processor 70 executes various functional applications and data processing of the Modbus device by running the software programs, instructions, and modules stored in the memory 71, thereby realizing the aforementioned synchronization control of the Modbus master-slave devices.

[0079] The memory 71 may primarily include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a function; the data storage area may store data created based on the use of the terminal. Furthermore, the memory 71 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device.

[0080] Input device 72 can be used to receive input digital or character information, and to generate key signal inputs related to user settings and function control of the Modbus device. Output device 73 may include a display device such as a display screen.

[0081] This embodiment has the corresponding functional modules and beneficial effects of the execution method, which will not be described in detail here.

[0082] This invention also provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform a synchronization control method for a Modbus master-slave device, the method comprising:

[0083] In response to a time synchronization signal broadcast by the Modbus master that does not require Modbus slave to return information;

[0084] The phase-locked loop is maintained according to the frame start time of the time synchronization signal to synchronize the time base of the Modbus master and the Modbus slave;

[0085] In response to the Modbus master pre-set a synchronization control signal based on the synchronized time base, the Modbus master and the Modbus slave execute synchronization control commands according to the pre-set synchronization control signal.

[0086] Specifically, the step of the Modbus master broadcasting a time synchronization signal that does not require a return message from the Modbus slave also includes:

[0087] The Modbus host obtains standard time;

[0088] The standard time is corrected based on the time required for the Modbus host to send a complete time signal;

[0089] The time synchronization signal that does not require Modbus slave to return information is generated based on the corrected standard time.

[0090] Specifically, the step of correcting the standard time based on the time required for the Modbus host to send a complete timing signal includes:

[0091] The sum of the software path delay and the physical medium transmission delay is taken as the time required for the Modbus host to send a complete timing signal;

[0092] The corrected standard time is the sum of the time required for the Modbus host to send a complete time signal and the standard time.

[0093] Specifically, the step of maintaining a phase-locked loop based on the frame start time of the time synchronization signal to synchronize the time base of the Modbus master and the Modbus slave includes:

[0094] After receiving the time synchronization signal, the slave device offsets the time within the time synchronization signal by the sum of the transmission time, the slave device interrupt response time, and the local time acquired by the slave device.

[0095] The software phase-locked loop is maintained based on the offset time to synchronize the time base of the Modbus master and the Modbus slave.

[0096] Specifically, the steps for synchronizing the time base of the Modbus master and the Modbus slave based on the offset time using a software phase-locked loop include:

[0097] The offset time is compared with the local time, and the loop parameters are adjusted using a loop filter based on the comparison result;

[0098] Based on the adjusted loop parameters, the time base of the Modbus slave is adjusted to achieve synchronization with the time base of the Modbus master.

[0099] Specifically, the adjustment method of the loop filter includes a successive approximation algorithm.

[0100] Specifically, the steps of executing a synchronization control command in response to a synchronization control signal from the Modbus host based on a control cycle include:

[0101] The Modbus master and all Modbus slaves agree to execute synchronization control commands at a future preset time.

[0102] The Modbus master and all Modbus slaves execute synchronization control commands at the preset future time according to their respective time bases.

[0103] Of course, the computer-executable instructions provided in the embodiments of the present invention are not limited to the above-described method operations, but can also perform related operations in the synchronization control of Modbus master and slave devices provided in any embodiment of the present invention, and have the corresponding functional modules and beneficial effects of the execution method, which will not be described in detail here.

[0104] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.

[0105] It is worth noting that in the embodiments of the search device described above, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.

[0106] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.

Claims

1. A method for synchronous control of Modbus master and slave devices, characterized in that, include: Responding to a time synchronization signal broadcast by the Modbus master that does not require a return message from the Modbus slave; Maintaining a phase-locked loop based on the frame start time of the time synchronization signal, and synchronizing the time base of the Modbus master and the Modbus slave, includes: After receiving the time synchronization signal, the slave device offsets the time within the time synchronization signal by the sum of the transmission time, the slave device interrupt response time, and the slave device's local time. Based on the offset time, a software phase-locked loop is maintained to synchronize the time base of the Modbus master and the Modbus slave device. Among them, the time synchronization process is performed more than once during the time period when the local time base of the Modbus slave is offset to an unavailable time period after the local time base is calibrated. The step of maintaining a software phase-locked loop based on the offset time to synchronize the time base of the Modbus master and the Modbus slave includes: comparing the offset time with the local time, and adjusting the loop parameters using a loop filter based on the comparison result; Based on the adjusted loop parameters, the time base of the Modbus slave is adjusted to achieve synchronization with the time base of the Modbus master; wherein, the adjustment method of the loop filter includes a successive approximation algorithm; In response to the Modbus master pre-set a synchronization control signal based on the synchronized time base, the Modbus master and the Modbus slave execute synchronization control commands according to the pre-set synchronization control signal.

2. The synchronization control method for Modbus master-slave devices according to claim 1, characterized in that, Before the step of the Modbus master broadcasting a time synchronization signal that does not require a return message from the Modbus slave, the following steps are also included: The Modbus host obtains standard time; The standard time is corrected based on the time required for the Modbus host to send a complete time signal; The time synchronization signal that does not require Modbus slave to return information is generated based on the corrected standard time.

3. The synchronization control method for Modbus master-slave devices according to claim 2, characterized in that, The steps for correcting the standard time based on the time required for the Modbus host to send a complete time signal specifically include: The sum of the software path delay and the physical medium transmission delay is taken as the time required for the Modbus host to send a complete timing signal; The corrected standard time is the sum of the time required for the Modbus host to send a complete time signal and the standard time.

4. The synchronization control method for Modbus master-slave devices according to claim 1, characterized in that, The steps of executing a synchronization control command in response to a synchronization control signal from the Modbus host based on a control cycle specifically include: The Modbus master and all Modbus slaves agree to execute synchronization control commands at a future preset time. The Modbus master and all Modbus slaves execute synchronization control commands at the preset future time according to their respective time bases.

5. A Modbus device, characterized in that, The Modbus device includes: a memory, a processor, and a synchronization control program for Modbus master-slave devices stored in the memory and capable of running on the processor. When the synchronization control program for Modbus master-slave devices is executed by the processor, it implements the synchronization control method for Modbus master-slave devices as described in any one of claims 1 to 4.

6. A readable storage medium, characterized in that, The readable storage medium stores a synchronization control program for a Modbus master-slave device, which, when executed by a processor, implements the steps of the synchronization control method for a Modbus master-slave device according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Data link layer protocol of low voltage power line spread-frequency communication

    CN101938518A

  • Time synchronization method and device based on Kalman filtering

    CN111245593A

  • BMS parallel operation implementation control method and device and power supply

    CN113258148A