Industrial control algorithm debugging method, system, device and electronic equipment
By simulating the hardware environment in a simulation controller to debug industrial control algorithms, the inefficiency caused by dependence on physical controllers is solved, and more efficient algorithm development and debugging are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-25
- Publication Date
- 2026-03-24
AI Technical Summary
The development and debugging of industrial control algorithms are highly dependent on the development and verification environment of physical controllers, resulting in low debugging efficiency and the ability to detect the algorithm's running status only through the log output of the physical controller.
By downloading the target industrial control algorithm to the target simulation controller, the software simulates the hardware environment for verification and debugging, obtains and displays the running results, and responds to debugging commands to debug when the results are inconsistent with the preset expectations.
Industrial control algorithms can be verified and debugged without the need for a hardware environment, reducing debugging and optimization time and improving development and production efficiency.
Smart Images

Figure CN115793582B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of industrial automation control, in particular, relates to an industrial control algorithm debugging method, system, device and electronic equipment. BACKGROUND
[0002] In industrial production and life, powerful high-performance controllers are widely used in traditional factories and workshops to realize the upgrading of traditional processes and provide parallel computing capabilities for each task, by virtue of their general computing capabilities, support for rich industrial standard protocols, large storage capacity, and input / output functions; however, the development and debugging of industrial control algorithms in the current industrial field, as well as subsequent upgrading and modification, highly depend on the development and verification environment provided by the physical controller, and the algorithm cannot be compiled and debugged after being separated from the physical controller, and the algorithm can only be debugged by detecting the running status of the algorithm through the log output of the physical controller, resulting in low efficiency of industrial control algorithm development and debugging.
[0003] At present, there is no effective solution to the above problems. SUMMARY
[0004] The embodiments of the present application provide an industrial control algorithm debugging method, system, device and electronic equipment, to at least solve the technical problem of low efficiency of industrial control algorithm development and debugging caused by the fact that the development and debugging of industrial control algorithms in the current industrial field must rely on the development and verification environment provided by the physical controller, and the algorithm can only be debugged by detecting the running status of the algorithm through the log output of the physical controller.
[0005] According to an aspect of an embodiment of the present application, an industrial control algorithm debugging method is provided, including: downloading a target industrial control algorithm into a target simulation controller, wherein the target simulation controller is a program module consistent with the function of a physical controller, and the physical controller is a device for controlling a to-be-controlled device in an industrial production environment; obtaining a target running result generated by the target simulation controller running the target industrial control algorithm, wherein the target running result includes: a first running result and a second running result, the first running result is an output result generated in the running process of the target industrial control algorithm, and the second running result is an output result generated after the complete running of the target industrial control algorithm; displaying the target running result to a target object, and in the case that the target running result is inconsistent with a preset expected result, responding to an algorithm debugging instruction of the target object to debug the target industrial control algorithm, wherein the preset expected result is a result output by the running target industrial control algorithm planned to be obtained.
[0006] Optionally, in response to the algorithm debugging instruction of the target object, debugging the target industrial control algorithm comprises: determining a target debugging mode indicated by the algorithm debugging instruction, wherein the target debugging mode comprises at least one of the following: an additional debugging mode and a start debugging mode; and debugging the target industrial control algorithm according to the target debugging mode.
[0007] Optionally, debugging the target industrial control algorithm according to the target debugging mode comprises: in the case where the target debugging mode is the additional debugging mode, determining a first running result inconsistent with the preset expected result as a to-be-corrected running result; determining a code position in the target industrial control algorithm that produces the to-be-corrected running result; presenting the code position to the target object, and in response to a breakpoint setting instruction of the target object, setting a target breakpoint in the program code of the target industrial control algorithm, wherein the target breakpoint is used to make the target industrial control algorithm pause at the position where the target breakpoint is located when running; running the target industrial control algorithm containing the target breakpoint to obtain a breakpoint running result; presenting the breakpoint running result to the target object, and in response to a breakpoint debugging instruction of the target object, debugging the target industrial control algorithm.
[0008] Optionally, debugging the target industrial control algorithm according to the target debugging mode comprises: in the case where the target debugging mode is the start debugging mode, debugging the target industrial control algorithm according to the algorithm debugging instruction.
[0009] Optionally, before determining the target debugging mode, the method further comprises: in the case where the target running result is inconsistent with the preset expected result, determining a code module in the target industrial control algorithm that produces the target running result inconsistent with the preset expected result; sending the target running result inconsistent with the preset expected result and the code module to the front-end interface for display, and sending an alarm information.
[0010] Optionally, downloading the target industrial control algorithm into the target simulation controller comprises: determining function parameters and structure parameters of a target entity controller, wherein the target entity controller is an entity controller to which the target industrial control algorithm is planned to be applied; establishing the target simulation controller according to the function parameters and the structure parameters; obtaining the target industrial control algorithm in an integrated development environment, and configuring the target industrial control algorithm into the target simulation controller, wherein the integrated development environment is used to develop the target industrial control algorithm.
[0011] Optionally, the method further comprises: in the case where there are a plurality of target industrial control algorithms, setting a target identifier for each target industrial control algorithm, and configuring the target identifier and the target industrial control algorithm into the target simulation controller; obtaining a target running result corresponding to the target industrial control algorithm according to the target identifier; in the case where the target running result is inconsistent with a preset expected result, debugging the corresponding target industrial control algorithm in response to an algorithm debugging instruction.
[0012] According to another aspect of embodiments of the present application, there is also provided an industrial control algorithm debugging system, comprising: a target simulation controller, a device to be controlled, and a processor, wherein the target simulation controller is configured to collect bit number data of the device to be controlled, and perform operation on the bit number data according to a target industrial control algorithm to obtain a target running result, wherein the target running result comprises a first running result and a second running result, the first running result is an output result generated in a running process of the target industrial control algorithm, and the second running result is an output result generated after the target industrial control algorithm is completely run; the device to be controlled is configured to receive an output signal of the target simulation controller, and send the bit number data to the target simulation controller; and the processor is configured to download the target industrial control algorithm to the target simulation controller, obtain the target running result generated by the target simulation controller running the target industrial control algorithm, show the target running result to a target object, and in a case where the target running result is inconsistent with a preset expected result, debug the target industrial control algorithm in response to an algorithm debugging instruction of the target object.
[0013] According to another aspect of embodiments of the present application, there is also provided an industrial control algorithm debugging device, comprising: a simulation configuration module configured to download a target industrial control algorithm to a target simulation controller, wherein the target simulation controller is a program module consistent with a function of an entity controller, and the entity controller is a device configured to control a device to be controlled in an industrial production environment; a result obtaining module configured to obtain a target running result generated by the target simulation controller running the target industrial control algorithm, wherein the target running result comprises a first running result and a second running result, the first running result is an output result generated in a running process of the target industrial control algorithm, and the second running result is an output result generated after the target industrial control algorithm is completely run; and an algorithm debugging module configured to show the target running result to a target object, and in a case where the target running result is inconsistent with a preset expected result, debug the target industrial control algorithm in response to an algorithm debugging instruction of the target object, wherein the preset expected result is a result output by the running target industrial control algorithm which is planned to be obtained.
[0014] According to yet another aspect of embodiments of the present application, there is also provided an electronic device, comprising a processor configured to run a program, wherein the program is configured to perform an industrial control algorithm debugging method when running.
[0015] According to still another aspect of embodiments of the present application, there is also provided a non-volatile storage medium comprising a stored computer program, wherein a device in which the non-volatile storage medium is located is configured to perform an industrial control algorithm debugging method by running the computer program.
[0016] In the embodiment of the present application, the target industrial control algorithm is downloaded into the target simulation controller, wherein the target simulation controller is a program module consistent with the function of the physical controller, and the physical controller is a device for controlling the to-be-controlled device in the industrial production environment; the target running result generated by the target simulation controller running the target industrial control algorithm is acquired, wherein the target running result includes: a first running result and a second running result, the first running result is an output result generated in the running process of the target industrial control algorithm, and the second running result is an output result generated after the target industrial control algorithm is completely run; the target running result is displayed to the target object, and in the case that the target running result is inconsistent with the preset expected result, the algorithm debugging instruction of the target object is responded to, and the target industrial control algorithm is debugged, wherein the preset expected result is a manner of planning to acquire the output result of the running target industrial control algorithm, by using the software to simulate the hardware environment, a simulation development environment is established, the industrial control algorithm can be verified and debugged without the aid of the hardware environment, the purpose of reducing the debugging and optimization time and improving the development and production efficiency is achieved, and further, the technical problem of low development and debugging efficiency of the industrial control algorithm in the current industrial field is solved, because the development and debugging of the industrial control algorithm must rely on the development and verification environment provided by the physical controller, and the running state of the algorithm can only be detected through the log output of the physical controller. BRIEF DESCRIPTION OF DRAWINGS
[0017] The accompanying drawings, which are included to provide a further understanding of the present application and are incorporated in and constitute a part of this application, illustrate embodiments of the present application and serve to explain the present application, but do not limit the present application. In the drawings:
[0018] Figure 1 FIG. 1 is a hardware structure block diagram of a computer terminal (or electronic device) for implementing an industrial control algorithm debugging method according to an embodiment of the present application;
[0019] Figure 2 FIG. 2 is a flowchart of an industrial control algorithm debugging method according to an embodiment of the present application;
[0020] Figure 3 FIG. 3 is a flowchart of an algorithm development method based on a simulation controller according to an embodiment of the present application;
[0021] Figure 4 FIG. 4 is a structural schematic diagram of an industrial control algorithm debugging system according to an embodiment of the present application;
[0022] Figure 5 FIG. 5 is an architecture schematic diagram of an internal function module of a target simulation controller according to an embodiment of the present application;
[0023] Figure 6is a structural schematic diagram of an industrial control algorithm debugging device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0024] In order for those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work should fall within the scope of protection of the present application.
[0025] It should be noted that the terms "first", "second" and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to the process, method, product or device.
[0026] In order for those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work should fall within the scope of protection of the present application.
[0027] Integrated Development Environment (IDE): is an application program for providing a program development environment.
[0028] In the related art, the development and debugging of the industrial control algorithm is highly dependent on the development and verification environment provided by the entity controller, and therefore, there is a problem of low efficiency of the development and debugging of the industrial control algorithm. In order to solve this problem, the present application provides related solutions, which will be described in detail below.
[0029] According to the embodiments of the present application, a method for debugging an industrial control algorithm is provided. It should be noted that the steps shown in the flowchart can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown herein.
[0030] The method embodiments provided by the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 A hardware structure block diagram of a computer terminal (or electronic device) for implementing the industrial control algorithm debugging method is shown. As shown in Figure 1 , the computer terminal 10 (or electronic device 10) can include one or more processors 102 (the processor 102 can include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions. In addition, it can also include a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which can be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. Those skilled in the art can understand that Figure 1 The structure shown is only schematic, which does not limit the structure of the above-mentioned electronic device. For example, the computer terminal 10 can include more or fewer components than those shown in Figure 1 , or have a different configuration than that shown in Figure 1 .
[0031] It should be noted that the one or more processors 102 and / or other data processing circuits described above can be referred to herein as "data processing circuits" in general. The data processing circuit can be embodied in whole or in part as software, hardware, firmware or any other combination. In addition, the data processing circuit can be a single independent processing module, or any one of the other elements combined into the computer terminal 10 (or electronic device) in whole or in part. As referred to in the embodiments of the present application, the data processing circuit serves as a processor control (for example, selection of a variable resistance terminal path connected to an interface).
[0032] The memory 104 can be used to store software programs and modules of application software, such as program instructions / data storage devices corresponding to the industrial control algorithm debugging method in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implements the above-mentioned industrial control algorithm debugging method. The memory 104 can include a high-speed random access memory, and can also include a non-volatile memory such as one or more magnetic storage devices, flash memory or other non-volatile solid state memory. In some examples, the memory 104 can further include a memory remotely disposed with respect to the processor 102, which can be connected to the computer terminal 10 through a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.
[0033] The transmission device 106 is configured to receive or send data via a network. The network can include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network interface controller (NIC) that can be connected to other network devices through a base station to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module that is configured to communicate with the Internet wirelessly.
[0034] The display can be a liquid crystal display (LCD) that is touch screen type, for example, which can enable a user to interact with a user interface of the computer terminal 10 (or the electronic device).
[0035] In the above operating environment, the embodiments of the present application provide an industrial control algorithm debugging method, Figure 2 is a schematic diagram of a method for debugging an industrial control algorithm according to the embodiments of the present application, as shown in Figure 2 The method includes the following steps:
[0036] In step S202, a target industrial control algorithm is downloaded into a target simulation controller, wherein the target simulation controller is a program module consistent with a function of an entity controller, and the entity controller is a device for controlling a device to be controlled in an industrial production environment.
[0037] In some embodiments of the present application, the step of downloading the target industrial control algorithm into the target simulation controller includes the following steps: determining function parameters and structure parameters of a target entity controller, wherein the target entity controller is an entity controller to which the target industrial control algorithm is to be applied; establishing the target simulation controller according to the function parameters and the structure parameters; obtaining the target industrial control algorithm in an integrated development environment, and configuring the target industrial control algorithm into the target simulation controller, wherein the integrated development environment is used to develop the target industrial control algorithm.
[0038] The target industrial control algorithm is an algorithm program for controlling industrial devices (such as industrial instruments) in an industrial production environment.
[0039] As an optional implementation, the target industrial control algorithm can be written by a technician (i.e., a target object) in an integrated development environment (IDE) according to actual requirements.
[0040] Specifically, the algorithm is written by remotely connecting the target simulation controller through the IDE. The simulation controller has integrated a cross-compilation environment, and technicians only need to write the relevant algorithm. Then, the compiled target industrial control algorithm is downloaded to the target simulation controller through the configuration software.
[0041] In step S204, a target running result generated by the target simulation controller running the target industrial control algorithm is obtained. The target running result includes a first running result and a second running result. The first running result is an output result generated during the running of the target industrial control algorithm. The second running result is an output result generated after the running of the target industrial control algorithm is completed.
[0042] Specifically, the target simulation controller schedules and runs according to the downloaded target industrial control algorithm to control the to-be-controlled device in the industrial production environment. In some embodiments of the present application, the to-be-controlled device can be an entity to-be-controlled device in the industrial production environment or a virtual simulation to-be-controlled device in the system.
[0043] In step S206, the target running result is displayed to the target object. If the target running result is inconsistent with a preset expected result, the target industrial control algorithm is debugged in response to an algorithm debugging instruction of the target object. The preset expected result is an output result of the running target industrial control algorithm planned to be obtained.
[0044] Specifically, the technician can remotely debug the target industrial control algorithm through the IDE, modify the relevant code, continue to download the target industrial control algorithm, and monitor the output result.
[0045] To improve the flexibility of algorithm debugging, the target industrial control algorithm is debugged in response to an algorithm debugging instruction of the target object. The method includes the following steps: determining a target debugging mode indicated by the algorithm debugging instruction. The target debugging mode includes at least one of the following: an additional debugging mode and a start debugging mode. The target industrial control algorithm is debugged according to the target debugging mode.
[0046] In some embodiments of the present application, in the target debugging mode, debugging the target industrial control algorithm comprises the following steps: in the case that the target debugging mode is an additional debugging mode, determining that the first running result inconsistent with the preset expected result is a to-be-corrected running result; determining the code position in the industrial control algorithm that produces the to-be-corrected running result; presenting the code position to the target object, and in response to the breakpoint setting instruction of the target object, setting a target breakpoint in the program code of the target industrial control algorithm, wherein the target breakpoint is used to make the target industrial control algorithm pause at the position of the target breakpoint when running; running the target industrial control algorithm containing the target breakpoint to obtain a breakpoint running result; presenting the breakpoint running result to the target object, and in response to the breakpoint debugging instruction of the target object, debugging the target industrial control algorithm.
[0047] Specifically, in the additional debugging mode, first, the first running result inconsistent with the preset expected result generated in the running process of the target industrial control algorithm is determined; then, the code position of the code in the program code of the target industrial control algorithm that generates the first running result inconsistent with the preset expected result is determined; the technical personnel can set a target breakpoint in the program code of the target industrial control algorithm according to the first running result inconsistent with the preset expected result and the position information for debugging, and when running the program code of the target industrial control algorithm with the target breakpoint set, single-step debugging can be performed (one step from the position of the previous target breakpoint to the position of the next target breakpoint), so that the problem can be located and solved faster, and the algorithm development and debugging efficiency is improved.
[0048] In some embodiments of the present application, in the target debugging mode, debugging the target industrial control algorithm further comprises the following steps: in the case that the target debugging mode is a startup debugging mode, debugging the target industrial control algorithm according to the algorithm debugging instruction.
[0049] Specifically, in the startup debugging mode, the program code of the target industrial control algorithm is executed all at once to directly obtain the final running result.
[0050] The startup debugging is suitable for scenarios where the additional debugging cannot be applied, for example, the program directly crashes upon startup, which makes it impossible to debug the corresponding program in time, and scenarios for debugging the logic related to startup.
[0051] In order to enable the technical personnel to better monitor the running of the target industrial control algorithm, before determining the target debugging mode, the following steps are further included: in the case that the target running result is inconsistent with the preset expected result, determining the code module in the target industrial control algorithm that produces the target running result inconsistent with the preset expected result; sending the target running result inconsistent with the preset expected result and the code module to the front-end interface for display, and sending an alarm information.
[0052] As an optional implementation, real-time data is provided externally through standard protocols such as OPCUA, Modbus TCP Slave, so that technicians (target objects) can monitor the data through related standard tools.
[0053] In some embodiments of the present application, the method further comprises: in the case where there are multiple target industrial control algorithms, setting a target identifier for each target industrial control algorithm, and configuring the target identifier and the target industrial control algorithm into the target simulation controller; according to the target identifier, obtaining a target running result corresponding to the target industrial control algorithm; in the case where the target running result is inconsistent with a preset expected result, responding to an algorithm debugging instruction to debug the corresponding target industrial control algorithm.
[0054] As an optional implementation, sandbox isolation technology is adopted to realize independent running of a single user program.
[0055] The industrial control algorithm debugging method in steps S202 to S206 of the embodiments of the present application is further introduced below.
[0056] Figure 3 is a schematic diagram of a method flow of algorithm development based on a simulation controller according to an embodiment of the present application, as shown in Figure 3 The method comprises the following steps:
[0057] Step S302, configuring a simulation controller, and downloading a target industrial control algorithm into the simulation controller;
[0058] Specifically, a simulation controller corresponding to the function of an entity controller is built, the simulation controller is mounted on a host computer, the hardware resources of the simulation controller are allocated (for example, by default if no special requirement), and the simulation controller is started; relevant development IDE programming software is installed on the host computer, the algorithm is written by remotely connecting the target simulation controller through the IDE, the simulation controller has integrated a cross-compilation environment, and a technician does not need to install a complex compilation environment, and the technician only needs to write a relevant algorithm, and then downloads the compiled target industrial control algorithm to the target simulation controller through configuration software.
[0059] In some embodiments of the present application, when developing a target industrial control algorithm, a technician writes a corresponding optimization algorithm according to actual field requirements, downloads the optimization algorithm to a simulation controller through configuration software, and the simulation controller is responsible for algorithm scheduling and running, and supports development in multiple programming languages, including but not limited to C / C++ / Python algorithm development.
[0060] Step S304, running the target industrial control algorithm in the simulation controller, and debugging the target industrial control algorithm according to a running result.
[0061] Specifically, the target simulation controller schedules and controls the equipment to be controlled in the industrial production environment according to the downloaded target industrial control algorithm; it monitors whether the running results of the target industrial control algorithm in the simulation controller meet expectations. If they do not meet expectations, technicians can remotely debug the target industrial control algorithm through the IDE, modify the relevant code, continue to download the target industrial control algorithm, and monitor the output results.
[0062] In some embodiments of this application, the scheduling engine in the simulation environment (i.e., the simulation controller) performs differentiated scheduling based on the characteristics of the programs of different target industrial control algorithms, and also supports a mixed scheduling mode of programming language algorithms such as C / C++ / Python.
[0063] Through the above steps, a simulation development environment is established by using software to simulate the hardware environment. This allows for the verification and debugging of industrial control algorithms without the need for a physical hardware environment, thereby reducing debugging and optimization time and improving development and production efficiency. This solves the technical problem of low efficiency in the development and debugging of industrial control algorithms, which currently relies on the development and verification environment provided by physical controllers and can only detect the algorithm's running status through the log output of physical controllers.
[0064] According to an embodiment of this application, an embodiment of an industrial control algorithm debugging device is also provided. Figure 4 This is a schematic diagram of the structure of an industrial control algorithm debugging system provided according to an embodiment of this application. Figure 4 As shown, the system includes: a target simulation controller 40, a device to be controlled 42, and a processor 44, wherein,
[0065] The target simulation controller 40 is used to collect the tag number data of the device to be controlled 42, and to perform calculations on the tag number data according to the target industrial control algorithm to obtain the target operation result. The target operation result includes: a first operation result and a second operation result. The first operation result is the output result generated during the operation of the target industrial control algorithm, and the second operation result is the output result generated after the target industrial control algorithm has finished running.
[0066] The device under control 42 is used to receive the output signal of the target simulation controller 40 and to send tag data to the target simulation controller 40;
[0067] The processor 44 is configured to download the target industrial control algorithm into the target simulation controller 40, acquire a target running result generated by the target simulation controller 40 running the target industrial control algorithm, show the target running result to the target object, and in the case that the target running result is inconsistent with a preset expected result, debug the target industrial control algorithm in response to an algorithm debugging instruction of the target object.
[0068] The target simulation controller 40 is further described as follows, Figure 5 is an internal functional module architecture diagram of a target simulation controller according to an embodiment of the present application. As shown in Figure 5 The target simulation controller 40 mainly includes three parts, a data acquisition module 50, an optimization calculation module 52, and a control output module 54, wherein,
[0069] The data acquisition module 50 is responsible for real-time acquisition of simulation system bit number data, provides a data source for optimization calculation, and stores the data. Currently supported standard industrial protocols include but are not limited to Modbus TCP Slave, OPC UA, and the like.
[0070] The optimization calculation module 52: After the optimization algorithm (i.e., the target industrial control algorithm) is developed by the technical personnel, it is downloaded to the simulation controller through the configuration software. The simulation controller provides an algorithm running environment, supports concurrent running, and responds to control in milliseconds.
[0071] The control output module 54: According to the result output by the target industrial control algorithm, the result is output to the controlled device, so as to achieve the purpose of control.
[0072] The present application provides a simulation development system solution similar to the function of the entity controller, which supports compilation and debugging, provides a more convenient and efficient algorithm debugging solution for technical personnel, such as single-step debugging and viewing global resources, which can quickly locate and solve problems, and improve the algorithm development and debugging efficiency.
[0073] According to an embodiment of the present application, an embodiment of an industrial control algorithm debugging device is also provided. Figure 6 is a structure diagram of an industrial control algorithm debugging device according to an embodiment of the present application. As shown in Figure 6 The device includes:
[0074] The simulation configuration module is configured to download the target industrial control algorithm into the target simulation controller, wherein the target simulation controller is a program module consistent with the function of the entity controller, and the entity controller is a device for controlling the controlled device in an industrial production environment.
[0075] a result obtaining module configured to obtain a target running result generated by the target simulation controller running the target industrial control algorithm, wherein the target running result comprises a first running result and a second running result, the first running result is an output result generated during running of the target industrial control algorithm, and the second running result is an output result generated after the target industrial control algorithm is completely run;
[0076] an algorithm debugging module configured to show the target running result to a target object, and in a case where the target running result is inconsistent with a preset expected result, to debug the target industrial control algorithm in response to an algorithm debugging instruction of the target object, wherein the preset expected result is a result output by the target industrial control algorithm which is planned to be obtained.
[0077] It should be noted that each module in the industrial control algorithm debugging apparatus described above can be a program module (for example, a program instruction set for implementing a certain specific function) or a hardware module. For the latter, it can be in the following forms, but is not limited thereto: each module is in the form of a processor, or the functions of each module are implemented by a processor.
[0078] It should be noted that the industrial control algorithm debugging apparatus provided in the present embodiment can be used to execute the industrial control algorithm debugging method shown in Figure 2 Therefore, the related explanations and descriptions of the industrial control algorithm debugging method described above are also applicable to the present embodiment, and will not be described here again.
[0079] The present embodiment further provides a non-volatile storage medium including a stored computer program, wherein a device in which the non-volatile storage medium is located executes the following industrial control algorithm debugging method by running the computer program: downloading a target industrial control algorithm into a target simulation controller, wherein the target simulation controller is a program module consistent with the function of an entity controller, and the entity controller is a device for controlling a to-be-controlled device in an industrial production environment; obtaining a target running result generated by the target simulation controller running the target industrial control algorithm, wherein the target running result comprises a first running result and a second running result, the first running result is an output result generated during running of the target industrial control algorithm, and the second running result is an output result generated after the target industrial control algorithm is completely run; showing the target running result to a target object, and in a case where the target running result is inconsistent with a preset expected result, debugging the target industrial control algorithm in response to an algorithm debugging instruction of the target object, wherein the preset expected result is a result output by the target industrial control algorithm which is planned to be obtained.
[0080] The serial numbers of the above embodiments of the present application are only for description, and do not represent the advantages or disadvantages of the embodiments.
[0081] In the above-described embodiments of the present application, the description of each embodiment focuses on different aspects, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.
[0082] In several embodiments provided in the present application, it should be understood that the disclosed technical contents can be implemented by other ways. Among them, the above-described device embodiments are only schematic, for example, the division of the units can be a logical function division, and actual implementation can have another division way, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units or modules shown or discussed can be indirect coupling or communication connection through some interfaces, units or modules, which can be electrical or other forms.
[0083] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place or distributed on multiple units. Part or all of the units can be selected to achieve the purpose of the embodiment scheme according to actual needs.
[0084] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The above integrated unit can be realized in the form of hardware or in the form of software functional unit.
[0085] The integrated unit, if realized in the form of software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part of the prior art that makes a contribution or the whole or part of the technical solutions can be embodied in the form of software product, which is stored in a storage medium and includes a plurality of instructions for making a computer device (which can be a personal computer, a server or a network device, etc.) execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and various program code storage media.
[0086] The above is only the preferred embodiment of the present application, and it should be pointed out that for ordinary skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, which should be considered as the protection scope of the present application.
Claims
1. A method for debugging an industrial control algorithm, characterized in that, include: The target industrial control algorithm is downloaded to the target simulation controller, wherein the target simulation controller is determined by: determining the functional and structural parameters of the target physical controller, wherein the target physical controller is the physical controller that is planned to apply the target industrial control algorithm; based on the functional and structural parameters, the target simulation controller is established, which includes mounting a mirror of the target simulation controller onto the host machine and allocating hardware resources to the target simulation controller; wherein the target simulation controller is a program module with the same function as the physical controller, and the physical controller is a device that controls the equipment to be controlled in an industrial production environment; The target simulation controller generates the target running result by running the target industrial control algorithm. The target running result includes a first running result and a second running result. The first running result is the output result generated during the operation of the target industrial control algorithm, and the second running result is the output result generated after the target industrial control algorithm has finished running. The target operation result is displayed to the target object, and if the target operation result is inconsistent with the preset expected result, the target object's algorithm debugging command is responded to and the target industrial control algorithm is debugged, wherein the preset expected result is the result to be obtained from running the target industrial control algorithm.
2. The industrial control algorithm debugging method according to claim 1, characterized in that, Debugging the target industrial control algorithm in response to the algorithm debugging command of the target object includes: Determine the target debugging mode indicated by the algorithm debugging command, wherein the target debugging mode includes at least one of the following: additional debugging mode, and start debugging mode; Debug the target industrial control algorithm according to the target debugging method.
3. The industrial control algorithm debugging method according to claim 2, characterized in that, Debugging the target industrial control algorithm according to the aforementioned target debugging method includes: When the target debugging method is the additional debugging method, the first running result that is inconsistent with the preset expected result is determined as the running result to be corrected; Determine the location of the code in the target industrial control algorithm that generates the operating result to be corrected; The code location is displayed to the target object, and a breakpoint setting instruction is responded to by the target object. A target breakpoint is set in the program code of the target industrial control algorithm, wherein the target breakpoint is used to cause the target industrial control algorithm to pause at the location of the target breakpoint during runtime. Run the target industrial control algorithm that includes the target breakpoint to obtain the breakpoint execution result; The system displays the breakpoint execution results to the target object and responds to the breakpoint debugging commands of the target object to debug the target industrial control algorithm.
4. The industrial control algorithm debugging method according to claim 2, characterized in that, Debugging the target industrial control algorithm according to the aforementioned target debugging method includes: When the target debugging mode is the start debugging mode, the target industrial control algorithm is debugged according to the algorithm debugging instructions.
5. The industrial control algorithm debugging method according to claim 2, characterized in that, Before determining the target debugging method, the following should also be included: If the target operating result is inconsistent with the preset expected result, identify the code module in the target industrial control algorithm that generates the target operating result that is inconsistent with the preset expected result; The target running result that is inconsistent with the preset expected result, along with the code module, is sent to the front-end interface for display, and an alarm message is sent.
6. The industrial control algorithm debugging method according to claim 1, characterized in that, Downloading the target industrial control algorithm to the target simulation controller includes: The target industrial control algorithm is obtained from the integrated development environment and configured into the target simulation controller, wherein the integrated development environment is used to develop the target industrial control algorithm.
7. The industrial control algorithm debugging method according to claim 1, characterized in that, The method further includes: In the case where there are multiple target industrial control algorithms, a target identifier is set for each target industrial control algorithm, and the target identifier and the target industrial control algorithm are configured into the target simulation controller; Based on the target identifier, obtain the target operation result corresponding to the target industrial control algorithm; If the target operating result is inconsistent with the preset expected result, respond to the algorithm debugging command and debug the corresponding target industrial control algorithm.
8. An industrial control algorithm debugging system, characterized in that, include: The target simulation controller, the device to be controlled, and the processor, among which, The target simulation controller is used to collect the tag number data of the device to be controlled, and to perform calculations on the tag number data according to the target industrial control algorithm to obtain the target running result. The target running result includes: a first running result and a second running result. The first running result is the output result generated during the operation of the target industrial control algorithm, and the second running result is the output result generated after the target industrial control algorithm has completed all its operations. The device to be controlled is used to receive the output signal of the target simulation controller and to send the tag data to the target simulation controller; The processor is configured to download the target industrial control algorithm to the target simulation controller, wherein the target simulation controller is determined by: determining the functional and structural parameters of the target entity controller, wherein the target entity controller is the entity controller that is planned to apply the target industrial control algorithm; establishing the target simulation controller based on the functional and structural parameters; establishing the target simulation controller includes mounting a mirror of the target simulation controller onto the host machine and allocating hardware resources to the target simulation controller; obtaining the target running results generated by the target simulation controller running the target industrial control algorithm; displaying the target running results to the target object; and, in the event that the target running results are inconsistent with the preset expected results, responding to the algorithm debugging command of the target object and debugging the target industrial control algorithm.
9. An industrial control algorithm debugging device, characterized in that, include: A simulation configuration module is used to download the target industrial control algorithm to the target simulation controller. The target simulation controller is determined by: determining the functional and structural parameters of the target physical controller, wherein the target physical controller is the physical controller that plans to apply the target industrial control algorithm; establishing the target simulation controller based on the functional and structural parameters, which includes mounting a mirror image of the target simulation controller onto the host machine and allocating hardware resources to the target simulation controller; wherein the target simulation controller is a program module with the same function as the physical controller, and the physical controller is a device that controls the equipment to be controlled in an industrial production environment. The result acquisition module is used to acquire the target running result generated by the target simulation controller running the target industrial control algorithm. The target running result includes: a first running result and a second running result. The first running result is the output result generated during the operation of the target industrial control algorithm, and the second running result is the output result generated after the target industrial control algorithm has completed all its operations. The algorithm debugging module is used to display the target running result to the target object, and, in the event that the target running result is inconsistent with the preset expected result, respond to the algorithm debugging command of the target object to debug the target industrial control algorithm, wherein the preset expected result is the result to be obtained from running the target industrial control algorithm.
10. An electronic device, the electronic device comprising a processor, characterized in that, The processor is used to run a program, wherein the program executes the industrial control algorithm debugging method according to any one of claims 1 to 7 when it runs.
11. A non-volatile storage medium, characterized in that, The non-volatile storage medium includes a stored computer program, wherein the device containing the non-volatile storage medium executes the industrial control algorithm debugging method of any one of claims 1 to 7 by running the computer program.
Citation Information
Patent Citations
Debugging method and device of risk control system and storage medium
CN110674041A
Operating machine control system debugging method and system
CN113111006A
Underwater unmanned aerial vehicle navigation algorithm debugging system based on actually measured data playback
CN114492030A