A method for multiple programmable controller cooperative work based on data synchronization

By using a data synchronization method that enables multiple programmable controllers to work together, the problem of a single programmable controller being unable to support complex control programs is solved, achieving efficient variable synchronization and collaborative program operation, and improving system performance.

CN114661293BActive Publication Date: 2026-03-24HANGZHOU DIANZI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-18
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

A single programmable controller is difficult to support the needs of complex control programs, and it is easy to reach hardware bottlenecks when improving performance.

Method used

A method of multi-programmable controllers working together is adopted, which realizes variable synchronization and program collaborative operation among the programmable controllers through data synchronization function blocks and communication protocols.

Benefits of technology

It simplifies the user implementation process, improves the system's synchronization efficiency, reduces waiting time, and enhances the processing capabilities of complex control programs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114661293B_ABST
    Figure CN114661293B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on the method for the cooperative work of multiple programmable controllers of data synchronization, comprising the following steps: S1, variable definition, export variable declaration and program writing;S2, parse program file XML, allocate the variable address of each programmable controller variable, process each pair of export variable relationship;S3, program compilation, the synchronization function block provided by the application is essentially a function function encapsulating synchronization code, but it is transparent to the user, the user does not need to worry about its implementation problem, the implementation of code will be generated according to the difference of export variable and the difference of programmable controller device information;The application uses communication protocol, and the export variable of the same programmable controller is synchronized once, which well solves the problem of too many receiving and transmitting frames caused by synchronizing only a single variable each time, finally makes the waiting time too long.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The embodiment of the present application relates to the field of industrial control, and relates to a method for cooperative work of multiple programmable controllers based on data synchronization. BACKGROUND

[0002] With the continuous development of the field of industrial control, the automation degree is higher and higher, and the control system in the industrial field is more and more complex, and a single programmable controller often cannot support the demand of a complex control program.

[0003] In order to solve the problem that the programmable controller cannot support the demand of a complex control program, the performance of a single programmable controller is improved in the way of perfecting or improving the I / O point number, storage capacity, scanning speed, function and number of instructions, type and number of internal elements, special function unit and expandability of the programmable controller. But this way is easy to reach the bottleneck of hardware.

[0004] Therefore, a method for cooperative work of multiple programmable controllers based on data synchronization is needed, which uses multiple programmable controllers to cooperatively work to complete a system goal, that is, logically the same program, but each programmable controller only contains a part of the program in the physical, and the ability to support complex and variable control program requirements is improved. SUMMARY

[0005] The problem to be solved by the present application is to provide a method for cooperative work of multiple programmable controllers, so that finally each programmable controller only contains a part of the program and can complete the intended goal after cooperative work. Therefore, it is necessary to provide a method for cooperative work of multiple programmable controllers based on data synchronization.

[0006] In order to solve the above technical problem, the technical scheme of the present application is:

[0007] A method for cooperative work of multiple programmable controllers based on data synchronization, comprising the following steps:

[0008] S1, variable definition, export variable declaration and program writing

[0009] S1-1, a user defines variables under a programmable controller device in a variable editing area of the programmable controller device;

[0010] S1-2, a user declares export variables in a variable declaration area of the programmable controller device;

[0011] S1-3, a user writes a program in a code editing area of the programmable controller device, and uses a synchronization function block to represent a data synchronization when writing the program;

[0012] S1-4, saving the written program as a program file XML;

[0013] S2, parsing the program file XML, assigning variable addresses of each programmable controller variable, and processing each pair of export variable relationship;

[0014] S3, program compilation

[0015] S3-1, processing the code in the user code editor in the order of execution, and if a synchronization function block is encountered, then proceeding to step S3-2, otherwise continuing S3-1 until the code compilation is completed;

[0016] S3-2, based on the conversion method of automatically generating code for the synchronization data function block and the communication protocol for synchronization data between different programmable controllers, combining the variable information dictionary, finally obtaining the synchronization code, and adding the synchronization code to the result code after the program file XML is compiled, completing the compilation.

[0017] As a preferred, in the step S1, the variable definition, export variable declaration and program writing are performed for the plurality of programmable controllers.

[0018] As a preferred, in the step S1-3, only when the synchronization function block is used in the program, it means that data synchronization is performed once when the program runs to this place.

[0019] As a preferred, the step S2 includes the following steps:

[0020] S2-1, assigning variable addresses of the defined variables in the order of programmable controller devices;

[0021] S2-2, processing each export variable declaration statement, encapsulating the actual address of the source variable, the byte length of the source variable, the actual address of the destination variable and the IP address of the target device, and storing in the variable information dictionary with the device name as the key and the export variable information list as the value.

[0022] As a preferred, in the step S3-2, the synchronization code method of the synchronization function block is:

[0023] S3-2-1, creating a UDP socket for sending synchronization data;

[0024] S3-2-2, obtaining the export variable information list of the current device through the export variable information dictionary, and for different programmable controller devices, generating synchronization data frames for each programmable controller device according to the export variable information and the data write protocol format;

[0025] S3-2-2, sending synchronization data frames to different PLC devices.

[0026] As a preference, the communication protocol can synchronize multiple variables simultaneously, and the protocol format comprises a start symbol, a frame sequence number, a CRC check, and multiple sets of variable actual address and type information.

[0027] The present application has the following features and advantages:

[0028] 1. Simplicity: the synchronization function block provided by the present application is essentially a function function encapsulating synchronization code, but it is transparent to the user, who does not need to worry about its implementation. The code implementation is automatically generated according to the different exported variables and programmable controller device information.

[0029] 2. Efficiency: the present application uses a communication protocol to synchronize the exported variables of the same programmable controller once, which effectively solves the problem of excessive transmission and reception frames caused by synchronizing only a single variable each time, and ultimately reduces the waiting time. BRIEF DESCRIPTION OF DRAWINGS

[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0031] Figure 1 A framework flowchart of a method for cooperative work of multiple programmable controllers based on data synchronization is provided.

[0032] Figure 2 A conversion method flowchart for automatically generating code for a synchronization data function block of a method for cooperative work of multiple programmable controllers based on data synchronization is provided.

[0033] Figure 3 A communication protocol transmission frame format of a method for cooperative work of multiple programmable controllers based on data synchronization is provided. DETAILED DESCRIPTION

[0034] It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.

[0035] The technical solutions provided by the present application will be further described below with reference to the drawings, and the implementation mode, technical means and operation process of the embodiments of the present application will be completely and clearly described. It should be noted that the embodiments described are not all embodiments, but only some embodiments of the present application.

[0036] The application provides a method for cooperative work of multiple programmable controllers based on data synchronization, as shown in the formula (1). Figure 1 The method comprises the following steps:

[0037] S1, variable definition, export variable declaration and program writing

[0038] S1-1, a user defines variables under a programmable controller device in a variable editing area of the device;

[0039] S1-2, the user declares export variables under the programmable controller device in a variable declaration area, specifically, declares that an x variable of the current programmable controller device is exported to a y variable in a programmable controller device named Device2 in the form of x EXPORTDevice2.y;

[0040] S1-3, the user writes a program in a code editing area of the programmable controller device, and uses a synchronization function block to represent a data synchronization when the program is run to the position, only when the synchronization function block is used in the program, the data synchronization is performed once;

[0041] S1-4, the written program is saved as a program file XML;

[0042] S2, the program file XML is parsed, variable addresses of the programmable controller variables are allocated, and each pair of export variable relations is processed;

[0043] S3, program compilation

[0044] S3-1, the code in the user code editing is processed in an execution order, if a synchronization function block is encountered, step S3-2 is performed, otherwise, S3-1 is continuously performed until the code compilation is completed;

[0045] S3-2, based on a conversion method for automatically generating code for the synchronization data function block and a communication protocol for synchronizing data between different programmable controllers, combined with a variable information dictionary, synchronization code is finally obtained, the synchronization code is added to the result code after the program file XML is compiled, and the compilation is completed.

[0046] In the step S1, the multiple programmable controllers are defined, the export variables are declared, and the program is written.

[0047] Further provided in the application, the step S2 comprises the following steps:

[0048] S2-1, variable addresses of the defined variables are allocated in the order of the programmable controller devices;

[0049] S2-2, processing each derived variable declaration statement, encapsulating the actual address of the source variable, the byte length of the source variable, the actual address of the destination variable and the IP address of the target device, storing in a variable information dictionary with device name as key and derived variable information list as value, facilitating code compilation stage use.

[0050] Specifically, as shown in the figure, Figure 2 The synchronization code method of the synchronization function block in step S3-2 is as follows:

[0051] S3-2-1, creating a UDP socket for sending synchronization data;

[0052] S3-2-2, obtaining the derived variable information list of the current device through the derived variable information dictionary, and generating synchronization data frames for each programmable controller device according to the information of the derived variables and the data writing protocol format for different programmable controller devices.

[0053] S3-2-2, sending synchronization data frames to different PLC devices.

[0054] Further, the communication protocol can synchronize multiple variables at the same time, and the protocol format includes a start symbol, a frame sequence number, a CRC check, and multiple groups of variable actual addresses and type information.

[0055] Specifically, as shown in the figure, Figure 3 The communication protocol sends the frame format as follows: start symbol 2 bytes, data frame number 1 byte, variable actual address 4 bytes, variable byte length 1 byte, variable byte data, and CRC check 2 bytes. The value of the variable type is the variable byte size. If multiple variables are synchronized at the same time, the byte stream of the variable actual address, the variable byte length and the variable byte data is placed in order, and finally the CRC check is added.

[0056] It should be noted that the application uses the data writing protocol to synchronize the derived variables of the same PLC device once, which solves the problem of too many receiving and sending frames caused by synchronizing only a single variable each time, and finally makes the waiting time too long. In addition, the synchronization function block provided by the application is essentially a function function of encapsulating synchronization code, but it is transparent to users, and users do not need to worry about its implementation. The code implementation will be automatically generated according to the differences of the derived variables and the information of the PLC devices.

[0057] The embodiments of the present application are described in detail above with reference to the accompanying drawings, but the present application is not limited to the described embodiments. Various changes, modifications, replacements, and variations of the embodiments including components can be made by those skilled in the art without departing from the principles and spirit of the present application, and still fall within the scope of the present application.

Claims

1. A method for collaborative operation of multiple programmable controllers based on data synchronization, characterized in that, Includes the following steps: S1. Variable definition, derived variable declaration, and program writing S1-1. Users define variables for a programmable logic controller (PLC) device in the variable editing area of ​​the device. S1-2, User-defined area for exporting variables in the programmable controller device; S1-3. When writing programs in the code editing area of ​​the programmable controller device, the user uses the synchronization function block to indicate a data synchronization. S1-4. Save the completed program as a program file XML; S2. Parse the program file XML, allocate variable addresses for each programmable controller variable, and process the relationship between each pair of derived variables; S2-1. Assign variable addresses to the defined variables according to the sequence of programmable controller devices; S2-2. Process each exported variable declaration statement, encapsulate the actual address of the source variable, the byte length of the source variable, the actual address of the destination variable, and the IP address of the target device, and store a variable information dictionary with the device name as the key and the exported variable information list as the value. S3, Program Compilation S3-1. Process the code in the user code editor according to the execution order. If a synchronous function block is encountered, proceed to step S3-2. Otherwise, continue with S3-1 until the code compilation is completed. S3-2. Based on the conversion method of automatically generating code for synchronization data function blocks and the communication protocol for synchronization data between different programmable controllers, combined with the variable information dictionary, the synchronization code is finally obtained and added to the result code after compiling the program file XML to complete the compilation.

2. The method for collaborative operation of multiple programmable controllers based on data synchronization according to claim 1, characterized in that, In step S1, variables are defined, variables are declared, and programs are written for multiple programmable controllers.

3. The method for collaborative operation of multiple programmable controllers based on data synchronization according to claim 1, characterized in that, In steps S1-3, data synchronization only occurs when the program uses a synchronization function block.

4. The method for collaborative operation of multiple programmable controllers based on data synchronization according to claim 1, characterized in that, In step S3-2, the synchronization code method for the synchronization function block is as follows: S3-2-1. Create a UDP socket to send synchronization data; S3-2-2: Obtain the list of exported variable information for the current device through the exported variable information dictionary. For different programmable controller devices, generate a synchronization data frame for each programmable controller device according to the exported variable information and the data writing protocol format. S3-2-2, Send synchronization data frames to different PLC devices.

5. A method for collaborative operation of multiple programmable controllers based on data synchronization according to claim 4, characterized in that, The communication protocol enables multiple variables to be synchronized simultaneously. The protocol format includes a start symbol, frame sequence number, CRC checksum, and multiple sets of actual variable address and type information.

Citation Information

Patent Citations

  • Safety control method of industrial safety PLC

    CN111580454A

  • Compiled PLC controller system based on STM32 processor and implementation method

    CN112269579A