Convenient method for writing IEC-61131-3 program by using equipment configuration information
By using variable name replacement and restoration operations, the IEC program logic and device configuration are decoupled, solving the problem that users need to debug multiple versions of code under different device configurations. It enables flexible replacement of logical variables and IO variables, ensuring program continuity and robustness, and improving programming flexibility and system maintenance convenience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CLP INTELLIGENT TECH CO LTD
- Filing Date
- 2024-10-15
- Publication Date
- 2026-04-17
AI Technical Summary
Existing technologies lack methods for automatically identifying device channels and generating IO variables for PLCs, which requires users to debug multiple versions of code under different device configurations. Furthermore, changes in IO variables when device configurations change necessitate adjustments to the logic code, resulting in a lack of flexibility and robustness.
By performing variable name replacement and restoration operations, the IEC program logic and device configuration are decoupled. The variable mapping module, replacement execution module, configuration change monitoring module, and variable restoration module are used to dynamically manage the replacement and restoration of logical variables and IO variables, ensuring program continuity and robustness.
Without changing the program logic, it enables flexible replacement of logical variables and I/O variables, adapts to configuration changes, ensures the continuity and robustness of program operation, reduces user workload, and improves programming flexibility and system maintenance convenience.
Smart Images

Figure CN121879729A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial automation control technology in the industrial control field. It provides a convenient method in logic programming configuration software, allowing users to more easily program PLCs using equipment configuration information. This method aims to reduce the user's focus on equipment configuration during programming, improve the flexibility and robustness of PLC control software programming and equipment configuration, and reduce the coupling between user logic programming and equipment configuration. To achieve decoupling between program logic and equipment configuration, a method for variable name replacement and restoration is provided. An IEC program logic and equipment configuration decoupling method is implemented through a variable name management mechanism. This method can efficiently achieve dynamic decoupling between program logic and equipment configuration under the IEC-61131-3 standard. Through this method, users can flexibly adjust the equipment configuration without modifying the code logic, while ensuring the continuity and robustness of the program logic. The core of this method is to construct a set of variable name maintenance and variable association methods. Modifying the names of IO variables mapped by channels, by replacing the IO variable names with logical variable names, achieves decoupling between program logic and configuration relationships during upper-level computer logic programming. Background Technology
[0002] In PLC-based industrial automation control software, information interaction between the PLC and other configured devices is primarily achieved through the establishment of multiple channels. Currently, most logic programming configuration software allows users to specify variables in the code as data exchange entry / exit points for a particular channel. Users need to associate these logic variables with the channels after writing the logic code, increasing their workload. There is a lack of a method where the logic configuration software automatically identifies the configured device channels and generates PLC-oriented I / O variables, allowing users to directly reference these variable names during programming. Users of logic programming configuration software often need to debug situations where the same version of program code controls different configured devices in different scenarios. The method of automatically generating I / O variables for device configurations will automatically change the I / O variables when the device configuration changes, requiring users to adjust the logic code to adapt to the changes and write multiple versions of code for different scenarios. Currently, there is a lack of a logic programming configuration method for automatically generating I / O variables, and a method to pre-configure multiple device configurations for flexible replacement, ensuring that a unified version of logic code can adapt to multiple configurations simultaneously. Summary of the Invention
[0003] To address the aforementioned problems, this invention provides a method for decoupling IEC program logic from device configuration through variable name substitution and restoration operations. This method enables flexible substitution of logic variable and I / O variable names without altering the program logic, and automatically restores the logic variable names when configuration changes, ensuring the continuity and robustness of program operation. Attached Figure Description
[0004] The Figure 1 This is a schematic diagram of the overall processing flow of the variable decoupling software; The Figure 2 It is a graph showing the relationship between variables and channels; The Figure 3 It is a graph for creating logical variables; The Figure 4 This is a diagram of the variable name replacement process. Detailed Implementation
[0005] This software aims to efficiently manage the mapping and substitution relationships between logical variables and I / O variables in a PLC control system, ensuring programming flexibility and system maintenance convenience. The core software consists of four modules: a variable mapping module, a substitution execution module, a configuration change monitoring module, and a variable restoration module. These modules work closely together to achieve a dynamic management mechanism for variable names. Specifically, based on user manual operation or system preset conditions, the software replaces logical variable names with I / O variable names and deletes the logical variables. When the configuration changes, the logical variables are restored from the station, thus decoupling I / O variables from global variables in the logic configuration software. The software implements these functions through the following modules: 1. IO Variable Definition Module: Used to establish the mapping relationship between logical variables and IO variables, including the binding of variable data such as data type and address; 2. Replace execution module: Based on user operation or system preset conditions, replace the logical variable name with the corresponding IO variable name, and delete the logical variable; 3. Configuration Change Monitoring Module: Monitors configuration changes of the PLC configuration control system in real time; 4. Variable Restoration Module: After detecting a configuration change, the module automatically restores the replaced logical variables (i.e., restores their names) and re-establishes references in the program based on the previously established name correspondence, ensuring the continuity and correctness of program operation. 5. Replacement Information Configuration Hardware Configuration Storage Backup Module: When exporting hardware configuration, the exported information includes replacement information and hardware configuration settings. When importing hardware configuration, the logical variable information for IO variable replacement is processed. If there are logical variables with the same name and data type, replacements are recreated. If there is no replacement logical variable information in the logical variable table, the program automatically creates replacement logical variable information. If the number of variable entries in the logical variable table exceeds 3000, the program cannot create any more replacement logical variables, so the variable information without replacements is deleted from the replacement list and the replacement information before the IO variables is canceled. Users can quickly select the variable information to be replaced by searching on the displayed replacement logical variable or IO variable list page.
Claims
1. A convenient method for IEC-61131-3 program writing with device configuration information, characterized in that: The logic configuration software automatically identifies and defines PLC-oriented I / O variables for configured devices. Users can directly reference I / O variable names when writing code. When the device configuration changes, the definition of the I / O variables is automatically modified. A management mechanism for replacing and restoring logic variables and I / O variables is provided. In the compiled logic code, logic variables replace I / O variables. When the device configuration corresponding to the replaced I / O variable changes, the original logic variable is automatically restored, and a new I / O variable is defined, ensuring that the logic of the code is consistent with that before the configuration change. Furthermore, a method is provided for adapting the same version of logic code to multiple preset configurations. The execution characteristics of this method are as follows: (1) The PLC-oriented I / O variables can be automatically defined for the user for the channel between the PLC and the configured device; (2) Construct a method for replacing and restoring IO variables using logical variables; (3) Based on (2), this software allows users to select specific IO variables and specify that they are replaced by logical variables that meet the conditions. The replaced logical variables have all the characteristics of the original IO variables and logical variables. (4) The software maintains a replacement flag for each "replaced" IO variable, and the replaced variables are marked with a special icon in the software; (5) The configuration replacement relationship still exists after the project with replacement information based on the above characteristics is saved; (6) The software will monitor the configuration changes of the equipment in real time. When the logic variables involved in the replacement are affected, the software will automatically start the logic variable restoration process, automatically restore the original logic variables, define new IO variables, and ensure that the logic code is consistent with the logic before the configuration change. (7) Backup data of the above configuration information and replacement and restoration information can be generated outside the software, which can be used by users to quickly create configurations and match programs; (8) The software uses the above backup data restoration function. The same version of logic code can support the backup data of multiple versions (7), which can be used by users to quickly adapt the same version of logic code to different configurations.
2. According to claim 1, feature 1, the software identifies the device it is configured for and generates PLC-oriented IO variables, the types of variables generated include: Boolean type, unsigned 1-byte integer, signed 2-byte integer, unsigned 2-byte integer, unsigned 4-byte integer, 4-byte single-precision floating-point type.
3. According to claim 1, features 2 and 3, variables in the logic configuration software that are not replaced can be replaced if they meet the variable name replacement conditions (variable type compatibility, correct address range, variable name replacement relationship not yet determined). The replaced IO variables and logical variables should meet the requirements of claim 1. The specific replacement process is as follows: right-click on the IO variable and replace the logical variable. If there are "unreplaced" logical variables of the same type as the IO variable in the logical variables, a list of logical variables of the same type will pop up. Select the logical variable to be replaced, and the system will automatically assign the name of the logical variable to the IO variable for renaming. Then delete the logical variable. After the replacement relationship is established, the variable information of the logical variable is consistent with the replaced IO variable. If there are no unreplaced logical variables of the same type in the logical variables, the software will automatically create logical variables that meet the conditions and perform the operation in (1) above. Right-click on the logical variable and replace the IO variable. Information on IO variables of the same type will pop up. Select the IO variable to be replaced, and the system will automatically assign the name of the logical variable to the IO variable for renaming. Then delete the logical variable. After establishing the replacement relationship, the information of the logical variable is consistent with that of the replaced IO variable; the replaced logical variable has all the characteristics of the original IO variable and the logical variable; after the logical variable replaces the IO variable, changing the address of the variable (moving or replacing the module) does not affect the replacement relationship.
4. According to claim 1, features 2 and 6, the replaced logical variables can be canceled by right-clicking and selecting the replacement information in the replacement list and right-clicking and deleting, respectively, and the software will automatically perform a restore operation; the specific restore process is as follows: the original logical variables will be automatically restored, new IO variables will be defined, and the logic of the logic code will be consistent with that before the configuration change.
5. The method of claim 1, feature 6, wherein, The software monitors the configuration changes of the equipment in real time. When the changes affect the logical variables that are being replaced, the software automatically starts the logical variable restoration process, automatically restores the original logical variables, defines new IO variables, and ensures that the logic code is consistent with the logic before the configuration change.
6. The method of claim 1, feature 8, wherein If a user needs the same version of logic code to be applicable to different device configurations, the user can replace the logic variables and IO variables in the logic code, and export and store the different device configurations and replacement relationships separately for debugging by users in different scenarios. When the configuration configuration is imported, the existing configuration information in the software is deleted first, and the logic variables that have established replacement and restoration relationships are restored. Then, the configuration information and IO variables are established, and the logic variables are replaced according to the imported replacement and restoration relationships as described in claim 1. After the replacement, the original logic is automatically adapted to the new configuration.