Download as pdf or txt
Download as pdf or txt
You are on page 1of 183

Computer Numerical Control

(CNC) Systems Design

CNC 1
Outline

➢ Introduction to NC system

➢ CNC System for wire-EDM Machine

➢ Open Architecture CNC

➢ Introduction to Main Modules of CNC

CNC 2
The Brief History of NC Machine Tools
➢ The concept of NC was actually applied to machine tools after
World War II and in 1947, the United States Air force and the
Parsons company developed the method almost simultaneously
for moving two axes by using punch cards including coordinate
data to machine aircraft parts.
➢ In 1952, servo control laboratory in MIT developed a three-axis
milling machine, being the first NC machine tool, by using
linear interpolation technology.
➢ In this era, because there was not the circuitry such as transistors
and ICs, a vacuum tube was used and the size of NC was bigger
than that of the machine tools.
➢ In 1969, CNC technology was first applied to machine tools
owing to the rapid development of microprocessors.
➢ In the 1990s, the open architecture of controls based on PC
enabled to develop intelligent CNC machine tools. 3
Types of NC Machine
• Cutting machines: performing a
removal process to make a
finished part; e.g. milling,
turning EDM, LBM machines
• Non-cutting machines: changing
the shape of the blank material
by applying force. e.g. press
machines.
• Others: e. g. robots, coordinate
measurement machines (CMM),
flexible manufacturing systems
(FMS).
CNC 4
Four Traditional Machining Processes

5
Electric Discharge Machining (EDM)
Material removal takes place as a result of the
generation of high temperatures generated by the
high-intensity discharges that melt and evaporate
the two electrodes.

6
Wire EDM
Special form of EDM that uses small diameter wire as
electrode to cut a narrow kerf in work

Figure 26.10 - Electric discharge wire cutting (EDWC), also


called wire EDM
7
Basic Components of NC System

Part program Machine control unit

Process device

Part program : G ,M , S code machining command


Machine control unit: system software、algorithm and
communication software
Process device: work table、spindle、motor and controller
CNC 8
車床與銑床機器軸向

Numerical Control 機電工程學系 機電控制實驗室 9


切削中心機與線切割放電加工機機器軸向

Numerical Control 機電工程學系 機電控制實驗室 10


Coordinate System Used in NC

11
Driving Mechanisms of Machine Tools

• The command from NC makes the servo motor rotate, the rotation of the servo
motor is transmitted to a ball screw via a coupling, the rotation of the ball
screw is transformed into linear movement of a nut, and finally the table with
the workpiece moves linearly.
• The rotation of the spindle motor is transmitted to the spindle body via a belt.
CNC 12
NC Positioning System

13
Servo Control System

Cheap but lack of accuracy

Increasing accuracy but liable to be


unstable due to the machine dynamics.

High accuracy and high gain in an ill-


conditioned machine.

CNC 14
Open-Loop Positioning Systems (part 1 of 3)
360
=
ns
 : step angle (degrees), ns : the number of step angle from the motor
Am = n p
Am : angle of motor shaft rotation (degrees)
n p : number of pulses received by the motor
n p
A= , A : angle of leadscrew rotation (degrees)
rg
Am N m
rg : gear ratio, rg = =
A N
N m : rotational speed of the motor (rev/min)
N : rotational speed of the lead screw (rev/min)
15
Open-Loop Positioning Systems (part 2 of 3)

pA
x=
360
x : x - axis position relative to the starting position (mm)
p : pitch of the leadscrew (mm/rev)
360 xrg ns xrg
np = or
p p
n p : number of pulses received by the motor
rg : gear ratio, defined as the number of turns of the motor for each single turn
of the leadscrew
 : step angle (degrees)

16
Open-Loop Positioning Systems (part 3 of 3)
60 f p
N=
ns rg
ns : the number of step angle for the motor
rg : gear ratio
N : rotational speed of the leadscrew
f p : pulse train frquency(Hz, pulses/sec)
vt = f r = Np
vt : table travel speed (mm/min)
f r : table feedrate (mm/min)
p : leadscrew pitch
vt ns rg f r ns rg
fp = or
60 p 60 p
17
Example of NC Open-Loop Positioning (part 1 of 2)
A positioning system is driven by a leadscrew whose pitch = 6 mm.
The leadscrew is connected to the output shaft of a stepping through
a gearbox whose ratio is 5:1 (5 turns of the motor to one turn of the
leadscrew). The stepping motor has 48 step angles. Moving distance
= 250 mm, table federate = 500 mm/min. Determine (a) how many
pulses are required to move the table the specified distance, and (b)
the required motor speed and pulse rate to achieve the desired table
velocity. Solution: (a)
The leadscrew rotation angle

Step angle
The number of pulses to move the table 250 mm is

18
Example of NC Open-Loop Positioning (part 2 of 2)
A positioning system is driven by a leadscrew whose pitch = 6 mm.
The leadscrew is connected to the output shaft of a stepping through
a gearbox whose ratio is The stepping motor has 48 step angles.
Moving distance = 250 mm, table federate = 500 mm/min.
Determine (a) how many pulses are required to move the table the
specified distance, and (b) the required motor speed and pulse rate
to achieve the desired table velocity.
Solution: (b)
The rotational speed of the leadscrew corresponding to a table speed
of 500 mm/min can be determined by

The motor speed is


The applied pulse rate to drive the table is given by
vt ns rg
500(48)(5)
fp = = = 333.333 Hz
60 p 60(6) 19
Closed-Loop Positioning Systems (part 1 of 2)
360
=
ns
 : angle between slots (degrees/s lot), ns : the number of slots in the disk (slots/rev)
A
np = e

n p : pulse count emitted by the encoder
Ae : angle of rotation of the encoder (degrees)
A N
rge : gear reduction between the encoder and the leadscrew, rge = e = e
A N
Ae : encoder shaft angle (degrees)
A : leadscrew angle (degrees)
N e : rotation speed of shaft (rev/min)
N : rotation speed of encoder shaft (rev/min)

20
Closed-Loop Positioning Systems (part 2 of 2)
pn p
x =
ns rge
60 pf p
vt = f r =
ns rge
x : linear position of the work table (mm)
vt : table travel speed (mm/min)
f r : table feedrate (mm/min)
f p : frequency of the pulse train emitted by the encoder (Hz, pulses/sec)
p : leadscrew pitch (mm/rev)
n p : pulse count emitted by the encoder
ns : number of slots in the disk (slots/rev)
rge : gear reduction between the encoder and the leadscrew

21
Example of NC Closed-Loop Positioning(part 1 of 3)
An NC worktable operates by closed-loop positioning. The system
consists of a servomotor, leadscrew and optical encoder. The
leadscrew has a pitch = 6 mm and is coupled to the motor shaft with
a gear ratio of 5:1 (5 turns of the drive motor for each turn of the
lead screw). The optical encoder generates 48 pulses/rev of its
output shaft. The encoder output shaft is coupled to the leadscrew
with 4:1 reduction ( 4 turns of the encoder shaft for each turn of the
leadscrew. The table has been programmed to move a distance of
250 mm at a feed-rate = 500 mm/min. Determine (a) how many
pulses should be received by the control system to verify that the
table has moved exactly 250 mm. (b) the pulse rate of the encoder,
and (c) the drive motor speed and that correspond to the specified
feed-rate. Solution: (a)
pn p xns rge 250(48)(4)
x =  np = = = 8000 pulses
ns rge p 6.0 22
Example of NC Closed-Loop Positioning(part 2 of 3)
An NC worktable operates by closed-loop positioning. The system
consists of a servomotor, leadscrew and optical encoder. The
leadscrew has a pitch = 6 mm and is coupled to the motor shaft with
a gear ratio of 5:1 (5 turns of the drive motor for each turn of the
lead screw). The optical encoder generates 48 pulses/rev of its
output shaft. The encoder output shaft is coupled to the leadscrew
with 4:1 reduction ( 4 turns of the encoder shaft for each turn of the
leadscrew. The table has been programmed to move a distance of
250 mm at a feed-rate = 500 mm/min. Determine (a) how many
pulses should be received by the control system to verify that the
table has moved exactly 250 mm. (b) the pulse rate of the encoder,
and (c) the drive motor speed and that correspond to the specified
feed-rate. Solution: (b)
60 pf p f r ns rge 500(48)(4)
vt = f r =  fp = = = 266.667 Hz
ns rge 60 p 60(6.0)
23
Example of NC Closed-Loop Positioning(part 3 of 3)
An NC worktable operates by closed-loop positioning. The system
consists of a servomotor, leadscrew and optical encoder. The
leadscrew has a pitch = 6 mm and is coupled to the motor shaft with
a gear ratio of 5:1 (5 turns of the drive motor for each turn of the
lead screw). The optical encoder generates 48 pulses/rev of its
output shaft. The encoder output shaft is coupled to the leadscrew
with 4:1 reduction ( 4 turns of the encoder shaft for each turn of the
leadscrew. The table has been programmed to move a distance of
250 mm at a feed-rate = 500 mm/min. Determine (a) how many
pulses should be received by the control system to verify that the
table has moved exactly 250 mm. (b) the pulse rate of the encoder,
and (c) the drive motor speed and that correspond to the specified
feed-rate. Solution: (b)
rg f r5(500)
Nm = = = 416.667 rev/min
p 6.0 24
Machining Flow
1. Offline tasks: CAD, CAPP, CAM
2. Online tasks: NC machining, monitoring
and On-Machine Measurement.
3. Post-line tasks: Computer-Aided
Inspection (CAI), post-operation

CNC 25
The Construction of CNC

CNC 26
The Components of a CNC System

CNC 27
Internal Behavior of The CNC System

CNC 28
PLC Function

• The PLC module that reads the program edited by the Loader and
executes sequential logic operations is the Executer, which is the core of a
PLC kernel. The Executer is repeated successively, reading the input
points, doing logic operations of the program, and sending the results to
the output points via the output module.
CNC 29
Task Scheduling in an NC System

• For example: The position control with the highest priority is activated
every 1 msc and the interpolator with the second highest priority every 2
msec, and that the interpreter is executed once every 4 msec. The above-
mentioned three tasks are designed to have constant cycle time (sampling
time).
• The MMI with the lowest priority is designed to use the surplus processor 30
CNC
resource after the cyclic tasks finish
The Change of NC Over Time

• CNC technologies were rapidly progressed due to the advancement of electrical


technology In the 1970s -1980s. However, the CNC system is a closed system
where a user cannot add customized functions to the CNC system.
• Duringthe1990s,an effort was made to change the closed CNC system to an Open
Architecture Controller (OAC).
• Soft-NC is designed to use a PC platform as hardware and the architecture is
designed based on object-oriented technology in order to fulfill openness from the
software
CNC view point. 31
線切割放電加工機控制器發展趨勢圖
Open system with multiple CPUs
and graphical user interface

開放式多 CPU
發 圖形介面系統架構

趨 開放式單 CPU
勢 DOS 系統架構 Open system with single CPU
and DOS operating system
傳統封閉
專屬架構 Closed system with
proprietary structure.

1985 1990 1995 2000 2005 2010


線切割機控制器發展趨勢圖

(資料來源:各公司型錄及國際大展)

CNC 32
Current CNC Hardware Architectures-Case I

➢ Advantage: Low cost and easily integrated with the classic CNC.
➢ Disadvantage: PC peripherals on the electrical control panel
complicated cabling and centralized inputs/outputs.
CNC 33
Current CNC Hardware Architectures-Case II

➢ Advantage: The PC is incorporated in the keyboard and cabling


is simpler.
➢ Disadvantage: higher cost (use of Ethernet) and centralized
inputs/outputs.
CNC 34
Current CNC Hardware Architectures-Case III

➢ Advantage: 1) PC peripherals in the keyboard, 2) simpler


cabling, 3) distributed inputs/outputs, and 4) facilitation of a
single processor solution for low-range controls
➢ Disadvantage: The support of a real-time operating system
CNC (RTOS) on PC. 35
SERCOS /DeviceNet/ PROFIBUS
SERCOS(Serial Real time Communication Specification,串列及時通訊協議)

是一種專門用於在工業機械電氣設備的控製單元與數字伺服裝置及可編程控製
器之間實現串列及時數據通訊的協議標準。

DeviceNet是一種用在自動化技術的現場總線標準,由美國的Allen-Bradley公
司在1994年開發。DeviceNet使用控制器區域網路(CAN)為其底層的通訊協定,
其應用層有針對不同設備所定義的行規(profile)。主要的應用包括資訊交
換、安全設備及大型控制系統。在美國的市場佔有率較高

PROFIBUS是一個用在自動化技術的現場總線標準,在1987年由德國西門子等
十四家公司及五個研究機構所推動, PROFIBUS是程式總線網絡(PROcess
FIeld BUS)的簡稱
CNC 36
不同控制系統之比較
控制架構 單 CPU 控制 多 CPU 控制

Windows NT Windows XP Windows NT +


作業系統 MS-DOS Windows CE
+ RTX Embedded DSP

軟體支援 少 多 多 多 多

人機界面 不易發展 易發展 易發展 易發展 易發展

開發時間 長 短 短 短 短

低,需外加 低,需外加
即時性 中 中 高
即時模組 即時模組

安全性 中 中 中 中 高

Mitsubishi
工研院 工研院
廠商 徠通科技 * Sodick
第一代 第二代
健陞

CNC 37
ITRI PC-based CNC 控制系統硬體架構

Power Supply
System
Control Panel

Mainframe
Dielectric
Regeneration
System
IPC Wire
I/O Interface
Card Transport
System
EPCIO Card
Machine I/O

Cable Driver * 5

MOTOR * 5

CNC 38
ITRI CNC 控制系統軟體架構
G92X0Y0; MLC階梯圖模組
G01 X100.0 F60.0; 1.MLC程式編輯
2.MLC程式編譯
G02 I5.0; 3.MLC程式模擬
M02
運動命令 CNC狀態 PLC程式機械碼
轉助 輔助
功能命令
操作模組 命令 O點
解譯模組 1.操作命令處理 MLC模組
1.檢查NC碼格式 操作 2.操作狀態反應 機械週邊I/O
模式 操作 I點
2.刀具補正功能 3.運動命令下達 命令
操作面板
1.MLC程式執行
操作 4.運動狀態處理
狀態
工件程式

刀具資料

運動命令
參數

運動狀況

系統狀態
粗插值
人機介面 運動規劃模組 命令
位置
1.工件程式編輯 1.差值運算2.加減速 運動控制卡 命令

2.參數設定 座標
3.座標轉換 軸卡訊號 1.細插值 驅動
3.刀具資料設定 4.機械誤差補償 Home Dog 2.位置控制 系統
4.系統狀態顯示 5.驅動系統異常偵測 位置
回授

CNC 39
SODICK 線切割機控制器

• 圖形操作介面
• 3D 圖形直接讀取並
加工(CAM 功能)
• 遠端監控系統
• 多 CPU 控制系統(運
動控制使用另一個
CPU)
• USB 磁碟機

CNC 40
FANUC 線切割機控制器

• 圖形操作介面
• 3D 圖形直接讀取並
加工(CAM 功能)
• 遠端監控系統
• USB 磁碟機

CNC 41
CHARMILLES 控制器

• 圖形操作介面
• 網路功能
• 遠端監控系統
• 光碟機

CNC 42
Development of an Open
Architecture CNC System for a
Wire-EDM Machine

Mu-Tian Yan, Chen-Wei Huang and Chuan-Jie Wang, “Development of an Open


Architecture CNC system for a Wire-EDM Machine”, Materials Science Forum, Vols.
505-507, January 2006, pp. 481-486.

CNC 43
Outline

➢ Introduction
➢ Open Architecture CNC system for Wire-EDM
⚫ Hardware structure
⚫ Design of Modular CNC Software
➢ System Implementation
➢ Video Show
➢ Conclusion and Discussion

CNC 44
A Comparison of Wire-cutters
Manufacturer Charmilles Fanuc Mitsubishi Sodick Taiwan

Controller PC PC Proprietary PC PC

Automatic Wire YES YES YES YES YES


Threading
Internet YES YES YES YES YES
Connectivity

Intelligent Process YES YES YES YES NO


Control

Remote Diagnosis YES YES YES YES YES

Servo System Total Amount:


Ball-screw Ball-screw11700
Ball-screw Linear Motor Linear Motor
Resolution (m) 0.1 0.1 0.1 0.1 Ball-screw
1
CNC 45
Motivation and Purpose
➢ Motivation
❑ In Taiwan, commercialized wire-EDM machines are
equipped with proprietary CNC systems.
❑ An increasing cost in diagnosis and maintenance.

➢ Purpose
❑ Developing an open architecture CNC system for intelligent
process control, remote diagnosis and maintenance of a wire-
EDM machine.

CNC 46
Hardware structure of the developed
CNC system
PC-side

Ethernet
Windows-based System

Five-axis PCI Bus


Motion System

Dielectric
Regeneration DSP-side
System
Wire
Transport PMC32-6000 DSP-based Control Card
System

Power Supply
Connect to DSP-based
System
Motion Control Card
Machine I/O

Motion System
Machine I/O

Five-axis
Control Panel
I/O Interface Card

Wire Transport System、Dielectric


Wire-cut CNC Regeneration System、Power Supply System
EDM System

CNC 47
Software structure of the developed
CNC system
PC Man
Part Program
Interpreter Machine Data Communication
Interface
Status

Machine Inputs
Operation Logic Machine
Command
Control I/O
Outputs
DSP Position
Reference Command
Machining Servo Voltage
Process Motion Feedback Wire-EDM
Control

CNC 48
Open Architecture CNC V. S. Proprietary CNC

Open Architecture CNC Proprietary CNC in Taiwan


Multi-CPU Single-CPU
Distributed control system Direct control system
Microsoft Windows 2000/XP
Microsoft DOS platform
platform
Peripheral integration Easily Peripheral integration difficultly
Internet/ Ethernet Connectivity
Hard to develop a remote
Remote Diagnosis and
supervisory control system
Maintenance

Discrete software module


Software module coupling
Multitask MMI
CNC 49
Motion Control Test
(feed-rate = 230 mm/min, radius = 5 mm)

Tracking response Contour error of a circular path


(maximum error: 80 m)

CNC 50
Test of Remote Diagnosis

Diagnosis window of the developed CNC. Diagnosis window of a remote computer.

This test reveals that the developed CNC can provide the
functions of remote diagnosis over an Internet connection.
CNC 51
Video Show for Wire-EDM

CNC 52
Conclusions
❑ An open architecture CNC system for wire-EDM
has been proposed for manufacturing automation.
❑ The fully featured system combined with open
architecture human machine interface, modular
CNC design, Internet connectivity and DSP-based
control have been implemented.
❑ Machining test, motion control application and test
of remote diagnosis validate the effectiveness of the
proposed CNC system.
CNC 53
健陞DSP-based CNC系統硬體方塊圖

Ethernet 水質
Ethernet
感測器

USB USB 間隙
隨身碟 感測器

六軸之正負
工業電腦 USB DSP-based IO
觸控螢幕 極限、原點
(IPC) 運動控制板
感測器

USB USB

兩軸光學尺
操作面板
IO 界面板
界面板 VCOM
六軸
編碼器 驅動器
RS-485 RS-485
IO IO IO

線控盒 自動穿線 六軸
水系統 線系統 放電電源
+手搖輪 系統 AC馬達

CNC 54
工業電腦(IPC)

主要功能:
•人機介面模組
•操作模組
•機械邏輯控制模組
•解譯模組
•USB & Ethernet
通訊模組
工業電腦 PCM-4381
(圖片來源–研華公司網站)

CNC 55
DSP-based Motion Control Card (運動控制板-母板)

六軸極限 六軸驅動器輸出
及IO輸入 主要功能:
•六軸運動控制模
組+兩軸光學尺。
•六軸極限控制。
•水質訊號轉換。
•放電間隙電壓訊
號轉換及控制。
•放電電源資料傳
送及控制。
水質及放電間 FPAG 兩軸光學尺
隙電壓輸入
CNC 56
DSP-based Motion Control Card

RAM CPLD

DSP
CPU

FLASH USB
RS-485

CNC 57
Primary IO Card (母板)

主要功能:
•自動穿線系統控制
介面。
•水系統控制介面。
•線系統控制介面。
•自動剪線控制介面。

CNC 58
Secondary IO Card (子板)

主要功能:
•自動穿線系統控
制。
•張力控制。

CNC 59
IO 界面板-子板

主要功能:
•自動穿線系統控
制。
•張力控制。

CNC 60
CNC 61
Open Architecture Controller - Structures

• A homogenous, standardized environment


• Software- oriented and configurable structure
• Open control interfaces 62
Open Architecture Controller - Benefits

• 設計者可獨立開發

• 容易實現顧客制定控制

功能

• 使用者特定應用易整合

至系統

CNC 63
Control Systems and their Interfaces

• 外部介面: 連接至上層

或下層單元

• 程式介面 : NC/PLC

• 通訊協定系統: SERCOS/

Devicenet/PROFIBUS

• 區域網路: Ethernet or

TCP/IP
CNC 64
MAP/MMS DIN 66025
MAP: Manufacturing Automation Protocol
Manufacturing Automation Protocol (MAP) is a network architecture created
by General Motors to meet the specific needs of the factory floor. MAP
specifies a token-passing LAN similar to IEEE 802.4.
MMS: Manufacturing Message Specification
Manufacturing Message Specification (MMS) is an international standard
(ISO 9506) dealing with messaging system for transferring real time process
data and supervisory control information between networked devices and/or
computer applications.

DIN 66025 is the main standardized version of G code in Europe.

CNC 65
Variants of CNCs

A. 傳統類比驅動介面具

有位置控制器

B. 智慧型數位驅動具有

整合式功能 (Ex:

DSP-Based System)

C. PC-based 單CPU 具

有即時系統
CNC 66
Commercial CNC Systems

Psos= portable real time system PxRos= operating system for hard real-time
CNC 67
Definitions of Openness
A. Portability – Application modules can be used on different platforms.
B. Extendibility – A varying number of AM can run on a platform without any
conflicts.
C. Interoperability – AM work together in a consistent manner and can
interchange data in a defined way.
D. Scalability – Depending on the requirements of the user, functionality of
the AM and performance and size of the hardware can be adapted.

68
Categories of Open Control Systems

OSACA (Open system Architecture for Controls with Automation Systems)

⚫ Open HMI
⚫ Kernel with restricted openness.
⚫ Open Control System 69
Key of Open System Architecture - Modularity

 Smaller modules provide a higher level of openness and more


options, but increase the complexity and integration costs.
 A low level of granularity can lead to much higher demands for
resources and it may even deteriorate the real-time performance
of the overall system. 70
FISW GmbH – OSACA Example
The Europe ESPRIT project Open System Architecture for Controls
within Automation System (OSASA) was initiated in 1992.

CNC 71
UBC (Canada) Open System Architecture

ISA/PCI Bus

The Open Real-Time CNC Operating System (ORTS) operating system provides an
easy-to-use environment for configuring or modifying soft real-time tasks and
establishing communications between tasks.
CNC 72
Aachen WZL – Ocean Project
The European project OCEAN (Open Controller Enabled by an advanced
Real-Time Network)

To enable the efficient exchange of data


between components.

The Common Object Request Broker Architecture (CORBA) allows software


objects to communicate with each other even when running in different processes
and on different hardware platforms with different operating systems.
CNC 73
Smart Machines

CNC
https://www.mazakusa.com/news-events/blog/the-10-signs-of-manufacturing-intelligence/ 74
人機介面模組設計

CNC 75
Man Machine Interface Software Structure

CNC 76
MMI Functions - Application Layer
1. Machine Manager: This program monitors the machine status
and displays the real-time tool path during machining in Auto
mode or MDI operation mode.
2. Parameter Manager: The user can edit NC parameters and
system parameters using this program.
3. Program Manager: This program provides the functions for
editing G-code programs and managing part programs such as
saving and deleting.
4. Tool Manager: This program is used for editing and managing
the tool information, such as tool offset, tool life, and tool
geometry.
5. Utility: Service functions of the CNC system such as alarm
history management, PLC monitoring, DNC, and
communication with external systems are provided.
CNC 77
MMI Functions - Kernel Layer
1. System boot-up: This function initializes the variables of the operating system
for setting the language type of MS Windows, machine parameters, etc.
2. Communications interface: This carries out communication and data exchange
with the other modules.
3. File management: This function provides the services for managing folders and
files, such as copying, saving, deleting, and changing part programs.
4. Alarm: This displays alarm and error messages from the machine, PLC, and
MMC in the alarm window.
5. Key input: This transmits the key input from softkeys, keyboard, and dialog
boxes to the applications and the CNC system.
6. Screen Display: This handles the horizontal or vertical function key window that
is shared by all applications and connects the function keys with particular
applications
7. Task manager: This executes the programs registered in the application layer
and provides the function for calling and switching them. It registers the
applications as a program list in a text file format and executes the applications
sequentially when the task manager begins. When the task manager is
CNCterminated, it terminates the applications in reverse order. 78
Functions of Operation Module
1. CNC kernel operation system
2. Mode management: EDIT、 MEM、JOG、INCJ and Mode
change management.
3. Manual mode: HOME、EDGE, CENTER、SLIT、
AUTO_VERT functions.
4. Miscellaneous functions: Break point return、Start point return、
Vertical point return.
5. Alarm management
6. Cutting log management

79
What is a finite state machine ?

➢ 一種裝置可接受有限不同種類輸入且產生有限不
同輸出。
➢ 狀態(State) 可表示為一機器內部架構或是動作,例
如: 交通號誌之紅綠燈狀態。
➢ 有限狀態機制可依據外界輸入以改變內部狀態,
或是維持原來狀態。
➢ 為了制定FSM,我們必須列出所有可能狀態組合
,對應於輸入列出下一個狀態與輸出組合。
80
Finite State Machine的設計
1. state machine 內部依據自己的status來決定運作邏輯,同時
將運作狀態反應給外界。
2. 在不同的state,state machine 會去monitor與該state有關的事
件event (ex:x+,x-,.......) 。
3. 每一個state machine自行monitor外界的控制指令,外界有
相關的控制指令發生時,state machine自行決定內部相關的
運作狀態。
4. state machine可以非常獨立的發展,模組化程度高。
5. 避免一件事情,因為timing的關係,而沒有被執行,或是
被多個模組重覆執行。
81
紅綠燈控制
➢ 將交通號誌狀態設計為 IDLE 、GREEN 、FLASH_YELLOW 、YELLOW 、RED 。
➢ 每個狀態判斷時間是否到了 將狀態狀轉換 。

Reset
Reset IDLE
Reset

RED 4秒 GREEN

Reset
3秒 5秒
FLASH_
YELLOW YELLOW

2秒

82
State-Transition Table (SST)
States
Input IDLE (0) GREEN(1) FLASH_YELLOW(2) YELLOW(3) RED(4)
初始狀態 顯示 NA NA NA NA
1 NC NC NC NC

5秒到了 NA 解除計時 顯示與計時 顯示與計時 顯示與計時


NC 2 NC NC NC

3秒到了 NA 顯示與計時 解除計時 顯示與計時 顯示與計時


NC NC 3 NC NC

2秒到了 NA 顯示與計時 顯示與計時 解除計時 顯示與計時


NC NC NC 4 NC

4秒到了 NA 顯示與計時 顯示與計時 顯示與計時 解除計時


NC NC NC NC 1

重置 NA 解除計時 解除計時 解除計時 解除計時


NC 1 1 1 1

NA: no action
NC: no change
1, 2, 3, 4 : next state 83
CNC State Machine

84
標準State Machine 的程式格式
char state_machine_1(void)
{ IDLE
switch(mode_machine_state)
case START:
machine_1_run();
START
break;
case FEEDHOLD: FEEDHOLD

machine_1_feedhold();
break;
case IDLE:
➢ mode_machine_state 必須是
machine_1_do_nothing() ;
break; 外部變數或 static 函式內區域變數
return mode_machine_state ;
85

Task Decomposition
(1) 金字塔的管理架構之State Machine 。
(2) 最底層的是由單一功能的state machine 所組成,往上一層有一個state
machine利用底層這些state machine的功能,組合成一個具有高階功能的
state machine,依此類推。
(3) state machine的狀態是由下而上,底層的state machine 若有一個是
RUNNING,則上一層的state machine的state一定是RUNNING,所以STATE
是由下層往上pass。
(4) 每一層的state machine都具有相同的特性。
(5) 每個state machine 並沒有特定的服務對象,任何模組都可對它啟動,在
該動作沒有完成之前(IDLE),不接受新的啟動指令(START),若要硬插入
一個動作,祇好先放棄執行中的動作(ABORT) 。
ex:尋孔中心是由X+,X-,Y+,Y- 4個尋邊組合而成。
(6)對突發事件的處理(operator的要求、 警報) 。

86
CNC Wire-cutter Task Decomposition

CNC
Machine

Auto Manual
Machine Machine

Miscel. Memory Incremental Jog Related Continuous


Machine Machine Jog Machine Machine Jog Machine

Start Point Held Point Restart Retrace Center


Edge Machine
Machine Machine Machine Machine Machine

87
Edge Function
➢ EDGE.C --- edge_machine( )
--- enable_edge_machine( )
--- abort_edge_machine( )
➢ Edge function can also be used for center and slit functions.
➢ This function use six different feed-rates to obtain high
positioning accuracy of work edge.

STEP 1: feedrate 1 < 5V

STEP 2: feedrate 2 >10V

STEP 3: feedrate 3 < 5V


STEP 4: feedrate 4 >10V
STEP 5: feedrate 5 < 5V

STEP 6: feedrate 6 >10V


STEP 7: abort_edge_machine 88
Programmable Logic Control
➢ Containing a logical operator, relay, counter, timer, and
arithmetic calculation functions to control the execution
sequence of machines or production processes.

89
Behavior of Compiling Method
1. Editing a sequence program using a programming tool.
2. Converting the sequence program to internal commands by the Internal
Command Converter.
3. Replacing the internal commands with the appropriate pre-defined assembly
codes.
4. Converting the assembly code into the machine language (binary code)
which can be executed by the CPU.
5. Transmitting the native code to the internal memory and then it is executed
sequentially.

90
PLC Language
1.Textual language
•Instructions List (IL)
•Structured Text (ST)
2. Graphical language
• Ladder Diagrams (LD)
• Function Block Diagram (FBD)
• Sequential Function Chart (SFC)

91
機械邏輯控制模組之訊號傳遞介面圖

C-bits
I-bits

CNC模組 MLC模組
O-bits
圖片資料來源:健陞機電公司
S-bits

DSP

92
機械邏輯控制介面軟體設計
➢ 線切割放電加工機的MLC模組分成幾個部分來加以
設計與程式撰寫:
(1)床台極限與五軸伺服警報之訊號介面控制
(2)操作面板輸出入之訊號控制
(3)水系統之介面控制
(4)線系統之介面控制
(5)電源系統之介面控制
(6)伺服驅動系統之介面控制
(7)其它訊號之介面控制
93
機 MLC模組初始化


邏 MLC訊號管理函式 MLC模組關閉


控 其它訊號之邏輯控
制 I/O驅動介面 制介面


面 床台極限與五軸伺
服警報之訊號邏輯
伺服驅動系統之邏
輯控制介面
軟 控制介面


流 操作面板輸出入之
訊號邏輯控制介面
電源系統之邏輯控
制介面


圖 水系統之邏輯控制 線系統之邏輯控制
介面 介面

94
水系統之邏輯介面設計
水系統初始狀態
(W01)

當操作面板上的緊
當操作面板上的 急開關鬆開後,進
緊急開關壓下 入下個狀態
後,回到初始狀

水系統狀態(W02)
啟動水系統幫浦

當操作面板上之水系
統按鍵按下時,進入
下個狀態

水系統狀態(W03)
維持水系統幫浦啟

當操作面板上之水系統
當操作面板上的緊 按鍵彈跳恢復後,進入 當水系統發生警報
急開關壓下後,回 下個狀態 時,回到狀態W02,
到初始狀態 等待下一次啟動
水系統狀態(W04)
啟動水系統幫浦
啟動水閥門開關

當操作面板上之水
當操作面板上之水系統
系統按鍵按下時,
當操作面板上的緊 按鍵彈跳恢復後,表示
進入下個狀態
急開關壓下後,回 將水系統關閉,回到狀
到初始狀態 態W02等待下一次啟動
水系統狀態(W05)
啟動水系統幫浦
關閉水閥門開關

95
水系統之階梯圖

96
水系統之邏輯控制程式

// Water alarm
if(i_bit[25] == ON) c_bit[25] = ON;
else c_bit[25] = OFF;

// Water ESTOP
if( a_bit[2] == ON || ( a_bit[50] == ON &&
a_bit[51] == OFF ) ||
( ( a_bit[51] == ON || a_bit[52] == ON ||
a_bit[53] == ON ) && i_bit[24] == OFF ) )
a_bit[50] = ON;
else a_bit[50] = OFF;

97
解譯模組設計

CNC 98
Software Structure of Interpreter

CNC 99
Function of Interpreter 1

CNC 100
Function of Interpreter 2

CNC 101
G & M Code Interpreter

CNC 102
Part Program Structure

CNC 103
Typical addresses and associated functions

CNC 104
Modules of Interpreter
1. Parser: this module interprets the part program block by
block. The lexical interpreter of this module reads the block
character by character and makes meaningful words from the
characters. The calculator carries out numerical operations
within the part program. The sentence interpreter retrieves the
command and the related data such as G-code, M-code, S-code,
T-code, conditional branching, and iteration loop based on the
words from the lexical interpreter.

2. Executor: this module executes the functions related with the


interpreted sentence and stores the execution result in the
internal memory. In addition, this module generates the data
required for executing the modal code.

CNC 105
Modules of Interpreter(continued)
3. Path Generator: This module generates the position data
based on the programmed coordinates. In this module, the
computation for mapping from workpiece coordinates to
machine coordinates, tool compensation, and the axis limit
is carried out.
4. Macro Executor: this module interprets and executes macro
commands included in an NC part program. As the macro is
user-defined code, the user can make specific functions that
are not provided by the CNC maker by using a macro
language, which is similar to the BASIC language.
5. Error Handler: if there is an error in a part program, the
error should be noticed and the user notified. This module is
responsible for this.
CNC 106
Implemented Interpreter Structure

• The Compiler extracts the meaningful data from the part program
based on the grammar of G/M-codes and calls the G/M-code
Interpreter related to the extracted information.
• The G/M-code Interpreter called by the Compiler calculates the
toolpath or transforms the coordinates according to the definition
of the G-code and sends the computed result to the Compiler.
• The Machine DB stores the necessary data for compilation.
CNC 107
Tool Radius Compensation

• The tool radius compensation (G40, G41 and G42) functions


are used for generating a path that is offset from the
programmed path by the radius of tool.
• The path followed by the tool center should be the path
indicated by B, which is separated from A by the value R, in
the case when a part, indicated by A, is machined by a tool
CNC 108
with radius R
線徑補正方向指令(G40,G41,G42)
(Wire Radius Compensation)
G40 線徑補正消除 (compensation cancel)
G41 線徑補正偏左(compensation left)
G42 線徑補正偏右(compensation right)

G41
G40

G42

線徑 線徑
線之中心路線 線之中心路線

程式設計路線
程式設計路線
二次加工之加工裕度
109
Tool Radius Compensation Mode

1. Cancel mode: After power is turned on, the CNC system is


reset, or M02/M30 is executed, the status of the CNC system
turns into Cancel mode. In this mode, tool compensation
mode is canceled and the path of the tool center point is the
same as the programmed path.
2. Start-Up mode: If G41 or G42 is commanded in Cancel
CNC mode, the CNC system turns into Offset mode. (Figure 2.16). 110
線徑補正起始 (Start-up Mode)
S
S
G42
G41

S
G41
G41
S
S
G42
G41

圖3-19線之中心路線接觸下一區
線徑補正後路徑中心路徑 線之中心 段路線時恰位於該區段之起點上
指令路線 S 單節操作之停止點

圖3-18 指令線徑補正後之移動路線

111
線徑補正中 (Compensation Mode)
G41 G41 s
s

G41 S
G41
S

S G41 S
s
G42
G42

圖3-20 移動命令無交叉點之補償路徑
G41
S G41 S

S
G42

S
G42

(a)兩直線相接 (b)圓弧相接

112
圖 3-19 G41/G42兩直線或兩弧相接移動路線
Tool Radius Compensation Type
Type A Type B Type C
Cross point type Circular type Adding path type

Program path

Compensated path

Type A : Using a cross point to compute compensated paths.


Type B: Using a circular path to compute compensated paths.
Type C: Using some adding paths to compute compensated paths.
113
Tool Radius Compensation Cancel Mode

3. Offset mode: During Offset mode, the offset path of the


path programmed in each block is calculated and the real
machining path is made by connecting these individual
offset paths.
4. Offset Cancel mode: In the case of commandingG40 during
the Offset mode, the tool radius compensation function
CNC comes to be canceled. (Figure 2.17). 114
線徑補正消除 (Cancel Mode)
G41
S S
G42
G40 G40

G41 S
S G42
G40
G40

圖3-21 線徑補正值消除時線之中心移動路線

G42
S
G42
S

圖3-22 線之中心路線接觸前一程式區段恰位於該區段終點上 115


刀具半徑補償
➢ 刀具半徑補償可分為四部分:
⚫ 路徑相接夾角判別: 利用兩連續路徑之向
量。
⚫ 路徑相接方式判別:利用兩連續路徑之切削
方式 。
⚫ 刀具半徑補償狀態判別:啟動 、執行中、
結束狀態。
⚫ 刀具半徑補償函式:依兩連續路徑夾角與相
接方式對應不同補償函式 。

116
路徑相接夾角計算
 
a •b
➢ 由純量積公式 cos  =
刀具路徑補償範例 ab
可知 cos =,為90或270度;
0

➢ 由向量積公式  
a b

 = − sin  =
b =(0, 1) 可知 sin 1 ,依右手定 a .b

則,可知角度為90度。
 (0, 0)
a =(-1, 0)

117
刀具半徑補償函式-連續路徑夾角判斷

➢ 依兩連續路徑夾角與相接方式對應不同補償函式 。

(L表示小於,E表示等於,G表示大於)
向量積 0 -1 0 1
sinθ
純量積 -1 0 1 0
cosθ
相接角度 E0 L90 E90
L180G E180 G180
90
相接方式 線到線 線到弧 弧到線 弧到弧

118
刀具半徑補償函式-直線到直線

交點補償方法 ➢先求出 AB 之移動向量


AB = (a, b) 、 單 位 移 動 與
切削刀具中心路徑
切削刀具中心路徑
單位法線向量,可求得
D D B1 B
1
RR
EE
刀具半徑長之法線向量
BB ,並求出 -- B1 點座標
R R R RR
A A
R
B B
R R -- 1
欲加工輪廓
欲加工輪廓 B 2 B2
B1 = (c, d ) 。
BB1
C
C R
R
F
F ➢ 由 AB 向量與 B1 座標及
點斜式公式 yx −− dc = ba
R :刀具半徑
:偏移向量
:程式路徑
:刀具中心路徑

,可知 AB -- 之刀具半徑補
償方程式 DE -- 。
119
刀具半徑補償函式-直線到直線(續)
➢同理可求得 EF 之直線補
交點補償方法 償方程式。
➢取 DE
-- 、EF
-- 兩直線方程式
切削刀具中心路徑
切削刀具中心路徑 交點 --E 點,為新的刀具
D
R
D
R
B1 B
R R
1
RR
RR
EE 補償點。
A A B B
R R
欲加工輪廓
欲加工輪廓 BB1 B 2 B2
C
C R
R
F
F
R :刀具半徑
:偏移向量
:程式路徑
:刀具中心路徑

120
刀具半徑補償函式-直線到圓弧

直接補償方法 ➢ 先求出線段 AB - 之移動向


(使用夾角:0度或180度) 量、單位移動與單位法
線向量,並分別求出刀
切削刀具中心路徑
切削刀具中心路徑
具半徑長之法線與移動
BB
D D
R R
1 1

RR
EE FF
RR 向量 BB__、__。
1 BB 2
B R RRC
A A AB B R BB22
➢ 將 BB BB 相加,可求得
C
欲加工輪廓
_、__
1 2
欲加工輪廓
BE 向量,可求出 E 點座
__
R :刀具半徑
:偏移向量 標。
:程式路徑
:刀具中心路徑

121
刀具半徑補償函式(二)

直接補償方法 ➢ 先求出線段 AB - 之移動向


(使用夾角:0度或180度) 量、單位移動與單位法
線向量,並分別求出刀
切削刀具中心路徑
切削刀具中心路徑
具半徑長之法線與移動
BB
D D
R R
1 1

RR
EE FF
RR 向量 BB__、__。
1 BB 2
B R RRC
A A AB B R BB22
➢ 將 BB BB 相加,可求得
C
欲加工輪廓
_、__
1 2
欲加工輪廓
BE 向量,可求出 E 點座
__
R :刀具半徑
:偏移向量 標。
:程式路徑
:刀具中心路徑

122
運動模組設計

CNC 123
運動模組程式架構

Motion Non- ISR Position Control


real-time Task Command Fetching Information
Buffer Command Feedrate Calculation Position Command
Initialization
G Code Command Interpolation/Homing Tracking Error
Data Data Conversion Data
Jog Command Axis Exchange and Mirror Control Voltage
Command Analysis
Operation Command Interface Coordinate System Maintenance Interface
Command Processing Coordinate
Cycle Start、Feedhold Compensation (Backlash, Pitch error)
Acceleration/Deceleration Information
Clear、Reset
Command Modification Ratio Absolute Coordinate
Jog Mode、Auto Mode
Position Control Relative Coordinate
Configuration Command Machine Coordinate
Dry-Run、Machine Lock User-Defined Coordinate
Coordinate Setting
Interpolation
Axis Exchange
Information
Current Block Message
Interpolation State
Cutting Length

CNC 124
運動控制(Continuous Path)

CNC 125
Interpolator(插值器)

➢ The interpolator divides the overall movement into individual


displacements along the X- and Y-axes based on the pre-defined
feedrate. Finally, the velocity command blocks for the two axes are
generated as shown in Fig. 3.1.
CNC 126
Requirements of An Interpolator
(插值器的規定)
1. The data from the interpolator should be close to the actual part
shape.

2. Interpolators should be capable at least of linear and circular


interpolation.

3. The interpolator should consider the limitation of speed due to the


machine structure and the servo specifications while calculating
velocity.

4. The accumulation of interpolation error should be avoided in


order that the final position should coincide as closely as possible
to the position commanded.

CNC 127
Two Stage Interpolators

1. Rough Interpolation
➢ Firstly provides intermediate reference points (P11, P12, P13….)
➢ Software interpolation
➢ Interpolation cycle time (1~10 ms)
2. Fine Interpolation
➢ Subsequently determines the intermediate co-ordinate values
(xi, yi) linearly between the reference points.
➢ Hardware interpolation
CNC ➢ Interpolation cycle time  1 ms 128
插補法(Interpolation Method)

CNC 129
Basic Principle of Digital Differential Analyzer(DDA)
Given the velocity function V(t), the displacement S(t) can be approximated
by summing the areas of the thin rectangles beneath the velocity curve as
shown in Fig. 3.2.
(1)

t :iteration time interval.

(2)

Sk: the displacement at time t = k · t

(3)

(4)

CNC 130
Feature of Improved DDA Algorithm
➢ This method is based on the mathematical integration of the
velocity components.
➢ Calculate the incremental displacement of the workpiece along
each axis, thus the workpiece is moved along a desired
trajectory.
➢ High interpolation speed.
➢ Distributed pulse commands.
➢ High interpolation accuracy.
➢ Easily implemented on a multi-axis motion control system.
➢ Not easily implemented on hardware.
CNC 131
DDA Linear Interpolation (part 1 of 4)
Set the processing line is PsPe, coordinates of start point Ps is (xs, ys) and
coordinates of end point Pe is (xe, ye). If a workpiece is to travel along the
straight with a constant feedrate (V), then the displacement (xe - xs ) and
(ye - ys ) must be constant during the interpolation time T1 .

Pe (xe, ye)

VY V
f

VX

Ps (xs, ys)
O X
CNC 132
DDA Linear Interpolation (part 2 of 4)

Displacement at time t along X axis and Y axis are:

𝑡 𝑡 𝑥𝑒 −𝑥𝑠
𝑥(𝑡)=𝑥𝑠 + ‫׬‬0 𝑉𝑋 𝑑𝑡 = 𝑥𝑠 + ‫׬‬0 ∙ 𝑉𝑑𝑡 (1)
𝐿
𝑡 𝑡 𝑦𝑒 −𝑦𝑠
y(𝑡)= 𝑦𝑠 + ‫׬‬0 𝑉𝑌 𝑑𝑡 = 𝑦𝑠 + ‫׬‬0 ∙ 𝑉𝑑𝑡 (2)
𝐿

Feedrate component in X axis and Y axis are:


(𝑥𝑒 −𝑥𝑠 )
𝑉𝑋 = ∙𝑉 (3)
𝐿

(𝑦𝑒 −𝑦𝑠 ) (4)


𝑉𝑌 = ∙𝑉
𝐿

CNC 133
DDA Linear Interpolation (part 3 of 4)
If the total interpolation time T1 is divided into N equal time intervals for
each interpolation cycle time T, and N is an integer number, it must meet
the following condition:
𝑇1
N≥ (5)
𝑇

we obtain x and y coordinates at discrete time instant.


𝑥 𝑘 + 1 = 𝑥 𝑘 + ∆𝑋𝑘+1
for k =0, 1, 2, 3 …., N (6)
𝑦 𝑘 + 1 = 𝑦 𝑘 + ∆𝑌𝑘+1
Total incremental displacement of the interpolation cycle time along X
axis and Y axis should be
σ𝑁
𝑖=1 ∆𝑋𝑖 = 𝑥𝑒 − 𝑥𝑠 (7)

CNC σ𝑁
𝑖=1 ∆𝑌𝑖 = 𝑦𝑒 − 𝑦𝑠 (8) 134
DDA Linear Interpolation (part 4 of 4)
Incremental displacement for each interpolation cycle time along X axis
and Y axis are:
𝑥𝑒 −𝑥𝑠
Δ𝑋=𝑉𝑋 ∙ 𝑇 = ∙ 𝑉 ∙ 𝑇 = 𝜆𝑡 ∙ 𝐹𝑅𝑁 ∙ 𝑥𝑒 − 𝑥𝑠 (9)
𝐿
𝑦𝑒 −𝑦𝑠
Δ𝑌=𝑉𝑌 ∙ 𝑇 = ∙ 𝑉 ∙ 𝑇 = 𝜆𝑡 ∙ 𝐹𝑅𝑁 ∙ 𝑦𝑒 − 𝑦𝑠 (10)
𝐿

where 𝐹𝑅𝑁 represents feedrate number, it can be computed by

𝑉 𝑉
𝐹𝑅𝑁= = (11)
𝐿 ( 𝑥𝑒 −𝑥𝑠 2 + 𝑦𝑒 −𝑦𝑠 2

V: Feedrate [mm/min], T: interpolation cycle time [ms]


𝑇∙10−3
𝜆𝑡 = (scaling factor)
60
CNC 135
Example of DDA Linear Interpolation (part 1 of 3)
Given the processing line is PsPe, coordinates of start point Ps is (10000, -
55000) and coordinates of end point Pe is (60000, 15000) m. and the
slide velocity is to be constant at 0.5 m/min and the interpolation cycle
time is 1 ms.
Solution:
The length L of the processing line is determined by

𝐿 = ( 𝑥𝑒 − 𝑥𝑠 2 + 𝑦𝑒 − 𝑦𝑠 2 = (500002 + 70000 2

≈ 86023 m
The total interpolation time T1 is:
𝐿 86023×60
T1=𝑉 =
0.5×106
=10.323 seconds
CNC 136
Example of DDA Linear Interpolation (part 2 of 3)
The lowest suitable value of N is determined from

𝑇1 10323 𝑚𝑠
N≥ = =10323
𝑇 1 𝑚𝑠

Thefeedrate number 𝐹𝑅𝑁 can be computed by

𝑉 𝑉 500 𝑚𝑚/𝑚𝑖𝑛
𝐹𝑅𝑁= = = =5.8123990096
𝐿 ( 𝑥𝑒 −𝑥𝑠 2 + 𝑦𝑒 −𝑦𝑠 2 86.023 mm

The scaling factor is computed by


𝑇∙10−3 1 ×10−3 1
𝜆𝑡 = = =
60 60 60000

CNC 137
Example of DDA Linear Interpolation (part 3 of 3)
Incremental displacement for each interpolation cycle time along X axis
and Y axis are:
𝑥𝑒 −𝑥𝑠
Δ𝑋=𝑉𝑋 ∙ 𝑇 = ∙ 𝑉 ∙ 𝑇 = 𝜆𝑡 ∙ 𝐹𝑅𝑁 ∙ 𝑥𝑒 − 𝑥𝑠
𝐿
1
= × (5.8123990096)×(50000 m)
60000
= 4.84366658413 (m)
𝑦𝑒 −𝑦𝑠
Δ𝑌=𝑉𝑌 ∙ 𝑇 = ∙ 𝑉 ∙ 𝑇 = 𝜆𝑡 ∙ 𝐹𝑅𝑁 ∙ 𝑦𝑒 − 𝑦𝑠
𝐿
1
= × (5.8123990096)×(70000 m)
60000
= 6.7811321779 (m)
Verify the total incremental displacement for x-axis and y-axis:
𝑁 𝑁

෍ ∆𝑋𝑖 = 𝑁 ∙ Δ𝑋 ≅∙ 𝑥𝑒 − 𝑥𝑠 ෍ ∆𝑌𝑖 = 𝑁 ∙ Δ𝑌 ≅∙ 𝑦𝑒 − 𝑦𝑠
𝑖=1 𝑖=1
= 50001.170148 (m) ≅ 50000 (m) = 70001.627472461 (m) ≅ 70000 (m)

How do get σ𝑁
𝑖=1 ∆𝑋𝑖 = 𝑥𝑒 − 𝑥𝑠 and σ 𝑁
𝑖=1 ∆𝑌𝑖 = 𝑦𝑒 − 𝑦𝑠 ?
CNC 138
DDA Circular Interpolation (part 1 of 5)
If we consider an arc path with its center at the origin of the
coordinate system, the arc path starts at point Ps (xs, ys), ends at
point Pe (xe, ye) and radius of the arc path is R. Feed speed along
the arc path with a constant feedrate v, which can be resolved into
horizontal velocity vx and vertical velocity vy at any point Pn on the
arc path, then we have
Y
𝑥 = 𝑅 ∙cos∅ (1)
Pe (xe, ye)
v vy
𝑦 = 𝑅 ∙sin∅ (2)

R vx Pn (xn, yn)

Ps (xs, ys)

CNC
O X 139
DDA Circular Interpolation (part 2 of 5)
During circular interpolation, tangential velocity v should be held on
the circular path. The tangential velocity can be represented by

2𝜋 2𝜋
𝑣 =𝑅∙𝜔 =𝑅∙ and ∅=𝜔 ∙ 𝑡 = ∙𝑡 (3)
𝑇1 𝑇1

where 𝜔 stands for angular velocity, 𝑇1 is the time required to


travel along the full circle. we obtain x and y coordinates at current
time t
2𝜋𝑡
𝑥 = 𝑅 ∙cos∅ = 𝑅 cos( ) (4)
𝑇1

2𝜋𝑡
𝑦 = 𝑅 ∙sin∅ = 𝑅 sin( ) (5)
𝑇1

CNC 140
DDA Circular Interpolation (part 3 of 5)
By differentiating equations (4) and (5), the horizontal velocity vx
and vertical velocity vy can be derived as

𝑑𝑥 2𝜋 2𝜋𝑡 2𝜋
𝑣𝑥 = =− 𝑅 ∙ sin( ) =− ∙y(t) (6)
𝑑𝑡 𝑇1 𝑇1 𝑇1

𝑑𝑦 2𝜋 2𝜋𝑡 2𝜋
𝑣𝑦 = = 𝑅 ∙ 𝑐𝑜𝑠( ) = ∙ 𝑥(t) (7)
𝑑𝑡 𝑇1 𝑇1 𝑇1

The calculated velocity component are then substituted into the


basic equations of the DDA algorithm and we have
𝑡 2𝜋 𝑡
𝑥(𝑡)=𝑥𝑠 + ‫׬‬0 𝑣𝑥 𝑑𝑡 = 𝑥𝑠 − ‫ ׬‬y(t) 𝑑𝑡
𝑇1 0
(8)

𝑡 2𝜋 𝑡
y(𝑡)= 𝑦𝑠 + ‫׬‬0 𝑣𝑦 𝑑𝑡 = 𝑦𝑠 + ‫׬‬0 𝑥(t) 𝑑𝑡 (9)
𝑇1

CNC 141
DDA Circular Interpolation (part 4 of 5)
The calculated velocity component are then substituted into the
basic equations of the DDA algorithm and we have

𝑡 2𝜋 𝑡
𝑥(𝑡)=𝑥𝑠 + ‫׬‬0 𝑣𝑥 𝑑𝑡 = 𝑥𝑠 − ‫ ׬‬y(t) 𝑑𝑡
𝑇1 0
(8)

𝑡 2𝜋 𝑡
y(𝑡)= 𝑦𝑠 + ‫׬‬0 𝑣𝑦 𝑑𝑡 = 𝑦𝑠 + ‫׬‬0 𝑥(t) 𝑑𝑡 (9)
𝑇1

If the integration is substituted by a summation (as the


displacements are small, then we have
2𝜋 𝑘
𝑥 𝑡 ≈ 𝑥(𝑘𝑇) = 𝑥𝑠 − ෍ 𝑦(𝑖𝑇)
𝑁 𝑖=0
for k =0, 1, 2, 3 …., N (10)
2𝜋 𝑘
𝑦 𝑡 ≈ 𝑦 𝑘𝑇 = 𝑦𝑠 + ෍ 𝑥(𝑖𝑇)
𝑁 𝑖=0
CNC 142
DDA Circular Interpolation (part 5 of 5)
with the following condition:
𝑇1
N≥ (11)
𝑇
where T represents the interpolation cycle time.
Using equation (10) we obtain x and y coordinates at each discrete
time instant.
𝑥(0) = 𝑥𝑠
for k = 0
𝑦 0 = 𝑦𝑠
2𝜋
𝑥(1) = 𝑥𝑠 − [𝑦 0 ]
𝑁
for k = 1
2𝜋
𝑦 1 = 𝑦𝑠 + [𝑥 0 ]
𝑁
2𝜋
𝑥(2) = 𝑥𝑠 − [𝑦 0 +y (1)]
𝑁
2𝜋 for k = 2
y 2 = 𝑦𝑠 + [𝑥 0 + 𝑥 1 ] 143
CNC 𝑁
Reference Word Interpolator for Lines

CNC 144
Reference Word Interpolator for Lines (continued)

CNC 145
線性插補(Linear Interpolation)(1/3)
假設有一直線插值指令:
G01 X dX Y dy F f;
其指示行徑軌跡如圖所示。

CNC 146
線性插補(Linear Interpolation)(2/3)

計算x軸與y軸在每個差值運算時間的位置增量,
可由進給速率根據目前位置推求出下一個差值
運算時間床台所需走到位置,再對應出x、y軸
所需走到位置,此x、y軸位置與目前位置之差
值即為下一個差值運算時間x、y軸之位置增量。
例如進給率 60 mm/min 相當於每個差值運算
時間(1ms)的位置增量(1  m):
60 mm/min = 60000m/60000 ms = 1 m/ms

CNC 147
線性插補(Linear Interpolation)(3/3)
若L為移動距離,分
別為每個差值運算時
間所移動之位置增量
(此值可由進給率換 L = dx2 + dy 2 (2 - 1)
算而得)、x軸位置增 S (k ) = S (k − 1) + S (2 - 2)
量與y軸位置增量, x(k ) = S (k )  cos() (2 - 3)
S(k)、x(k)、y(k)分別 y (k ) = S (k )  sin()) (2 - 4)
x = x(k ) − x(k − 1) (2 - 5)
為第k次差值運算時
y = y (k ) − y (k − 1) (2 - 6)
間應走到的距離、x
軸位置座標與y軸位
置座標則
CNC 148
Reference Word Interpolator for Circles (part 1 of 4)
During circular interpolation, tangential velocity, V should be held on
the circular path. The individual velocity of the axes is defined by

Vx(t) = V‧sinө(t)
Vy(t) = V‧cosө(t)

 2 V
 = = =
T R

Where R stands for radius of circle,  represents angular speed

CNC 149
Reference Word Interpolator for Circles (part 2 of 4)
In the reference word interpolator for a circle, the iteration
step can be expressed using the incremental angle α .
cos ө(i+1) = A cos ө(i) - B sin ө(i)
sin ө(i+1) = A sin ө(i) - B cos ө(i)

where
A=cos , B=sin 
ө(i+1)= ө(i) + 

The incremental angle a


can be designed as V/R

CNC 150
Reference Word Interpolator for Circles (part 3 of 4)

X(i+1) =R cos ө(i+1)


Y(i+1)=R sin ө(i+1)
X(i+1)=A X(i) - B Y(i)
Y(i+1)=A Y(i) + B X(i)
The length of the line segment is computed by
DX(i)=X(i+1) - X(i)
=(A - 1) X(i) - BY(i)
DY(i)= Y(i+1) - Y(i)
=(A - 1) Y(i) + BX(i)
DX(i) and DY(i) are the increments along the X- and Y- axes,
respectively
CNC
151
Radial Error and Chord Height Error
Two kinds of an error occur when a circle is approximated by line
segments, as shown in Fig. 3.16; radial error (ER) and chord height
error (EH). If the radius of a circle is R, the radial error, ER, and the
chord height error are computed by
ER(i)=R(i)−R=√[X2(i)+Y2(i)]−R
EH(i)= R (1-cos /2)
If Smax represents the
maximum chord height error
which can be tolerated. Thus,
the maximum incremental
angle is
S max
 max = 2 cos −1 (1 − )
R
CNC 152
加減速(Acceleration/Deceleration)

⚫ 一般在運動控制系之軌跡,是以速度曲線的方
式來儲存,對它作積分獲累加即可得位置命令,
對它作微分,則可得到加速度之命令曲線,其
位移、速度、加速度、急跳度(Jerk)的關係,
如圖6-25所示,其名稱之定義如下:
⚫ (A) 位移:X
⚫ (B) 速度: v = dx = x2 − x1 = x I
dt t 2 − t1
(一次微分)

CNC 153
dv v2 − v1
(C) 加速度: a = = =x II
dt t 2 − t1
(二次微分)

da a2 − a1
(D) 急跳度(Jerk): j = = = x III
dt t 2 − t1
(三次微分)

CNC 154
CNC 155
前加減速控制(Acc/Dec Control Before Interpolation)
⚫ 圖6-26為前加減速控制迴路,其加減速放在插
值器前,它直接對進給率做加減速規劃,其加減
速規劃的順序如圖6-27,它不會影響插值輸出的
位置精度

CNC 156
CNC 157
後加減速控制(Acc/Dec Control After Interpolation)

➢ 後加減速控制

⚫ 圖6-28為後加減速控制迴路,其加減速放在插
值器後,它分別對各運動座標進行控制,在加減
速過程中合成位置可能不準確,其加減速規劃的
順序,如圖6-29。
In the case of ADCAI, firstly the NCK, Numerical Control Kernel, interprets a part
program using the interpreter module and calculates the displacement distance for
each axis, Δ X, Δ Y, Δ Z for every interpolation time interval based on the interpreted
result using the rough interpolation module. Next, independent Acc/Dec control of
each axis is performed with respect to Δ X, Δ Y, Δ Z.
CNC 158
CNC 159
⚫ 目前加減速的型式大致可分為:直線型加減速,
指數型加減速,鐘形加減速(Bell Shape)等,如
圖6-30,以日本FANUC 18i控制器而言,則為直
線形與鐘形兩種

CNC 160
Acc/Dec Control After Interpolation (ADCAI)

In the case of ADCAI, firstly the NCK,


Numerical Control Kernel, interprets a
part program using the interpreter
module and calculates the
displacement distance for each axis,
Δ X, Δ Y, Δ Z for every interpolation
time interval based on the interpreted
result using the rough interpolation
module. Next, independent Acc/Dec
control of each axis is performed with
respect to Δ X, Δ Y, Δ Z.

161
Acc/Dec Control Before Interpolation (ADCBI)
Unlike ADCAI-type NCK, ADCBI-
type NCK generates the speed
profile before executing rough
interpolation. Also unlike ADCAI-
type NCK, where Acc/Dec control is
carried out separately for individual
axes, ADCBI-type NCK carries out
the Acc/Dec control for the
programmed path itself. Therefore,
theoretically, ADCBI type NCK does
not result in machining error. 162
Acc/Dec Control Machining Errors

• The ADCBI needs to hold a lot of information, related to all


the interpolated points, a large amount of memory is
required for executing this type of Acc/Dec control.
However, because of the large amount of information the
Acc/Dec control does not result in machining error because
of the increased accuracy.

• The implementation of ADCAI-type is simple but machining


errors occur because each axis movement is determined
separately. Since Acc/Dec control in ADCAI is individually
applied for each axis, acceleration and deceleration for
movement so f each axis are carried out regardless of the
interpolated position. Accordingly, the interpolated points
deviate from the desired path.
CNC 163
Machining Errors Due to Servo Lag and ADCAI

circular command

R = R1 + R2
R: machining error of circular command.
R1: machining error due to ADCAI.
R2: machining error due to servo lag of servo control system
164
進給伺服控制系統的時間延遲(time delay),會造
成進給系統因延遲而產生誤差,在圖6-32中,輸入命
令為直線部分,而因伺服延遲造成曲斜線部分的輸出,
以單軸的伺服系統為例,若時間T1時,給的命令須到
達終點P1,可是經伺服延遲,只到達P2,而造成了終
點P1−P2的延遲誤差,這種因伺服延遲造成的誤差,
若在單軸直線加工,並不會產生軌跡誤差,但是,若
在曲面加工,轉角加工,循圓時,就會產生軌跡誤差。

CNC 165
⚫ 在探討精度與速度的課題外,若要滿足加工表面的
平滑光潔度,則須將抑制振動的問題考慮進去,即
所謂的Jerk如圖6-33所示有限制型與平滑型兩種,
所謂限制型Jerk,即Jerk的變化為步階方式,而平
滑型S-Curve Jerk,其Jerk變化的情形,則是較平
滑,它呈現連續曲線。

CNC 166
⚫ 此兩者在轉角運動產生的路徑誤差,限制型Jerk
產生的振動非常明顯,如圖6-34所示。

CNC 167
Linear Type ACC/DEC

pulse pulse
10 10

0 2 4 6 8 10 12 14 16 18 20 22 24 ms
0 2 4 6 8 10 12 14 16 ms

Interpreter‘s output pulse Pulse train after ACC/DEC


train before ACC/DEC

168
Moving Average Method

Output pulse of ADCAI can be calculated by using


moving average method.
X[n] : interpreter’s output pulse
N : total ACC/DEC sampling counts
A[n]: output pulse after ACC/DEC for each sampling time.
n: descrete sampling time
169
Circuit of Linear Type ACC/DEC

170
Acc/Dec Control After Interpolation Machining Errors (part 1 of 5)

1. In the case of a circular path on the XY plane, the


speed of the X- and Y-axes input to the Acc/Dec
control circuit is actually a sine wave or cosine wave
form.
2. After passing through an Acc/Dec control filter (or
circuit), the speed profiles of the X- and Y-axes are
changed to a sine wave or cosine wave whose
beginning and end are distorted.
CNC 171
Acc/Dec Control After Interpolation Machining Errors (part 2 of 5)

We assume that the feedrate for a circular path is F (mm/min)


and the radius of the circular path is R (mm).
The position of X - axis and Y - axis is given by
x(t ) = R cos( wt ) (1)
y (t ) = R sin( wt ) (2)
F
w= (3)
R
Then the speed of each axis can be expressed as
V x (t ) = − Rw sin( wt ) (4)
V y (t ) = − Rw cos( wt ) (5)
CNC 172
Acc/Dec Control After Interpolation Machining Errors (part 3 of 5)

By applying Laplace transformation, Eq. 4 and Eq. 5 can be converted


into Eq. 6 and Eq. 7
w
V x ( s ) = − Rw (6)
s +w
2 2

s
V y ( s ) = Rw 2 (7)
s +w 2

In the Linear - type Acc/Dec control, the impulse response for the Linear
Type Acc/Dec control whose time constant is τ is given by Eq. 8.
11
H l (s) = (1 − e −s ) (8)
 s
where τ represents the Acc/Dec time.

CNC 173
Acc/Dec Control After Interpolation Machining Errors (part 4 of 5)

Therefore, the output of the Acc/Dec control, W x ( s ), of the X - axis is


given by Eq. 9
11 −s w
W x ( s ) = H l ( s )V x ( s ) = (1 − e )(− Rw 2 ) (9)
 s s +w 2

K 1 s −s
Wx (s) = [ - 2 ]( (1 − e )
2 2 s +w 2

1
where K = - Rw

Using the inverse Laplace transform, Eq. 9 is converted to Eq. 10
2 w 
W x (t ) = sin( )(− Rw) sin w(t − ) (10)
w 2 2

CNC 174
Acc/Dec Control After Interpolation Machining Errors (part 5 of 5)
By integrating Wx(t), we can obtain the radius of the circular path after applying
the Linear - type Acc/Dec control as Eq. 11
2 
rx (t ) = R sin( w )(− Rw) sin(t − ) (11)
w 2
From Eq. 11, we can find the radiusof thecircularpatha fter Acc/Dec time (t > τ ),
R , which is expressed by Eq. 12
2
R = R sin( w ) (12)
w
As the machining error is the difference between the radius of the commanded path
and the distorted path due to the Linear - type Acc/Dec control, the error is simplified as
Eq. 13
2 2
ΔR = R − R  = R − R sin( w ) = R[1 − sin( w )] (13)
w w
2 w w 3 3
ΔR = R{1 − ( − )}
w 2 8  3!
R 2 2 1 2 F2 
z 2n +1
ΔR  w   where, sinz =  from the Taylor series
24 24 R n = 0 (2n + 1)!
CNC 175
Linear Type Acc/Dec Control After Interpolation Using Simulink

CNC 176
Look Ahead
• When machine 3D surfaces from CAD/CAM data
➢ Consists of a sequential linear path with short length
➢ Machined surface is degraded due to frequent
acceleration/deceleration and the discontinuity of the feedrate.
• If use look ahead function
➢ Preview hundred blocks
➢ Calculate an adequate feedrate for each axis with the
maximum allowable feedrate and acceleration/deceleration.

CNC 177
Look Ahead
• When machine 3D surfaces from CAD/CAM data
➢ Consists of a sequential linear path with short length
➢ Machined surface is degraded due to frequent
acceleration/deceleration and the discontinuity of the feedrate.
• If use look ahead function
➢ Preview hundred blocks
➢ Calculate an adequate feedrate for each axis with the
maximum allowable feedrate and acceleration/deceleration.

CNC 178
Modules of Numerical Control Kernel

CNC 179
Modules of Numerical Control Kernel (ADCAI-Type)

For CNC systems, two kinds of Acceleration and Deceleration (Acc/Dec) control methods have
been developed; Acc/Dec Control Before Interpolation(ADCBI) and Acc/Dec Control After
Interpolation (ADCAI).
CNC 180
背隙補正 (Backlash Compensation)
• 在傳動機構中,背隙的存在是不可避免的。背隙的影響在
於機台運動時會產生遲滯現象,因而造成加工軌跡誤差。
解決的方法之一,是在軟體中加入補償功能。
• 背隙補正的原理,是在發現機台的軸向運動發生反向運動
時,運動模組額外再送出一些進給增量,以抵消背隙。在
運動控制系統的設計上,背隙補正功能必須在完成機械原
點回歸 (Homing) 之後才有效。
if ( MOT_homeOK.x ) { // check homing
if ( MOT_movdir.x == 0 ) {
if ( MOT_delta_machine.x < 0 ) { // direction change
MOT_delta_machine.x += -( MOT_backlash.x ); // backlacs comp.
MOT_movdir.x = 1;
}
}
}

CNC 181
節距誤差補正 (Pitch Error Compensation)
➢ 節距誤差誤差如同背隙一般,是發生在機械結構上的誤差,主要
是來自導螺桿、解碼器、和光學尺的製造與架設。其誤差具有良
好的重現性,故透過軟體的補正,可得到相當程度的改善。
➢ 節距誤差補正的原則為,先選定一補正參考點,再依此參考點為
基準,將該軸全行程分為若干區段,然後分別量測各區段誤差值
,補正時則依機械座標所在區段,給與適當補正量。
Example
Pitch error zero point = 0
Compensation interval = 1000
Value inside (.) is the compensation value
0 1 2 3 36
setting point
(0) (+7) (-6) (+4) (-0)

Machine
coordinate
system 0 +10000 +20000 +30000 +36000
CNC 182
References
1. Mu-Tian Yan, Chen-Wei Huang and Chuan-Jie Wang,
“Development of an Open Architecture CNC system for a Wire-
EDM Machine”, Materials Science Forum, Vols. 505-507,
January 2006, pp. 481-486.
2. G. Pritschow, Y. Altintas, F. Govane and Y. Koren, “ Open
Controller Architecture – Past, Present and Future”, Annals of
CIRP, Vol. 50/2, 2001, pp. 463-470.
3. Suk-Swan Suh, Seong-Kyoon Kang, Dae-Hyuk Chung, Lan
Stroud, Theory and Design of CNC Systems, 2008 Springer-

CNC
Verlag London Limited. 183

You might also like