Basic Principle
During NC machining, once the program begins execution, the tool specified in the program is typically selected first, followed by the execution of the machining block after reading the currently valid tool radius parameter. To ensure tool compensation and prevent errors, a judgment module should be inserted between the two program statements before executing the machining block. This module evaluates whether the currently valid tool radius falls within the appropriate range: programs meeting the criteria proceed downward, while those failing the check jump to an alarm block and terminate (as illustrated in Figure 1).
2. Key Programming Instructions and System Parameters
To implement the tool offset error prevention function described in the principle above, the execution program must include three essential elements: retrieving the currently valid tool radius, performing logical operations and conditional checks, and handling program jumps and displaying alarm messages.
The following provides a detailed explanation of the programming commands and system parameters required for programming using the Siemens SINUMERIK system.
(1) Retrieving the Valid Tool Radius Value: The current valid tool radius value is obtained by reading a system variable. In the SINUMERIK system, "$TC_DP6[t,d]" represents the geometry radius value of a specific tool, where 't' is the tool number and 'd' is the tool offset address number. The commonly used readable form is "$TC_DP6[$P_TOOLNO, $P_TOOL]", where "$P_TOOLNO" is the system variable indicating the currently active tool number, and "$P_TOOL" is the valid tool offset address number. Thus, "$TC_DP6[$P_TOOLNO, $P_TOOL]" represents the geometry radius value of the currently valid tool number.
Another system variable, "$P_TOOLP", exists for the tool number, representing the programmable tool number, which corresponds to the 'T' command number in the NC program. For instance, if T21 is written during programming, the system assigns 21 to "$P_TOOLP". The tool management feature in the SINUMERIK system assigns the number in the tool management list corresponding to the T command number, which might not match the actual tool position number. Using "$P_TOOLP" as the calling variable could lead to assignment errors, so it is not recommended.
(2) Conditional Judgment: The SINUMERIK system's instruction for guiding (two-choice) conditional judgment is IF, with a complete instruction set of IF-ELSE-ENDIF. The standard programming syntax is:
IF
Block 1
ELSE
Block 2
ENDIF
If the logical return value of the expression is YES, i.e., the qualified condition is met, the program executes the subsequent program segment 1; if the return value is FALSE, i.e., the qualification condition is not met, the program executes the ELSE-directed program segment 2. In practical applications, auxiliary commands like ELSE and ENDIF can sometimes be omitted.
(3) Logical Operations: Logical operations (also known as Boolean operations, applicable only to Boolean variables) can be used as needed in conditional judgment expressions. The primary logical operators are: AND, OR, NOT, XOR. Often, there are multiple conditions for the tool compensation value. To make the limit condition stricter and safer, it is usually necessary to set both the maximum and minimum values. Therefore, the OR operator is generally used to connect the truth expressions of the conditional judgment.
(4) Program Line Jump: In the SINUMERIK system, program line jump instructions that alter the program operation sequence include GOTO, GOTOB, and GOTOF. GOTO searches forward based on the given target; if not found, it searches backward; GOTOB targets backward jumps; GOTOF targets forward jumps. For machining programs, the forward direction is toward the end of the program, and the reverse is toward the start. Based on the preset program structure, the jump target is in the forward position, so the GOTOB command is unavailable, and either GOTO or GOTOF commands can be used.
The standard programming syntax is as follows:
GOTO
GOTOF
Jump targets can be labels, program line numbers, strings, etc., but they must consist of more than two letters or numbers, with the first two symbols being letters or underscores.
There must be a colon after the jump target block marker, otherwise, it won't be searched. For example, "LAB LE:" means that when GOTO LABLE is executed, the program will search for and jump to the block marked with "LABLE:".
(5) Displaying Alarm Information: In the SINUMERIK system, the command to display programmable information on the machine operation monitor is "MSG()". The programming syntax is as follows:
MSG ("Content") is generally used in conjunction with the "G4 F..." command when using the "MSG()" instruction. Here, F is the pause duration in seconds.
The main purpose of this instruction is to pause the program for the corresponding time, allowing the content displayed by "MSG()" to remain on the monitor long enough for the operator to read it.
3. Programming Examples and Instructions
(1) Machining Content: A blind hole with a diameter of 25 mm is machined on the end face of a rectangular prism. The position dimensions are shown in Figure 2.
Machining Equipment: Horizontal machining center; CNC system: SINUMERIK 840D; Cutting tool: φ10mm solid carbide end mill; Programming method: Contour programming.
(2) Programming and Analysis:
N010 T21 M6 D1 (Tool change)
N020 G54 (Establishing the workpiece coordinate system)
N030 G0 G90 G40 X0 Y0 Z100 (Program origin)
N040 S900 M3 (Spindle forward rotation)
N050 IF $TC_DP6[$P_TOOLNO, $P_TOOLND] < 5 OR $TC_DP6[$P_TOOLNO, $P_TOOLND] > 9 GOTO LABLE (Conditional judgment: when the tool radius value is less than 5mm or greater than 9mm, the program jumps to the LABLE line)
N060 ELSE (When the tool radius value is between 5 and 9 mm, the downstream program is executed)
N070 TRANS X100 Y50 (Coordinate system zero offset)
N080 Z47 (Safe distance)
N090 G1 Z35 F100 M8 (Feed to the bottom of the hole, coolant on)
N100 G41 Y12.5 (Feed to the upper wall of the blind hole)
N110 G3 Y12.5 CR=12.5 (Milling circumference)
N120 G1 G40 Y0 (Retract to hole center)
N130 G0 Z100 M9 (Retract, coolant off)
N140 ENDIF (End judgment)
N150 M5 (Spindle stop)
N160 M30 (Program stop)
N170 LABLE: MSG("WARNING: THE TOOL RADIUS IS INCORRECT! PLEASE CHECK IT!") (Display alarm information)
N180 G4 F5 (Pause for 5 seconds)
N190 M5 (Spindle stop)
N200 M30 (Program stop)
When the program begins running at line N050, it will judge whether the currently valid tool radius value meets the requirements: if it is between 5 and 9mm, the program will continue to execute the next lines until the end of line N140; if it is less than 5mm or greater than 9mm, the program will jump to line N150 to prompt an error message, pausing for 5 seconds before stopping.
4. Conclusion
In this paper, we have demonstrated how to use the relevant instructions of the SINUMERIK system to obtain the basic form of NC program tool compensation and error prevention. The programming technique is simple and universal, effectively controlling the accuracy of manual tool compensation settings.
Exposed Shower Faucet Set,Bath Shower Set,Shower Heads Adjustable Height,Adjustable Rain Shower Head Shower Set
Kaiping Rainparty Sanitary Ware Technology Co.,Ltd. , https://www.rpshower.com