Configuration simulation method of user program and related device
By using the configuration simulation method of user programs in the development of upper computer software, using data refresh thread to call simulation functions to execute user program logic, the problem of low development efficiency caused by relying on hardware controllers in the existing technology is solved, and efficient Software development and debugging.
Patent Information
- Application Number
- CN202411582067.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-07
- Publication Date
- 2025-02-18
AI Technical Summary
When developing computer software, the prior art relies on the controller hardware for functional debugging, resulting in an increase in hardware costs. In addition, when multiple people develop, the controller resources may be insufficient, resulting in low development efficiency.
Provide a configuration simulation method for user programs. Through the communication protocol with the host computer, the configuration task is downloaded, and the user program logic and configuration data are obtained. The data refresh thread calls the simulation function to execute the user program logic, obtain the simulation results and update it. Configure data.
It realizes simulation development of user programs without hardware controllers, get rid of the dependence on controller hardware, improves the efficiency of computer software development, facilitates the correctness of user program logic, and improves industrial site equipment construction efficiency.
Smart Images

Figure CN119472334A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of automatic control, and in particular to a configuration simulation method and related devices for a user program. Background Art
[0002] The controller is an indispensable part of the automation system. As a hardware structure in the automation system, the controller is generally set in the control room. The controller receives input signals from sensors or other devices and generates corresponding output signals according to the preset control strategy or algorithm to achieve precise control of the controlled object.
[0003] Generally, the host computer software is used to realize the control of the controller. The developer realizes the user program configuration through the host computer software, uploads the user program obtained after configuration to the hardware controller, and executes the user program through the controller to realize the detection, so as to realize the configuration adjustment of the host computer software.
[0004] Since the user program obtained by the host computer software configuration needs to pass the controller hardware detection and subsequent execution, the development of the controller host computer software depends on the controller hardware for function debugging, which will increase the hardware cost during software development. In addition, when multiple people are developing, insufficient controller resources will occur, resulting in low development efficiency. Summary of the invention
[0005] The first aspect of the present application provides a configuration simulation method for a user program, comprising:
[0006] Based on the communication protocol with the host computer, the configuration task for the user program is downloaded from the host computer, and the configuration task is obtained by configuring the user program through the host computer software;
[0007] Parsing the configuration task to obtain at least the user program logic and configuration data corresponding to the configuration task;
[0008] Calling a simulation function corresponding to the user program logic through a data refresh thread;
[0009] Executing the user program logic according to the configuration data using the simulation function to obtain a simulation result of the user program logic;
[0010] The configuration data corresponding to the user program is updated according to the simulation result.
[0011] In a possible implementation, the parsing of the configuration task to obtain at least the user program logic and configuration data corresponding to the configuration task includes:
[0012] Parsing the configuration task to obtain the user program logic and data storage location corresponding to the configuration task;
[0013] Based on the data storage location, configuration data corresponding to the user program logic is obtained.
[0014] In a possible implementation, the configuration task further includes operation cycle information, and the calling of a simulation function corresponding to the user program logic through a data refresh thread includes:
[0015] Based on the operation cycle information, trigger a data refresh thread;
[0016] The simulation function corresponding to the user program logic is called through the data refresh thread.
[0017] In a possible implementation, calling a simulation function corresponding to the user program logic through a data refresh thread includes:
[0018] Parsing the user program logic through a data refresh thread to obtain three-address code information corresponding to the user program logic;
[0019] Generate at least one target instruction according to the three address code information and a preset instruction configuration file, wherein the preset instruction configuration file records the corresponding relationship between each three address code information and each instruction;
[0020] Based on the at least one target instruction, at least one simulation function corresponding to the at least one target instruction is called respectively.
[0021] In a possible implementation, the parsing the user program logic to obtain three-address code information corresponding to the user program logic includes:
[0022] A configuration task of parsing a binary file format to obtain an offset position in the binary file;
[0023] According to the offset position, obtaining the local target storage address of the three-address code information of the user program logic;
[0024] From the target storage address, three-address code information of the user program logic is obtained.
[0025] In a possible implementation, the using the simulation function to execute the user program logic according to the configuration data to obtain a simulation result of the user program logic includes:
[0026] Obtaining an address of a simulation function unit in the instruction configuration file, wherein the simulation function unit is a function unit that executes the simulation function;
[0027] Based on the address of the simulation function unit, the simulation function unit is triggered to execute the user program logic according to the configuration data to obtain a simulation result of the user program logic.
[0028] In a possible implementation, the parsing of the configuration task, before at least obtaining the user program logic and configuration data corresponding to the configuration task, further includes:
[0029] According to a preset user program format, the information header of the configuration task is parsed to obtain the verification information carried by the configuration task;
[0030] Based on the verification of the verification information, the step of parsing the configuration task is executed to obtain at least the user program logic and configuration data corresponding to the configuration task;
[0031] Based on the fact that the verification information fails the verification, the execution of the parsing of the configuration task is prohibited, and at least the user program logic and configuration data steps corresponding to the configuration task are obtained.
[0032] A second aspect of the present application provides a configuration simulation device for a user program, comprising:
[0033] A communication protocol parsing module, used for downloading configuration tasks for user programs from the host computer based on the communication protocol with the host computer, wherein the configuration tasks are obtained by configuring the user programs through the host computer software;
[0034] A data processing module, used for parsing the configuration task to at least obtain the user program logic and configuration data corresponding to the configuration task;
[0035] The configuration adaptation module is used to call the simulation function corresponding to the user program logic through the data refresh thread; use the simulation function to execute the user program logic according to the configuration data to obtain the simulation result of the user program logic; and update the configuration data corresponding to the user program according to the simulation result.
[0036] In a possible implementation, the method further includes:
[0037] A control module, used for receiving a control command for triggering a configuration simulation device, and controlling the operation state of the configuration simulation device according to the control command;
[0038] The configuration interface module is used to load configuration files for different simulation controllers to control the configuration simulation device to realize the simulation of different controllers.
[0039] A third aspect of the present application provides a computer program product, comprising computer-readable instructions, which, when executed on an electronic device, enables the electronic device to implement the configuration simulation method of a user program of the first aspect or any implementation of the first aspect.
[0040] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0041] The memory is used to store computer programs;
[0042] The processor is used to execute the computer program so that the electronic device can implement the configuration simulation method of the user program of the above-mentioned first aspect or any implementation manner of the first aspect.
[0043] A fifth aspect of the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can perform a configuration simulation method of a user program of the above-mentioned first aspect or any implementation method of the first aspect.
[0044] In summary, the present application provides a configuration simulation method and related devices for a user program, the method comprising: based on a communication protocol with a host computer, downloading a configuration task for a user program from the host computer, the configuration task being obtained by configuring the user program through the host computer software; parsing the configuration task to obtain at least the user program logic and configuration data corresponding to the configuration task; calling a simulation function corresponding to the user program logic through a data refresh thread; using the simulation function to execute the user program logic according to the configuration data to obtain a simulation result of the user program logic; updating the configuration data corresponding to the user program according to the simulation result, thereby realizing simulation implementation for the controller without setting up a hardware controller, thus getting rid of the dependence on the controller hardware and improving the efficiency of host computer software development, and making it convenient for users and implementation personnel to debug the correctness of the user program logic in advance, thereby improving the efficiency of industrial field device construction, saving construction time and thus improving the production efficiency of the automatic control system. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0046] Figure 1 It is a flow chart of a configuration simulation method of a user program provided in an embodiment of the present application;
[0047] Figure 2 It is a schematic diagram of an application scenario of a configuration simulation method of a user program provided in an embodiment of the present application;
[0048] Figure 3 It is a flowchart of parsing the configuration task provided by an embodiment of the present application to at least obtain the user program logic and configuration data corresponding to the configuration task;
[0049] Figure 4 It is a flowchart of calling a simulation function corresponding to the user program logic through a data refresh thread provided by an embodiment of the present application;
[0050] Figure 5 It is a flowchart of calling a simulation function corresponding to the user program logic through a data refresh thread provided by an embodiment of the present application;
[0051] Figure 6 is a flowchart of parsing the user program logic and obtaining three-address code information corresponding to the user program logic provided by an embodiment of the present application;
[0052] Figure 7 It is a flowchart of using the simulation function to execute the user program logic according to the configuration data to obtain the simulation result of the user program logic provided by the embodiment of the present application;
[0053] Figure 8 It is a flowchart of a configuration verification task provided in an embodiment of the present application;
[0054] Fig. 9 It is a schematic diagram of an application scenario of a configuration simulation method of a user program provided in an embodiment of the present application;
[0055] Fig.10 It is a structural diagram of a configuration simulation device for a user program provided in an embodiment of the present application;
[0056] Fig.11 It is another structural schematic diagram of a configuration simulation device for a user program provided in an embodiment of the present application;
[0057] Fig.12 A timing diagram of the operation of a configuration simulation device for a user program provided in an embodiment of the present application;
[0058] Fig.13 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0059] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0060] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0061] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0062] Figure 1 It is a flow chart of a configuration simulation method of a user program provided in an embodiment of the present application, which may include steps 101 to 105, and these steps are described in detail below.
[0063] 101. Based on the communication protocol with the host computer, download the configuration task for the user program from the host computer, where the configuration task is obtained by configuring the user program through the host computer software;
[0064] Among them, the configuration simulation method of the user program provided in the present application is applied to an electronic device, which serves as a simulation device of the controller, and can execute the configuration simulation method of the user program provided in the embodiment of the present application to realize the simulation of the configuration task of the user program.
[0065] The electronic device may be a host computer, an all-in-one machine, a PC (personal computer), a laptop computer, a tablet computer, etc., which has data processing capabilities. The specific form of the electronic device is not limited in this application.
[0066] The user program is a logic processing program written by the user configuration, which is presented in the form of configuration. Specifically, a bin file is generated during configuration compilation. The configuration task is specifically downloaded to the electronic device in the form of a bin file.
[0067] Among them, the user program may be a different type of programming language such as FBD (Function Block Diagram), LD (Ladder Diagram), ST (Structured Text), etc. This application does not limit the programming language used by the user program.
[0068] Among them, data can be transmitted between the electronic device and the host computer. A communication protocol is agreed upon between the electronic device and the host computer, and data transmission between the host computer and the electronic device is achieved based on the communication protocol.
[0069] Among them, the communication protocol can adopt the communication protocol between the hardware controller and the host computer to realize the simulation of the hardware controller function through the method in the embodiment of the present application, and then after the subsequent simulation is completed, the hardware controller is used to execute it in a specific application scenario.
[0070] Among them, for the hardware controller and the host computer of the same manufacturer, the manufacturer pre-sets the communication protocol between the two to use UCP (Unified Control Protocol). Accordingly, the UCP protocol interface can be set in the electronic device to receive the configuration task of the host computer.
[0071] In a possible implementation, the configuration task may also be transmitted through a network. Accordingly, the data packet of the configuration task may adopt TCP (Transmission Control Protocol), UDP (User Datagram Protocol), etc., and may be converted into the UCP protocol after receiving the data packet of the protocol.
[0072] 102. Analyze the configuration task to obtain at least the user program logic and configuration data corresponding to the configuration task;
[0073] Among them, after the configuration task is downloaded to the local electronic device, the configuration task is parsed to obtain the corresponding user program logic and configuration data.
[0074] Among them, the user program logic is the logic to be executed by the controller, which may include multiple execution steps. The relationship between each execution step may be a sequential execution relationship, a reference relationship, or a parallel execution relationship, etc. This application does not limit the specific relationship between the execution steps.
[0075] In a possible implementation, the process of parsing the configuration task to obtain the configuration data may be to record the data storage location in the configuration task, obtain the corresponding configuration data through the data storage location, and then Figure 3The process is described in detail.
[0076] The electronic device executing the method may be pre-set with configuration analysis rules, and the configuration task is analyzed by the configuration analysis rules to obtain the user program logic and corresponding configuration data.
[0077] Among them, the configuration analysis rule can be the reverse process of configuring the user program in the host computer, and the specific content of the configuration analysis rule is not limited in this application.
[0078] 103. Calling a simulation function corresponding to the user program logic through a data refresh thread;
[0079] The electronic device is provided with a data refresh thread, which triggers the processing of the user program logic to obtain corresponding simulation results.
[0080] Among them, through the data refresh thread, first call the simulation function corresponding to the user program logic, and then use the simulation function to execute the user program logic according to the configuration data obtained in the above steps to obtain the corresponding simulation result.
[0081] The user program logic may include multiple execution steps, each execution step corresponds to a different simulation function. After completing one execution step by calling the corresponding simulation function, the simulation function corresponding to the next execution step is called.
[0082] The simulation function is a function function pre-set in the storage space of the electronic device and used to simulate the functions that can be executed in the controller hardware.
[0083] In a possible implementation, the data refresh thread can be triggered according to the operation cycle of the user program logic, and the data refresh thread calls the simulation function to execute the user program logic. Figure 4 This process is described in detail in .
[0084] 104. Using the simulation function to execute the user program logic according to the configuration data, to obtain a simulation result of the user program logic;
[0085] Among them, the configuration task records the configuration data used in the user program logic.
[0086] Correspondingly, when the user program logic is executed through the data refresh thread, the required input data is obtained, and the input data includes the configuration data obtained in the aforementioned steps, and may also include the execution results of the previously executed steps.
[0087] The simulation result is obtained by using various simulation functions to calculate the user program logic, and the corresponding calculation result is used as the simulation result of the electronic device for the user program logic.
[0088] Among them, the simulation results include the bit number during operation, the real-time value of the user program, etc.
[0089] The bit number is a unique identifier assigned to each device in the automation system, and the relevant information of the corresponding device can be recorded through the bit number.
[0090] 105. Update the configuration data corresponding to the user program according to the simulation result.
[0091] After obtaining the simulation result for the user program logic, the configuration data corresponding to the user program stored locally in the electronic device can be updated according to the simulation result, so as to realize data refresh in the simulation controller of the electronic device.
[0092] In a possible implementation, the simulation result can also be used as a basis for the host computer software to debug the user program configuration, and can be used as a basis for the host computer software development.
[0093] It should be noted that the configuration simulation method in the embodiment of the present application is to simulate the operation status in the hardware controller during the operation of the configuration task and simulate the process of the logical execution of the user program.
[0094] Figure 2 It is a schematic diagram of an application scenario of a configuration simulation method of a user program provided in an embodiment of the present application, and the application scenario includes a host computer 201 and an electronic device 202.
[0095] Among them, the host computer compiles the user program logic and various related data parameters, etc., and configures them to obtain the configuration task. The electronic device and the host computer can transmit data. The configuration task is transmitted to the electronic device, and the electronic device implements the controller simulation process for the configuration task to update the configuration data corresponding to the user program.
[0096] The information carried in the configuration task includes the AI (Analog Input) bit number, AO (Analog Output) bit number, DI (Digital Input) bit number, DO (Digital Output) bit number, etc. of the field equipment, so as to realize analog control of the operation of the field equipment.
[0097] The application scenario may be a scenario where the hardware controller adopts a PLC (Programmable Logic Controller) or a scenario where the hardware controller adopts a DCS (Distributed Control System).
[0098] In this embodiment, based on the communication protocol with the host computer, the configuration task for the user program is downloaded from the host computer, and the configuration task is obtained by configuring the user program through the host computer software; the configuration task is parsed to obtain at least the user program logic and configuration data corresponding to the configuration task; the simulation function corresponding to the user program logic is called through the data refresh thread; the user program logic is executed according to the configuration data using the simulation function to obtain the simulation result of the user program logic; the configuration data corresponding to the user program is updated according to the simulation result, thereby realizing the simulation implementation for the controller without setting up a hardware controller, getting rid of the dependence on the controller hardware, bringing about the improvement of the host computer software development efficiency, and facilitating users and implementers to debug the correctness of the user program logic in advance, thereby improving the efficiency of the construction of industrial field devices, saving construction time and thus improving the production efficiency of the automatic control system.
[0099] Figure 3 It is a flowchart of parsing the configuration task provided by an embodiment of the present application to at least obtain the user program logic and configuration data corresponding to the configuration task, which may include steps 301 to 302, and these steps are described in detail below.
[0100] 301. Analyze the configuration task to obtain the user program logic and data storage location corresponding to the configuration task;
[0101] The configuration task carries the user program logic and the related information of the data involved in the user program logic.
[0102] By analyzing the configuration task, the configured user program logic and the corresponding data storage location can be obtained.
[0103] In a possible implementation, the configuration task may carry a data storage location, for example, the data storage location may be represented in the form of a storage address.
[0104] In one possible implementation, the configuration task can carry a bit number / bit number type, and the correspondence between the bit number / bit number type and the data storage location can be recorded locally on the electronic device. When the configuration task is parsed to obtain the bit number / bit number type carried therein, the data storage location of the bit number / bit number type can be determined through the locally recorded correspondence.
[0105] The user program logic is a logical operation performed on various data generated / required for the operation of the field equipment. Accordingly, the data involved may be data corresponding to the bit number of each field equipment.
[0106] In a possible implementation, the data storage location may be a storage location in a memory set in the automatic control system for storing data of each field device, and the data storage location of different field devices is different.
[0107] In a possible implementation, the data storage location may be a data storage location set for a corresponding bit number in a data storage space set in each field device.
[0108] 302. Based on the data storage location, obtain configuration data corresponding to the user program logic.
[0109] After the data storage location is determined, the configuration data required by the user program logic is obtained from the data storage address.
[0110] In which, when the user program logic includes multiple execution steps, all configuration data corresponding to the user program logic can be obtained from its data storage location before calling the simulation function corresponding to the execution step; or before calling the simulation function corresponding to each execution step, the corresponding configuration data can be obtained from the corresponding data storage location.
[0111] In a possible implementation, the configuration task also carries the initial value of the data corresponding to each bit number. When the simulation function is subsequently used to execute the user program logic, the initial value and the configuration data can be used to perform simulation function calculations to obtain simulation results.
[0112] In this embodiment, by parsing the configuration task, the user program logic corresponding to the configuration task and the data storage location of the configuration data used by the user program logic are obtained. Through the data storage location, the configuration data corresponding to the user program logic is obtained, thereby realizing the parsing of the configuration task downloaded from the host computer and obtaining the configuration-related information required for the simulation controller to run the user program.
[0113] In a possible implementation, the configuration task also includes operation cycle information, where the operation cycle information is related information indicating the logical execution cycle of the user program.
[0114] Figure 4 It is a flowchart of calling a simulation function corresponding to the user program logic through a data refresh thread provided by an embodiment of the present application, which may include steps 401 to 402, and these steps are described in detail below.
[0115] 401. Based on the operation cycle information, trigger a data refresh thread;
[0116] Wherein, a data refresh thread is provided in the electronic device, and the data refresh thread controls the operation of the user program logic.
[0117] When parsing the configuration task, the operation cycle information contained therein can be obtained by parsing.
[0118] Among them, through the operation cycle information, it is possible to trigger the data refresh thread according to the set operation cycle, so as to realize the simulation process of running the user program logic according to the operation cycle and obtain the corresponding simulation result.
[0119] As an example, the operation cycle information includes an operation cycle, according to which the data refresh thread is triggered. The operation cycle information may also include a start time of the first operation, so as to trigger the data refresh thread for the first time according to the start time.
[0120] 402. Call a simulation function corresponding to the user program logic through the data refresh thread.
[0121] The data refresh thread is used to execute the user program logic. The data refresh thread can be used to call the simulation function corresponding to the user program logic, and store the simulation result when the simulation function obtains the simulation result.
[0122] When the simulation function obtains the simulation result, the data refresh thread refreshes the simulation result into the preset storage space of the electronic device.
[0123] The simulation result can be used to control the operation of the field equipment. The simulation result can be stored according to different equipment bit numbers to facilitate the host computer software to read the bit numbers and simulate the scenario of controlling the field equipment using the equipment bit numbers.
[0124] Each time the data refresh thread is triggered, the simulation functions corresponding to the user program logic are called through the data refresh thread to implement the periodic execution of the user program logic.
[0125] In this embodiment, based on the operation cycle information parsed from the task configuration, the data refresh thread is triggered, and the simulation function corresponding to the user program logic is called through the data refresh thread to trigger the execution of the user program logic according to the operation cycle in the task configuration to obtain the corresponding simulation result.
[0126] Figure 5 It is a flowchart of calling a simulation function corresponding to the user program logic through a data refresh thread provided by an embodiment of the present application, which may include steps 501 to 503, and these steps are described in detail below.
[0127] 501. Analyze the user program logic through the data refresh thread to obtain three-address code information corresponding to the user program logic;
[0128] Among them, the user program logic compilation is compiled using three-address code.
[0129] Among them, the three-address code is a form of intermediate code, which includes three basic instruction formats, three-address instructions (including an operator and two operands), labels (used to indicate jump targets in the code), and temporary variables (used to store intermediate calculation results). Compared with the source code, it is more concise and standardized. The three-address code can make the analysis of the program faster, and the three-address code, as an intermediate code, makes the parsing and the final instruction set adaptation more flexible.
[0130] The user program logic is parsed to obtain the corresponding three-address code information. The user program logic may be composed of a plurality of three-address code information.
[0131] Among them, when the electronic device is initialized, the addresses of different architecture instructions corresponding to all three address codes are cached, and the addresses of different architecture instruction sets are stored in the form of instruction configuration files, so that it can respond to instructions of various architectures.
[0132] The three-address code information may include an operator, a parameter type, and a parameter address. The parameter address may be an address of an instruction set corresponding to a corresponding architecture.
[0133] In a possible implementation, an offset address is recorded in the configuration task, and corresponding three-address code information is determined locally in the electronic device according to the offset address. Figure 6 This process is described in detail in .
[0134] In the embodiment of the present application, the three-address code intermediate code is used to directly interact between the host computer and the electronic device of the simulation controller, decoupling the simulation controller of the electronic device from the instruction architecture, and getting rid of the dependence on the controller hardware.
[0135] 502. Generate at least one target instruction according to the three address code information and a preset instruction configuration file, wherein the instruction configuration file records the corresponding relationship between each three address code information and each instruction;
[0136] Among them, the preset instruction configuration file contains the addresses of various architecture instruction sets.
[0137] Among them, the preset instruction configuration file pairs the three-address code operator, parameter type, parameter address under a specific architecture with the address, operator, and simulation function of the target instruction, such as calling AND, MOV, OR and other functions. The preset configuration file can be set in a set format. The format used by the preset configuration file can be agreed upon by the host computer and the controller, and the basic configuration rules are similar to the XML format.
[0138] The instruction architecture refers to the instruction architecture adopted by the controller chip. In this embodiment, the electronic device simulation controller can be set to adopt the instruction architecture, and the electronic device can be used to simulate controllers with different instruction structures.
[0139] In a possible implementation, the information header of the data packet of the configuration task includes the parameter type of the target instruction required by the user program, and the parameter type is used as the parameter type in the three-address code.
[0140] Among them, the conversion relationship between the three address codes and the target instructions specified in the preset instruction configuration file can be a pre-agreed agreement between the user program and the controller, and can be set according to needs. This application does not limit the specific form of the conversion relationship.
[0141] Among them, through the conversion relationship specified in the preset instruction configuration file, it is possible to convert the operators, parameter types, and parameter addresses in the three-address code into a target instruction set, which is the instruction under the corresponding architecture of the three-address code in the configuration task.
[0142] According to the parameter address included in the three-address code information, the address of the instruction set of the corresponding architecture is determined in the preset instruction configuration file, and based on the parameter address, the target instruction corresponding to the operator and the parameter type can be obtained from the corresponding instruction set address.
[0143] The target instruction may be an ARM (Advanced RISC Machines) instruction.
[0144] 503. Based on the at least one target instruction, call at least one simulation function corresponding to the at least one target instruction respectively.
[0145] The preset instruction configuration file may include corresponding functions, and the corresponding simulation function may be called according to the corresponding relationship between the target instruction and the function, thereby realizing simulation of the user program logic.
[0146] After the simulation function is used to perform simulation calculations, the simulation results are used to update the configuration data corresponding to the user program in real time, thereby realizing the update action for the input and output data of the hardware controller.
[0147] In this embodiment, the user program logic is parsed through the data refresh thread to obtain the three-address code information corresponding to the user program logic; at least one target instruction is generated based on the three-address code information and the preset instruction configuration file, and the instruction configuration file records the corresponding relationship between each three-address code information and each instruction; based on the at least one target instruction, at least one simulation function corresponding to the at least one target instruction is called respectively, and the process of calling the corresponding simulation function for the user program logic is realized. The corresponding relationship between the three-address code information and the instruction of each architecture is recorded through the preset instruction configuration file, which can be implemented for various architecture instructions, expanding the configuration simulation application architecture that can be adopted by this application. Moreover, the three-address code is an intermediate code, and it is not easy to obtain the logic information of the user program through decompilation. It is difficult for the cracker to obtain the code logic information corresponding to the user program when it cannot know its final code. Therefore, the possibility of obtaining the user program logic by decompiling the configuration compilation result is greatly reduced, and the security of the user program logic is improved.
[0148] Figure 6 It is a flowchart of parsing the user program logic and obtaining the three-address code information corresponding to the user program logic provided by an embodiment of the present application, which may include steps 601 to 603, and these steps are described in detail below.
[0149] 601. Parse the configuration task of the binary file format to obtain the offset position in the binary file;
[0150] Among them, after the configuration software is used in the host computer to complete the user program configuration, the compiled content is a binary file.
[0151] The binary file records the offset address, and the address information at the offset address is the address information of the operator and operand after the user program is logically converted into a three-address code.
[0152] Each execution step in the simulated user program logic may be implemented by calling a simulation function, or by triggering a simulation function unit (the simulation function unit is executed using a simulation function).
[0153] In a possible implementation, the address information at the location of the offset address may also record a jump address of a corresponding simulation function unit, and the jump address may be used to trigger the corresponding simulation function unit to execute a corresponding simulation function.
[0154] 602. Obtain the local target storage address of the three-address code information of the user program logic according to the offset position;
[0155] The three-address code information of each architecture is pre-stored locally in the electronic device, and the storage address of the three-address code information of each architecture is recorded in advance.
[0156] According to the correspondence between the pre-configured offset position and the address information of the instruction configuration file, the offset position in the binary file and the address information of the corresponding instruction configuration file can be determined.
[0157] In a possible implementation, the jump distance is configured in the local instruction configuration file of the electronic device, and the operator and operand addresses are stored in the user program binary file. After matching with the corresponding instruction configuration file, the jump distance is determined. The actual address of the parameter can be obtained by calculating the operator, operand address and jump distance in the binary file, specifically the local target storage location.
[0158] 603. Obtain three-address code information of the user program logic from the target storage address.
[0159] After the target storage address is determined, the three-address code information of the user program logic is obtained from the target storage address.
[0160] In the subsequent steps, the corresponding simulation function is determined by the three address code information to implement the simulation by calling the corresponding simulation function for the user program logic to obtain the simulation result.
[0161] In this embodiment, the configuration task in the binary file format is parsed to obtain the offset position in the binary file; based on the offset position, the local target storage address of the three-address code information of the user program logic is obtained; from the target storage address, the three-address code information of the user program logic is obtained, thereby achieving the purpose of transmitting the user program logic by combining the configuration task in the binary file format with the three-address code, and reducing the data transmission burden between the host computer and the electronic device while improving the security of the user program logic.
[0162] Figure 7 The embodiment of the present application provides a flow chart of using the simulation function to execute the user program logic according to the configuration data to obtain the simulation result of the user program logic, which may include steps 701 to 702. These steps are described in detail below.
[0163] 701. Obtain an address of a simulation function unit in the instruction configuration file, where the simulation function unit is a function unit that executes the simulation function;
[0164] Among them, the electronic device pre-configures the address for each simulation function unit, and writes the address into the instruction configuration file. According to the configuration address recorded in the instruction configuration file, it jumps to the corresponding simulation function module so that the simulation function module executes the operation logic and obtains the operation result.
[0165] After parsing the configuration task and obtaining the user program logic therein, each simulation function unit corresponding to the user program logic is determined.
[0166] In a possible implementation, the configuration task adopts a binary file format, and the address of the simulation function unit is determined in the instruction configuration file according to the offset position in the binary file.
[0167] According to the correspondence between the pre-configured offset position and the address information of the instruction configuration file, the offset position in the binary file and the address information of the corresponding instruction configuration file can be determined, and the address information is the address of the simulation function unit.
[0168] In one possible implementation, various simulation functions required for simulation are preset in the system function library of the electronic device, and an address is configured for each simulation function. The function in the system function library of the electronic device can be pointed to by an offset position in the configuration task, so that the configuration address of the corresponding simulation function can be determined based on the offset position, and then the corresponding simulation function can be called according to the configuration address.
[0169] 702. Based on the address of the simulation function unit, trigger the simulation function unit to execute the user program logic according to the configuration data to obtain a simulation result of the user program logic.
[0170] After the address of the simulation function unit is determined, the execution of the electronic device is controlled to jump to the simulation function unit to execute the operation logic, so as to simulate the user program logic and obtain the corresponding simulation result.
[0171] In a possible implementation, the user program logic needs to be implemented by a combination of multiple simulation function units, and each simulation function unit is triggered in turn to execute its operation logic to achieve simulation of the user program logic.
[0172] In this embodiment, a simulation function unit is provided in the electronic device. The simulation function unit is a function unit for executing a simulation function. The address of the simulation function unit is obtained in the instruction configuration file. Based on the address of the simulation function unit, the simulation function unit is triggered to execute the user program logic according to the configuration data, and the simulation result step of the user program logic is obtained, thereby realizing the embedding of the simulation function into the function unit so as to execute the corresponding simulation function according to the function unit.
[0173] Figure 8It is a flowchart of the configuration verification task provided in an embodiment of the present application, which may include steps 801 to 804. These steps are described in detail below.
[0174] 801. Parse the information header of the configuration task according to a preset user program format to obtain verification information carried by the configuration task;
[0175] After receiving the configuration task, the legality of the configuration task is firstly verified.
[0176] According to the preset user program format, the information header of the configuration task is parsed to obtain the verification information carried by it.
[0177] The verification information may be a user ID added by the host computer, a host computer ID, or other information that can characterize the source of the configuration task. The specific content of the verification information is not limited in this application.
[0178] The format of the user program in the configuration task is preset, and the format includes the number of bits in the information header, the number of bits in the content, and the content corresponding to each bit in the information header.
[0179] According to the user program format, the data packet of the configuration task is parsed to obtain its information header, and then the verification information is determined from the information header.
[0180] 802. Determine whether the verification information passes verification;
[0181] Among them, a verification condition can be preset, and the verification condition can be a verification condition agreed upon between the controller and the host computer.
[0182] As an example, the verification condition includes: the user ID of the configuration task is one of the set user IDs.
[0183] As an example, the verification condition includes: the host computer of the coding configuration task is one of the set host computers.
[0184] Correspondingly, if the verification information meets the verification condition, it is determined that the verification information has passed the verification; otherwise, the verification information has failed the verification.
[0185] If the verification information passes the verification, execute step 803; if the verification information fails the verification, execute step 804.
[0186] 803. Based on the verification information being verified, executing the step of parsing the configuration task to at least obtain the user program logic and configuration data corresponding to the configuration task;
[0187] Among them, if the verification information in the configuration task passes the verification and it is determined that the configuration task is legal, the subsequent simulation process can be executed to parse the configuration task and perform simulation based on the obtained user logic and configuration data. For the simulation process, please refer to the explanation in the aforementioned embodiment.
[0188] 804. Based on the fact that the verification information fails verification, the execution of parsing the configuration task is prohibited, and at least the user program logic and configuration data steps corresponding to the configuration task are obtained.
[0189] If the verification information in the configuration task fails the verification and the configuration task is determined to be illegal, the configuration task cannot be simulated and the process of parsing the configuration task is prohibited to improve the operation safety of the electronic device.
[0190] In one possible implementation, the configuration task is transmitted using multiple data packets. A data packet containing an information header is first sent to the electronic device. The electronic device can parse the content in the information header of the first received datagram to determine whether the configuration task has passed the verification, and then download subsequent data packets containing user program logic and configuration data. If the configuration task has not passed the verification, subsequent data packets containing user program logic and configuration data will not be downloaded, so as to reduce the burden of data transmission and reduce the burden of storage space in the electronic device.
[0191] In this embodiment, the information header of the configuration task is parsed according to a preset user program format to obtain verification information carried by the configuration task; based on the verification information passing the verification, subsequent parsing of the configuration task is performed to at least obtain the user program logic and configuration data steps corresponding to the configuration task, so as to realize the process of simulating according to the user program logic and configuration data; based on the verification information failing the verification, parsing of the configuration task is prohibited and simulation is not performed, so as to improve the security of controller simulation in electronic equipment.
[0192] Fig. 9 Schematic diagram of an application scenario of a configuration simulation method of a user program provided in an embodiment of the present application, comprising the following steps:
[0193] 901: Initialize the three-address code instruction set;
[0194] 902: Cache three-address code instruction set;
[0195] 903: Parsing configuration task;
[0196] The configuration task is a user program in binary file format.
[0197] 904: Parsing the configuration task information header;
[0198] 905: Verify whether the configuration task is legal;
[0199] The legitimacy of the configuration task is verified based on the information header.
[0200] If it is legal, execute step 906; otherwise, the parsing fails and execute step 913.
[0201] 906: Matching the instruction architecture of the electronic device;
[0202] The instruction architecture may be ARMV1, ARMV2, etc., and may be a pre-set architecture in the electronic device.
[0203] 907: Parse the user program information body based on the instruction architecture;
[0204] During the parsing process, each part of the user program information body is parsed in turn.
[0205] 908: Determine whether the end of the user program has been reached;
[0206] Among them, judging whether the parsed user program information has reached the end indicates whether the user program logic has been completely parsed.
[0207] If the tail is reached, execute step 909; if the tail is not reached, execute step 910.
[0208] 909: Parsing completed;
[0209] When it is determined that the analysis is complete, step 911 is executed.
[0210] 910: parsing the address information in the information body, matching and obtaining the corresponding execution instruction;
[0211] After obtaining the execution instruction, return to parse the next part and execute steps 908 to 910 in a loop.
[0212] 911: Analyze operator type and variable type, calculate jump distance, and obtain actual address of parameter;
[0213] After the user program logic is fully parsed, the three-address code in the user program is matched with each target instruction set in the preset configuration file to determine the jump distance and the actual address of the parameter, so as to call the simulation function and obtain the configuration parameters;
[0214] 912: Execute the simulation function corresponding to the instruction to complete the data update;
[0215] The execution instruction obtained in step 910 calls the simulation function according to the jump distance, and executes the simulation function according to the configuration parameters to obtain the simulation result, which is then updated to the local data storage space as the storage data for the simulation.
[0216] 913: Parsing failed.
[0217] A configuration simulation method for a user program provided in an embodiment of the present application is introduced above, and a device for executing the configuration simulation method for a user program is introduced below.
[0218] Fig.10 1 is a schematic diagram of a configuration simulation device for a user program provided in an embodiment of the present application. The configuration simulation device 1000 for a user program includes:
[0219] The communication protocol parsing module 1001 is used to download the configuration task of the user program from the host computer based on the communication protocol with the host computer, and the configuration task is obtained by configuring the user program through the host computer software;
[0220] The communication protocol parsing module can receive network data packets of various protocols and convert them into data packets of the protocol adopted by the controller.
[0221] If the data packet of the host computer adopts the TCP protocol, the TCP data packet is parsed into a corresponding UCP data packet according to the UCP protocol, and then the UCP data packet is transmitted to the subsequent data processing module.
[0222] In a possible implementation, the communication protocol parsing module can also receive a network data packet UDP, parse the UDP data packet into a corresponding UCP data packet according to the UCP protocol, and then transmit the UCP data packet to a subsequent data processing module.
[0223] The data processing module 1002 is used to analyze the configuration task and obtain at least the user program logic and configuration data corresponding to the configuration task;
[0224] Among them, the data processing module is mainly used to parse the received configuration tasks, monitor the UCP commands issued by the host computer software, etc.
[0225] The detailed process of parsing the configuration task can be referred to the explanation in the aforementioned method embodiment, which will not be described in detail here.
[0226] Among them, the UCP commands issued by the host computer software include but are not limited to domain download of configuration software, controller information query, password modification, configuration clearing, controller start, stop, variable reading and other commands.
[0227] The configuration adaptation module 1003 is used to call the simulation function corresponding to the user program logic through the data refresh thread; use the simulation function to execute the user program logic according to the configuration data to obtain the simulation result of the user program logic; and update the configuration data corresponding to the user program according to the simulation result.
[0228] The device can execute user program logic for different types of controllers. The number of the configuration adaptation modules can be multiple, and one configuration adaptation module is set for each type of controller.
[0229] Among them, different controllers may have different configuration space types and configuration offsets. Therefore, different configuration adaptation modules are set to realize configuration task processing for different controllers.
[0230] Among them, the detailed process of calling the simulation function to obtain the simulation result can refer to the explanation in the aforementioned method embodiment, which will not be repeated here.
[0231] Fig.11 1 is another structural diagram of a configuration simulation device for a user program provided in an embodiment of the present application. The configuration simulation device 1100 for a user program includes: a communication protocol parsing module 1101, a data processing module 1102, a configuration adaptation module 1103, a control module 1104, and a configuration interface module 1105;
[0232] The structure and function of the communication protocol parsing module 1101, the data processing module 1102 and the configuration adaptation module 1103 are the same as those described above. Fig.10 The corresponding structures and functions are the same, so they will not be described in detail this time.
[0233] The control module 1104 is used to receive a control command for triggering the configuration simulation device, and control the operation state of the configuration simulation device according to the control command;
[0234] The control command may be a command from an operator of the electronic device to control the configuration simulation device.
[0235] Among them, the control command can control the operating status of the configuration simulation device, such as starting operation, double-speed stepping, pausing, resuming operation, etc. The specific content of the control command is not limited in this application.
[0236] The configuration interface module 1105 is used to load configuration files for different simulation controllers to control the configuration simulation device to realize simulation of different controllers.
[0237] The configuration simulation device can simulate different controllers, and specifically, the configuration interface loads corresponding configuration files for different simulation controllers.
[0238] In a possible implementation, multiple controller configuration files may be pre-configured in the electronic device. When simulating a certain controller, the corresponding configuration file is loaded through the configuration interface module to realize the simulation of the configuration task processing process for the controller.
[0239] In a possible implementation, when the configuration simulation device is started, each module needs to be initialized and configured, and may be initialized with set initialization parameters.
[0240] In this embodiment, it includes: a communication protocol parsing module, which is used to download the configuration task of the user program from the host computer based on the communication protocol with the host computer, and the configuration task is obtained by configuring the user program through the host computer software; a data processing module, which is used to parse the configuration task and at least obtain the user program logic and configuration data corresponding to the configuration task; a configuration adaptation module, which is used to call the simulation function corresponding to the user program logic through the data refresh thread; use the simulation function to execute the user program logic according to the configuration data to obtain the simulation result of the user program logic; update the configuration data corresponding to the user program according to the simulation result. The simulation implementation for the controller is realized without setting up a hardware controller, which not only gets rid of the dependence on the controller hardware, but also brings about the improvement of the efficiency of the host computer software development, and it is convenient for users and implementation personnel to debug the correctness of the user program logic in advance, improve the efficiency of the construction of industrial field devices, save construction time, and thus improve the production efficiency of the automatic control system.
[0241] Fig.12 A timing diagram of the operation of a configuration simulation device of a user program provided in an embodiment of the present application, the timing diagram includes: a control module 1201, a data processing module 1202, a configuration adaptation module 1203, a communication protocol analysis module 1204 and an Ethernet simulator 1205;
[0242] After the simulation device is started, each component in the configuration simulation device is initialized first.
[0243] Step 1: Initialize the control module 1201 and the data processing module 1202
[0244] Step 2: Initialize the configuration adaptation module 1203;
[0245] Step 3: Initialize the communication protocol parsing module 1204;
[0246] Step 4: Initialize the Ethernet simulator 1205;
[0247] Step 5: Return the initialization result of the Ethernet simulator 1205;
[0248] Step 6: Return the initialization result of the communication protocol analysis module 1204;
[0249] Step 7: Return the initialization result of the configuration adaptation module 1203;
[0250] Step 8: Return the initialization result of the data processing module 1202;
[0251] Step 9: The control module executes the run command;
[0252] Step 10: Start the data processing thread in the data processing module.
[0253] Steps 11 to 15 represent the complete execution flow of a configuration task.
[0254] Step 11: Trigger the configuration adaptation module to start running the configuration task;
[0255] Step 12: Update memory data;
[0256] Step 13: Execute the user program logic calculation in the configuration task;
[0257] Step 14: Based on the calculated simulation results, synchronously update the memory data;
[0258] Step 15: The configuration adaptation module returns the simulation results to the data processing module.
[0259] Step 16 to step 21 represent the process in which the configuration simulation device analyzes the command request of the host computer software through the communication protocol analysis module.
[0260] Step 16: The protocol parsing module 1204 receives the UDP protocol request packet transmitted by the Ethernet simulator 1205;
[0261] Step 17: The protocol parsing module 1204 converts the UDP data packet into a UCP data packet;
[0262] Step 18: Call different command interfaces of the data processing module 1202 according to the different UCP commands parsed;
[0263] Step 19: The configuration adaptation module 1203 reads / writes data through the command interface of the data processing module 1202;
[0264] Step 20: The configuration adaptation module 1203 feeds back the read / write result to the data processing module 1202;
[0265] Step 21: The data processing module 1202 feeds back the read / write result to the protocol parsing module 1204.
[0266] The present application also provides an electronic device in an embodiment. Fig.13As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Fig.13 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0267] like Fig.13 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1302 or a program loaded from a storage device 1308 to a random access memory (RAM) 1303. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 1303. The processing device 1301, the ROM 1302, and the RAM 1303 are connected to each other via a bus 1304. An input / output (I / O) interface 1305 is also connected to the bus 1304.
[0268] Typically, the following devices may be connected to the I / O interface 1305: an input device 1306 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1308 including, for example, a memory card, a hard disk, etc.; and a communication device 1309. The communication device 1309 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Fig.13 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0269] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements a configuration simulation method of any user program provided in the embodiment of the present application.
[0270] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When one or more computer programs are executed by an electronic device, the electronic device can implement a configuration simulation method of any user program provided in an embodiment of the present application.
[0271] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0272] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0273] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0274] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
Claims
1. A configuration simulation method for a user program, characterized in that: include: Based on the communication protocol with the host computer, the configuration task for the user program is downloaded from the host computer, and the configuration task is obtained by configuring the user program through the host computer software; Parsing the configuration task to obtain at least the user program logic and configuration data corresponding to the configuration task; Calling a simulation function corresponding to the user program logic through a data refresh thread; Executing the user program logic according to the configuration data using the simulation function to obtain a simulation result of the user program logic; The configuration data corresponding to the user program is updated according to the simulation result.
2. The configuration simulation method of user program according to claim 1, characterized in that: The parsing of the configuration task to obtain at least the user program logic and configuration data corresponding to the configuration task includes: Parsing the configuration task to obtain the user program logic and data storage location corresponding to the configuration task; Based on the data storage location, configuration data corresponding to the user program logic is obtained.
3. The configuration simulation method of user program according to claim 1, characterized in that: The configuration task also includes operation cycle information, and the calling of the simulation function corresponding to the user program logic through the data refresh thread includes: Based on the operation cycle information, trigger a data refresh thread; The simulation function corresponding to the user program logic is called through the data refresh thread.
4. The configuration simulation method of user program according to claim 1, characterized in that: The calling of the simulation function corresponding to the user program logic through the data refresh thread includes: Parsing the user program logic through a data refresh thread to obtain three-address code information corresponding to the user program logic; Generate at least one target instruction according to the three address code information and a preset instruction configuration file, wherein the preset instruction configuration file records the corresponding relationship between each three address code information and each instruction; Based on the at least one target instruction, at least one simulation function corresponding to the at least one target instruction is called respectively.
5. The configuration simulation method of user program according to claim 4, characterized in that: The step of parsing the user program logic to obtain three-address code information corresponding to the user program logic includes: A configuration task of parsing a binary file format to obtain an offset position in the binary file; According to the offset position, obtaining the local target storage address of the three-address code information of the user program logic; From the target storage address, three-address code information of the user program logic is obtained.
6. The configuration simulation method of user program according to claim 1, characterized in that: The adopting the simulation function to execute the user program logic according to the configuration data to obtain the simulation result of the user program logic includes: Obtaining an address of a simulation function unit in the instruction configuration file, wherein the simulation function unit is a function unit that executes the simulation function; Based on the address of the simulation function unit, the simulation function unit is triggered to execute the user program logic according to the configuration data to obtain a simulation result of the user program logic.
7. The configuration simulation method of user program according to claim 1, characterized in that: The parsing of the configuration task, before at least obtaining the user program logic and configuration data corresponding to the configuration task, further includes: According to a preset user program format, the information header of the configuration task is parsed to obtain the verification information carried by the configuration task; Based on the verification of the verification information, the step of parsing the configuration task is executed to obtain at least the user program logic and configuration data corresponding to the configuration task; Based on the fact that the verification information fails the verification, the execution of the parsing of the configuration task is prohibited, and at least the user program logic and configuration data steps corresponding to the configuration task are obtained.
8. A configuration simulation device for a user program, characterized in that: include: A communication protocol parsing module, used for downloading configuration tasks for user programs from the host computer based on the communication protocol with the host computer, wherein the configuration tasks are obtained by configuring the user programs through the host computer software; A data processing module, used for parsing the configuration task to at least obtain the user program logic and configuration data corresponding to the configuration task; The configuration adaptation module is used to call the simulation function corresponding to the user program logic through the data refresh thread; use the simulation function to execute the user program logic according to the configuration data to obtain the simulation result of the user program logic; and update the configuration data corresponding to the user program according to the simulation result.
9. The configuration simulation device for user programs according to claim 8, characterized in that: Also includes: A control module, used for receiving a control command for triggering a configuration simulation device, and controlling the operation state of the configuration simulation device according to the control command; The configuration interface module is used to load configuration files for different simulation controllers to control the configuration simulation device to realize the simulation of different controllers.
10. An electronic device, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the configuration simulation method of the user program as described in any one of claims 1 to 7.