Numerical solution of numerical control system
Editing pre-processing and decoding separation The traditional data system provides a program editor, its function is only to edit and modify the CNC source program, and the operation is inconvenient, and the NC program format analysis and word, syntax analysis (these work Often referred to as pre-processing) are all handled by the decoding module. In the decoding process, no matter whether the program is wrong or not, it must be analyzed, which wastes CPU time. Therefore, when we develop the data processing module, we separate the preprocessing function from the decoding submodule and integrate it into the editor submodule, so that the editor can input and edit the NC program, and can analyze the entire source program at one time. Check the error. When the error is found, it is modified in time to avoid the situation that the machine has to stop when there is an error in the process. Microsoft's Visual C++ 5.0 MFC provides a text editing class CEditView, which can generate a text editor similar to WordPad in Windows without using any code. Although it does not have the powerful word processing of Word, it is used. Editing the list of CNC systems is sufficient. The text editor is mainly composed of two sub-windows, one is the editing window, all the editing operations of the NC program are performed here; the other is the information window, which displays various information (including various error information) in the pre-processing process, which is greatly convenient. The modification of the program.
Since the NC is stored in ASCII format, it must be converted before being read into the buffer. In addition, in order to speed up the preprocessing, the source program is required to read into the memory at one time. To do this we define a data structure and an array: structNCFormat{LPTSTRNCLineS; the array UINTNCLength stored in the block; during the preprocessing, each block has to be scanned twice. The first scan is for format analysis and lexical analysis, and the second scan is for parsing. When an error is found during two scans, an error message is output to the information window. The error information is a data structure, which is defined as follows: structErrorInfo{UINTNCLineNO; the line with the error charNOChar; the character CStringLineStr with the error; the block UINTErrorKind where the error is located; the combination of the error type compile and the interpretation method, simply use the compile method or explain There are inevitable shortcomings in the method, so we combine the two methods to complement each other. Before starting the processing, first open a section of memory as a buffer (generally not too large, such as 256K), and then compile several blocks at a time until the buffer is full. Here, the result of the compilation is not the final code that the machine can recognize, but another data structure, which is defined as follows: structNCTemp{UINTNCLineNO; block line number CstringArrayModeAddress; store modal word CstringArrayNoModeAddress; store non-modal word BOOLAbsReCord; Absolute coordinate or relative coordinate mark UINTInterpG0123; Interpolation type CuterComG4012; Tool radius compensation type LenthComG434; Tool length compensation type EntMsgWorkPiece; Part entity coordinate information BOOLDowithFlag; The program is interpreted and processed; After the buffer is full, the interpretation processing program is started. The program segment stored by the above data structure is taken out from the buffer, and processed into a target program that the system can recognize, and then the motion track calculation, the feed rate calculation, the interpolation, and the position control are sequentially performed. Each block that has been interpreted and processed must have the flag DowithFlag set to TRUE.
Message driver is the fundamental operating mechanism of Windows 95, and multi-tasking multi-threaded operation is its biggest advantage. Here compile is defined as a thread; interpretation, motion trajectory calculation, feed rate calculation is defined as a thread; interpolation, position control is defined as a thread. The compile thread has the lowest priority and the three threads interact through the message. Once the CPU is idle and there are blocks in the buffer that have been interpreted, the compilation thread is started, and the program segment is read from the source program to refresh the interpreted blocks. This is alternated until the entire NC program is executed, which constitutes a temporal overlap of resources from a macro perspective.
(Finish)
Forged Products,Rotor Forging,Metal Forging Process,Forging Machine Parts
Zhangqiu Heavy Forging Co.,Ltd , https://www.zhangqiuforging.com