Data Synchronization System and Method

By introducing a data synchronization system into the power automation system, the interaction between the control module, subprocessing module and end module is used to realize the synchronous acquisition of multi-device data, which solves the problems of difficulty and high cost of synchronous acquisition in the existing technology, improves system performance and reduces costs.

CN118963934BActive Publication Date: 2025-06-03NANJING JIANGXING LIANJIA INTELLIGENT TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410937417.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-12
Publication Date
2025-06-03
Estimated Expiration
2044-07-12

AI Technical Summary

Technical Problem

In power automation systems, it is difficult for the prior art to realize the synchronous collection of data from multiple devices, especially when the system is loaded heavily. Due to thread blocking problems, it is difficult to synchronize instructions, and the requirements for the hardware resources and performance of the main CPU are added, resulting in an increase in costs.

Method used

A data synchronization system is proposed, including a control module, a subprocessing module and an end module. Through the control module, a preset operation instructions and synchronization pulses are sent to the subprocessing module. The subprocessing module responds to the synchronization pulse, sends instructions to the end module, and caches the results to realize the synchronization of commands and synchronizes the operation results.

Benefits of technology

By adding subprocessing modules to the control module and end modules, the load of the control module is reduced, making the control unit of the terminal device more focused on business processing, improving overall performance, achieving low-cost data synchronization, and reducing the requirements for hardware performance and cost.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118963934B_ABST
    Figure CN118963934B_ABST
Patent Text Reader

Abstract

The present application discloses a data synchronization system and method, relating to the technical field of data communication. The disclosed data synchronization system includes: after the control module sends a preset operation instruction to the sub-processing module, it sends a synchronization pulse to the sub-processing module. The sub-processing module responds to the synchronization pulse and sends the preset operation instruction to the terminal module. The terminal module receives the preset operation instruction sent by the sub-processing module, executes the preset operation instruction to obtain a preset operation result, and sends the preset operation result to the sub-processing module. The sub-processing module receives the preset operation result sent by the terminal module and caches the preset operation result in the internal storage. The control module sends a result acquisition instruction to the sub-processing module and acquires the preset operation result based on the result acquisition instruction. The present application realizes low-cost data synchronization and reduces the requirements for hardware performance and cost during the data synchronization process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data communication technologies, and particularly to a data synchronization system and method. Background Art

[0002] In the process of power automation, the requirements for data collection from various terminal devices are also getting higher and higher. With the increase in the types of on-site energy-consuming devices and the complexity of on-site use, it is often necessary to achieve the requirement of synchronous collection of data from multiple devices at the same time section. In the conventional collection method, the communication ports are led out from the main control chip, and the terminal devices to be read are directly mounted on the corresponding ports. Then, through the main control CPU in a multi-threaded or multi-process manner, each thread or process independently controls the corresponding port, and multiple ports are controlled to achieve the collection of each device.

[0003] In this case, the data collection time completely depends on the multitasking ability of the CPU. The time when the collection instruction is issued depends on the multi-threaded scheduling process of the system and is uncontrollable. Especially when the system load is heavy, due to thread blocking problems, it is even more impossible to perform synchronous operations on instructions.

[0004] In addition, when there are more communication ports, the number of different processes to be established will also increase accordingly, and the requirements for the hardware resources, performance, heat dissipation, etc. of the main control CPU will also increase accordingly, resulting in an increase in hardware costs.

[0005] The above content is only used to assist in understanding the technical solution of this application, and does not represent an admission that the above content is prior art. Summary of the Invention

[0006] The main purpose of this application is to provide a data synchronization system and method, aiming to solve the technical problem of how to perform data synchronization at low cost.

[0007] To achieve the above object, this application proposes a data synchronization system, which includes: a control module, at least one sub-processing module, and a terminal module. The control module is connected to at least one sub-processing module, and the sub-processing module is connected to the corresponding terminal module;

[0008] The control module is used to send a preset operation instruction to the sub-processing module, where the preset operation instruction can be one or more;

[0009] The sub-processing module is used to receive the preset operation instruction sent by the control module;

[0010] The control module is further used to send a synchronization pulse to the sub-processing module;

[0011] The sub - processing module is further configured to respond to the synchronization pulse and send the preset operation instruction to the terminal module;

[0012] The terminal module is configured to receive the preset operation instruction sent by the sub - processing module, execute the preset operation instruction to obtain a preset operation result, and send the preset operation result to the sub - processing module;

[0013] The sub - processing module is further configured to receive the preset operation result sent by the terminal module and cache the preset operation result in the internal storage;

[0014] The control module is further configured to send a result acquisition instruction to the sub - processing module and obtain the preset operation result based on the result acquisition instruction.

[0015] In one embodiment, the sub - processing module is further configured to, when the received preset operation instruction is a single one, allocate a corresponding thread or process for the single preset operation instruction;

[0016] The sub - processing module is further configured to, when the received preset operation instructions are multiple, establish a preset instruction queue based on the multiple preset operation instructions and allocate a corresponding thread or process for the preset instruction queue.

[0017] In one embodiment, two interaction channels are established between the control module and the sub - processing module, namely an instruction sending and receiving channel and a signal synchronization channel;

[0018] The instruction sending and receiving channel is used for the control module to broadcast and send the preset operation instruction to the sub - processing module;

[0019] The signal synchronization channel is used for the control module to send a synchronization pulse to the sub - processing module.

[0020] In one embodiment, the control module is further configured to traverse the operation status of all the preset operation instructions received by the sub - processing module;

[0021] The control module is further configured to, when detecting that the operation status of all the preset operation instructions received by the sub - processing module is ready, send the synchronization pulse to all the sub - processing modules to change the operation status of the preset operation instruction to interrupted.

[0022] In one embodiment, the sub - processing module is further configured to receive the preset operation result sent by the terminal module, record the time stamp when receiving the preset operation result, and cache the preset operation result with the time stamp in the internal storage.

[0023] In addition, to achieve the above object, the present application also proposes a data synchronization method, which is applied to a data synchronization system. The data synchronization system includes: a control module, at least one sub-processing module connected to the control module, and an end module corresponding to the sub-processing module; the data synchronization method includes:

[0024] The control module sends a preset operation instruction to the sub-processing module, where the preset operation instruction can be one or more;

[0025] The sub-processing module receives the preset operation instruction sent by the control module;

[0026] The control module sends a synchronization pulse to the sub-processing module;

[0027] The sub-processing module responds to the synchronization pulse and sends the preset operation instruction to the end module;

[0028] The end module receives the preset operation instruction sent by the sub-processing module, executes the preset operation instruction to obtain a preset operation result, and sends the preset operation result to the sub-processing module;

[0029] The sub-processing module receives the preset operation result sent by the end module and caches the preset operation result in the internal storage;

[0030] The control module sends a result acquisition instruction to the sub-processing module and acquires the preset operation result based on the result acquisition instruction.

[0031] In an embodiment, after the sub-processing module receives the preset operation instruction sent by the control module, it further includes:

[0032] When the received preset operation instruction is one, the sub-processing module allocates a corresponding thread or process to the single preset operation instruction;

[0033] When the received preset operation instruction is multiple, the sub-processing module establishes a preset instruction queue based on the multiple preset operation instructions and allocates a corresponding thread or process to the preset instruction queue.

[0034] In an embodiment, two interaction channels are established between the control module and the sub-processing module, namely an instruction transceiver channel and a signal synchronization channel;

[0035] The control module sending a preset operation instruction to the sub-processing module includes: the control module broadcasts and sends a preset operation instruction to the sub-processing module through the instruction transceiver channel;

[0036] The control module sends a synchronization pulse to the sub - processing module, including: the control module sends a synchronization pulse to the sub - processing module through the signal synchronization channel.

[0037] In one embodiment, the step of the control module sending a synchronization pulse to the sub - processing module further includes:

[0038] The control module traverses the operation status of the preset operation instructions received by all the sub - processing modules;

[0039] When the control module detects that the operation status of the preset operation instructions received by all the sub - processing modules is ready, it sends the synchronization pulse to all the sub - processing modules, so that the operation status of the preset operation instructions changes to interrupted.

[0040] In one embodiment, the sub - processing module receives the preset operation result sent by the terminal module and caches the preset operation result in the internal storage, including:

[0041] The sub - processing module receives the preset operation result sent by the terminal module, records the time stamp when receiving the preset operation result, and caches the preset operation result with the time stamp in the internal storage.

[0042] One or more technical solutions proposed in this application have at least the following technical effects:

[0043] By the control module sending one or more preset operation instructions to the sub - processing module, the sub - processing module receives the preset operation instructions sent by the control module, the control module sends a synchronization pulse to the sub - processing module, and the sub - processing module responds to the synchronization pulse and sends the preset operation instructions to the terminal module, the synchronization of instruction sending and receiving is realized; by the terminal module receiving the preset operation instructions sent by the sub - processing module, executing the preset operation instructions, obtaining the preset operation result, and sending the preset operation result to the sub - processing module, the sub - processing module receiving the preset operation result sent by the terminal module and caching the preset operation result in the internal storage, and the control module sending a result acquisition instruction to the sub - processing module and obtaining the preset operation result based on the result acquisition instruction, the synchronization of instruction operation result reading and writing is realized. By adding corresponding connected sub - processing modules in the control module and one or more terminal modules, the load of the control module is reduced, the control unit of the terminal device can focus more on business processing to improve the overall performance, and thus data synchronization is realized at low cost, reducing the requirements for hardware performance and cost in the data synchronization process. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] The drawings here are incorporated into the specification and form a part of this specification, showing embodiments consistent with this application, and are used together with the specification to explain the principles of this application.

[0045] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0046] Figure 1 It is a structural block diagram of the first embodiment of the data synchronization system of the present application;

[0047] Figure 2 It is a data transmission flowchart of an embodiment of the data synchronization system of the present application;

[0048] Figure 3 It is a structural block diagram of the second embodiment of the data synchronization system of the present application;

[0049] Figure 4 It is a hardware architecture diagram of an embodiment of the data synchronization system of the present application;

[0050] Figure 5 It is a schematic flowchart of the first embodiment of the data synchronization method of the present application;

[0051] Figure 6 It is a schematic flowchart of the second embodiment of the data synchronization method of the present application.

[0052] The realization of the purpose, functional features, and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. Specific Embodiments

[0053] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0054] To better understand the technical solutions of the present application, the following will be described in detail in combination with the accompanying drawings of the specification and specific embodiments.

[0055] Refer to Figure 1 , Figure 1 It is a structural block diagram of the first embodiment of the data synchronization system of the present application.

[0056] As Figure 1 shown, the data synchronization system includes: a control module 10, at least one sub-processing module 20, and an end module 30. The control module 10 is connected to at least one sub-processing module 20, and the sub-processing module 20 is connected to the corresponding end module 30;

[0057] In this embodiment, the control module 10 is used to send a preset operation instruction to the sub-processing module 20, where the preset operation instruction can be one or more;

[0058] It should be noted that this embodiment is used for the data synchronization link. The data synchronization includes instruction transceiver synchronization and instruction operation result read / write synchronization. In the instruction transceiver synchronization stage, the terminal module 30 receives one or more preset operation instructions from the control module 10 forwarded by the sub-processing module 20; in the instruction operation result read / write synchronization stage, the control module 10 obtains the results of the terminal module executing the preset operation instructions from the sub-processing module 20. The preset operation instructions are the operation instructions that need to be synchronized, and specifically can be data acquisition instructions.

[0059] It should be understood that the control module 10 is responsible for generating, managing, and distributing instructions. Specifically, the control module 10 includes the main control CPU of the terminal device, which is responsible for the control, data acquisition, and communication of the entire system in the power automation system. When the user requests synchronous acquisition of data of multiple on-site energy-consuming devices, it is necessary to first send a data synchronization acquisition request to the main control CPU through the interaction interface. The main control CPU will generate a data acquisition instruction, that is, a preset operation instruction, based on the data synchronization acquisition request, and send the data acquisition instruction to the sub-processing module 20 corresponding to each device connection.

[0060] In this embodiment, the sub-processing module 20 is used to receive the preset operation instructions sent by the control module 10;

[0061] It should be noted that the sub-processing module 20 can be a single-chip microcomputer, whose processing performance is lower than that of the main control CPU, but it has the advantages of simple architecture and low power consumption.

[0062] In a feasible implementation manner, when the preset operation instruction received by the sub-processing module 20 is one, the sub-processing module 20 is further used to allocate a corresponding thread or process for the single preset operation instruction;

[0063] When the preset operation instructions received by the sub-processing module 20 are multiple, the sub-processing module 20 is further used to establish a preset instruction queue based on the multiple preset operation instructions, and allocate a corresponding thread or process for the preset instruction queue.

[0064] It should be noted that when synchronously collecting data of one or more devices, there are specifically two application scenarios: single trigger and cyclic trigger. Among them, a single preset operation instruction corresponds to the single trigger scenario, and multiple preset operations correspond to the cyclic trigger scenario. When a user needs to perform real-time data collection on on-site energy-consuming devices, the single trigger method can be used to ensure a quick response to operation instructions, such as scenarios where real-time energy consumption data or device status information at a specific time point needs to be obtained immediately; when a user needs to perform periodic data collection on on-site energy-consuming devices, the cyclic trigger method can be used to store multiple operation instructions in a queue to ensure the long-term execution of operation instructions in chronological order, such as scenarios where energy consumption data or device status information needs to be collected regularly every day, week, or month for statistical analysis.

[0065] It should be understood that during the process of synchronously collecting data of on-site energy-consuming devices, when there are too many types of devices and the processing tasks of the main control CPU are relatively complex, if the main control CPU uses multi-threading or multi-process methods to let each thread or process independently control the corresponding ports to control multiple ports to achieve the collection of each device, it is very easy for the main control CPU's performance to be insufficient, resulting in blocking of the process or thread, thus causing the failure of data synchronous collection. By adding a low-cost single-chip microcomputer between the main control CPU and each terminal device, and each single-chip microcomputer independently schedules a single process or thread, the load of the main control CPU can be reduced.

[0066] In this embodiment, the control module 10 is further configured to send a synchronization pulse to the sub-processing module 20;

[0067] It should be noted that after the control module 10 sends a preset operation instruction to the sub-processing module 20, a synchronization pulse also needs to be sent to the sub-processing module 20 through a hardware channel to trigger the forwarding operation of the preset operation instruction by the sub-processing module 20.

[0068] Specifically, the control module 10 is further configured to traverse the operation status of the preset operation instructions received by all the sub-processing modules 20; the control module 10 is further configured to, when detecting that the operation status of the preset operation instructions received by all the sub-processing modules 20 is ready, send the synchronization pulse to all the sub-processing modules 10, so that the operation status of the preset operation instruction changes to interrupted.

[0069] It should be understood that after the control module 10 sends a preset operation instruction to the sub - processing module 20, it is necessary to traverse the operation status of the preset operation instructions received by all sub - processing modules 20. The traversal method can be polling, that is, regularly accessing each sub - processing module 20 to query the operation status of the preset operation instruction in the sub - processing module 20. Only when it is detected that the operation status of all preset operation instructions is ready, will the control module 10 send a synchronization pulse to all sub - processing modules 10. When the sub - processing module 10 receives the synchronization pulse, an interrupt will be triggered.

[0070] In this embodiment, the sub - processing module 20 is further configured to respond to the synchronization pulse and send the preset operation instruction to the end - module 30;

[0071] It should be noted that during initialization, the addresses and types of the end - modules 30 connected to each sub - processing module 20 need to be set properly to ensure that the sub - processing module 20 can correctly identify the corresponding connected end - module 30 and communicate. The end - module 30 can be different types of end - devices for collecting different types of data, specifically, it can be a temperature sensor, a humidity sensor, a pressure sensor, etc. When it is necessary to add or replace an end - device, the configuration process can be simplified through the defined addresses and types. When the single - chip microcomputer receives the synchronization pulse sent by the main control CPU, it will send the operation instruction to be synchronized to the corresponding connected end - device to achieve the synchronous operation of the instruction.

[0072] In this embodiment, the end - module 30 is configured to receive the preset operation instruction sent by the sub - processing module 20, execute the preset operation instruction to obtain a preset operation result, and send the preset operation result to the sub - processing module 20;

[0073] It should be understood that after the end - module 30 receives the preset operation instruction sent by the sub - processing module 20 and executes the preset operation instruction, a preset operation result will be obtained. Specifically, if the executed preset operation instruction is a data acquisition instruction, after obtaining the data acquisition result, the end - module 30 will send the data acquisition result to the sub - processing module.

[0074] In this embodiment, the sub - processing module 20 is further configured to receive the preset operation result sent by the end - module 30 and cache the preset operation result in the internal storage;

[0075] Specifically, the sub - processing module 20 is further configured to receive the preset operation result sent by the end - module 30, record the time stamp when receiving the preset operation result, and cache the preset operation result with the time stamp in the internal storage.

[0076] It should be noted that when the sub - processing module 20 receives the preset operation result sent by the terminal module 30, when storing the preset operation result, it will correspondingly store the time stamp when the preset operation result is received. When there are multiple preset operation instructions, the corresponding preset operation results after execution are also multiple. At this time, a FIFO (First In First Out) data queue will be established inside the sub - processing module 20 to cache the results of multiple operations. As Figure 3 shown, after the terminal device receives the operation instruction queue sent by the single - chip microcomputer and executes it in order, it will send back the execution result corresponding to the operation instruction queue to the single - chip microcomputer. The single - chip microcomputer records the time stamp of receiving each operation result and establishes a data queue based on the operation result and the corresponding time stamp, and stores the data queue in the internal storage. The main control CPU can perform system performance analysis, fault troubleshooting, and corresponding debugging through the accurate time information of the data received by the time stamp record, so as to better master and analyze the system operation situation.

[0077] In this embodiment, the control module 10 is further configured to send a result acquisition instruction to the sub - processing module 20, and acquire the preset operation result based on the result acquisition instruction.

[0078] It should be understood that after the sub - processing module 20 receives the synchronization pulse sent by the control module 10, the operation state of the process or thread corresponding to the preset operation instruction will change from ready to interrupted. When receiving the preset operation result sent by the terminal module 30, the operation state of the original process or thread will resume to ready. When the control module 10 detects that the operation states of the processes or threads of each sub - processing module 20 are ready, it will send a result acquisition instruction to the sub - processing module 20 and acquire the preset operation result based on the result acquisition instruction.

[0079] In this embodiment, the control module 10 sends one or more preset operation instructions to the sub-processing module 20. The sub-processing module 20 receives the preset operation instructions sent by the control module 10. The control module 10 sends a synchronization pulse to the sub-processing module 20, and the sub-processing module 20 responds to the synchronization pulse and sends the preset operation instructions to the terminal module 30, thus achieving synchronous instruction sending and receiving. The terminal module 30 receives the preset operation instructions sent by the sub-processing module 20, executes the preset operation instructions to obtain a preset operation result, and sends the preset operation result to the sub-processing module 20. The sub-processing module 20 receives the preset operation result sent by the terminal module 30 and caches the preset operation result in the internal storage. The control module 10 sends a result acquisition instruction to the sub-processing module 20 and obtains the preset operation result based on the result acquisition instruction, thus achieving synchronous reading and writing of instruction operation results. By adding a corresponding sub-processing module 20 between the control module 10 and one or more terminal modules 30, the load of the control module 10 is reduced, enabling the control unit of the terminal device to focus more on business processing to improve the overall performance, and thus achieving data synchronization at low cost and reducing the requirements for hardware performance and cost during the data synchronization process.

[0080] Based on the first embodiment of the data synchronization system of the present application, a second embodiment of the data synchronization system of the present application is proposed. In the second embodiment of the data synchronization system of the present application, the same or similar content as that in the first embodiment of the above data synchronization system can be referred to the above introduction and will not be elaborated hereinafter. On this basis, please refer to Figure 3 , Figure 3 which is the structural block diagram of the second embodiment of the data synchronization system of the present application.

[0081] In this embodiment, two interaction channels are established between the control module 10 and the sub-processing module 20, namely an instruction sending and receiving channel 40 and a signal synchronization channel 50.

[0082] It should be noted that the instruction sending and receiving channel 40 is a communication port that can perform multi-master control. The control module 10 can be connected to one or more sub-processing modules 20 through a communication port led out from the main control chip. The communication port can specifically be a serial communication port such as RS-485 and CAN, etc. The signal synchronization channel 50 is used to send synchronization signals and works in coordination with the instruction sending and receiving channel 40 to ensure synchronous instruction sending and receiving and synchronous data reading and writing.

[0083] In this embodiment, the instruction sending and receiving channel 40 is used for the control module 10 to broadcast and send preset operation instructions to the sub-processing module 20.

[0084] It should be understood that after receiving an operation request from the user, the control module 10 generates preset operation instructions based on the user's operation request and broadcasts these operation instructions to each sub-processing module 20 so that the sub-processing modules 20 can receive the preset operation instructions simultaneously. After the preset operation instructions are executed, the control module 10 will also retrieve the execution results through the instruction transceiver channel 40.

[0085] In this embodiment, the signal synchronization channel 50 is used for the control module 10 to send synchronization pulses to the sub-processing module 20.

[0086] It should be understood that when the control module 10 issues preset operation instructions, the sub-processing module 20 will enter the ready state after receiving the preset operation instructions. The control module 10 needs to send a synchronization pulse to the sub-processing module 20 to trigger an interrupt so that the sub-processing module 20 can send the preset operation instructions to the corresponding connected terminal module 30.

[0087] In a specific implementation, the hardware architecture diagram can be as Figure 4 shown. The control module 10 corresponds to the main control CPU, the sub-processing module 20 corresponds to the single-chip microcomputer, the terminal module 30 corresponds to the terminal device, the instruction transceiver channel 40 transmits the preset operation instructions and preset operation results in the form of CAN signals (CAN-H and CAN-L), and the signal synchronization channel 50 transmits the synchronization pulses in the form of SYNC signals. When data needs to be collected, the address and type of the terminal device connected to each single-chip microcomputer need to be set during initialization. The main control CPU will send the data collection instructions (i.e., preset operation instructions) to each single-chip microcomputer in a broadcast manner through the CAN bus. After all the single-chip microcomputers are ready for the data collection instructions, the main control CPU sends a synchronization pulse through the SYNC channel. The synchronization pulse will trigger the interrupt of the single-chip microcomputer so that the single-chip microcomputer can send the data collection instructions to the terminal device. The single-chip microcomputer caches the data collection results returned by the terminal device received in the internal storage and changes the operation state from interrupt to ready. After the main control CPU checks that the operation states of all single-chip microcomputers are ready, it retrieves all the data collection results through the CAN bus, thus completing a data synchronization operation. In this process, the slow reading and writing of the terminal device are taken over by the single-chip microcomputer, releasing the resources of the main control CPU and thus improving the overall performance.

[0088] In this embodiment, two interaction channels are established between the control module 10 and the sub-processing module 20, namely the instruction transceiver channel 40 and the signal synchronization channel 50. The control module 10 broadcasts and sends preset operation instructions to the sub-processing module 20 through the instruction transceiver channel 40 and sends synchronization pulses to the sub-processing module 20 through the signal synchronization channel 50 to achieve synchronous sending and receiving of instructions to the terminal module 30 and synchronous reading and writing of instruction operation results, reducing the coupling degree between the control unit 10 and the terminal module 30 and reducing the direct dependency relationship between the hardware, which is beneficial to the subsequent maintenance of the system and the expansion of the device.

[0089] Further, referring to Figure 5 , Figure 5 which is a schematic flowchart of the first embodiment of the data synchronization method of the present application. The data synchronization method is applied to a data synchronization system, and the data synchronization system includes: a control module, at least one sub-processing module connected to the control module, and an end module corresponding to the sub-processing module;

[0090] The data synchronization method includes steps S10 to S70:

[0091] Step S10, the control module sends a preset operation instruction to the sub-processing module, where the preset operation instruction can be one or more;

[0092] It should be noted that this embodiment is used for the data synchronization link. Data synchronization includes instruction transceiver synchronization and instruction operation result read / write synchronization. In the instruction transceiver synchronization stage, the end module receives one or more preset operation instructions from the control module forwarded by the sub-processing module; in the instruction operation result read / write synchronization stage, the control module obtains the result of the end module executing the preset operation instruction from the sub-processing module. The preset operation instruction is an operation instruction that needs to be synchronized, and specifically can be a data acquisition instruction.

[0093] It should be understood that the control module is responsible for generating, managing, and distributing instructions. Specifically, the control module includes the main control CPU of the terminal device, which is responsible for the control, data acquisition, and communication of the entire system in the power automation system. When the user synchronously acquires data of multiple on-site energy-consuming devices, it is necessary to first send a data synchronization acquisition request to the main control CPU through the interaction interface. The main control CPU will generate a data acquisition instruction, that is, a preset operation instruction, based on the data synchronization acquisition request, and send the data acquisition instruction to the sub-processing module corresponding to each device.

[0094] Step S20, the sub-processing module receives the preset operation instruction sent by the control module;

[0095] It should be noted that the sub-processing module can be a single-chip microcomputer, whose processing performance is lower than that of the main control CPU, but it has the advantages of simple architecture and low power consumption.

[0096] In a feasible implementation manner, after the sub-processing module receives the preset operation instruction sent by the control module, it further includes steps A1 to A2:

[0097] Step A1, when the preset operation instruction received by the sub-processing module is one, the sub-processing module allocates a corresponding thread or process to the single preset operation instruction;

[0098] Step A2, when the sub - processing module receives multiple preset operation instructions, it establishes a preset instruction queue based on the multiple preset operation instructions and allocates corresponding threads or processes to the preset instruction queue.

[0099] It should be noted that when synchronously collecting data from one or more devices, there are two specific application scenarios: single - trigger and cyclic - trigger. Among them, a single preset operation instruction corresponds to the single - trigger scenario, and multiple preset operations correspond to the cyclic - trigger scenario. When a user needs to perform real - time data collection on on - site energy - using devices, the single - trigger method can be used to ensure a quick response to operation instructions, such as in scenarios where it is necessary to immediately obtain real - time energy consumption data or device status information at a specific time point; when a user needs to perform periodic data collection on on - site energy - using devices, the cyclic - trigger method can be used to store multiple operation instructions in a queue to ensure the long - term execution of operation instructions in chronological order, such as in scenarios where it is necessary to collect energy consumption data or device status information regularly every day, week, or month for statistical analysis.

[0100] It should be understood that during the process of synchronously collecting data from on - site energy - using devices, when the types of devices are too numerous and the processing tasks of the main control CPU are relatively complex, if the main control CPU uses multi - thread or multi - process methods to let each thread or process independently control the corresponding ports to control multiple ports for data collection of each device, it is very easy for the main control CPU's performance to be insufficient, resulting in blocking of processes or threads, thus causing the failure of data synchronous collection. By adding a low - cost single - chip microcomputer between the main control CPU and each terminal device, and each single - chip microcomputer independently schedules a single process or thread, the load of the main control CPU can be reduced.

[0101] Step S30, the control module sends a synchronization pulse to the sub - processing module;

[0102] It should be noted that after the control module sends a preset operation instruction to the sub - processing module, it is also necessary to send a synchronization pulse to the sub - processing module through a hardware channel to trigger the forwarding operation of the preset operation instruction by the sub - processing module.

[0103] Specifically, the step of the control module sending a synchronization pulse to the sub - processing module further includes: the control module traverses the operation status of all the preset operation instructions received by the sub - processing module; when the control module detects that the operation status of all the preset operation instructions received by the sub - processing module is ready, it sends the synchronization pulse to all the sub - processing modules, so that the operation status of the preset operation instruction changes to interrupted.

[0104] It should be understood that after the control module sends a preset operation instruction to the sub - processing module, it is necessary to traverse the operation status of the preset operation instructions received by all sub - processing modules. The traversal method can be polling, that is, regularly accessing each sub - processing module to query the operation status of the preset operation instruction in the sub - processing module. Only when it is detected that the operation status of all preset operation instructions is ready, will the control module send a synchronization pulse to all sub - processing modules. When the sub - processing module receives the synchronization pulse, an interrupt will be triggered.

[0105] Step S40, the sub - processing module responds to the synchronization pulse and sends the preset operation instruction to the terminal module;

[0106] It should be noted that during initialization, the addresses and types of the terminal modules connected to each sub - processing module need to be set properly to ensure that the sub - processing module can correctly identify the corresponding connected terminal module and communicate. The terminal module can be different types of terminal devices for collecting different types of data, specifically, it can be a temperature sensor, a humidity sensor, a pressure sensor, etc. When it is necessary to add or replace a terminal device, the configuration process can be simplified through the defined addresses and types. When the single - chip microcomputer receives the synchronization pulse sent by the main control CPU, it will send the operation instruction to be synchronized to the corresponding connected terminal device to achieve the synchronization operation of the instruction.

[0107] Step S50, the terminal module receives the preset operation instruction sent by the sub - processing module, executes the preset operation instruction to obtain a preset operation result, and sends the preset operation result to the sub - processing module;

[0108] It should be understood that after the terminal module receives the preset operation instruction sent by the sub - processing module and executes the preset operation instruction, a preset operation result will be obtained. Specifically, if the executed preset operation instruction is a data acquisition instruction, after obtaining the data acquisition result, the terminal module will send the data acquisition result to the sub - processing module.

[0109] Step S60, the sub - processing module receives the preset operation result sent by the terminal module and caches the preset operation result in the internal storage;

[0110] Specifically, the sub - processing module receives the preset operation result sent by the terminal module and caches the preset operation result in the internal storage, including: the sub - processing module receives the preset operation result sent by the terminal module, records the time stamp when receiving the preset operation result, and caches the preset operation result with the time stamp in the internal storage.

[0111] It should be noted that when the sub - processing module receives the preset operation result sent by the terminal module, when storing the preset operation result, it will correspondingly store the time stamp when receiving the preset operation result. When there are multiple preset operation instructions, the corresponding preset operation results after execution are also multiple. At this time, a FIFO (First In First Out) data queue will be established inside the sub - processing module to cache the results of multiple operations. As Figure 3 shown, after the terminal device receives the operation instruction queue sent by the single - chip microcomputer and executes it in order, it will send back the execution result corresponding to the operation instruction queue to the single - chip microcomputer. The single - chip microcomputer records the time stamp of receiving each operation result and establishes a data queue based on the operation result and the corresponding time stamp, and stores the data queue in the internal storage. The main control CPU can perform system performance analysis, fault troubleshooting, and corresponding debugging through the accurate time information of the data received by the time stamp record, so as to better master and analyze the system operation situation.

[0112] Step S70, the control module sends a result acquisition instruction to the sub - processing module, and acquires the preset operation result based on the result acquisition instruction.

[0113] It should be understood that after the sub - processing module receives the synchronization pulse sent by the control module, the operation state of the process or thread corresponding to the preset operation instruction will change from ready to interrupted. When receiving the preset operation result sent by the terminal module, the operation state of the original process or thread will resume to ready. When the control module detects that the operation states of the processes or threads of each sub - processing module are ready, it will send a result acquisition instruction to the sub - processing module and acquire the preset operation result based on the result acquisition instruction.

[0114] In this embodiment, the control module sends one or more preset operation instructions to the sub - processing module. The sub - processing module receives the preset operation instructions sent by the control module. The control module sends a synchronization pulse to the sub - processing module, and the sub - processing module responds to the synchronization pulse and sends the preset operation instruction to the terminal module to achieve instruction sending and receiving synchronization; the terminal module receives the preset operation instruction sent by the sub - processing module, executes the preset operation instruction, obtains the preset operation result, and sends the preset operation result to the sub - processing module. The sub - processing module receives the preset operation result sent by the terminal module and caches the preset operation result in the internal storage. The control module sends a result acquisition instruction to the sub - processing module and acquires the preset operation result based on the result acquisition instruction to achieve instruction operation result reading and writing synchronization. By adding corresponding connected sub - processing modules in the control module and one or more terminal modules, the load of the control module is reduced, so that the control unit of the terminal device can focus more on business processing to improve the overall performance, and thus achieve data synchronization at low cost, reducing the requirements for hardware performance and cost in the data synchronization process.

[0115] Based on the first embodiment of the data synchronization method of the present application, the second embodiment of the data synchronization method of the present application is proposed. In the second embodiment of the data synchronization method of the present application, the content that is the same as or similar to the first embodiment of the above data synchronization method can be referred to the above introduction and will not be repeated hereinafter. On this basis, please refer to Figure 6 , Figure 6 which is a schematic flowchart of the second embodiment of the data synchronization method of the present application.

[0116] In this embodiment, two interaction channels are established between the control module and the sub-processing module, namely an instruction transceiver channel and a signal synchronization channel; step S10 further includes step S11, and step S30 further includes step S31:

[0117] Step S11, the control module broadcasts and sends a preset operation instruction to the sub-processing module through the instruction transceiver channel;

[0118] It should be noted that the instruction transceiver channel is a communication port that can perform multi-master control. The control module can be connected to one or more sub-processing modules through the communication port led out on the main control chip. The communication port can specifically be a serial communication port such as RS-485 and CAN, etc. The signal synchronization channel is used to send synchronization signals and works in coordination with the instruction transceiver channel to ensure instruction transceiver synchronization and data read / write synchronization.

[0119] It should be understood that when receiving an operation request from the user, the control module will generate a preset operation instruction based on the user's operation request and broadcast these operation instructions to each sub-processing module so that the sub-processing module can receive the preset operation instruction simultaneously. After the preset operation instruction is executed, the control module will also retrieve the execution result through the instruction transceiver channel.

[0120] Step S31, the control module sends a synchronization pulse to the sub-processing module through the signal synchronization channel.

[0121] It should be understood that the control module issues a preset operation instruction. After the sub-processing module receives the preset operation instruction, it will enter the ready state. The control module needs to send a synchronization pulse to trigger an interrupt to the sub-processing module so that the sub-processing module can send the preset operation instruction to the corresponding connected end module.

[0122] In a specific implementation, the hardware architecture diagram can be as Figure 4As shown, the control module corresponds to the main control CPU, the sub-processing module corresponds to the single-chip microcomputer, the terminal module corresponds to the terminal device, the instruction transceiver channel transmits preset operation instructions and preset operation results in the form of CAN signals (CAN-H and CAN-L), and the signal synchronization channel transmits synchronization pulses in the form of SYNC signals. When data needs to be collected, the addresses and types of the terminal devices connected to each single-chip microcomputer need to be set during initialization. The main control CPU will send data collection instructions (i.e., preset operation instructions) to each single-chip microcomputer in a broadcast manner through the CAN bus. After all the data collection instructions of the single-chip microcomputers are ready, the main control CPU sends a synchronization pulse through the SYNC channel. The synchronization pulse will trigger an interrupt of the single-chip microcomputer, so that the single-chip microcomputer can send the data collection instructions to the terminal device. The single-chip microcomputer caches the data collection results returned by the terminal device received in the internal memory and changes the operation state from interrupt to ready. After the main control CPU checks that the operation states of all single-chip microcomputers are ready, it retrieves all the data collection results through the CAN bus, thus completing a data synchronization operation. In this process, the slow reading and writing of the terminal device are taken over by the single-chip microcomputer, releasing the resources of the main control CPU, thereby improving the overall performance.

[0123] In this embodiment, two interaction channels are established between the control module and the sub-processing module, namely the instruction transceiver channel and the signal synchronization channel. The control module broadcasts and sends preset operation instructions to the sub-processing module through the instruction transceiver channel, and sends synchronization pulses to the sub-processing module through the signal synchronization channel to achieve synchronous sending and receiving of instructions for the terminal module and synchronous reading and writing of instruction operation results, reducing the coupling degree between the control unit and the terminal module, reducing the direct dependency relationship between hardware, and being conducive to the subsequent maintenance of the system and the expansion of equipment.

[0124] It should be noted that the above examples are only for understanding this application and do not constitute a limitation to the data synchronization method of this application. Based on this technical concept, more forms of simple transformation are within the protection scope of this application.

[0125] The above are only some embodiments of this application, and do not limit the patent scope of this application accordingly. All equivalent structural transformations made under the technical concept of this application by using the content of the specification and drawings of this application, or directly / indirectly applied in other related technical fields are included in the patent protection scope of this application.

Claims

1. A data synchronization system, characterized in that: The data synchronization system comprises: a control module, at least one sub-processing module and an end module, wherein the control module is connected to at least one sub-processing module, and the sub-processing module is connected to a corresponding end module; The control module is used to send a preset operation instruction to the sub-processing module, wherein the preset operation instruction is one or more; The sub-processing module is used to receive the preset operation instruction sent by the control module; The control module is further configured to traverse the operation states of the processes or threads corresponding to the preset operation instructions received by all the sub-processing modules; The control module is further configured to, when detecting that the operation status of the process or thread corresponding to the preset operation instruction received by all the sub-processing modules is ready, send a synchronization pulse to all the sub-processing modules, so that the operation status of the process or thread corresponding to the preset operation instruction is changed to interrupt; The sub-processing module is further used to respond to the synchronization pulse and send the preset operation instruction to the end module; The end module is used to receive the preset operation instruction sent by the sub-processing module, execute the preset operation instruction, obtain a preset operation result, and send the preset operation result to the sub-processing module; The sub-processing module is further configured to receive the preset operation result sent by the end module and cache the preset operation result in an internal storage; after receiving the preset operation result sent by the end module, restore the operation state of the process or thread corresponding to the preset operation instruction from interrupt to ready; The control module is further configured to send a result acquisition instruction to the sub-processing module when detecting that the operation status of the process or thread corresponding to the preset operation instruction is ready, and acquire the preset operation result based on the result acquisition instruction.

2. The system according to claim 1, characterized in that The sub-processing module is further configured to allocate a corresponding thread or process to a single preset operation instruction when the received preset operation instruction is one; The sub-processing module is further configured to, when a plurality of preset operation instructions are received, establish a preset instruction queue based on the plurality of preset operation instructions, and allocate a corresponding thread or process to the preset instruction queue.

3. The system according to claim 1, characterized in that Two interactive channels are established between the control module and the sub-processing module, namely, an instruction receiving and sending channel and a signal synchronization channel; The instruction transceiver channel is used for the control module to broadcast and send preset operation instructions to the sub-processing module; The signal synchronization channel is used for the control module to send a synchronization pulse to the sub-processing module.

4. The system according to claim 1, characterized in that The sub-processing module is further used to receive the preset operation result sent by the end module, record the time stamp of receiving the preset operation result, and cache the preset operation result with the time stamp in the internal storage.

5. A data synchronization method, characterized in that: The data synchronization method is applied to a data synchronization system, the data synchronization system comprising: a control module, at least one sub-processing module connected to the control module, and an end module corresponding to the sub-processing module; the data synchronization method comprises: The control module sends a preset operation instruction to the sub-processing module, wherein the preset operation instruction is one or more; The sub-processing module receives the preset operation instruction sent by the control module; The control module traverses the operation states of the processes or threads corresponding to the preset operation instructions received by all the sub-processing modules; When the control module detects that the operation status of the process or thread corresponding to the preset operation instruction received by all the sub-processing modules is ready, the control module sends a synchronization pulse to all the sub-processing modules to change the operation status of the process or thread corresponding to the preset operation instruction to interrupt; The sub-processing module sends the preset operation instruction to the end module in response to the synchronization pulse; The end module receives the preset operation instruction sent by the sub-processing module, executes the preset operation instruction, obtains a preset operation result, and sends the preset operation result to the sub-processing module; The sub-processing module receives the preset operation result sent by the end module, and caches the preset operation result in the internal storage; after receiving the preset operation result sent by the end module, the operation state of the process or thread corresponding to the preset operation instruction is restored from interrupt to ready; When the control module detects that the operation status of the process or thread corresponding to the preset operation instruction is ready, the control module sends a result acquisition instruction to the sub-processing module, and acquires the preset operation result based on the result acquisition instruction.

6. The method according to claim 5, characterized in that After the sub-processing module receives the preset operation instruction sent by the control module, it also includes: When the sub-processing module receives one preset operation instruction, it allocates a corresponding thread or process to the single preset operation instruction; When the sub-processing module receives a plurality of preset operation instructions, it establishes a preset instruction queue based on the plurality of preset operation instructions and allocates a corresponding thread or process to the preset instruction queue.

7. The method according to claim 5, characterized in that Two interactive channels are established between the control module and the sub-processing module, namely, an instruction receiving and sending channel and a signal synchronization channel; The control module sends a preset operation instruction to the sub-processing module, including: the control module broadcasts the preset operation instruction to the sub-processing module through the instruction transceiver channel; The control module sends a synchronization pulse to the sub-processing module, including: the control module sends a synchronization pulse to the sub-processing module through the signal synchronization channel.

8. The method according to claim 5, characterized in that The sub-processing module receives the preset operation result sent by the end module and caches the preset operation result in an internal storage, including: The sub-processing module receives the preset operation result sent by the end module, records the time stamp of receiving the preset operation result, and caches the preset operation result with the time stamp in an internal storage.

Citation Information

Patent Citations

  • Information synchronization method, load device, unmanned aerial vehicle, system and storage medium

    CN111279637A

  • Microsecond charge-discharge synchronous control method and system

    CN114422287A