Home > News > CNC turning simulation using VC++ programming (2)
Online Service
Jewel

Ms. Jewel

Leave a message
Contact Now

CNC turning simulation using VC++ programming (2)

2022-09-27

2 NC code identification method and test grammar

CNC machine is to work in accordance with the NC program, NC program recording the process sequence to the processing part, trajectory and orientation, the amount of displacement parameters (speed, feed Amount, depth of cut) and auxiliary action (feeding, shifting, supply of cutting fluid). A complete cnc machining program consists of several blocks, which are generally represented as a single line of code in the program. The block has a certain format, that is, the arrangement, writing method and order of the words in the block, as well as the length limit and regulation of each word and the entire block. Different CNC machine control systems often have different block formats. If the format does not match, the CNC system will not accept it. At present, the program format commonly used at home and abroad is a variable block "word address format". Each word in the block begins with an address character, followed by a symbol and a number. The order in which the code words are arranged is not strictly required. Unwanted code words and the same recurring words as the previous paragraph may not be written. The format specified by the ISO4683-1-01-1982 standard formulated by the International Organization for Standardization is as follows:
N...G...X±...Y±...Z±...I±... J±...K±...M...S...T... F...
Where N indicates the serial number: G command is called the preparation function command, which is used to specify the relative motion trajectory of the tool and the workpiece, the machine coordinate system, the coordinate plane, the tool compensation, the coordinate offset, and other machining operations: X, Y, Z are coordinates The address of the axis: I, J, K are used to describe the coordinates of the arc in the machining: M is called the auxiliary function command: F, S, T are the feed speed command, the spindle speed command and the tool number command.
The simulation process of NC machining is mainly the simulation of NC code. To this end, the NC program is first analyzed, and then the components of the simulation program that are valid in the NC program are extracted to form a file supply program call, and the NC program is compiled. The interpretation process is divided into the following steps: 1 Read in the NC program. Firstly, a Cbuffer-like object corresponding to the NC code block format is created. This object is a data buffer. Since the NC program code acts as a basic action unit, each action is set to a basic storage unit. The NC machining information in the segment is read out in sequence: 2 The NC program is read in line by line, and the character validity check is performed according to the validity rule of the NC program: 3 The comment character in the block is filtered out. Two steps 2 and 3 are very important for testing the handwritten NC program, from which you can find writing errors: 4 perform other rule checks, such as the number of digits, the range of digits, etc.: 5 lines (ie a block) The unit performs semantic analysis on the extracted valid information, and converts the machine coordinates into window coordinates. Finally, the transformed coordinates are written into the coordinate NC information file. Performing semantic analysis is to identify the meanings of G, M, S, F, T, etc., and then the numbers after the letters are processed together to make a reaction about the machining information and the coordinate transformation of the tool path: M repeats the above process until the NC code The end, this forms a complete NC information file.
Due to the slightly different grammar of different CNC systems. The machining simulation system is mainly based on F@NAC numerical control system and ISO6983-1-1982. In this simulation software, the main rules for identifying the NC program are as follows: The effective character set of the 1NC program is: number 0 to 9: English letters N, G, M, T, F, S, X, Y, Z, I, J, K, R: The first line of the symbol %, (,), /: 2NC program must be the symbol "%" or a comment line. In this CNC system, the symbol "%" is the mark at the beginning of the program: the number after the 3G code and the M code must be two digits and be a valid code, for example: G00, G01, G90, M00, M06, etc.: 4 same group G code cannot be repeated in a row. For example: G00 stands for fast positioning, G01 stands for linear interpolation, they cannot appear on the same line: 5S code and T code must be numbers, and are limited by the specific machine parameters used. The number after T represents the tool number and should not exceed the tolerance of the machine tool magazine. The number after S is the spindle speed, which should not exceed a certain range. In addition, for the recurring instruction in the NC program, the simulation system adopts the data buffer method to read the NC code line by line and keeps the data all the time, so the problem of supporting the renewing instruction is conveniently solved.
Dynamic simulation

dynamic simulation tool path simulation tool path 3 and the cutting process is to check the correctness of the NC machining program by viewing a method of tool path in the cutting process, this method is simple and intuitive, It can quickly make a preliminary judgment on the correctness of the tool path. The flow of the tool path simulation algorithm mainly includes three parts:
NC coordinate information file interpretation execution: In this part, it is first necessary to identify whether the command mode is absolute command mode (G90) or incremental command mode (G91). Secondly, the numerical control commands (such as G01, G02, etc.) related to the coordinates and the corresponding coordinate parameters are obtained. Finally, the starting point and end point coordinates of the straight line travel, the starting point, the end point and the center coordinates of the tool arc travel are calculated, and the machine coordinates are converted into the screen coordinates as a file. This file becomes the basis for the subsequent trajectory simulation.
Interpolation: The description of the part by the NC program gives the start and end points of the line, the start and end points of the arc, the inverse circle or the radius and the radius of the arc. The NC coordinate information file in 1 is also a description of these quantities. In order to express the intermediate process in the linear or circular cutting, interpolation is used. Interpolation is to calculate the coordinate values of several intermediate points between the starting point and the end point of the contour. Point-by-point comparison interpolation is used here.


Figure 2 Dynamic simulation example of tool path

Previous page next page

Home

Product

Phone

About Us

Inquiry

We will contact you immediately

Fill in more information so that we can get in touch with you faster

Privacy statement: Your privacy is very important to Us. Our company promises not to disclose your personal information to any external company with out your explicit permission.

Send