Time setting method of industrial control system, industrial control system and storage medium
By periodically scanning and exchanging messages to determine the clock difference and propagation delay of the target module in the industrial control system, the problem of insufficient time synchronization accuracy and high cost in the existing technology is solved, achieving accurate time synchronization and reducing system cost.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU HOLLYSYS AUTOMATION
- Filing Date
- 2022-12-29
- Publication Date
- 2026-04-21
Smart Images

Figure CN116192354B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial control, and more particularly to a time synchronization method for an industrial control system, an industrial control system, and a storage medium. Background Technology
[0002] With increasing complexity in industrial environments and the development of automation and intelligence, the precision requirements for controllers are rising. Currently, many control systems use various industrial bus communication methods such as Ethernet, fiber optics, and backplane buses for internal bus communication. Therefore, the conventional system time synchronization accuracy can no longer meet the needs of industrial environments. To achieve clock synchronization among various controllers, gateways, input / output modules, etc., Ethernet communication between the controller and gateway modules typically uses the high-precision IEEE 1588 standard (Precision Clock Synchronization Protocol Standard for Network Measurement and Control Systems) for time synchronization. The backplane bus between the gateway module and the input / output modules uses time synchronization broadcast frames every second or every minute. The current system time is added to the time synchronization broadcast frame, and the controller broadcasts the time information to all devices every second or every minute. After receiving the time synchronization broadcast frame, each device synchronizes its local system time. The time synchronization error of the entire system accumulates, resulting in poor time synchronization accuracy. At the same time, additional devices supporting IEEE 1588 standard time synchronization are required, increasing system costs.
[0003] Specifically, in the system network topology, racks are connected via Ethernet and fiber optic connections. The controller and gateway module require Ethernet-based clock synchronization, typically using NTP (Network Time Protocol) or the IEEE 1588 standard. NTP synchronization results in poor accuracy. While the IEEE 1588 standard offers high accuracy, it requires hardware supporting the IEEE 1588 standard (e.g., an Ethernet chip that supports IEEE 1588), increasing system cost. Furthermore, the gateway module communicates with input / output modules via serial RS485 / LVDS (Low-Voltage Differential Signaling). The gateway module synchronizes the time of the input / output modules within the rack using an independent synchronization protocol, typically employing synchronization broadcast frames. This necessitates the system supporting multiple synchronization methods, consumes significant network bandwidth during the synchronization process, and the cumulative synchronization errors lead to large deviations in system clock accuracy. Summary of the Invention
[0004] To address the aforementioned technical problems, this invention provides a time calibration method for an industrial control system, an industrial control system, and a storage medium, which can obtain accurate time calibration results without adding hardware.
[0005] To achieve the objectives of this invention, embodiments of this invention provide a time synchronization method for an industrial control system. The system includes a controller mounted in a main rack and at least one destination module mounted in a slave rack. The controller and the at least one destination module are connected via an industrial fieldbus, and the industrial fieldbus includes one or more of Ethernet, fiber optic, RS485 bus, and Low Voltage Differential Signaling (LVDS) interface. The time synchronization method for this industrial control system includes:
[0006] When the controller and the destination module exchange messages through periodic scanning, the clock difference and propagation delay of the destination module's local clock relative to the controller's clock are determined based on the time information contained in the message header.
[0007] The local clock of the target module is calibrated based on the clock difference and propagation delay of the target module's local clock relative to the controller's clock.
[0008] In an optional embodiment, when the controller and the destination module exchange messages through periodic scanning, the controller and the destination module determine the clock difference and propagation delay of the destination module's local clock relative to the controller's clock using the time information contained in the header of the exchanged messages, including:
[0009] Obtain the time difference between the message sent by the controller through periodic scanning and the message received by the destination module; and
[0010] The time difference between the message sent by the destination module through periodic scanning and the message received by the controller is obtained.
[0011] In an optional embodiment, obtaining the time difference between the controller sending a message via periodic scanning and the destination module receiving the message includes:
[0012] At the initial moment of the system's time synchronization cycle, the controller broadcasts a time synchronization broadcast packet to each destination module in the system through periodic scanning; wherein, the time synchronization broadcast packet contains the time T1 at which the controller broadcasts the time synchronization broadcast packet;
[0013] Each destination module records the time T2 when it receives the time synchronization broadcast packet and the time T1 when the controller broadcasts the time synchronization broadcast packet, which is parsed from the time synchronization broadcast packet;
[0014] The time difference between the message sent by the destination module through periodic scanning and the message received by the controller is obtained, including:
[0015] The controller and each destination module perform the following steps until the controller receives a time synchronization feedback message sent by each destination module;
[0016] The controller sends the first system calibration message to different target modules in the system sequentially at the start of different periodic scans through periodic scanning;
[0017] When each target module receives the first system synchronization message corresponding to its own target module, it sends a synchronization feedback message to the controller and records the time T3 when it sends the synchronization feedback message to the controller.
[0018] The controller records the time T4 when it receives the time synchronization feedback message corresponding to each destination module;
[0019] The controller and each destination module perform the following steps until each destination module receives the second system calibration message corresponding to the destination module;
[0020] The controller sequentially sends the second system synchronization message corresponding to each target module to different target modules in the system at the start of different periodic scans through periodic scanning; wherein, the second system synchronization message includes the time T4 at which the controller receives the synchronization feedback message corresponding to the target module;
[0021] Each destination module determines its local clock difference and propagation delay relative to the controller's clock using the following equations: the time T1 when the controller broadcasts the time synchronization broadcast packet, the time T2 when the destination module receives the time synchronization broadcast packet, the time T3 when the destination module sends the time synchronization feedback message, and the time T4 when the controller receives the corresponding time synchronization feedback message from the destination module.
[0022] DELAY=((T2-T1)+(T4-T3)) / 2;
[0023] OFFSET=((T2-T1)–(T4-T3)) / 2;
[0024] Where DELAY is the signal propagation delay of the local clock of the destination module relative to the clock of the controller, and OFFSET is the offset of the local clock of the destination module relative to the clock of the controller.
[0025] In an optional embodiment, the target module is an input / output module in the system or a gateway module between the input / output module and the controller; wherein the input / output module and the gateway module are disposed in one or more slave racks, each slave rack is provided with at least one gateway module, and the gateway module in the master rack where the controller is located forms a daisy-chain topology with the gateway modules in each slave rack.
[0026] The controller and the destination module exchange messages through periodic scans, including:
[0027] If, when a gateway module in a slave rack receives a message, it determines that the gateway module or an input / output module in the same slave rack as the gateway module is the destination module based on the address of the destination module contained in the message, then the gateway module saves the time when the controller broadcasts the time synchronization broadcast packet, the time when the gateway module receives the time synchronization broadcast packet, the time when the gateway module receives the first system synchronization message corresponding to the gateway module, and the time when the controller receives the calibration feedback message corresponding to the gateway module.
[0028] If, when the gateway module in the rack receives a message, it determines that the first input / output module located in the same rack as the gateway module is the destination module based on the address of the destination module contained in the message, then the gateway module saves the time when the controller broadcasts the time synchronization broadcast packet, the time when the first input / output module receives the time synchronization broadcast packet, the time when the first input / output module receives the first system synchronization message corresponding to the gateway module, and the time when the controller receives the calibration feedback message corresponding to the first input / output module.
[0029] If, upon receiving a message, the gateway module in the slave rack determines, based on the address of the destination module contained in the message, that neither the gateway module nor any input / output module in the same slave rack as the gateway module is the destination module, then the gateway module will sequentially transmit the message to the next gateway module in the slave rack or master rack according to the daisy-chain topology.
[0030] In an optional embodiment, the target module is an input / output module in the system or a gateway module between the input / output module and the controller; wherein the input / output module and the gateway module are disposed in one or more slave racks, each slave rack is provided with at least one gateway module, and the gateway module in the master rack where the controller is located forms a star topology or a tree topology with the gateway modules in each slave rack;
[0031] The controller and the destination module exchange messages through periodic scans, including:
[0032] If, when a gateway module in a slave rack receives a message, it determines that the gateway module or an input / output module in the same slave rack as the gateway module is the destination module based on the address of the destination module contained in the message, then the gateway module saves the time when the controller broadcasts the time synchronization broadcast packet, the time when the gateway module receives the time synchronization broadcast packet, the time when the gateway module receives the first system synchronization message corresponding to the gateway module, and the time when the controller receives the calibration feedback message corresponding to the gateway module.
[0033] If, when the gateway module in the rack receives a message, it determines that the second input / output module, which is located in the same rack as the gateway module, is the destination module based on the address of the destination module contained in the message, then the gateway module saves the time when the controller broadcasts the time synchronization broadcast packet, the time when the second input / output module receives the time synchronization broadcast packet, the time when the second input / output module receives the first system synchronization message corresponding to the gateway module, and the time when the controller receives the calibration feedback message corresponding to the second input / output module.
[0034] In an optional embodiment, the mainframe rack is further provided with an input / output module, and the time synchronization method further includes:
[0035] The controller exchanges messages with the input / output modules in the main unit rack via a backplane bus or industrial fieldbus.
[0036] In an optional embodiment, each main rack and each slave rack is provided with at least two gateways, and the at least two gateways in each rack form a daisy-chain topology, star topology, or tree topology for the controller and the destination module to exchange messages through periodic scanning.
[0037] In an optional embodiment, the time synchronization method further includes:
[0038] When the controller and the input / output modules located in the main rack exchange messages through periodic scanning, the gateway module in the main rack determines the clock difference and propagation delay of the local clock of the input / output modules in the main rack relative to the controller's clock by using the time information contained in the message header.
[0039] The local clocks of the input / output modules in the main rack are calibrated based on the clock difference and propagation delay of the local clocks of the input / output modules in the main rack relative to the controller's clock.
[0040] To achieve the above objectives, embodiments of the present invention provide an industrial control system, including: a controller, a target module, and a memory;
[0041] The memory is used to store the program for calibrating the time of the industrial control system.
[0042] The controller is used to read and execute a program for data processing, and based on the program for data processing, the controller and the target module perform the time synchronization method of the industrial control system as described in any of the above embodiments.
[0043] To achieve the above objectives, embodiments of the present invention provide a storage medium storing computer-executable instructions; the computer-executable instructions are used, when read and executed, to perform a time synchronization method for an industrial control system as described in any of the above embodiments.
[0044] Using the above method, the clock difference and propagation delay of the target module's local clock relative to the controller's clock can be determined simply by exchanging messages through periodic scanning between the controller and the target module. Then, the target module's local clock is calibrated based on this clock difference and propagation delay. This process eliminates the need for hardware supporting the IEEE 1588 standard for time calibration, thus reducing the cost of the industrial control system. Furthermore, since the clock difference and propagation delay are determined through periodic scanning, no additional bandwidth is required. The controller and target module can be connected via Ethernet, fiber optic cable, RS485 bus, and Low Voltage Differential Signaling (LVDS) interface, making it highly adaptable to various operating environments.
[0045] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the description, claims and drawings. Attached Figure Description
[0046] The accompanying drawings are provided to further understand the technical solutions of the present invention and constitute a part of the specification. They are used together with the embodiments of this application to explain the technical solutions of the present invention and do not constitute a limitation on the technical solutions of the present invention.
[0047] Figure 1 A flowchart illustrating a time synchronization method for an industrial control system provided in an embodiment of the present invention;
[0048] Figure 2 A timing diagram of the time synchronization method for an industrial control system provided in an embodiment of the present invention is shown;
[0049] Figure 3 This is a schematic diagram of an industrial control system provided in an embodiment of the present invention. Detailed Implementation
[0050] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be arbitrarily combined with each other.
[0051] The steps illustrated in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases the steps shown or described may be performed in a different order than that presented here.
[0052] To address the aforementioned technical problems, embodiments of the present invention provide a time synchronization method for an industrial control system. The system includes a controller mounted in a main rack and at least one destination module mounted in a slave rack. The controller and the at least one destination module are connected via an industrial fieldbus, and the industrial fieldbus includes one or more of Ethernet, fiber optic, RS485 bus, and Low Voltage Differential Signaling (LVDS) interfaces, such as... Figure 1 As shown, the time calibration method of this industrial control system includes steps S101-S103.
[0053] Step S101: When the controller and the destination module exchange messages through periodic scanning, the clock difference and propagation delay of the destination module's local clock relative to the controller's clock are determined based on the time information contained in the message header.
[0054] Step S103: Calibrate the local clock of the target module based on the clock difference and propagation delay between the local clock of the target module and the clock of the controller.
[0055] Using the above method, the clock difference and propagation delay of the target module's local clock relative to the controller's clock can be determined simply by exchanging messages through periodic scanning between the controller and the target module. Then, the target module's local clock is calibrated based on this clock difference and propagation delay. This process eliminates the need for hardware supporting the IEEE 1588 standard for time calibration, thus reducing the cost of the industrial control system. Furthermore, since the clock difference and propagation delay are determined through periodic scanning, no additional bandwidth is required. The controller and target module can be connected via Ethernet, fiber optic cable, RS485 bus, and Low Voltage Differential Signaling (LVDS) interface, making it highly adaptable to various operating environments.
[0056] In an optional embodiment, step S101 includes:
[0057] Obtain the time difference between the message sent by the controller through periodic scanning and the message received by the destination module; and
[0058] The time difference between the message sent by the destination module through periodic scanning and the message received by the controller is obtained.
[0059] In this embodiment, there is no restriction that the time when the controller sends a message should be at a certain precise time, nor is there a restriction that the time when the destination module sends a message should be at a certain precise time. Therefore, the applicability of determining the clock difference and propagation delay of the destination module's local clock relative to the controller's clock by periodic scanning is expanded.
[0060] In an optional embodiment, such as Figure 2 As shown, the industrial control system includes a controller and multiple target modules (target module 1, target module n).
[0061] The aforementioned acquisition of the time difference between the message sent by the controller through periodic scanning and the message received by the destination module includes:
[0062] At the initial moment of the system's time synchronization cycle, the controller broadcasts a time synchronization broadcast packet to each destination module in the system through periodic scanning; wherein, the time synchronization broadcast packet contains the time T1 at which the controller broadcasts the time synchronization broadcast packet;
[0063] Each destination module records the time T2 when it receives the time synchronization broadcast packet and the time T1 when the controller broadcasts the time synchronization broadcast packet, which is parsed from the time synchronization broadcast packet.
[0064] The aforementioned acquisition target module transmits messages via periodic scanning, and the time difference between the message sent and the message received by the controller includes:
[0065] The controller and each destination module perform the following steps until the controller receives a time synchronization feedback message sent by each destination module;
[0066] The controller sends the first system calibration message to different target modules in the system sequentially at the start of different periodic scans through periodic scanning;
[0067] When each of the target modules receives the first system synchronization message corresponding to its own target module, it sends the synchronization feedback message to the controller and records the time T3 when it sends the synchronization feedback message to the controller.
[0068] The controller records the time T4 when it receives the time synchronization feedback message corresponding to each of the destination modules;
[0069] The controller and each destination module perform the following steps until each destination module receives the second system calibration message corresponding to the destination module;
[0070] The controller sequentially sends the second system synchronization message corresponding to each target module to different target modules in the system at the start of different periodic scans through periodic scanning; wherein, the second system synchronization message includes the time T4 at which the controller receives the synchronization feedback message corresponding to the target module;
[0071] Each destination module determines the clock difference and propagation delay of its local clock relative to the controller's clock using the following equations: the time T1 when the controller broadcasts the time synchronization broadcast packet, the time T2 when the destination module receives the time synchronization broadcast packet, the time T3 when the destination module sends the time synchronization feedback message, and the time T4 when the controller receives the corresponding time synchronization feedback message from the destination module.
[0072] DELAY=((T2-T1)+(T4-T3)) / 2;
[0073] OFFSET=((T2-T1)–(T4-T3)) / 2;
[0074] Where DELAY is the signal propagation delay of the local clock of the destination module relative to the clock of the controller, and OFFSET is the offset of the local clock of the destination module relative to the clock of the controller.
[0075] In an optional embodiment, the target module is an input / output module in the system or a gateway module between the input / output module and the controller; wherein the input / output module and the gateway module are disposed in one or more slave racks, each slave rack is provided with at least one gateway module, and the gateway module in the master rack where the controller is located forms a daisy-chain topology with the gateway modules in each slave rack.
[0076] The aforementioned controller and destination module exchange messages through periodic scanning, including:
[0077] If, when a gateway module in a slave rack receives a message, it determines that the gateway module or an input / output module in the same slave rack as the gateway module is the destination module based on the address of the destination module contained in the message, then the gateway module saves the time when the controller broadcasts the time synchronization broadcast packet, the time when the gateway module receives the time synchronization broadcast packet, the time when the gateway module receives the first system synchronization message corresponding to the gateway module, and the time when the controller receives the calibration feedback message corresponding to the gateway module.
[0078] If, when the gateway module in the rack receives a message, it determines that the first input / output module located in the same rack as the gateway module is the destination module based on the address of the destination module contained in the message, then the gateway module saves the time when the controller broadcasts the time synchronization broadcast packet, the time when the first input / output module receives the time synchronization broadcast packet, the time when the first input / output module receives the first system synchronization message corresponding to the gateway module, and the time when the controller receives the calibration feedback message corresponding to the first input / output module.
[0079] If, upon receiving a message, the gateway module in the slave rack determines, based on the address of the destination module contained in the message, that neither the gateway module nor any input / output module in the same slave rack as the gateway module is the destination module, then the gateway module will sequentially transmit the message to the next gateway module in the slave rack or master rack according to the daisy-chain topology.
[0080] In an optional embodiment, the target module is an input / output module in the system or a gateway module between the input / output module and the controller; wherein the input / output module and the gateway module are disposed in one or more slave racks, each slave rack is provided with at least one gateway module, and the gateway module in the master rack where the controller is located forms a star topology or a tree topology with the gateway modules in each slave rack;
[0081] The aforementioned controller and destination module exchange messages through periodic scanning, including:
[0082] If, when a gateway module in a slave rack receives a message, it determines that the gateway module or an input / output module in the same slave rack as the gateway module is the destination module based on the address of the destination module contained in the message, then the gateway module saves the time when the controller broadcasts the time synchronization broadcast packet, the time when the gateway module receives the time synchronization broadcast packet, the time when the gateway module receives the first system synchronization message corresponding to the gateway module, and the time when the controller receives the calibration feedback message corresponding to the gateway module.
[0083] If, when the gateway module in the rack receives a message, it determines that the second input / output module, which is located in the same rack as the gateway module, is the destination module based on the address of the destination module contained in the message, then the gateway module saves the time when the controller broadcasts the time synchronization broadcast packet, the time when the second input / output module receives the time synchronization broadcast packet, the time when the second input / output module receives the first system synchronization message corresponding to the gateway module, and the time when the controller receives the calibration feedback message corresponding to the second input / output module.
[0084] In an optional embodiment, as an addition, the time synchronization method of the industrial control system further includes: the controller and the target module exchanging messages that do not contain time information through periodic scanning.
[0085] In an optional embodiment, the mainframe is further provided with input / output modules, and the time synchronization method further includes: the controller exchanging messages with the input / output modules provided in the mainframe via a backplane bus or an industrial fieldbus.
[0086] In an optional embodiment, each main rack and each slave rack is provided with at least two gateways, and the at least two gateways in each rack form a daisy-chain topology, star topology, or tree topology for the controller and the destination module to exchange messages through periodic scanning.
[0087] In an optional embodiment, the time synchronization method further includes:
[0088] When the controller and the input / output modules located in the main rack exchange messages through periodic scanning, the gateway module in the main rack determines the clock difference and propagation delay of the local clock of the input / output modules in the main rack relative to the controller's clock by using the time information contained in the message header.
[0089] The local clocks of the input / output modules in the main rack are calibrated based on the clock difference and propagation delay of the local clocks of the input / output modules in the main rack relative to the controller's clock.
[0090] To address the aforementioned technical problems, embodiments of the present invention provide an industrial control system, such as... Figure 3 As shown, it includes: a controller 20, a destination module 30, and a memory 10; wherein,
[0091] Memory 10 is used to store the program for calibrating the time of the industrial control system;
[0092] The controller 20 is used to read and execute a program for data processing, and based on the program for data processing, the controller 20 and the target module 30 perform the time synchronization method of the industrial control system as described in any of the above embodiments.
[0093] To address the aforementioned technical problems, embodiments of the present invention provide a storage medium storing computer-executable instructions; these computer-executable instructions, when read and executed, perform a time synchronization method for an industrial control system as described in any of the above embodiments.
[0094] While the embodiments disclosed in this invention are as described above, the above content is merely for the purpose of facilitating understanding of this invention and is not intended to limit the invention. Any person skilled in the art to which this invention pertains may make any modifications and changes to the form and details of the implementation without departing from the spirit and scope disclosed in this invention; however, the scope of patent protection of this invention shall still be determined by the scope defined in the appended claims.
Claims
1. A time synchronization method for an industrial control system, the system comprising a controller disposed in a main rack and at least one destination module disposed in a slave rack, the controller and the at least one destination module being connected via an industrial fieldbus, wherein the industrial fieldbus includes one or more of Ethernet, fiber optic, RS485 bus, and Low Voltage Differential Signaling (LVDS) interface, characterized in that, The time synchronization method of the industrial control system includes: When the controller and the destination module exchange messages through periodic scanning, the clock difference and propagation delay of the local clock of the destination module relative to the clock of the controller are determined based on the time information contained in the message header. The local clock of the target module is calibrated based on the clock difference and propagation delay of the local clock of the target module relative to the clock of the controller. The target module is either an input / output module in the system or a gateway module between the input / output module and the controller. The input / output module and the gateway module are located in one or more slave racks, and each slave rack has at least one gateway module. The gateway module in the master rack where the controller is located forms a daisy chain topology, a star topology, or a tree topology with the gateway modules in each slave rack. When the gateway module in the host rack where the controller resides forms a daisy-chain topology with the gateway modules in each of the slave racks, the controller and the destination module exchange packets through periodic scanning, including: If, when the gateway module in the slave rack receives the message, it determines, based on the address of the destination module contained in the message, that the gateway module or an input / output module located in the same slave rack as the gateway module is the destination module, then the gateway module saves the time when the controller broadcasts the time synchronization broadcast packet, the time when the gateway module receives the time synchronization broadcast packet, the time when the gateway module receives the first system synchronization message corresponding to the gateway module, and the time when the controller receives the time synchronization feedback message corresponding to the gateway module; If, when the gateway module in the slave rack receives the message, it determines, based on the address of the destination module contained in the message, that the first input / output module located in the same slave rack as the gateway module is the destination module, then the gateway module saves the time when the controller broadcasts the time synchronization broadcast packet, the time when the first input / output module receives the time synchronization broadcast packet, the time when the first input / output module receives the first system synchronization message corresponding to the gateway module, and the time when the controller receives the time synchronization feedback message corresponding to the first input / output module; If, when the gateway module in the slave rack receives the message, it determines, based on the address of the destination module contained in the message, that neither the gateway module nor any input / output module in the same slave rack as the gateway module is the destination module, then the gateway module will sequentially transmit the message to the next gateway module in the slave rack or master rack according to the daisy-chain topology. The clock difference and propagation delay of the local clock of the target module relative to the clock of the controller are determined by the following equations: DELAY = ((T2-T1) + (T4-T3)) / 2; OFFSET = ((T2-T1) – (T4-T3)) / 2; Where DELAY is the signal propagation delay of the local clock of the destination module relative to the clock of the controller, OFFSET is the offset of the local clock of the destination module relative to the clock of the controller, T1 is the time when the controller broadcasts the time synchronization broadcast packet, T2 is the time when the destination module records the time synchronization broadcast packet received, T3 is the time when the destination module sends the time synchronization feedback message to the controller, and T4 is the time when the controller receives the time synchronization feedback message corresponding to the destination module.
2. The time synchronization method for an industrial control system according to claim 1, wherein, When the controller and the destination module exchange messages through periodic scanning, the controller and the destination module determine the clock difference and propagation delay of the destination module's local clock relative to the controller's clock using the time information contained in the header of the exchanged messages, including: Obtain the time difference between the message sent by the controller through periodic scanning and the message received by the destination module; and The time difference between the message sent by the target module through periodic scanning and the message received by the controller is obtained.
3. The time synchronization method for an industrial control system according to claim 2, wherein, The step of obtaining the time difference between the message sent by the controller through periodic scanning and the message received by the destination module includes: At the initial moment of the system's time synchronization cycle, the controller broadcasts a time synchronization broadcast packet to each destination module in the system through periodic scanning; wherein, the time synchronization broadcast packet contains the time T1 at which the controller broadcasts the time synchronization broadcast packet; Each of the destination modules records the time T2 when the time synchronization broadcast packet is received and the time T1 when the controller broadcasts the time synchronization broadcast packet, which is parsed from the time synchronization broadcast packet; The step of obtaining the time difference between the message sent by the target module through periodic scanning and the message received by the controller includes: The controller and each of the destination modules perform the following steps until the controller receives a time synchronization feedback message sent by each of the destination modules; The controller sends the first system calibration message to different target modules in the system sequentially at the start time of different periodic scans through periodic scanning; When each of the target modules receives the first system synchronization message corresponding to its own target module, it sends the synchronization feedback message to the controller and records the time T3 when it sends the synchronization feedback message to the controller. The controller records the time T4 when it receives the time synchronization feedback message corresponding to each of the destination modules; The controller and each of the target modules perform the following steps until each of the target modules receives the second system calibration message corresponding to the target module; The controller sequentially sends the second system synchronization message corresponding to each target module to different target modules in the system at the start time of different periodic scans; wherein, the second system synchronization message includes the time T4 at which the controller receives the synchronization feedback message corresponding to the target module; Each destination module determines the clock difference and propagation delay of its local clock relative to the controller's clock based on the time T1 when the controller broadcasts the time synchronization broadcast packet, the time T2 when the destination module receives the time synchronization broadcast packet, the time T3 when the destination module sends the time synchronization feedback message, and the time T4 when the controller receives the time synchronization feedback message corresponding to the destination module.
4. The time synchronization method for an industrial control system according to claim 1, wherein when the gateway module in the main rack where the controller is located forms a star topology or a tree topology with the gateway modules in each of the slave racks, the controller and the destination module exchange messages through periodic scanning, including: If, when the gateway module in the slave rack receives the message, it determines, based on the address of the destination module contained in the message, that the gateway module or an input / output module located in the same slave rack as the gateway module is the destination module, then the gateway module saves the time when the controller broadcasts the time synchronization broadcast packet, the time when the gateway module receives the time synchronization broadcast packet, the time when the gateway module receives the first system synchronization message corresponding to the gateway module, and the time when the controller receives the time synchronization feedback message corresponding to the gateway module; If, when the gateway module in the slave rack receives the message, it determines, based on the address of the destination module contained in the message, that the second input / output module located in the same slave rack as the gateway module is the destination module, then the gateway module saves the time when the controller broadcasts the time synchronization broadcast packet, the time when the second input / output module receives the time synchronization broadcast packet, the time when the second input / output module receives the first system synchronization message corresponding to the gateway module, and the time when the controller receives the time synchronization feedback message corresponding to the second input / output module.
5. The time synchronization method for an industrial control system according to claim 1, characterized in that, The mainframe is also equipped with an input / output module, and the time synchronization method further includes: The controller exchanges messages with the input / output modules in the main unit rack via the backplane bus or the industrial fieldbus.
6. The time synchronization method for an industrial control system according to claim 1 or 4, wherein, Each main rack and each slave rack is provided with at least two gateways, and the at least two gateways in each rack form a daisy-chain topology, a star topology, or a tree topology for the controller and the destination module to exchange messages through periodic scanning.
7. The time synchronization method for an industrial control system according to claim 1, characterized in that, The time synchronization method also includes: When the controller and the input / output modules located in the main rack exchange messages through periodic scanning, the gateway module in the main rack determines the clock difference and propagation delay of the local clock of the input / output modules in the main rack relative to the clock of the controller by using the time information contained in the message header; The local clocks of the input / output modules in the main rack are calibrated based on the clock difference and propagation delay of the local clocks of the input / output modules in the main rack relative to the clock of the controller.
8. An industrial control system, comprising: Controller, destination module, and memory; characterized in that: The memory is used to store the program for calibrating the time of the industrial control system. The controller is used to read and execute the program for data processing, and according to the program for data processing, the controller and the target module perform the time synchronization method of the industrial control system as described in any one of claims 1-7.
9. A storage medium storing computer-executable instructions; said computer-executable instructions, when read and executed, are used to perform a time synchronization method for an industrial control system as described in any one of claims 1-7.
Citation Information
Patent Citations
Wireless network accurate time synchronization method
CN110401505A
Clock synchronization method and device, computer storage medium and electronic equipment
CN110649984A
Time synchronization method and device and storage medium
CN114269012A
Clock synchronization implementation method of wind tunnel pressure measurement system
CN114785445A