Instruction operation method and development system based on programmable logic controller
By adopting resource manager and interpreter technologies in programmable logic controller development environments, the challenges of traditional development environments in project management, system expansion and integration are solved, efficient project management and data interaction are achieved, system coupling is reduced, and modern development tools are supported, providing a more convenient and efficient PLC project development solution.
Patent Information
- Application Number
- CN202411955171.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-05-16
AI Technical Summary
The traditional programmable logic controller development environment has many challenges in project management, system expansion and integration with existing development tools, including insufficient scalability, tight module coupling, code version management relies on third-party tools, difficulty in transferring across devices, difficulty in supporting multiple PLC brands and models, complex function expansion and customized development.
Use resource managers and interpreters to achieve efficient project management and data interaction, improve project management capabilities, reduce system coupling, and achieve in-depth integration with modern development tools. Specific measures include creating or opening a project, identifying the user programming language through a language interpreter and generating a control program, obtaining and configuring the function block data through a function block interpreter, setting breakpoints and monitoring resources through a data interpreter, and realizing separate interaction between the human-computer interaction interface and the project resource manager and the function resource manager through the interpreter module.
It improves the user's configuration management efficiency of PLC projects and functional blocks, reduces system coupling, realizes deep integration with modern development tools, and provides a more convenient, efficient and flexible PLC project development solution.
Smart Images

Figure CN120010367A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software development, and in particular to an instruction running method and a development system based on a programmable logic controller. Background Art
[0002] In the field of industrial automation control, PLC programming and development are crucial. However, the traditional programmable logic controller development environment faces many challenges in project management, system expansion, and integration with existing development tools. Existing PLC (Programmable Logic Controller) Integrated Development Environment (IDE) usually provides programming tools designed for industrial automation control and supports multiple PLC programming languages. These IDEs usually have the following features: powerful code editing and debugging functions, tight integration with specific brands and models of PLC hardware, rich library and module support, graphical programming interface, real-time monitoring and diagnostic functions, and project management and version control tools. However, these IDEs generally have problems such as insufficient scalability and tight module coupling. Code version management relies on third-party tools and is difficult to transfer across devices. It is difficult to support multiple PLC brands and models, and functional expansion and customized development are difficult.
[0003] In the traditional programmable logic control development environment, there are the following problems:
[0004] Inconvenient project management: There is a lack of effective project storage and management methods, which leads to difficulties in code version management and cross-device transfer. For example, there is no unified project file format, which means that code version management can only rely on third-party tools, and data sharing and management are difficult to achieve when transferring projects between different devices, which seriously affects users' demand for convenient project management.
[0005] Difficult to expand and highly coupled: When the system is expanded, the expansion of new functions becomes complicated due to the inflexible architecture design. The coupling between modules is high, and this close connection is not conducive to the maintenance and upgrade of the system, making it difficult to improve and perfect the system functions.
[0006] Insufficient integration with existing development tools: Traditional PLC IDE designs are often independent software environments that lack cross-platform compatibility and scalability. Users need to write and debug PLC code in a specific environment and cannot fully utilize existing modern development tool chains, such as VSCode. This causes users to frequently switch between different operating environments and tools during use, reducing development efficiency. Summary of the invention
[0007] In order to overcome the defects in the prior art, the present invention provides an instruction running method and a development system based on a programmable logic controller. The development system based on the programmable logic controller adopts a resource manager and an interpreter to achieve efficient project management and data interaction, so as to improve project management capabilities, reduce system coupling and achieve deep integration with modern development tools, providing a more convenient, efficient and flexible solution for PLC project development.
[0008] To achieve the above object, the technical solution adopted by the present invention is: a command operation method based on a programmable logic controller, comprising the following steps:
[0009] Create or open a project;
[0010] Perform engineering operations on the project, including:
[0011] The language interpreter recognizes the user programming language and generates a control program based on the input language code;
[0012] Acquire function block data and configure function block parameters according to user instructions, and apply the configured function block data to the control program;
[0013] According to the user's instructions, the data interpreter sets one or more of the breakpoints, variable monitoring, controller status monitoring, and resource monitoring of the control program;
[0014] The engineering data obtained through engineering operations is translated into a preset file by the data interpreter and the file is stored
[0015] According to user instructions, the interpreter compiles and processes the engineering data;
[0016] According to the user's instructions, the interpreter sends the compiled engineering data to the master device.
[0017] Further, the step of obtaining function block data and configuring function block parameters according to user instructions includes:
[0018] The function block data is obtained from the microservice database according to the user instructions, the function block parameters are configured according to the user instructions, and the function block interpreter transmits the configured function block data to the human-computer interaction interface.
[0019] Furthermore, the step language interpreter recognizes the user programming language and generates a control program including:
[0020] The language interpreter recognizes the programming language input by the user in the human-computer interaction interface and generates a control program according to the rules of the corresponding programming language.
[0021] Furthermore, in the step of the language interpreter identifying the user's programming language, the language interpreter parses the programming code, checks the syntax and generates prompt information.
[0022] Furthermore, during the debugging process, the data interpreter obtains the variable values in the programmable logic controller after the breakpoint and displays them to the user.
[0023] A development system based on a programmable logic controller for executing the above-mentioned instruction execution method based on a programmable logic controller comprises:
[0024] A project explorer, wherein the project explorer is used to create, open or save a project;
[0025] A human-computer interaction interface, the human-computer interaction interface is used to edit code, and the human-computer interaction interface interacts with the project resource manager through an interpreter module;
[0026] An interpreter module, which performs data communication and command interaction with various modules of the development system based on the programmable logic controller through a communication interface;
[0027] A function resource manager, which interacts with the human-computer interaction interface through an interpreter module, and is used to obtain function block data, configure function block parameters, and transmit the configured function block data to the human-computer interaction interface according to user instructions.
[0028] Through the above technical solutions, the development system based on programmable logic controller adopts resource manager and interpreter to realize efficient project management and data interaction, so as to improve project management capabilities, reduce system coupling and realize deep integration with modern development tools, providing more convenient, efficient and flexible solutions for PLC project development.
[0029] Furthermore, the project resource manager includes:
[0030] A project resource management interface, wherein the project resource management interface includes multiple interfaces, and the interfaces at least include create, open, and save operations;
[0031] A project database, which is used to store project data to achieve reliable and persistent data storage. The project data includes project name, creation time, and engineering data;
[0032] A plug-in module is used to adapt the project management system of the development tool. The plug-in module includes a VSCode or VSCodium plug-in, and writing code in the plug-in can realize automated project management operations. For example, writing code in the plug-in realizes the automatic backup function of the project file, and copies the project file to the specified backup directory at a certain time interval.
[0033] Through the above technical solution, the project resource manager can store engineering data in the form of files. When migrating projects across devices, only related files need to be transferred, which improves the convenience of migration.
[0034] Further, the interpreter includes:
[0035] A language interpreter, which is used to parse and execute programming language codes;
[0036] A data interpreter, which is used for data type conversion and data transmission processing;
[0037] A function block interpreter is used to process the operation and scheduling logic of the function block.
[0038] The interpreter is used to realize separate interaction between the human-computer interaction interface and the project resource manager and the function resource manager, thereby ensuring that data at different levels can be accurately transmitted between modules, thereby ensuring the smoothness and accuracy of data flow.
[0039] Furthermore, the human-computer interaction interface includes:
[0040] A development module, based on the language interpreter, the development module at least includes a structured text language, a continuous function chart language, a function module chart language, and a ladder diagram language, and the visualization becomes a window;
[0041] A debugging module is based on the data interpreter, and is used to complete breakpoint setting, variable monitoring setting, controller status monitoring setting, and resource monitoring. The debugging module is communicatively connected with a programmable logic controller.
[0042] Through the above technical solution, the human-computer interaction interface supports multiple programming languages. The debugging module can obtain the operating status information of the programmable logic controller and display it to the user.
[0043] Furthermore, the function resource manager includes:
[0044] A microservice database, wherein the microservice database is used to store function block data;
[0045] Function resource management interface, where the user selects the required function block and configures the function block parameters;
[0046] The functional resource management interface can obtain the functional block data from the microservice database through the microservice, and transmit the configured functional block data to the development module through the functional block interpreter.
[0047] By means of the above technical solution, the beneficial effects of the present invention are as follows:
[0048] 1. In this application, the interpreter module is set to realize the separate interaction between the human-computer interaction interface and the project resource manager and the function resource manager, so as to ensure that data at different levels can be accurately transmitted between various modules, and ensure the smoothness and accuracy of data flow;
[0049] 2. This application uses a customized resource manager and interpreter to optimize the operation process. In the data selection stage, users can easily select predefined data through the function block resource manager; in the engineering operation stage, the editing operations performed by users in the human-computer interaction interface will be automatically stored in the file of the project resource manager through the interpreter; in the operation stage, the interpreter can send the engineering data to the master station device to execute the operation command; through these designs, the user's configuration management efficiency of PLC projects and function blocks is greatly improved.
[0050] In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0052] Figure 1 It is an overall architecture diagram of a development system based on a programmable logic controller in an embodiment of the present invention;
[0053] Figure 2 is a schematic diagram of an interactive interface in an embodiment of the present invention;
[0054] Figure 3 is a configuration flow chart of a development system based on a programmable logic controller in an embodiment of the present invention;
[0055] Figure 4 is a configuration flow chart of a resource manager in an embodiment of the present invention;
[0056] Figure 5 is a configuration flow chart of a function block resource manager in an embodiment of the present invention;
[0057] Figure 6 is a configuration flow chart of the interpreter module in an embodiment of the present invention;
[0058] Figure 7is a configuration flow chart of a human-computer interaction interface in an embodiment of the present invention;
[0059] Figure 8 is a flowchart of system initialization and plug-in loading in an embodiment of the present invention;
[0060] Fig. 9 is a flowchart of project resource management and configuration in an embodiment of the present invention;
[0061] Fig.10 is a flow chart of resource acquisition and configuration of functional blocks in an embodiment of the present invention;
[0062] Fig.11 is a flow chart of project resource management configuration in an embodiment of the present invention;
[0063] Fig.12 It is a flow chart of project compilation and operation in an embodiment of the present invention. DETAILED DESCRIPTION
[0064] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0065] It should be noted that, in the description of the present invention, the terms "first", "second", etc. are only used for descriptive purposes and to distinguish similar objects. There is no order of precedence between the two, and they cannot be understood as indicating or implying relative importance. In addition, in the description of the present invention, unless otherwise specified, "plurality" means two or more.
[0066] Embodiment: Embodiment 1 discloses a method for executing instructions based on a programmable logic controller, comprising the following steps:
[0067] Create or open a project and perform engineering operations on the project, including:
[0068] Acquire function block data from the microservice database according to user instructions, configure function block parameters according to user instructions, and the function block interpreter transmits the configured function block data to the human-computer interaction interface;
[0069] The language interpreter recognizes the programming language input by the user in the human-computer interaction interface and generates a control program according to the rules of the corresponding programming language. The language interpreter can also parse the programming code, check the syntax and generate prompt information;
[0070] According to the user instruction, the data interpreter completes one or more of breakpoint setting, variable monitoring setting, controller status monitoring setting, and resource monitoring setting;
[0071] During debugging, the data interpreter obtains the variable values in the PLC after the breakpoint and displays them to the user;
[0072] The engineering data obtained through engineering operations are translated by a data interpreter and stored in the form of files;
[0073] According to user instructions, the interpreter compiles and processes the engineering data;
[0074] According to user instructions, the interpreter sends the compiled engineering data to the master station device for execution.
[0075] Embodiment 2 discloses a development system based on a programmable logic controller for executing the above-mentioned instruction execution method based on a programmable logic controller, comprising:
[0076] Project resource management module, including project resource manager, such as Figure 4 As shown, the configuration process of the resource manager is as follows:
[0077] Formulate project operation procedures and file storage structure, and design file formats to support the storage and management of PLC project data. For example, the file header contains basic information about the project, such as project name, creation time, etc., and the main body of the file stores PLC program code, configuration parameters and other data according to specific logic;
[0078] Develop interfaces that support project management, including project creation, opening, saving, and other operations. Create a project resource management interface by calling the relevant interface functions of VSCode or VSCodium. When the user clicks the Create Project button, the relevant files are initialized in the background according to the predetermined file storage structure;
[0079] By writing VSCode or VSCodium plug-ins, automated project management operations can be achieved. For example, you can write code in the plug-in to implement the automatic backup function of project files and copy project files to the specified backup directory at a certain time interval.
[0080] To ensure reliable and persistent storage of project data, design a database or file system to store all project-related data. This includes project files, tags, and various data points in the iteration process, ensuring that the accurate environment state can be restored no matter which step of the project development process is loaded.
[0081] Through the above technical solution, the project resource manager can store engineering data in the form of files. When migrating projects across devices, only related files need to be transferred, which improves the convenience of migration.
[0082] Function block resource management module, including function block resource manager, such as Figure 5 As shown, the configuration process of the function block resource manager is as follows:
[0083] Design the data model of the function block, including the definition of function block attributes, interface specifications, behavior logic, etc. For example, for a motor control function block, its attributes include motor speed, direction, etc., the interface includes control signal input, status signal output, etc., and the actions include start, stop, speed regulation, etc.;
[0084] Create a microservice database to store function block information, and write file read and write functions to implement the import and export operations of function blocks.
[0085] Design the function block resource management interface and provide a search box and editing area on the function block resource management interface to facilitate user operation;
[0086] By calling the microservice-based interface to connect to the function block in the microservice database, the function block resource manager can obtain the remotely hosted function block resources. This makes the plug-in not have to integrate the entire function block code, thereby enhancing its flexibility;
[0087] Combined with the plugin system of VSCode or VSCodium, a graphical interface is provided for function block management. Through this interface, users can manage function blocks like managing source code files, such as adding, deleting, renaming or organizing function blocks. In addition, when it is necessary to add new function blocks and call function blocks, it can be implemented directly in the plugin without leaving the IDE environment.
[0088] Interpreter modules such as Figure 6 As shown, the interpreter module includes:
[0089] Language interpreter, used to parse and execute programming language codes. For example, structured text, continuous function chart, function block diagram, ladder diagram, the interpreter is responsible for translating various PLC programming languages into machine executable intermediate codes or direct instructions;
[0090] The data interpreter is responsible for data type conversion and data transmission processing. When transferring data between different functional blocks, the data interpreter converts the data format according to the pre-defined data type rules to ensure that the data type between the compiler and the execution environment is correct and follows the expected format;
[0091] Function block interpreter is used to process the operation and scheduling logic of function blocks. For example, the execution order and execution conditions of each function block are determined according to the control logic in the project.
[0092] Human-computer interaction interface, such as Figure 7 As shown, the human-computer interaction interface includes:
[0093] User interface, including code editing, debugging, configuration options area, etc. For example, the code editing area is placed at the top of the interface, the debugging area is placed at the bottom, and the configuration options area is displayed in the form of a pop-up window;
[0094] Development module, based on the language interpreter, the development module supports visual programming windows of multiple programming languages. By calling the corresponding programming language library, the corresponding programming window is created in the development module, and the user can switch between different windows for programming;
[0095] The debugging module, based on the data interpreter, provides functions such as breakpoint setting, variable monitoring, real-time monitoring of controller status, and resource monitoring. In the debugging module, by establishing a communication connection with the PLC controller, the running status information of the controller is obtained and displayed to the user in real time on the interface.
[0096] Create a communication interface to realize data communication and command interaction between the human-computer interaction interface and the interpreter module. Use the Web Socket protocol to establish a two-way communication channel between the human-computer interaction interface and the back-end interpreter module. When the user operates on the human-computer interaction interface, the operation command is sent to the interpreter module through the communication interface for processing.
[0097] After completing the above configuration, Figure 8 As shown, the development environment is started. When it is started, the development environment will automatically scan the local plug-in directory and load the PLC plug-in that meets the interface standard; initialize the project resource manager, function block resource manager, interpreter module, human-computer interaction interface and microservice database. According to the preset initialization parameters, memory space is allocated to each module and the initial connection relationship between modules is established.
[0098] The operation logic of the above development system based on programmable logic controller is as follows:
[0099] like Fig. 9 As shown, create or open a PLC project through the project resource manager. The user clicks the Create Project button in the project resource management interface, enters the project name and other information to create a new project, or selects an existing project file to open;
[0100] Store PLC project data locally in the form of files. When the user writes PLC programs, configures parameters, and other operations in the project, the system automatically stores the updated data in the local disk in the predetermined file format.
[0101] like Fig.10 As shown, the function block resource manager obtains the function block data from the microservice database through the microservice. For example, when a user needs to use a function block of a specific function, the function block resource manager sends a request to the microservice database to obtain the data of the function block;
[0102] The user selects the required function block by clicking or dragging on the function block resource management interface.
[0103] Perform configuration operations on the selected function block, such as setting parameters, etc. After selecting the function block, the user enters the parameter value in the pop-up configuration window, such as setting the timing time of the timer function block.
[0104] like Fig.11 As shown, when the user selects configuration data in the function block resource manager, the data is transmitted to the human-computer interaction interface through the function block interpreter;
[0105] In the human-computer interaction interface, the development module uses the language interpreter to support the visual programming window of multiple programming languages for programming operations. When the user writes the PLC program in the programming window, the language interpreter parses the program code in real time and provides syntax checking and prompting functions;
[0106] The debugging module provides breakpoint setting, variable monitoring, real-time monitoring of controller status, and resource monitoring through the data interpreter. During the debugging process, after the user sets a breakpoint, the debugging module obtains the variable value in the PLC controller through the data interpreter and displays it on the interface;
[0107] After the human-computer interaction interface is configured and edited, the data is transferred to the project resource manager for storage through the data interpreter. For example, after the user modifies the configuration parameters of the project on the human-computer interaction interface, the modified data is stored in the project file of the project resource manager through the data interpreter.
[0108] like Fig.12 As shown, the language interpreter and data interpreter etc. compile the PLC engineering data and convert it into an executable code format;
[0109] The interpreter module sends the compiled engineering data to the master device and executes the run command, and the PLC master device starts to execute the PLC program.
[0110] Through the above technical solutions, the development system based on programmable logic controller adopts resource manager and interpreter to realize efficient project management and data interaction, so as to improve project management capabilities, reduce system coupling and realize deep integration with modern development tools, providing more convenient, efficient and flexible solutions for PLC project development.
[0111] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for executing instructions based on a programmable logic controller, characterized in that: The following steps are involved: Create or open a project; Perform engineering operations on the project, including: The language interpreter recognizes the user programming language and generates a control program based on the input language code; Acquire function block data and configure function block parameters according to user instructions, and apply the configured function block data to the control program; According to the user's instructions, the data interpreter sets one or more of the breakpoints, variable monitoring, controller status monitoring, and resource monitoring of the control program; The engineering data obtained through engineering operations is translated into a preset file by the data interpreter and the file is stored According to user instructions, the interpreter compiles and processes the engineering data; According to the user's instructions, the interpreter sends the compiled engineering data to the master device.
2. The method for executing instructions based on a programmable logic controller according to claim 1, characterized in that: The steps of obtaining function block data and configuring function block parameters according to user instructions include: The function block data is obtained from the microservice database according to the user instructions, the function block parameters are configured according to the user instructions, and the function block interpreter transmits the configured function block data to the human-computer interaction interface.
3. The instruction execution method based on a programmable logic controller according to claim 1, characterized in that: The step language interpreter recognizes the user programming language and generates a control program including: The language interpreter recognizes the programming language input by the user in the human-computer interaction interface and generates a control program according to the rules of the corresponding programming language.
4. The instruction execution method based on a programmable logic controller according to claim 3, characterized in that: In the step language interpreter recognizes the user programming language, the language interpreter parses the programming code, checks the syntax and gives generation prompt information.
5. The instruction execution method based on a programmable logic controller according to claim 1, characterized in that: During debugging, the data interpreter obtains the variable values in the programmable logic controller after the breakpoint and displays them to the user.
6. A development system based on a programmable logic controller for running the instruction running method based on a programmable logic controller according to any one of claims 1 to 5, characterized in that: include: A project explorer, wherein the project explorer is used to create, open or save a project; A human-computer interaction interface, the human-computer interaction interface is used to edit code, and the human-computer interaction interface interacts with the project resource manager through an interpreter module; An interpreter module, which performs data communication and command interaction with various modules of the development system based on the programmable logic controller through a communication interface; A function resource manager, which interacts with the human-computer interaction interface through an interpreter module, and is used to obtain function block data, configure function block parameters, and transmit the configured function block data to the human-computer interaction interface according to user instructions.
7. The programmable logic controller-based development system according to claim 5, characterized in that: The project explorer includes: A project resource management interface, wherein the project resource management interface includes multiple interfaces, and the interfaces at least include create, open, and save operations; A project database, wherein the project database is used to store project data, including project name, creation time, and engineering data; A plug-in module is used to adapt the project management system of the development tool.
8. The programmable logic controller-based development system according to claim 5, characterized in that: The interpreter includes: A language interpreter, which is used to parse and execute programming language codes; A data interpreter, which is used for data type conversion and data transmission processing; A function block interpreter is used to process the operation and scheduling logic of the function block.
9. The programmable logic controller-based development system according to claim 8, characterized in that: The human-computer interaction interface comprises: A development module, based on the language interpreter, the development module at least includes a structured text language, a continuous function chart language, a function module chart language, and a ladder diagram language, and the visualization becomes a window; A debugging module is based on the data interpreter, and is used to complete breakpoint setting, variable monitoring setting, controller status monitoring setting, and resource monitoring. The debugging module is communicatively connected with a programmable logic controller.
10. The programmable logic controller-based development system according to claim 9, characterized in that: The function resource manager includes: A microservice database, wherein the microservice database is used to store function block data; Function resource management interface, where the user selects the required function block and configures the function block parameters; The functional resource management interface can obtain the functional block data from the microservice database through the microservice, and transmit the configured functional block data to the development module through the functional block interpreter.