NC Programming: R. A. Wysk, PH.D
NC Programming: R. A. Wysk, PH.D
R. A. Wysk, Ph.D.
Agenda
Introduction
Types of NC Machines
Components of a NC Machine
Control Mechanisms
Interpolation Software Components
Readings
Chapters 9-10 of Computer Aided Manufacturing, Wang, H.P., Chang, T.C. and Wysk, R. A., 2rd Edition ,1991. http://www.engr.psu.edu/cim/ie450 /mllwrkbk.pdf
Exercise
Readiness Assessment Test
A.K.A. RAT
AS A INDIVIDUAL, prepare a detailed response for the Readiness Assessment test found on the web http://www.engr.psu.edu/cim/ie450/ie450rat3. doc (ratNC.doc in this module directory)
Objectives
To be able to read and interpret an NC part program To be able to create NC part programs for milled parts To understand the difference between world, machine and part coordinates To understand how to set machine offsets To execute an NC part program
HISTORICAL DEVELOPMENT
15th century - machining metal. 18th century - industrialization, production-type machine tools. 20th century - F.W. Taylor - tool metal - HSS
Automated production equipment Screw machines Transfer lines Assembly lines using cams and preset stops Programmable automation NC
PLC
Robots
NC MACHINES
Computer control Servo axis control Tool changers Pallet changers On-machine programming Data communication Graphical interface
Group Exercise
As a group, discuss how you could justify the purchase of an NC machine. What are the downsides for purchasing an NC machine? Besides direct labor reductions, what other benefits come from NC machines?
NC MACHINES
MCU - Machine control unit MCU Machine Tool CLU - Control-loops unit CLU DPU
NC MOTION-CONTROL
NC Program Execut ion Sy st em Dim ensio n s Com m ands
T r an sl at o r
Cont rol
Logic
Po w e r
Re la y
Linear
Mot ion
So len o id
NC MACHINE CLASSIFICATIONS
1. Motion control: point to point (PTP) continuous (contouring) path 2. Control loops: open loop closed loop 3. Power drives: hydraulic, electric,or pneumatic
NC MACHINE CLASSIFICATIONS
4. Positioning systems: incremental absolute positioning 5. Hardwired NC and softwired Computer Numerical Control (CNC)
POINT TO POINT
Moving at maximum rate from point to point. Accuracy of the destination is important but not the path.
CONTINUOUS PATH
Controls both the displacement and the velocity. Machining profiles. Precise control. Use linear and circular interpolators.
Controller
Motor
Leadscrew Servo drive
NC MACHINE RATING
Accuracy Repeatability
NC ACCURACY
Accuracy = control instrumentation resolution and hardware accuracy.
Control resolution: the minimum length distinguishable by the control unit (BLU). Hardware inaccuracies are caused by physical machine errors.
HARDWARE INACCURACIES
Component tolerances: inaccuracies in the machine elements, machine-tool assembly errors, spindle runout, and leadscrew backlash.
Machine operation: Tool deflection (a function of the cutting force), produces dimensional error and chatter marks on the finished part.
HARDWARE INACCURACIES
Thermal error: heat generated by the motor operation, cutting process, friction on the ways and bearings, etc. Use cutting fluids, locating drive motors away from the center of a machine, and reducing friction from the ways and bearings
REPEATABILITY
Programmed position Repeatability
Avg. error
Test result
LEADSCREWS
Leadscrew
Pitch
pitch (p): the distance between adjacent screw threads the number of teeth per inch (n):
n=1/p
BLU: Basic Length Unit (machine resolution) BLU = p / N
CONTROL LOOPS
CONTROL LOOPS
CLOSED LOOP
_
Up-down counter DAC Amp
Differential amplifier
Shaft
DC Mot or
Tachomet er
Encoder
+
Reference pulses
(10,5)
(3,2) X
(3,2)
Point-to-point control path (10-3) 7 Vx =6 = 6 = 5.5149 2 2 49+ 9 (10-3) + (5-2) (5-2) 3 Vy =6 = 6 = 2.3635 2 2 49+ 9 (10-3) + (5-2)
Linear path
INTERPOLATORS
COORDINATE SYSTEMS
y z
Z axis align with the spindle - +Z moves away from the workpiece or the spindle. X axis - Lathe: perpendicular to the spindle. Horizontal machine: parallel to the table. Vertical machine: +X points to the right.
MACHINE COORDINATES
Z X - Primary Feed axis Z - Spindle axis Y - Remaining axis
PROGRAM STORAGE
Paper tape
Paper or Mylar coated paper. Diskettes From other computers through RS 232 or local area network (LAN)
SYMBOLIC CODES
ASCII or ISO, use even parity
EIA - Binary Coded Decimal (BCD), RS 244A standard, use odd parity.
Fixed sequential format 0010 01 07500 06250 00000 00000 612 Tab sequential format T0010 T01 T07500 T06250 T T T612 Word-address format N0010 G01 X07500 Y06250 S612
Resources
Primary Reference: Chang T-C., Wysk, R. A., and Wang, H-P., Computer Aided Manufacturing, Prentice Hall International Series in Industrial and Systems Engineering, Upper Saddle Valley, NJ 07458. ISBN 0-13-754524-X
Agenda
Introduction Absolute and Incremental Programming Elements of NC Program NC Words (G, M, T, S, Codes) Examples Cutter Compensation and Offsets Examples Conclusions
Introduction to NC programming
Manual part programming Computer-assisted part programming
Formats
Fixed-Address Tab-Sequential
Word-Address
Manual NC programming
Absolute Programming
Incremental Programming Example (on Board)
NC WORDS
A G-code program consists the following words: N, G, X, Y, Z, A, B, C, I, J, K, F, S, T, R, M An EIA standard, RS-273 defines a set of standard codes.
NC WORDS G codes
Table 9.1 G codes g00 Rapid traverse Line ar interpolation g40 Cutter compensation - cancel Cutter compensation - left Cutter compensation -right Inch format Metric format Full circle programming Off Full circle programming On Fixed cycle cancel Fixed cycles Absolute dimension programming Incremental de imension programming
N code.
sequence number
g01 g02
Circular inte rpolation, CW Circular inte rpolation, CCW Dwe ll Acceleration Deceleration X-Y Plane Z-X Plane Y-Z Plane Thread cutting, cons tant lead Thread cutting, increasing
* g18
g19 g33 g34
g91
NC WORDS- BLU
X, Y, Z, A, B, C Codes. coordinate positions of the tool. The coordinates may be specified in decimal number (Decimal Programming), or integer number (BLU Programming). BLU programming: leading zero, trailing zero.
In the leading zero format:
sequence no.
destination center
N0100 G02 X7.000 Y2.000 I5.000 J2.000 Cut from (5.000,4.000) to (7.000,2.000) CW
(7.000,2.000) (5.000,2.000)
F code must be given before either G01, G02, or G03 can be used. Example: N0100 G02 X7.000 Y2.000 I5.000 J2.000 F6.00 S Code. cutting speed code. Programmed in rpm. S code does not turn on the spindle, spindle is turned on by a M code. N0010 S1000
5 Z point 4
NC WORDS M Codes
M Code. miscellaneous word.
Table 9.2. M codes m00 Program stop m01 Optional stop m02 End of program m03 Spindle CW m04 Spindle CCW m05 Spindle off m06 m07 m08 m09 m30 Tool change Flood coolant on Mist coolant on Coolant off End of tape
4. Drill two holes with a 0.75" dia twist drill. Use 0.18 ipr feed and 100 fpm speed.
PART DRAWING
2 ho les 0 . 7 5 0 .0 0 1 .7 5 0 . 0 0 1 M MA BC 4 .0 0 0 R1 . 0 0 0 3 .0 0 0
2 .0 0 0 1 .0 0 0
A B
1 .7 5
3 .0 0 0
5 .0 0 0
.5 0 0
2 .0 0 0
C
A l l d i m en si o n in i n ch e s. A ll t o l er a n ce 0 . 0 0 1 "
SOLUTION TO EXAMPLE
Solution:
The cutting parameters need be converted into rpm and ipm. Milling:
Drilling:
12 V RPM = = D
p9 p1
(0,0,0)
Drill
End mill
Vise jaw
(0,0,0)
CUTTER LOCATIONS The coordinates of each point (cutter location) are calculated below:
p1': ( 1.75+0.375, -0.1-0.375, 4.00) = (2.125, -0.475, 4.000) p1: (2.125,-0.475, 2.000-0.500) = (2.125,-0.475,1.500) p2: (2.125,4.000+0.100,1.500) = (2.125,4.100,1.500) p3: (3.000-0.375,4.100,1.500) = (2.625,4.100,1.500) p4: (2.625,1.375,1.500) p5: (3.000,2.000-1.000+0.375,1.500) = (3.000,1.375,1.500) p6: (3.000,2.625,1.500) p7: (3.000,2.000,1.500) p8: (2.625,2.000,1.500) p9: (2.625,-0.100,1.500) p9': (2.625,-0.100,4.000)
PART PROGRAM
Part program
N0010 G70 G 90 T08 M06
Explanation
Set the machine to inch format and absolute dimension programming.
N0020 G00 X2.125 Y-0.475 Z4.000 S3157 Rapid to p1'. N0030 G01 Z1.500 F63 M03 Down feed to p1, spindle CW.
Feed to p2.
To p3. To p4.
PART PROGRAM
Part program Explanation
N0070 G01 X3.000 To p5. N0080 G03 Y2.625 I3.000 J2.000 Circular interpolation to p6. N0090 G01 Y2.000 To p7. N0100 G01 X2.625 To p8. N0110 G01 Y-0.100 To p9 N0120 G00 Z4.000 T02 M05 To p9', spindle off, tool #2. N0130 F9.16 S509 M06 Tool change, set new feed and speed. N0140 G81 X0.750 Y1.000 Z-0.1 R2.100 M03 Drill hole 1. N0150 G81 X0.750 Y3.000 Z-0.1 R2.100 Drill hole 2. N0160 G00 X-1.000 Y-1.000 M30 Move to home position, stop the machine.
CNCS VERIFICATION
CNCS 3D DRAWING
Offsets
Fixture
G10, G54, G54.1 Diameter
Tool
Length compensation Part-Edge compensation Cutter Compensation Next Slides Others Discussed in Lab Exercises (Simulators)
G41 (or G42) and G01 in the same block ramp takes place at block N0010. N0010 G01 G42 X0.500 Y1.700 N0020 G01 X1.500
G41 G42
G41 (or G42) and G01 in separate blocks the compensation is effective from the start.
N0010 G41
N0020 G01 X0.500 Y1.700 N0030 G01 X1.500
G41
G42
(1.5, 2.0)
Use of M96 and M97. Cutting tool that is larger than the height of the step, M97 must be used N0010 G41 N0020 G01 X1.000 Y1.000 N0030 G01 Y0.800 M97 N0040 G01 X2.000
G41 M97
G41
M96
TOOL-RADIUS COMPENSATION
Cancel Tool Compensation.
G40 in the same block ramp off block. N0060 G40 X2.000 Y1.700 M02
G42 G41 G40
(2.000, 1.700)
G40 in a block following the last motion, the compensation is effective to the end point (2.000,1.700). N0060 X2.000 Y1.700
G41
(2.000, 1.700)
EXAMPLE
A square 2.0 in. x 2.0 in. is to be milled using a 1/2 in. end milling cutter. Write an NC part program to make the square. Solution Let us set up the lower left corner of the square at (6.0,6.0). Using toolradius compensation, the square can be produced.
2.000
2.000
(6 ,6)
PART PROGRAM
Part Program N0010 G41 S1000 F5 M03 N0020 G00 X6.000 Y6.000 N0030 G01 Z-1.000 N0040 Y8.000 N0050 X8.000 N0060 Y6.000 N0070 X6.000 N0080 Z1.000 N0090 G40 M30 Explanation
Begin compensation, set feed and speed, spindle on Move to lower left corner Plunge down the tool Cut to upper left corner Cut to upper right corner Cut to lower right corner Cut to lower left corner Lift the tool End compensation, stop the machine
Exercise
Complete the exercise on setting up an NC machine. The exercise can be found at
http://www.engr.psu.edu/cim/ie450/ie450as2.doc
TURNING
2.87 5 .250 .625 1.12 5 R.125 1.00 0 2.12 5 2.87 5
Z X
Part design
Cutter path
Tool
Cutter path
TURNING
Programming tool point Surfaces cut
No compensation needed.
calculations
Post processing
Summary
NC can reduce machining skill NC can reduce the time required to machine a part NC provides sophisticated contour capability NC is a flexible method for manufacture of sophisticated machined components
Questions