How to complete the real-time control of multi-task is the key problem that must be solved in the development of CNC system. This paper introduces the basic concept of multi-threading technology, analyzes the application method of multi-threading technology in C++ builder environment, and gives the application of multi-threading technology in real-time response of numerical control system through development examples.
1 Introduction
Real-time performance is an important performance indicator for CNC systems.
On the open CNC system development platform composed of IPC (Industrial Personal Computer) + motion controller, although this master-slave structure ensures that the motion control commands are executed in the motion controller in high speed and in real time, but on the PC Many tasks such as real-time display, pre-processing calculations, system status monitoring, etc. still need to be completed. In order to ensure the real-time performance of the system, it is proposed to adopt multi-threading technology to improve the real-time performance of the system through multi-task parallel processing.
This development platform adopts the open CNC system of IPC+ motion controller mode. The main motion control is completed by Gugo's GT400-SV universal motion controller. It provides the C language function library GT400sv.lib and the Windows dynamic link library GT400.dll, which can implement complex control functions. The development of the numerical control system is to integrate these control functions with the application modules such as data processing, interface display and user interface required by the control system to construct a control system that meets the requirements of specific applications.
2 processes and threads and multi-threading technology
The Windows operating system supports both multi-process and multi-threading. A process is an instance of an application. An execution process is a program that is loaded into memory to be executed, including the execution code of the currently executing application and some environment information related to program execution. Each process has the resources of the entire computer, without having to know the information of other processes on the computer. Usually, at least one thread in each process executes the code in its own address space. This thread is called the main thread. If the main thread finishes running, the system will automatically clear the process and other address spaces.
A thread is a path executed internally by a process. It is the basic entity that the operating system allocates CPU time and is the smallest unit in which the program runs. Each process starts with the main thread and executes the application. A thread consists of a stack, the state of a CPU register, and an entry in the list of system calls. Each process can contain more than one thread, which can execute code in the process address space independently and share all resources in the process.
The smallest unit of Windows system allocation processor time is the thread, and the system keeps switching between threads. In a PC, only one thread is running at a time. Usually, the time slice for each thread is small (ms level), so the real-time nature of the fast system is guaranteed.
To implement multithreaded programming, a worker thread and a user interface thread can be established. The auxiliary thread is mainly used to execute NC programs, coordinate display, dynamic simulation and data preprocessing; the user interface thread is used to process user input and respond to user generated events and messages.
3 Real-time analysis of CNC system
3.1 Thread real-time
There are many tasks that the CNC system needs to accomplish. Among these tasks, the priority level is different. According to this, you can use the multi-tasking, preemptive features and multi-threading technology of Windows system to assign each task to different threads and give different priorities to each thread. When high-priority threads execute, they are real-time requirements. When a high task needs to be executed, it can automatically terminate the work of other threads and execute this thread. Through this method, the real-time performance required by the numerical control system can be achieved.
3.2 Assisted Thread Creation
The auxiliary threads created in this development system can be roughly divided as follows:
(1) coordinate display thread
In the manual pulse panel, electric control panel and incremental control panel, the coordinates of the three motion axes X, Y and Z can be displayed in real time. This allows the operator to visually see the actual coordinates of the three axes. The real-time requirements are lower, so use the lowest priority: Lowest Normal.
(2) Graphic display thread
The image display thread is used to execute graphics drawing instructions in the dynamic simulation panel. Through the graphic display, the operator can operate the man-machine interface while dynamic simulation. This thread has low real-time requirements and the rating is: Blow Normal.
(3) IO state control thread
This thread is used to detect the discrete quantities input by the system, as well as the instructions from the NC program to output the status of each discrete quantity of the machine. This thread has a higher priority than the first two threads, and the level is: Normal.
(4) data preprocessing thread
The data preprocessing thread is mainly responsible for the execution of motion control data preprocessing functions such as code format conversion, tool length compensation, tool radius compensation and metric conversion. The rating is: Normal.
(5) Motion control thread
This thread is mainly used by the motion controller to perform the operation of the NC code function. Responsible for inputting motion control commands to the buffer, emptying the buffer and opening the shutdown buffer. The level is slightly higher: Above Normal.
(6) Emergency control thread
This thread handles some time that requires the machine to react immediately, such as an emergency stop of the machine. The highest priority, the level is: Highest.
Next page
4 Channel Reagent Reservoirs,8 Channel Reagent Reservoirs,12 Channel Reagent Reservoirs,96 Well Reservoir,384 Well Reservoir, from Yongyue Medical, is made of strong clear polypropylene (PP). Low profile designation which is suitable for small volume robotic tips used in high flux instruments. In the automatic pipetting process, the reservoir can perfectly overcome the surface tension of the liquid and minimize residual liquid
Our Reservoir Plates are perfect for storing volumes of samples to be pipetted into other microplates for further applications.
These plates are manufactured in cleanroom facilities which are certified free of RNase, DNase, human genomic DNA and endotoxins. We use only the highest medical grade virgin polypropylene with high resistance against chemicals such as DMSO, phenol, and chloroform. Pyramid channel bases are best for small volume recovery. The standard SBS footprint ensures its compatibility with automation.
Our sturdy and reusable reagent reservoirs can stand-up to autoclaving, exposure to temperature extremes, and chemicals. Made from polypropylene these reservoirs offer a stable base that makes them suitable for manual procedures as-well-as automation.
These fully automation compatible reservoirs feature an SBS footprint and can be used in plate handlers or stackers. To minimize space on platforms (when a stacker is not in use) or under hoods, these reservoirs can be filled and stacked.
Conical Bottom Design To Save Expensive Reagents
DNase/RNase & Pyrogen Free
Stable at -80℃
Conformed to ANSI/SBS Standards
96 Well Reservoir,Reagent Reservoir,Reservoir Plate,12 Channel Reservoir,8 Channel Reservoir,384 Well Reservoir
Yong Yue Medical Technology(Kunshan) Co.,Ltd , https://www.yongyue-tube.com