Rp Đồ Án 2 Hoài Ngọc
Rp Đồ Án 2 Hoài Ngọc
Rp Đồ Án 2 Hoài Ngọc
DESIGN PROJECT II
TOPIC: DESIGING A CONTROL SYSTEM FOR THE CNC AXIS
Hanoi, 08/01/2024
2
Contents
OVERVIEW OF CNC MILLING MACHINE ....................................................7
1.3. Methods for Calculating and Algorithms for Interpolating Functions .........17
4.4.1. Wiring diagram between PLC and CN1 of the driver ...........................66
Conclusion...............................................................................................................87
REFERENCES .......................................................................................................88
5
The various CNC codes are N Code, G Code, XYZ Code, F code, etc.
- Tape reader: This is used as a storage device where we can store the program for
a particular machining operation.
Also, the mini-computer equipped with diagnostic software which can detect any
problem and restore the machine accordingly.
- Servo system: The function of the servo system is to receive the control signal
from the feedback devices and the set output accordingly (To shaft, tools and other
components of CNC machines.
+ Servo Motors
+ Feed-back devices
+ Ball screws
- CNC machine: This is the actual machine where the finished product made. This
is the housing of headstock, tailstock, foot switch, chuck, and tool turret.
9
The data processing in a CNC control system is responsible for setting up the
necessary data from the NC program required for the operation of the CNC
machine in manufacturing parts.
axis's motion. Once the motion paths are generated, they continue to be
controlled by the closed-loop control circuit to ensure the tool positions are
accurate.
- Servo Motors: Servo motors are used to perform precise motions and control
the position of the axes. They have the ability to provide feedback and adjust
automatically to ensure accurate positioning.
- Limit Switches: Limit switches are commonly used to restrict the motion of
the axes or mark fixed positions on the CNC machine.
- Push Buttons: Push buttons are used to perform necessary operations, such
as starting the machine, stopping it, or activating other functions on the CNC
machine.
15
- Standard: JIS
- Material: S45C
- Grade: 4040
- Speed: V = 24 m/ph
1 Guide Way X-
MSA20LA PMI
Axis
2 Guide Way Y-
MSA20LA PMI
Axis
5 Ball Bearing
7205 BECPH PMI
X-Axis
6 Ball Bearing
7205 BECPH PMI
Y-Axis
The reference points must be closely spaced to ensure the accuracy of the
machined shape, with no points falling outside the allowable tolerance.
- Concept: The drill bit moves from the start point to the end point in a sequence of
straight line segments.
- Required parameters:
Consider a tool moving from: Starting point to the ending point along a straight
line at a constant tool feed rate u (as shown in the diagram).
XE − XA
x(t ) = X A + VX dt = X A + dt
0 0 T
Y −Y
y(t ) = YA + Vydt = YA + E A dt
0 0 T
Divide the time T into sufficiently small intervals and replace the integral
operation with addition:
XB − XA
x(t ) = x(n. t ) = X A + .n
N
Với n =1,2,3.....,n
YB − YA
y(t ) = y (n.t ) = YA + .n
N
For each addition step, the position value increases by a constant value. To ensure
the accuracy of the interpolation, the addition steps must be smaller than the unit
f rate of tool movement.
21
XA − XB X − XB
f x , y max hay max A
N N
- Concept: The tool is moved from the start point to the end point along a circular
path using a simple command block, replacing many straight-line interpolation
commands.
- Required parameters:
Starting point: PA
Ending point: PE
From the diagram: To cut along a curve, the intermediate points on the contour
must be determined using an interpolation set in a relationship that depends on the
cutting time.
Following:
x = R cos
y = R sin
With = 2 / T
x = R cos(2 / T )
y = R sin(2 / T )
Integrating with respect to time, we obtain the individual component velocities for
each axis:
dx 2 R 2 t −2
= cos( )= y(t )
dt T T T
dy 2 R 2 t −2
= cos( )= x(t )
dt T T T
→ d X = −(2 / T ). y (t ) d t
d y = −(2 / T ).x(t ) d t
With sufficient accuracy, the integral operation can be replaced by the addition of
displacement step constants. Therefore:
23
2 n
xt = xPA − . y (i.t )
N i =1
2 n
yt = yPA − . y(i.t )
N i =1
24
Initial specifications:
Equation:
Motor force:
𝑙
𝐹𝑑𝑐 = 𝐾𝑥(𝑡) = 𝐾𝜃(𝑡)
2𝜋
- 𝜃(𝑡): The angle of rotation of the motor required to produce a displacement
x(t)
- 𝑙: Lead screw step
Hardness coefficient:
1 1 1 1 1
= + + +
𝐾 𝑘𝑐 𝑘𝑏 𝑘𝑔 + 𝑘𝑠 𝑘𝑛
Where:
Where:
−1
0.44 𝑄2 3
+ 𝛿𝑎𝑜 : Movement along the axis 𝛿𝑎𝑜 = ( ) = 5,4 × 10−3
sin∝ 𝐷𝑊
𝜋×322
𝐴.𝐸 .2,1.104 𝑘𝑔𝑓
4
Lead screw stiffness: 𝑘𝑠 = 10−3 = 10−3 =13.41 ( )
𝑥 1259 𝜇𝑚
Where:
𝜋𝐷2
- A: Lead screw cross-sectional area, A=
4
Where k=151, dynamic load 𝐶𝑎 = 4660 kgf, axial force 𝐹𝑎 =130,7 kgf
𝑘𝑐 𝑘𝑏 𝑘𝑔 𝑘𝑠 𝑘𝑛
𝑙
=> [ M𝑠 2 + (B+𝜇𝑀𝑔)𝑠 + 𝐾]𝑋(𝑠)= 𝐾𝜃 (𝑠)
2𝜋
𝑙
𝑋(𝑠) 𝐾2π 397,9
=> G(s)= = =
𝜃(𝑠) M𝑠2 +(B+𝜇𝑀𝑔)𝑠+𝐾 70𝑠2 +2998𝑠+250021
If all the roots of A(s) lie on the left of the imaginary axis, then A(s) is called a
Routh-Hurwitz polynomial, we use the roots A(s) command to get the following
set of solutions:
𝑋1 = -21,4 + 55.9i
𝑋2 = -21,4 – 55,9i
Bode graph.
This is unresponsible for a system where the required transients are only in the 2%
range. Furthermore, here we give the excitation system the signal l(t) but the
system does not stick to the input.
32
- If the error e(t), through the amplification stage, the signal u(t) is larger.
- If the error e(t) is not zero, then through the integral step, the PID still
generates an adjustment signal.
- If the error change e(t) is larger, through the differential component, the
appropriate response of u(t) will be faster.
- The PID controller is described by the I/O model:
1 1 𝑑𝑒(𝑡)
𝑢(𝑡) = 𝑘𝑝 [𝑒(𝑡) + ∫0 𝑒(𝜏)𝑑𝜏 + 𝑇𝐷 ]
𝑇1 𝑑𝑡
1
𝑅(𝑠) = 𝑘𝑝 (1 + + 𝑇𝐷 𝑠)
𝑇𝑠
The larger the value, the faster the response speed, so the larger the error, the
larger the proportional compensation. If the magnitude of the proportional is too
high, the system will be unstable. The big-small magnitude is because the output
response is small while the input error is large, and makes the controller less
sensitive, or slow to respond. If the gain of the proportional link is too low, the
control action may be too small in response to system disturbances.
34
Figure 15. . The role of the proportional step in the PID controller
- Integral step:
Figure 16. The role of the integral step in the PID controller
The distribution of the integral (sometimes called reset) is proportional to
both the amplitude of the error and the duration of the error. Total instantaneous
error over time
The larger the value, the faster the error is eliminated. The return is a larger
overshoot: any negative error that is integrated during the transient response must
be suppressed by the positive error before reaching the steady state.
- Differential step:
The differential step reduces the rate of change of the controller output and
this characteristic is most noticeable to reach the controller setpoint. Since then,
differential control is used to reduce the spurious amplitude generated by the
integral component and improve the stability of the composite controller.
However, the differential of a signal will amplify the noise and thus this link will
be more sensitive to noise in error and can cause the process to become unstable if
the noise and differential gain are large enough.
Figure 17. The role of the differential stage in the PID controller
36
The experimental method is responsible for determining the parameters KP, TI, TD
for the PID controller on the basis of approximating the transfer function G(s) to
the form (1), so that the closed system quickly returns to the deterministic mode.
setting and overshoot does not exceed an allowable limit, about 40% of the
ℎ∞ = 𝑙𝑖𝑚 ℎ(𝑡)
𝑡→∞
The three parameters L(delay time constant), k(gain factor) and T(time of inertia
constant) of the approximation(1) model can be approximated from the transient
function h(t).
37
L is the time at which the output h(t) does not immediately respond to the stimulus
l(t) at the input.
Let A be the end of the time delay, that is, the point on the horizontal axis of length
L. Then T is the time required after L for the tangent of h(t) at A to reach the value
k.
After calculating the above parameters, the PID controller has the form:
1
𝑅(𝑠) = 𝐾𝑝 (1 + + 𝑇𝐷𝑆 )
𝑇1𝑠
1,2𝑇 𝑘𝑝 𝐿
with 𝐾𝑝 = . 𝑇𝐼 = 2𝐿 or 𝐾𝐼 = , 𝑇𝐷 = or 𝐾𝐷 = 0,5𝑘𝑝 𝐿
𝐾𝐿 2𝐿 2
The use of the numerical simulation tool Matlab has a built-in PID controller
design tool. The results of designing automatic PID sets using Matlab & Simulink
are as follows:
𝑘𝑝 = 1195.6488
𝑘𝑖 = 36777.4355
𝑘𝑑 = 9.628
39
Looking at the graph above, the step response of the X table when there is a PID
controller, we can see that the system has a good grasp of the input signal.
42
Initial specifications:
Equation:
Motor force:
𝑙
𝐹𝑑𝑐 = 𝐾𝑥(𝑡) = 𝐾𝜃(𝑡)
2𝜋
- 𝜃(𝑡): The angle of rotation of the motor required to produce a displacement
x(t)
43
Hardness coefficient:
1 1 1 1 1
= + + +
𝐾 𝑘𝑐 𝑘𝑏 𝑘𝑔 + 𝑘𝑠 𝑘𝑛
Where:
Where:
−1
0.44 𝑄2 3
+ 𝛿𝑎𝑜 : Movement along the axis 𝛿𝑎𝑜 = ( ) = 4,7 × 10−3
sin∝ 𝐷𝑊
𝜋×322
𝐴.𝐸 .2,1.104 𝑘𝑔𝑓
4
Lead screw stiffness: 𝑘𝑠 = 10−3 = 10−3 =13,41 ( )
𝑥 1259 𝜇𝑚
Where:
𝜋𝐷2
- A: Lead screw cross-sectional area, A=
4
Where k=151, dynamic load 𝐶𝑎 = 4660 kgf, axial force 𝐹𝑎 =149,7 kgf
45
𝑘𝑐 𝑘𝑏 𝑘𝑔 𝑘𝑠 𝑘𝑛
𝑙
=> [ M𝑠 2 + (B+𝜇𝑀𝑔)𝑠 + 𝐾]𝑋(𝑠)= 𝐾𝜃 (𝑠)
2𝜋
𝑙
𝑋(𝑠) 𝐾2π 397,9
=> G(s)= = =
𝜃(𝑠) M𝑠2 +(B+𝜇𝑀𝑔)𝑠+𝐾 165𝑠2 +4933𝑠+281270
If all the roots of A(s) lie on the left of the imaginary axis, then A(s) is called a
Routh-Hurwitz polynomial, we use the roots A(s) command to get the following
set of solutions:
𝑋1 = -14,9 + 38,5i
𝑋2 = -14,9 – 38,5i
Bode graph.
This is unresponsible for a system where the required transients are only in the 2%
range. Furthermore, here we give the excitation system the signal l(t) but the
system does not stick to the input.
The use of the numerical simulation tool Matlab has a built-in PID controller
design tool. The results of designing automatic PID sets using Matlab & Simulink
are as follows:
Looking at the graph above, the step response of the Y table when there is a PID
controller, we can see that the system has a good grasp of the input signal.
52
Specifications:
- Type: AC Servo Motor
- Series: Melservo J3
- Model: HF-KR053
- Brand: Mitsubishi Electric – Japan
- Function: Brushless DC motor
- Design: Straight axis
- Encoder: 18-bit, resolution of 262,144 pulses per revolution.
53
4.1.3. PLC
Diagram of 50 pins X8 drive with PLC in PTI mode (Pulse Train Input Position
Control) - controlling the input position of the pulse sequence.
62
The pins that need to be connected between PLC S7-1200 and the control pins of
63
+) Supply 0V to the DI_COM (3, 4), NEXT_D0 (49, 50), PTI_A_24P (37), and
PTI_B_24P (39) pins.
+) Connect the PTI_B_24P (38) - X-axis direction (DIRECTION) pin to the output
Q0.1 of the PLC.
+) Connect the SON (5) - SERVO X ON CMD/SERVO ENABLE CMD pin to the
output Q1.0 of the PLC.
+) Connect the RESET (6) - SERVO X FAULT RESET CMD pin to the output
Q1.1 of the PLC.
+) Connect the EMG (13) - SERVO EMERGENCY CMD pin to the output Q0.4
of the PLC.
+) Connect the PTI_A_24P (36) - Y-axis pulse (PULSES) pin to the output Q0.2 of
the PLC.
+) Connect the PTI_B_24P (38) - Y-axis direction (DIRECTION) pin to the output
Q0.3 of the PLC.
+) Connect the SON (5) - SERVO Y ON CMD/SERVO ENABLE CMD pin to the
output Q0.5 of the PLC.
+) Connect the RESET (6) - SERVO Y FAULT RESET CMD pin to the output
Q0.6 of the PLC.
64
+) Connect the ALARM (31) - SERVO X FAULT PRESENT pin to the input I0.1
of the PLC.
+) If rising edge of the pulse from 0 to 1 occurs: Supply power to the power circuit
and make the servo drive ready for operation.
PP 10 Connect to 0VDC
NP 35 Connect to 0VDC
Step1: Open GX Works2 → New project → Parameter Setting → Read PLC Data
→ Check → End. (Determine the actual positions of the devices within the
module)
Step 5: Parameter → Pr.1 Unit setting → Compute basic parameters → Ball screw,
Horizontal → o: mm →10000um → 1/1 → 4194304 → compute basic parameters
1 → oke → Pr.12,Pr.13 chooses 1 → Pr.18 →1:After mode → Pr.80 → Use
External Input signal of servo amplifier → Pr.43 HPR method → 7:Scale home
Position Signal Delection Method → Pr.44 HPR direction → 1:Reverse Direction
→ Help → Memory add list.
- Returning to the origin requires a storage system and determining the origin.
74
75
- After loading a new program into the PLC, it is necessary to verify the execution
of the interpolation command.
77
Chapter 5. Simulation
5.1.Simulating Interpolation Using GX-Work2 Software
Setup Steps:
S2: Select Simple Motion Module -> Open File: Servo BK.
S3: Choose Positioning Data -> Enter values from the Excel table into the
corresponding Axis tables.
M-code -> 1 (lower tool) / 2 (lift tool) / 3 (return to home). After entering all the
82
Figure 38. Applying linear interpolation for milling the straight line
- Enter the coordinates of 3 points.
85
Conclusion
In conclusion, I would like to express my sincere gratitude for the enthusiastic
guidance of Professor Dr. Le Minh Quy. Through completing the project on
designing an electro-mechanical system - an automated device with the topic of
designing a control system for a CNC table, I have achieved several positive
outcomes:
REFERENCES