Disclosure of Invention
Based on this, the embodiment of the application provides a shaft motion control method and system based on a PLC, which can facilitate the development and debugging of programs of an upper computer and more intuitively understand the editing of shaft motion programs in a lower computer environment separated from the implementation.
In a first aspect, a PLC-based shaft motion control method is provided, which includes:
obtaining axis motion scene information data, and configuring a PLC simulator according to the axis motion scene information data; the PLC simulator is an axis motion simulator;
configuring an address table according to the address information of the upper computer and the register, and establishing a communication relation between the PLC simulator and the upper computer;
and acquiring an axis motion control instruction input by the upper computer based on the communication relation between the PLC simulator and the upper computer, and dynamically displaying axis motion after multithreading processing is carried out through a register corresponding to the communication relation.
Optionally, establishing a communication relationship between the PLC simulator and the upper computer specifically includes:
and the PLC simulator is communicated with the upper computer through a Modbus Tcp communication protocol.
Optionally, configuring an address table according to the address information of the upper computer and the register, further comprising:
and configuring an address table according to the variable address information.
Optionally, the control instructions include at least:
single axis debug instructions, action debug instructions, and program debug instructions.
Optionally, performing multi-thread processing through a register corresponding to the communication relationship, and then performing dynamic display of axis motion, includes:
and displaying the real-time motion effect of the shaft motion through an LCD display screen.
In a second aspect, there is provided a PLC-based shaft motion control system, the system comprising:
the acquisition module is used for acquiring the axis motion scene information data and configuring the PLC simulator according to the axis motion scene information data; the PLC simulator is an axis motion simulator;
the configuration module is used for configuring an address table according to the address information of the upper computer and the register and establishing a communication relation between the PLC simulator and the upper computer;
and the display module is used for acquiring an axis motion control instruction input by the upper computer based on the communication relation between the PLC simulator and the upper computer, and performing multi-thread processing through a register corresponding to the communication relation and then performing dynamic display of axis motion.
Optionally, establishing a communication relationship between the PLC simulator and the upper computer specifically includes:
and the PLC simulator is communicated with the upper computer through a Modbus Tcp communication protocol.
Optionally, configuring an address table according to the address information of the upper computer and the register, further comprising:
and configuring an address table according to the variable address information.
Optionally, the control instructions include at least:
single axis debug instructions, action debug instructions, and program debug instructions.
Optionally, the display module specifically includes:
and displaying the real-time motion effect of the shaft motion through an LCD display screen.
According to the technical scheme provided by the embodiment of the application, axis motion scene information data are obtained firstly, and a PLC simulator is configured according to the axis motion scene information data; then configuring an address table according to the address information of the upper computer and the register, and establishing a communication relation between the PLC simulator and the upper computer; and based on the communication relation between the PLC simulator and the upper computer, obtaining an axis motion control instruction input by the upper computer, and finally performing multi-thread processing through a register corresponding to the communication relation and then performing dynamic display of axis motion. It can be seen that the invention has the advantages that: under the environment of a lower computer which is separated from the realization, the development and the debugging of programs of an upper computer are facilitated, and the editing of axial motion programs can be more intuitively understood.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
In the description of the present invention, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements specifically listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus or additional steps or elements based on further optimization of the inventive concept.
Referring to fig. 1, a flow chart of a PLC-based axis motion control method according to an embodiment of the present application is shown, where the method may include the following steps:
step 101, obtaining axis motion scene information data, and configuring a PLC simulator according to the axis motion scene information data.
Wherein, the PLC simulator is an axis motion simulator.
And 102, configuring an address table according to the address information of the upper computer and the register, and establishing a communication relation between the PLC simulator and the upper computer.
In the embodiment of the application, the address table is configured according to the variable address information.
And 103, acquiring an axis motion control instruction input by the upper computer based on the communication relation between the PLC simulator and the upper computer, and dynamically displaying axis motion after multithreading processing is performed through a register corresponding to the communication relation.
In the embodiment of the application, the PLC simulator is communicated with the upper computer through a Modbus Tcp communication protocol. The control instructions at least comprise one or more of single-axis debugging instructions, action debugging instructions and program debugging instructions.
After the multithreading processing is carried out, the real-time motion effect of the shaft motion can be displayed through the LCD display screen.
The embodiment of the application provides a real-time motion effect schematic diagram of an axis motion simulator. The practical operation steps based on the method are given as follows:
1. configuring axis information of a PLC simulator;
2. configuring an address table;
3. operating a PLC simulation server;
4. detecting and playing the action, and observing the motion state of the shaft through a motion simulator;
5. detecting programs, playing the programs, and observing the theoretical effect of the mechanical programs through a motion simulator;
6. the effect of communicating the mechanical program with the director is achieved, and the real-time effect of the mechanical program displayed in the motion simulator is visually observed through the simulation environment.
In summary, the PLC simulation system of the present application is to implement the following functions, for example, as shown in fig. 2, a functional structure diagram of the PLC simulation system of the present application and an information interaction diagram of the PLC simulation system of fig. 3 are given:
the method comprises the steps that firstly, a Modbus Tcp communication protocol is supported;
secondly, variable address configuration is supported;
thirdly, supporting the input and output of the simulation motion data of the shaft;
and fourthly, PLC variable operation is supported. Debugging variable communication;
and fifthly, supporting dynamic display of the shaft motion.
The PLC simulation system is flexible in application and strong in transportability; the functions are complete, and the development and debugging of the upper computer program and the editing of mechanical programs are facilitated.
The embodiment of the application also provides a shaft motion control system based on the PLC. The system comprises:
the acquisition module is used for acquiring the axis motion scene information data and configuring the PLC simulator according to the axis motion scene information data; wherein, the PLC simulator is an axis motion simulator;
the configuration module is used for configuring an address table according to the address information of the upper computer and the register and establishing a communication relation between the PLC simulator and the upper computer;
and the display module is used for acquiring the shaft motion control instruction input by the upper computer based on the communication relation between the PLC simulator and the upper computer, and performing multi-thread processing through a register corresponding to the communication relation and then performing dynamic display of shaft motion.
In an optional embodiment of the present application, establishing a communication relationship between the PLC simulator and the upper computer specifically includes: and the PLC simulator is communicated with the upper computer through a Modbus Tcp communication protocol.
In an optional embodiment of the present application, configuring an address table according to address information of an upper computer and a register further includes: and configuring an address table according to the variable address information.
In an optional embodiment of the present application, the control instructions comprise at least single-axis debug instructions, action debug instructions, and program debug instructions.
In an alternative embodiment of the present application, the display module specifically includes displaying the real-time motion effect of the shaft motion through the LCD display screen.
The axis motion control system based on the PLC provided in the embodiment of the present application is used to implement the axis motion control method based on the PLC, and for specific limitations of the axis motion control system based on the PLC, reference may be made to the above limitations of the axis motion control method based on the PLC, which are not described herein again. Various portions of the PLC-based axis motion control system described above may be implemented in whole or in part by software, hardware, and combinations thereof. The modules can be embedded in a hardware form or independent from a processor in the device, and can also be stored in a memory in the device in a software form, so that the processor can call and execute operations corresponding to the modules.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the claims. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.