Controller address operation method and device, human-computer interface and storage medium
By obtaining the script sent by the upper computer, using the script to call the application program interface, the operation of the controller address is completed, and the problem of inconvenience in update of traditional methods is solved, and the effect of updating the control logic without shutting down and changing the code is achieved.
Patent Information
- Application Number
- CN202411731552.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-25
AI Technical Summary
The traditional controller address operation method is inconvenient to update, and the controller needs to be disassembled to modify the code, resulting in the impact of the function.
By obtaining the script sent by the upper computer, the script contains the controller address and interface to be operated, and the application program interface is called using the script to complete the operation of the controller address.
It realizes updating the control logic without shutting down the controller and changing the code, reducing the impact of disassembly and downtime, making it more convenient to update.
Smart Images

Figure CN119690477A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a controller address operation method, device, human-computer interface and storage medium. Background Art
[0002] Currently, when using a controller, when you need to associate some address information logic or add new logic, you need to remove the controller from the site, modify the controller code, and then install it back. In this way, the entire function related to the controller will be affected by the process. The traditional controller address operation method has the problem of inconvenient update. Summary of the invention
[0003] Based on this, it is necessary to provide a controller address operation method, device, human-machine interface and storage medium that can make updating more convenient in response to the above technical problems.
[0004] A controller address operation method, applied to a human-machine interface, comprising: Obtaining a script sent by the host computer; the script includes an interface to be operated and an address of the controller to be operated for operating the controller; The script calls the application program interface corresponding to the interface to be operated to complete the corresponding operation on the address of the controller to be operated.
[0005] A controller address operation device, the device comprising: A script acquisition module, used to acquire a script sent by a host computer; the script includes an interface to be operated and an address of a controller to be operated for operating the controller; The operation module is used to call the application program interface corresponding to the interface to be operated through the script to complete the corresponding operation on the address of the controller to be operated.
[0006] A human-machine interface comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of each controller address operation method embodiment when executing the computer program.
[0007] A computer-readable storage medium stores a computer program, which implements the steps of each controller address operation method embodiment when the computer program is executed by a processor.
[0008] The above-mentioned controller address operation method, device, human-machine interface and storage medium obtain the address of the controller to be operated and the interface to be operated for operating the controller sent by the host computer, and complete the corresponding operation of the controller address to be operated by calling the application interface corresponding to the interface to be operated through the script. That is, the relevant address of the controller is operated through the script, and the control logic can be updated on the basis of not shutting down the controller and not changing the controller code, thereby reducing the impact caused by disassembly and shutdown of the controller and making the update more convenient. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1 An application environment diagram of a controller address operation method in an embodiment; Figure 2 A schematic diagram of a flow chart of a controller address operation method in one embodiment; Figure 3 is a structural block diagram of a controller address operation device in one embodiment; Figure 4 FIG. 4 is a diagram showing the internal structure of a human-machine interface in one embodiment. DETAILED DESCRIPTION
[0010] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0011] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0012] It should be noted that all directional indications in the embodiments of the present application (such as up, down, left, right, front, back, etc.) are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly. The connection can be a direct connection or an indirect connection.
[0013] In addition, in this application, descriptions such as "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0014] It can be understood that the “connection” in the following embodiments should be understood as “electrical connection”, “communication connection”, etc. if the connected circuits, modules, units, etc. have electrical signals or data transmission between each other.
[0015] The controller address operation method provided in this application can be applied to Figure 1 application environment. Figure 1 1 is an application environment diagram of a controller address operation method in an embodiment. It includes a host computer 110, a human-machine interface 120 and a controller 130. The host computer 110 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers and portable wearable devices. The human-machine interface (HMI) 120 is a medium for interaction and information exchange between the system and the user. The controller 130 refers to an industrial controller, which can be a PLC (Programmable Logic Controller). PLC is an operating system designed specifically for use in an industrial environment. The host computer 110 is used to generate scripts, and the human-machine interface 120 is used to receive and execute scripts to control the controller 130.
[0016] In one embodiment, Figure 2 FIG. 1 is a flow chart of a controller address operation method in an embodiment, which is described by taking the method applied to a human-machine interface as an example, and includes the following steps: Step 202, obtaining a script sent by the host computer; the script includes an interface to be operated for operating the controller and an address of the controller to be operated.
[0017] The address of the controller to be operated is an address in the controller, and a certain operation needs to be performed on the address of the controller to be operated.
[0018] There is a mapping relationship between the interface to be operated in the script and the application interface. Calling a certain interface in the script will be mapped to the corresponding application interface. The application interface encapsulates the relevant operations of the controller address. If the script contains the interface to be operated for operating the controller, the application interface can be called to control the controller. For example, the application interface includes functions such as reading data, writing data, and calculating data.
[0019] Specifically, in the HMI application, the address-related operations on the controller are encapsulated into an application programming interface (API) that can be called by the script. The user can write a script on the host computer according to the provided application programming interface, and the host computer sends the script to the HMI after completion. The HMI obtains the script sent by the host computer, which includes the address of the controller to be operated and the interface to be operated for operating the controller.
[0020] Step 204, calling the application program interface corresponding to the interface to be operated through the script, and completing the corresponding operation on the address of the controller to be operated.
[0021] Specifically, the script calls the application program interface corresponding to the interface to be operated to complete the corresponding operation on the target controller address to be operated. For example, if the read interface is called through the script, the HMI reads the corresponding value from the controller address to be operated of the controller. Alternatively, the script also includes the value of the controller address to be operated, and the write interface is called through the script, then the HMI writes the corresponding value to the controller address to be operated of the controller.
[0022] In this embodiment, by obtaining the address of the controller to be operated and the interface to be operated for operating the controller sent by the host computer, the application program interface corresponding to the interface to be operated is called through the script to complete the corresponding operation on the address of the controller to be operated. That is, the relevant address of the controller is operated through the script, and the control logic can be updated without shutting down the controller and changing the controller code, thereby reducing the impact caused by disassembly and shutdown of the controller and making the update more convenient. In addition, the control logic of the script is simple, and it is easier to complete the operation of the controller.
[0023] In one embodiment, the calling of the application program interface corresponding to the interface to be operated by the script to complete the corresponding operation on the address of the controller to be operated includes: Parsing the script, executing the functional logic in the script, and obtaining an execution result; An application program interface corresponding to the interface to be operated is called, and a corresponding operation on the address of the controller to be operated is completed based on the execution result.
[0024] The functional logic in the script depends on the type of script used, such as including but not limited to logical AND, OR, NOT, XOR, and EQUAL.
[0025] Specifically, the HMI parses the script, executes the functional logic in the script, and obtains the execution result. The HMI calls the application program interface corresponding to the interface to be operated, and writes the execution result into the operation of the address of the controller to be operated.
[0026] In this embodiment, the execution result is obtained by parsing the script, and the corresponding operation on the address of the controller to be operated is completed based on the execution result. The logic of part of the controller can be completed in the script. Due to the poor performance of the controller, the complex logical operations in the controller are put on the HMI to complete, and then the calculated results are written to the HMI through the application program interface. This can reduce the computing pressure of the controller and improve the control performance.
[0027] In one embodiment, parsing a script, executing the functional logic in the script, and obtaining an execution result include: parsing the script through a script interface of an application program, and executing the functional logic in the script.
[0028] Specifically, a supported script interface is built into the HMI application program. The HMI parses the script through the script interface of the application program and can execute the functional logic in the script.
[0029] In this embodiment, a script interface is built into the application, and the script is parsed through the script interface of the application to execute the functional logic in the script. The script can be used to quickly implement logical adjustment, modification and extension of the industrial controller, thereby reducing the impact of controller disassembly and shutdown.
[0030] In one embodiment, the controller address operation method further includes: when receiving data sent by the controller, calling a display interface of an application program through a script to display the data.
[0031] Specifically, when data sent by the controller is received, the display interface of the application is called through the script, and the data is displayed.
[0032] In this embodiment, when data sent by the controller is received, the display interface of the application is called through a script to display the data, thereby completing two-way communication of data and monitoring the controller simply and quickly.
[0033] In one embodiment, the script is a Lua script.
[0034] Specifically, the script syntax and operation use the open source architecture Lua. In the HMI, the data interaction between the script and the application uses the heap structure in Lua. The script and the application realize data interaction through a common heap. The application interface is encapsulated on the basis of data interaction.
[0035] In this embodiment, the Lua script file can be modified dynamically. This feature can complete the logic adjustment, modification, and extension of the controller without shutting down the controller, reducing the impact of controller disassembly and shutdown. In addition, Lua scripts can be flexibly embedded in applications to provide flexible expansion and customization functions for applications. They can be compiled and run on almost all operating systems and platforms, and have strong versatility. Compared with other scripting languages, they do not require pre-defined characters, are easy to use, and are suitable for industrial scenarios.
[0036] In one embodiment, the script syntax and operation use the open source architecture Lua. In the HMI, the data interaction between the script and the application uses the heap structure in Lua. The script and the application use a common heap to achieve data interaction. The API interface is encapsulated on the basis of data interaction. There is a mapping table between the script and the application. Calling a certain interface in the script will be mapped to the corresponding application interface.
[0037] The HMI application program has a built-in script interface. The user writes the code logic of the script in the host computer and sends the script file to the HMI after editing. The script is executed through the script interface of the application program in the HMI. The script calls the corresponding application program interface to execute the operation logic and complete the operation of the external controller.
[0038] Therefore, the script includes the address of the controller to be operated and the interface to be operated for operating the controller, and may also include the target value of the controller address and the functional logic configured in the script. The application program interface encapsulates the relevant operations on the controller address, such as read operations, write operations, calculation operations, etc.
[0039] The main function is to encapsulate the address-related operations on the industrial controller into a Lua callable API in the application. The user writes a script on the host computer according to the provided API, and the host computer sends the script to the HMI after completion. The user can call the API of the operation control-related address defined in the application through the script on the HMI to complete the operation of the controller address value. In addition, part of the controller logic can be completed in the Lua script. Using this solution, the complex logical operations in the controller can be completed on the HMI (HMI performance is better than the controller), and then the calculation results can be written back to the controller through the Lua interface through the application, reducing the calculation pressure of the controller and improving the control performance.
[0040] In this embodiment, script programming is used to operate the values of the relevant addresses of the industrial controller, and new control logic can be added to the logic of the original controller code without changing it. A part of the complex logic and operation can be implemented in the script, and the function of the original controller can be flexibly expanded. In addition, the Lua script file can be dynamically modified. This feature can complete the logic adjustment, modification, and extension of the controller without shutting down the controller, reducing the impact of controller disassembly and shutdown.
[0041] In one embodiment, a controller address operation method is applied to a human-machine interface, comprising: Step (a1), obtaining a Lua script sent by a host computer; the Lua script includes an address of a controller to be operated and an interface to be operated for operating the controller.
[0042] Step (a2), parse the Lua script through the script interface of the application, execute the functional logic in the Lua script, and obtain the execution result.
[0043] Step (a3), calling the application program interface corresponding to the interface to be operated, and completing the corresponding operation on the controller address to be operated based on the execution result.
[0044] Step (a4), when the data sent by the controller is received, the display interface of the application is called through the Lua script to display the data.
[0045] In this embodiment, the Lua script can complete part of the controller's logic, and the complex logic operations in the controller can be put on the HMI to complete (the HMI performance is better than the controller), and then the calculation results are written back to the controller through the Lua interface through the application, reducing the controller's computing pressure and improving control performance. On the other hand, the Lua script file can be modified dynamically. This feature can complete the controller's logic adjustment, modification, and extension without shutting down the controller, reducing the impact of controller disassembly and shutdown. It should be understood that although the above Figure 2 The steps in the flowchart are shown in sequence as indicated by arrows, and the steps in steps (a1) to (a4) are shown in sequence as indicated by numbers, but these steps are not necessarily performed in the order indicated by arrows or numbers. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be performed in other orders. Moreover, Figure 2 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps. In one embodiment, Figure 3 FIG. 1 is a block diagram of a controller address operation device in one embodiment. Figure 3 A controller address operation device is provided. The device can adopt a software module or a hardware module, or a combination of the two to become a part of a human-machine interface. The device specifically includes: a script acquisition module 302 and an operation module 304, wherein: The script acquisition module 302 is used to acquire the script sent by the host computer; the script includes the interface to be operated and the address of the controller to be operated for operating the controller; The operation module 304 is used to call the application program interface corresponding to the interface to be operated through a script to complete the corresponding operation on the controller address to be operated.
[0046] In one embodiment, the operation module 304 is used to: parse the script, execute the functional logic in the script, and obtain the execution result; call the application program interface corresponding to the interface to be operated, and complete the corresponding operation on the controller address to be operated based on the execution result.
[0047] In one embodiment, the operation module 304 is used to parse the script through the script interface of the application program and execute the functional logic in the script.
[0048] In one embodiment, the operation module 304 is further configured to call a display interface of an application program through a script to display the data when receiving data sent by the controller.
[0049] In one embodiment, the script is a Lua script. For the specific definition of the controller address operation device, please refer to the definition of the controller address operation method above, which will not be repeated here. Each module in the above-mentioned controller address operation device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the human-machine interface in the form of hardware, or can be stored in the memory in the human-machine interface in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0050] In one embodiment, a human-machine interface is provided, whose internal structure diagram can be as follows: Figure 4As shown. The human-machine interface includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the human-machine interface is used to provide computing and control capabilities. The memory of the human-machine interface includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the human-machine interface is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a controller address operation method is implemented. The display screen of the human-machine interface can be a liquid crystal display screen or an electronic ink display screen, and the input device of the human-machine interface can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the housing of the human-machine interface, or an external keyboard, touchpad or mouse, etc.
[0051] Those skilled in the art will understand that Figure 4 The structure shown in the figure is merely a block diagram of a portion of the structure related to the scheme of the present application, and does not constitute a limitation on the human-machine interface to which the scheme of the present application is applied. The specific human-machine interface may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components. In one embodiment, a human-computer interface is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps of the above-mentioned method embodiments when executing the computer program.
[0052] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned method embodiments are implemented.
[0053] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a human-machine interface reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the human-machine interface performs the steps in the above-mentioned method embodiments. Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes in the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0054] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A controller address operation method, characterized in that: Applied to a human-machine interface, the method comprises: Obtaining a script sent by the host computer; the script includes an interface to be operated and an address of the controller to be operated for operating the controller; The script calls the application program interface corresponding to the interface to be operated to complete the corresponding operation on the address of the controller to be operated.
2. The method according to claim 1, characterized in that The step of calling the application program interface corresponding to the interface to be operated by the script to complete the corresponding operation on the address of the controller to be operated includes: Parsing the script, executing the functional logic in the script, and obtaining the execution result; An application program interface corresponding to the interface to be operated is called, and a corresponding operation on the address of the controller to be operated is completed based on the execution result.
3. The method according to claim 2, characterized in that The step of parsing the script, executing the functional logic in the script, and obtaining the execution result includes: The script is parsed through the script interface of the application program, and the functional logic in the script is executed.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: When the data sent by the controller is received, the display interface of the application is called through the script to display the data.
5. The method according to claim 1, characterized in that The script is a Lua script.
6. A controller address operation device, characterized in that: The device comprises: A script acquisition module is used to acquire a script sent by a host computer; the script includes an interface to be operated and an address of a controller to be operated for operating the controller; The operation module is used to call the application program interface corresponding to the interface to be operated through the script to complete the corresponding operation on the address of the controller to be operated.
7. The device according to claim 6, characterized in that The operation module is used for: Parsing the script, executing the functional logic in the script, and obtaining an execution result; An application program interface corresponding to the interface to be operated is called, and a corresponding operation on the address of the controller to be operated is completed based on the execution result.
8. The device according to claim 7, characterized in that The operation module is used for: The script is parsed through the script interface of the application program, and the functional logic in the script is executed.
9. A human-computer interface, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.