Simulation debugging method and device, electronic equipment and storage medium
By using model creation tools, simulation integration tools and simulation controllers in the simulation environment, detecting and feedbacking the data of multiple encoders, the problem of effective simulation and debugging of multiple encoder devices in the existing technology is solved, and a comprehensive verification of the logic, mechanical structure and dynamic interference of the device is achieved.
Patent Information
- Application Number
- CN202411337667.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2025-06-03
AI Technical Summary
The existing simulation debugging technology is difficult to effectively implement the feedback data and feedback methods of multiple encoders in the simulation environment, resulting in the inability to conduct full simulation debugging of equipment installed with multiple encoders.
Create the device motion axis through the model creation tool, use the simulation integration tool to send execution instructions, detect the current speed and displacement of multiple encoders, and calculate the actual displacement through the position calculation component, and feedback it to the simulation controller. When the target speed or displacement is not reached within the preset range, the command is sent again through the simulation controller until the target is reached.
Effective simulation debugging of devices containing multiple encoders in the simulation environment can be realized, and the logic of the PLC program, the availability of equipment mechanical structure and dynamic interference of equipment can be verified in advance.
Smart Images

Figure CN120086115A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular, to a simulation debugging method, apparatus, electronic device, and storage medium. Background Art
[0002] With the development of technology, simulation debugging technology has emerged. The simulation debugging technology transfers the debugging process in the real environment to the digital world. For some devices, problems such as the logic of the Programmable Logic Controller (PLC) program, the usability of the device mechanical structure, and the dynamic interference of the device can be verified in advance through the simulation debugging solution.
[0003] In the related art, only the motion axis of the device with a single encoder installed is simulated and debugged in the simulation environment. However, for certain devices, such as some machine tools, automated guided vehicles, mobile trolleys, non-standard devices, etc., since multiple sets of encoders are installed on their motion axes, the feedback data and feedback methods of these multiple sets of encoders cannot be effectively implemented in the simulation environment. Therefore, full-scale simulation debugging of such devices cannot be performed, and thus it is impossible to verify in advance problems such as the logic of the PLC program, the usability of the device mechanical structure, and the dynamic interference of the device through simulation debugging. Summary of the Invention
[0004] In view of this, the simulation debugging method, apparatus, electronic device, and storage medium provided by the present application can perform simulation debugging on devices including multiple encoders in advance.
[0005] According to the first aspect of the embodiments of the present application, a simulation debugging method is provided, including:
[0006] The device motion axis response simulation controller created by the model creation tool moves according to the execution instruction sent by the simulation integration tool, obtains the current speed and current displacement detected by multiple encoders, and sends the current speed and the current displacement to the simulation integration tool; the execution instruction includes a target speed and a target displacement;
[0007] The position calculation component in the simulation integration tool calculates an actual displacement based on the current displacement; and sends the actual displacement and the current speed to the simulation controller;
[0008] When the current speed and / or the actual displacement do not reach the target speed and / or the target displacement within a preset range, the simulation controller sends a re-execution instruction to the device motion axis according to a preset program until the device motion axis reaches the target speed and / or the target displacement within the preset range, and the preset program is completed.
[0009] According to a second aspect of the embodiments of the present application, a simulation debugging device is provided, including:
[0010] A detection module, configured to move by using an execution instruction sent by a simulation integration tool through a device motion axis response simulation controller created by a model creation tool, obtain a current speed and a current displacement detected by a plurality of encoders, and send the current speed and the current displacement to the simulation integration tool; the execution instruction includes a target speed and a target displacement;
[0011] A calculation module, configured to calculate an actual displacement by using a position calculation component in the simulation integration tool based on the current displacement; and send the actual displacement and the current speed to the simulation controller;
[0012] A sending module, configured to, when the current speed and / or the actual displacement do not reach the target speed and / or the target displacement within a preset range, send a re-execution instruction to the motion axis through the simulation controller according to a preset program until the device motion axis reaches the target speed and / or the target displacement within the preset range, and complete the preset program.
[0013] According to a third aspect of the embodiments of the present application, an electronic device is provided, including: a processor, a memory, a communication interface, and a communication bus, where the processor, the memory, and the communication interface complete mutual communication through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction causes the processor to execute the operations corresponding to the method described in the first aspect or the second aspect.
[0014] According to a fourth aspect of the embodiments of the present application, a computer storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method described in the first aspect or the second aspect is implemented.
[0015] As can be seen from the above technical solution, the device motion axis response simulation controller created by using the model creation tool moves according to the execution instructions sent by the simulation integration tool, obtains the current speed and current displacement detected by multiple encoders, and sends the current speed and current displacement to the simulation integration tool; the execution instructions include the target speed and target displacement; the position calculation component in the simulation integration tool calculates based on the current displacement to obtain the actual displacement; and sends the actual displacement and the current speed to the simulation controller; when the current speed and / or the actual displacement do not reach the target speed and / or the target displacement within the preset range, the simulation controller sends a re-execution instruction to the device motion axis according to the preset program until the device motion axis reaches the target speed and / or the target displacement within the preset range, and the preset program is completed. In this process, in the simulation environment, the position calculation component in the simulation integration tool calculates the actual displacement based on the current displacement detected by the device motion axis including multiple encoders, and feeds back the actual displacement and the current speed to the simulation controller, realizing the interaction of information among the model creation tool, the simulation integration tool, and the simulation controller, enabling the corresponding simulation debugging of the device including multiple encoders in advance. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The following will describe in detail the preferred embodiments of the present invention with reference to the accompanying drawings, making the above and other features and advantages of the present invention clearer to those of ordinary skill in the art. In the drawings:
[0017] Figure 1 is the flowchart of the simulation debugging method according to an embodiment of the present application Figure 1 ;
[0018] Figure 2 is a schematic diagram of the operation of a full-closed loop control system according to an embodiment of the present application;
[0019] Figure 3 is a schematic structural diagram of a simulation debugging device according to an embodiment of the present application;
[0020] Figure 4 is a schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0021] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying 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 embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art shall fall within the protection scope of the embodiments of the present application.
[0022] The following will describe in detail the simulation debugging method, electronic device, and storage medium provided by the embodiments of the present application with reference to the accompanying drawings.
[0023] Simulation and debugging method
[0024] Figure 1 is the flowchart of the simulation debugging method according to an embodiment of the present application Figure 1 As Figure 1 shown, the simulation debugging method includes the following steps:
[0025] S101. The device motion axis response simulation controller created by the model creation tool moves according to the execution instruction sent by the simulation integration tool, obtains the current speed and current displacement detected by multiple encoders, and sends the current speed and current displacement to the simulation integration tool; the execution instruction includes the target speed and target displacement.
[0026] In the embodiments of the present application, the device motion axis refers to the axis in the device used to achieve motion or rotation in different directions, which is driven by a drive system so that the device can move according to a preset path and speed. The model creation tool can be a simulation platform, on which a virtual device motion axis is obtained by modeling according to the actual device motion axis. The simulation controller is the simulation and reproduction of the actual controller, aiming to simulate the functions of the actual controller. The simulation integration tool is not only used for information transmission between the model creation tool and the simulation controller, but also used to develop a position calculation component for displacement calculation.
[0027] Further, after the device motion axis is created by the model creation tool, the simulation controller sends an execution instruction to the simulation integration tool. The simulation integration tool receives the execution instruction, parses it to obtain the parsed execution instruction, and sends the execution instruction to the device motion axis. The execution instruction is used to instruct the device motion axis to move, and the execution instruction includes the target speed and target displacement indicating the movement of the device motion axis. The device motion axis responds to the execution instruction and detects the current speed and current displacement through multiple encoders installed on the device motion axis. Among the multiple encoders, there may include a speed encoder and a position encoder. The current speed is detected by the speed encoder, and the current displacement is detected by the position encoder.
[0028] Exemplarily, the simulation environment can be constructed through a model creation tool (Mechatronics Concept Designer, NXMCD), a simulation integration tool (SIMIT Simulation Framework, SIMIT), and a simulation controller (PLC SimulationAdvanced, PLCSIM AdvancedAdvanced).
[0029] Exemplarily, as Figure 2 shown, Figure 2 is a schematic diagram of the operation of a full-closed-loop control system according to an embodiment of the present application. Figure 2 is a schematic diagram of the operation of an actual full-closed-loop control system, where 1 is a controller, 2 is a position control circuit, 3 is a speed control circuit, 4 is a servo motor, 5 is a device movement axis, 6 is a speed encoder, 7 is a position encoder, 8 is to feed back the displacement detected by the position encoder to the position control circuit, and 9 is to feed back the speed detected by the speed encoder to the speed control circuit. The present application can Figure 2 The working flow chart containing multiple encoders in
[0030] S102. Use the position calculation component in the simulation integration tool to calculate based on the current displacement to obtain the actual displacement; and send the actual displacement and the current speed to the simulation controller.
[0031] In the embodiment of the present application, when the encoder is used in the application scenario, the initial value may be set to 0 or a specific starting value. When the initial value is set to a specific starting value and the initial displacement of the device movement axis is 0, after the device movement axis moves based on the initial displacement subsequently, that is, after moving forward from 0, the actual displacement of the device movement axis is inconsistent with the displacement measured by the encoder, further making the displacement of the device movement axis fed back to the simulation controller inaccurate. Therefore, use the position calculation component in the simulation integration tool to calculate based on the current displacement to obtain the actual displacement, and send the obtained actual displacement and the current speed to the simulation controller.
[0032] Exemplarily, the initial displacement of the device movement axis is 0, and it moves in response to an execution instruction to a position of 100 meters. Then the current displacement is 100. However, if the starting value set by the encoder is 1000, when the device movement axis moves to a position of 100 meters, the displacement detected by the encoder is 1100, that is, the current displacement obtained is 1100, and 1100 is sent to the simulation controller, resulting in inaccurate displacement values. Therefore, develop a position calculation component in the simulation integration tool, and use the position calculation component to calculate the actual displacement based on the current displacement detected by the encoder, that is, calculate the actual displacement of 100 according to the current displacement of 1100.
[0033] Among them, the simulation integration tool can feed back the current displacement and the current speed of the device movement axis in different time periods to the simulation controller in real time. The position calculation component can be developed through a Component Type Editor (CTE) or a template development tool.
[0034] S103. When the current speed and / or the actual displacement do not reach the target speed and / or the target displacement within the preset range, the simulation controller sends a re-execution instruction to the device motion axis according to the preset program until the device motion axis reaches the target speed and / or the target displacement within the preset range, and the preset program is completed.
[0035] In an embodiment of the present application, the preset program may be a PLC program written by the user. When the current speed and / or the actual displacement within the preset range specified in the preset program do not reach the target speed and / or the target displacement, the simulation controller may send a re-execution instruction to the device motion axis according to the preset program. The re-execution instruction may include the acceleration value of the device motion axis, so that the motion axis of the device responds to the re-execution instruction to move until the motion axis reaches the target speed / or the target displacement within the preset range, and the preset actions specified in the preset program are completed. Among them, the preset range may be a specified time range or an acceleration range, etc.
[0036] In an embodiment of the present application, through the sending of a series of execution instructions, if the current speed / current displacement of the device motion axis does not reach the target speed / or the target displacement within the preset range, then this simulation debugging proves that there is an error in the logic of the preset program, the usability of the device mechanism, or the interaction between the actual controller and the actual device, and rectification is required.
[0037] It can be understood that in an embodiment of the present application, the device motion axis response created by the model creation tool moves according to the execution instructions sent by the simulation integration tool, obtains the current speed and the current displacement detected by multiple encoders, and sends the current speed and the current displacement to the simulation integration tool; the execution instructions include the target speed and the target displacement; the position calculation component in the simulation integration tool is used to calculate based on the current displacement to obtain the actual displacement; and the actual displacement and the current speed are sent to the simulation controller; when the current speed and / or the actual displacement do not reach the target speed and / or the target displacement within the preset range, the simulation controller sends a re-execution instruction to the device motion axis according to the preset program until the device motion axis reaches the target speed and / or the target displacement within the preset range, and the preset program is completed. In this process, in the simulation environment, the actual displacement is calculated based on the current displacement detected by multiple encoders by the position calculation component in the simulation integration tool, and the actual displacement and the current speed are fed back to the simulation controller, realizing the interaction of information among the model creation tool, the simulation integration tool, and the simulation controller, and enabling the corresponding simulation debugging of the device including multiple encoders in advance.
[0038] In some embodiments of the present application, before S101, there is also S10, and the sending of the actual displacement and the current speed to the simulation controller in S102 can be implemented through S1021, which will be described through the following steps.
[0039] S10. Parse the execution instructions sent by the simulation controller through the drive messages configured in the simulation integration tool to obtain first parsed data; and send the first parsed data to the device motion axis.
[0040] In some embodiments of the present application, there is no direct data interaction between the simulation controller and the actuator, that is, the created device motion axis. The simulation controller sends the execution instructions to the simulation integration tool. After receiving the execution instructions sent by the simulation controller, the simulation integration tool parses the execution instructions through the configured drive messages to obtain the parsed execution instructions, that is, the first parsed data, and sends the first parsed data to the device motion axis.
[0041] S1021. Package the actual displacement and the current speed into a message to obtain a first transmission message; and send the first transmission message to the simulation controller.
[0042] In some embodiments of the present application, message packaging refers to packing the data to be transmitted in a certain format and adding necessary identifiers and control information for transmission and reception in network communication. There is no direct data interaction between the simulation controller and the actuator, that is, the created device motion axis. After the simulation integration tool obtains the actual displacement and the current speed sent by the device motion axis, it packages the actual displacement and the current speed into a message to obtain a first transmission message, and sends the first transmission message to the simulation controller.
[0043] It can be understood that in some embodiments of the present application, the execution instructions sent by the simulation controller are parsed through the drive messages configured in the simulation integration tool to obtain first parsed data; and the first parsed data is sent to the device motion axis, and the actual displacement and the current speed are packaged into a message to obtain a first transmission message; and the first transmission message is sent to the simulation controller. Through the simulation integration tool, a connection is established between the model creation tool and the simulation controller to achieve data interaction.
[0044] In some embodiments of the present application, sending the current speed and the current displacement to the simulation integration tool in S101 can be achieved through S1011 to S1012 and is implemented through the following steps.
[0045] S1011. Convert the current speed and the current displacement through a signal adapter to obtain the converted current speed and the converted current displacement.
[0046] In some embodiments of the present application, a signal adapter is used to connect and convert interfaces of different types or specifications, so that incompatible simulation integration tools and model creation tools can communicate and interact effectively. The signal adapter mainly converts signal types, protocols, voltages, interfaces, etc., to ensure that data exchange and communication can be correctly carried out between the simulation integration tools and the model creation tools. The current speed and the current displacement are data-converted through the signal adapter to obtain the converted current speed and the converted current displacement.
[0047] S1012. Send the converted current speed and the converted current displacement to the simulation integration tool through a preset signal interface.
[0048] A signal interface is a physical interface for connecting communication devices to transmit information. Its function is to convert the digital signal from the sender into a signal suitable for the transmission medium and send it to the receiver, and at the same time convert the signal sent back by the receiver into a digital signal suitable for the sender to process.
[0049] In some embodiments of the present application, the converted speed and the converted current displacement are converted through a preset signal interface and sent to the simulation integration tool. The converted current speed and the converted current displacement are sent to the simulation integration tool through the preset signal interface to ensure the accuracy and reliability of data transmission and realize the exchange and sharing of information.
[0050] It can be understood that in some embodiments of the present application, the current speed and the current displacement are data-converted through the signal adapter to obtain the converted current speed and the converted current displacement, so that incompatible simulation integration tools and model creation tools can communicate and interact effectively.
[0051] In some embodiments of the present application, the calculation of the actual displacement based on the current displacement by using the position calculation component in the simulation integration tool in S102 can be implemented through S201, and the following steps are used for illustration.
[0052] S201. Input the initial position and the current position of the device moving axis into the position calculation component for calculation to obtain the actual displacement.
[0053] In some embodiments of the present application, the initial position of the device moving axis is the position detected at the previous moment of the current position. The received and parsed current position and the initial position of the device moving axis are input into the developed position component for calculation to obtain the actual position of the device moving axis in the position encoder.
[0054] Exemplarily, at the first moment, the device moving axis moves to position A, and at the second moment, the device moving axis moves to position B. Then, the initial position of the device moving axis at the second moment is A.
[0055] Among them, the position calculation component is a module developed for the simulation integration tool to complete the special function of position calculation, which can accurately calculate the actual displacement of the device motion axis on the position encoder. After calculating the actual displacement, the simulation integration tool encapsulates the actual displacement into a message and sends the encapsulated message to the simulation controller.
[0056] It can be understood that in some embodiments of the present application, the initial position and the current position of the device motion axis are input into the position calculation component for calculation to obtain the actual displacement, so that the simulation controller can effectively obtain the feedback data detected by the position encoder in the simulation environment.
[0057] In some embodiments of the present application, before S101, there are also S20 to S22, which are described through the following steps.
[0058] S20: According to the hardware configuration of the current programmable logic controller, add the first variable for controlling the device motion axis, the address corresponding to the first variable, the second variable of the position encoder among multiple encoders, and the address corresponding to the second variable in the variable table corresponding to the current project.
[0059] In some embodiments of the present application, the hardware configuration is a process of configuring hardware devices to ensure that they can work together correctly. In the current project, such as a TIA (Totally Integrated Automation) project, the hardware configuration is the first step in the implementation of the entire project. The variable table is used to centrally manage all variables, and all variables are centrally displayed in a table for easy searching and management. Among them, the variables include global variables, local variables, and data block variables. According to the hardware configuration of the current programmable logic controller, add the first variable for controlling the device motion axis, the address corresponding to the first variable, the second variable of the position encoder among multiple position encoders, and the address corresponding to the second variable encoder in the variable table corresponding to the current project to determine the updated configuration, and import the updated hardware configuration into the simulation integration tool.
[0060] Among them, the first variable can be a speed variable.
[0061] S21: Determine the updated hardware configuration according to the first variable, the address corresponding to the first variable, the second variable of the position encoder, and the address corresponding to the second variable; and import the updated hardware configuration into the simulation integration tool.
[0062] In some embodiments of the present application, when the added variables involve new hardware, it is necessary to perform a new hardware configuration again to obtain the updated hardware configuration and import the updated hardware configuration into the simulation integration tool.
[0063] S22. Configure messages according to the updated hardware configuration in the simulation integration tool to obtain the configured drive messages; the drive messages are used to parse the data sent by the simulation controller.
[0064] In this application, after importing the updated hardware configuration into the simulation integration tool, it is necessary to configure messages according to the updated hardware configuration, communicate with the simulation controller according to the configured drive messages, and parse the data sent by the simulation controller.
[0065] It can be understood that in some embodiments of this application, variables and their corresponding positions are added in the current project according to the hardware configuration, which improves the readability and maintainability of the program. Determining the updated hardware configuration according to the added variables and addresses enhances the system performance and stability and supports new functions and applications. Importing the updated hardware configuration into the simulation integration tool, the drive messages configured according to the updated hardware configuration in the simulation integration tool can effectively parse the data sent by the simulation controller.
[0066] In some embodiments of this application, S201 can be implemented through S2011 to S2012, and the following steps are used for illustration.
[0067] S2011. Receive the range and accuracy of the set position encoder through the position calculation component to obtain the set position calculation component.
[0068] S2012. Input the initial position and the current position into the set position calculation component to obtain the actual displacement.
[0069] In some embodiments of this application, the user can set the range and accuracy of the position encoder in the position calculation component by themselves or select within the existing range of range and accuracy. The accuracy represents the error range of the current displacement detected by the position encoder, and the range is the range composed of the minimum value and the maximum value, so that the displacement value detected by the position encoder is within the set range. By setting the range and accuracy of the position encoder in the position calculation component, and then inputting the initial position and the current position into the set position calculation component, the actual displacement is obtained.
[0070] It can be understood that in some embodiments of this application, setting the range and accuracy of the position encoder in the position calculation component and inputting the initial position and the current position into the set position calculation component improves the accuracy of actual displacement calculation.
[0071] In some embodiments of this application, after using the position calculation component in the simulation integration tool in S102 to calculate based on the current displacement to obtain the actual displacement, it may further include S30, which is illustrated by the following steps.
[0072] S30. Create a specific template component corresponding to a specific project using the developed position calculation component, so as to be reused in the specific project based on the specific template component.
[0073] In some embodiments of the present application, after the position calculation component is developed, the position calculation component can be used as a specific template component. The specific project is a project related to this project for calculating the actual displacement, speed, or time measured by an encoder, etc. Or it is not limited to an encoder, and can also be an inertial measurement unit, an accelerometer, or a potentiometer, etc. In a project identical to this project, the position calculation component can be directly reused. In a project related to this project, the specific template component is modified and then reused.
[0074] It can be understood that, in some embodiments of the present application, creating a specific template component corresponding to a specific project using the developed position calculation component for reuse in the specific project based on the specific template component improves the development efficiency, reduces the development cost, and reduces the risk of project failure.
[0075] Figure 3 It is a schematic structural diagram of a simulation debugging device according to an embodiment of the present application. This device is applicable to execute the simulation debugging method provided by the embodiments of the present application, such as Figure 3 shown, this device may specifically include:
[0076] A detection module 301, configured to move by using an execution instruction sent by a simulation integration tool through a device motion axis response simulation controller created by a model creation tool, obtain the current speed and current displacement detected by multiple encoders, and send the current speed and the current displacement to the simulation integration tool; the execution instruction includes a target speed and a target displacement;
[0077] A calculation module 302, configured to calculate an actual displacement based on the current displacement by using a position calculation component in the simulation integration tool; and send the actual displacement and the current speed to the simulation controller;
[0078] A sending module 303, configured to, when the current speed and / or the actual displacement do not reach the target speed and / or the target displacement within a preset range, send a re-execution instruction to the motion axis through the simulation controller according to a preset program until the device motion axis reaches the target speed and / or the target displacement within the preset range and completes the preset program.
[0079] In one embodiment, the simulation debugging device further includes a parsing module. Before the device motion axis response simulation controller created by the model creation tool moves according to the execution instructions sent by the simulation integration tool to obtain the current speed and current displacement detected by multiple encoders, the parsing module is used to parse the execution instructions sent by the simulation controller through the drive message configured in the simulation integration tool to obtain first parsed data; and send the first parsed data to the device motion axis;
[0080] In one embodiment, the simulation debugging device further includes a packaging module. The packaging module is used to package the actual displacement and the current speed into a message to obtain a first transmission message; and send the first transmission message to the simulation controller.
[0081] In one embodiment, the calculation module 302 is specifically used for:
[0082] Convert the current speed and the current displacement through a signal adapter to obtain the converted current speed and the converted current displacement;
[0083] Send the converted current speed and the converted current displacement to the simulation integration tool through a preset signal interface.
[0084] In one embodiment, the calculation module 302 is specifically used for:
[0085] Input the initial position and the current position of the device motion axis into the position calculation component for calculation to obtain the actual displacement.
[0086] In one embodiment, the simulation device further includes a configuration module. Before the device motion axis response simulation controller created by the model creation tool moves according to the execution instructions sent by the simulation integration tool to obtain the current speed and current displacement detected by multiple encoders, the configuration module is used to add, according to the hardware configuration of the current programmable logic controller, a first variable for controlling the device motion axis, the address corresponding to the first variable, a second variable of the position encoder among the multiple encoders, and the address corresponding to the second variable to the variable table corresponding to the current project;
[0087] Determine the updated hardware configuration according to the first variable, the address corresponding to the first variable, the second variable of the position encoder, and the address corresponding to the second variable; and import the updated hardware configuration into the simulation integration tool;
[0088] Perform message configuration according to the updated hardware configuration in the simulation integration tool to obtain the configured drive message; the drive message is used to parse the data sent by the simulation controller.
[0089] In one embodiment, the calculation module 302 is specifically configured to:
[0090] Receive the range and precision of the position encoder set by the position calculation component, and obtain the position calculation component after setting;
[0091] Input the initial position and the current position into the set position calculation component to obtain the actual displacement.
[0092] In one embodiment, the simulation adjustment device further includes a creation module. After calculating the actual displacement based on the current displacement by using the position calculation component in the simulation integration tool, the creation module is used to create a specific template component corresponding to a specific project by using the developed position calculation component, so as to be reused in the specific project based on the specific template component.
[0093] In the device of the present application, the device motion axis response simulation controller created by using the model creation tool moves according to the execution instruction sent by the simulation integration tool, obtains the current speed and the current displacement detected by multiple encoders, and sends the current speed and the current displacement to the simulation integration tool; the execution instruction includes the target speed and the target displacement; calculates the actual displacement based on the current displacement by using the position calculation component in the simulation integration tool; and sends the actual displacement and the current speed to the simulation controller; when the current speed and / or the actual displacement do not reach the target speed and / or the target displacement within the preset range, the simulation controller sends a re-execution instruction to the device motion axis according to the preset program until the device motion axis reaches the target speed and / or the target displacement within the preset range, and the preset program is completed. In this process, in the simulation environment, the actual displacement is calculated based on the current displacements detected by multiple encoders by using the position calculation component in the simulation integration tool, and the actual displacement and the current speed are fed back to the simulation controller, realizing the interaction of information among the model creation tool, the simulation integration tool, and the simulation controller, so that the device including multiple encoders can be subjected to corresponding simulation debugging in advance.
[0094] Refer to Figure 4 , which shows a schematic diagram of an electronic device according to an embodiment of the present application. The specific implementation of the electronic device is not limited in the specific embodiments of the present application.
[0095] As Figure 4 shown, the electronic device 600 may include: a processor 602, a communications interface 604, a memory 606, and a communication bus 608.
[0096] Wherein:
[0097] The processor 602, the communication interface 604, and the memory 606 communicate with each other via the communication bus 608.
[0098] The communication interface 604 is used to communicate with other electronic devices or servers.
[0099] The processor 602 is used to execute the program 610, and specifically can execute the relevant steps in the above method embodiments.
[0100] Specifically, the program 610 may include program code, and the program code includes computer operation instructions.
[0101] The processor 602 may be a central processing unit (CPU), or a specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. One or more processors included in the intelligent device may be of the same type of processor, such as one or more CPUs; or may be of different types of processors, such as one or more CPUs and one or more ASICs.
[0102] The memory 606 is used to store the program 610. The memory 606 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk memory.
[0103] The program 610 is specifically used to cause the processor 602 to perform the operations corresponding to the methods described in the above method embodiments.
[0104] For the specific implementation of each step in the program 610, reference may be made to the corresponding steps and descriptions in the above method embodiments, which will not be elaborated here. Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the above-described devices and modules can refer to the corresponding process descriptions in the foregoing method embodiments, which will not be elaborated here.
[0105] It should be noted that according to the needs of implementation, each component / step described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.
[0106] The method according to the embodiments of the present application can be implemented in hardware, firmware, or be implemented as software or computer code that can be stored in a recording medium (such as a CD ROM, RAM, floppy disk, hard disk, or magneto-optical disk), or be implemented as computer code originally stored in a remote recording medium or a non-transitory machine-readable medium and to be downloaded through a network and stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware (such as an ASIC or FPGA). It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component (such as RAM, ROM, flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by the computer, the processor, or the hardware, the method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the method shown herein, the execution of the code converts the general-purpose computer into a dedicated computer for executing the method shown herein.
[0107] Those of ordinary skill in the art can realize that the units and method steps of each example described in combination with the embodiments disclosed herein can be implemented in electronic hardware, or in a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. A professional technician can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present application.
[0108] The above embodiments are only used to illustrate the embodiments of the present application, rather than to limit the embodiments of the present application. Those of ordinary skill in the relevant technical field can also make various changes and modifications without departing from the spirit and scope of the embodiments of the present application. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present application, and the patent protection scope of the embodiments of the present application should be defined by the claims.
Claims
1. A simulation debugging method, characterized in that: include: The device motion axis response simulation controller created by the model creation tool moves according to the execution instruction sent by the simulation integration tool, obtains the current speed and current displacement detected by multiple encoders, and sends the current speed and current displacement to the simulation integration tool; the execution instruction includes the target speed and the target displacement; Using the position calculation component in the simulation integrated tool to perform calculation based on the current displacement to obtain the actual displacement; and sending the actual displacement and the current speed to the simulation controller; When the current speed and / or the actual displacement does not reach the target speed and / or the target displacement within the preset range, the simulation controller sends a re-execution instruction to the device motion axis according to a preset program until the device motion axis reaches the target speed and / or the target displacement within the preset range, thereby completing the preset program.
2. The method according to claim 1, characterized in that The device motion axis created by the model creation tool responds to the simulation controller through the execution instruction sent by the simulation integration tool to move, and before obtaining the current speed and current displacement detected by multiple encoders, the method also includes: Parsing the execution instruction sent by the simulation controller through the drive message configured in the simulation integration tool to obtain first parsed data; and sending the first parsed data to the device motion axis; The sending the actual displacement and the current speed to the simulation controller comprises: The actual displacement and the current speed are packaged into a message to obtain a first transmission message; and the first transmission message is sent to the simulation controller.
3. The method according to claim 1 or 2, characterized in that: The sending the current speed and the current displacement to the simulation integration tool comprises: Performing data conversion on the current speed and the current displacement through a signal adapter to obtain a converted current speed and a converted current displacement; The converted current speed and the converted current displacement are sent to the simulation integration tool through a preset signal interface.
4. The method according to claim 1, characterized in that: The using the position calculation component in the simulation integrated tool to calculate based on the current displacement to obtain the actual displacement includes: The initial position of the device motion axis and the current position are input into the position calculation component for calculation to obtain the actual displacement.
5. The method according to claim 1, characterized in that The device motion axis created by the model creation tool responds to the simulation controller through the execution instruction sent by the simulation integration tool to move, and before obtaining the current speed and current displacement detected by multiple encoders, the method also includes: According to the hardware configuration of the current programmable logic controller, add a first variable for controlling the motion axis of the device, an address corresponding to the first variable, a second variable of a position encoder among the multiple encoders, and an address corresponding to the second variable in a variable table corresponding to the current project; Determine an updated hardware configuration according to the first variable, the address corresponding to the first variable, the second variable of the position encoder, and the address corresponding to the second variable; and import the updated hardware configuration into the simulation integration tool; In the simulation integration tool, message configuration is performed according to the updated hardware configuration to obtain the configured drive message; the drive message is used to parse the data sent by the simulation controller.
6. The method according to claim 4, characterized in that The step of inputting the initial position and the current position of the device motion axis into the position calculation component for calculation to obtain the actual displacement includes: Receiving the set range and accuracy of the position encoder through the position calculation component to obtain the set position calculation component; The initial position and the current position are input into the set position calculation component to obtain the actual displacement.
7. The method according to any one of claims 1, 4 or 6, characterized in that: After the position calculation component in the simulation integrated tool is used to calculate based on the current displacement to obtain the actual displacement, the method further includes: The developed position calculation component is used to create a specific template component corresponding to a specific project, so as to be reused in the specific project based on the specific template component.
8. A simulation debugging device, characterized in that: include: A detection module is used to move the motion axis of the device created by the model creation tool in response to the execution instruction sent by the simulation integration tool through the simulation controller, obtain the current speed and current displacement detected by multiple encoders, and send the current speed and current displacement to the simulation integration tool; the execution instruction includes a target speed and a target displacement; A calculation module, used for performing calculation based on the current displacement using a position calculation component in the simulation integrated tool to obtain an actual displacement; and sending the actual displacement and the current speed to the simulation controller; A sending module is used to send a re-execution instruction to the motion axis through the simulation controller according to a preset program when the current speed and / or the actual displacement does not reach the target speed and / or the target displacement within the preset range, until the device motion axis reaches the target speed and / or the target displacement within the preset range, thereby completing the preset program.
9. An electronic device, comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform an operation corresponding to the method as described in any one of claims 1-7.
10. A computer storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.