# ModelSim/Simulink Cosimulation and FPGA Realization of a Multiaxis Motion Controller

Authors: Ying-Shieh Kung; Jin-Mu Lin; Yu-Jen Chen; Hsin-Hung Chou
Journal: Mathematical Problems in Engineering
 (2015)

---

## Abstract

This paper is to implement a multiaxis servo controller and a motion trajectory planning within one chip. At first, SoPC (system on a programmable chip) technology which is composed of an Altera FPGA (field programmable gate arrays) chip and an embedded soft-core Nios II processor is taken as the development of a multiaxis motion control IC. The multiaxis motion control IC has two modules. The first module is Nios II processor which realizes the motion trajectory planning by software. It includes the step, circular, window, star, and helical motion trajectory. The second module presents a function of the multiaxis position/speed/current controller IP (intellectual property) by hardware. And VHDL (VHSIC Hardware Description Language) is applied to describe the multiaxis servo controller behavior. Before the FPGA realization, a cosimulation work by ModelSim/Simulink is applied to test the VHDL code. Then, this IP combined by Nios II processor will be downloaded to FPGA. Therefore, a fully digital multiaxis motion controller can be realized by a single FPGA chip. Finally, to verify the effectiveness and correctness of the proposed multiaxis motion control IP, a three-axis motion platform (XYZ table) is constructed and some experimental results are presented.


---

## Body

## 1. Introduction

The integration of a multiaxis servo and motion controller into one chip and then application toXYZ table, CNC (Computed Numerically Controlled) machine or robotic system, and so forth, for reducing the system volume and increasing the system performance and motion stability, have become a popular research topic in literatures [1–5]. Further, in typical applications, adopting PMSM as an actuator in automatic multiaxis equipment is a major technique trend due to its excellent high power density and better motion control characteristics, fast response and accuracy positioning [6–8]. In traditional machine, it usually utilizes one central controller for planning the motion trajectory and multiple microprocessors for multiaxis servo motor drive system to establish a multiaxis motion controller. In this architecture, the coordination and communication between center controller and multiple microprocessors are a challenge task in the automatic multiaxis equipment. However, some drawbacks appear, such as large volume, being easily affected by the noise, expensive cost, and inflexible. In addition, data communication and handshaking protocol between the central controller and multiple microprocessors certainly slow down the system executing speed. To solve this problem, FPGA provides a best solution among those commercial high-end microprocessors due to its fast computational power, parallel processing ability, field programmable characteristics, and SoPC environment which can perform hardware-software codesign task [9–12]. For example, in the design of PMSM servo drive using FPGA, it only needs less than 2 μs in realizing the SVPWM algorithm, less than 3 μs in implementing the current vector controller, and less than 3 μs in executing the fuzzy controller algorithm in speed loop. The fast computational and parallel processing characteristics make it possible to integrate multiaxis servo controllers and the function of motion trajectory planning into one FPGA.Recently, a cosimulation work by Electronic Design Automation (EDA) Simulator Link has been gradually applied to verify the effectiveness of the HDL (Hardware Description Language) code in the motor drive system [13–15]. The EDA Simulator Link [16] provides a cosimulation interface between Simulink and ModelSim [17] where you can use Simulink models as a test bench that generates stimulus for ModelSim and analyzes the simulation’s response [16]. Therefore, before the FPGA realization, a cosimulation work by EDA Simulator Link will be applied to the multiaxis motion control system in this paper. The multi-PMSMs, multi-inverters, a motion trajectory planning, and motion position response are performed in Simulink and the position/speed/current controller IP (Intellectual Property) which is described by VHDL code is executed in ModelSim. After successful verification in simulation, the position/speed/current controller IP can be directly used in the FPGA.The realization in this paper is the SoPC technology in which FPGA embedding a Nios II processor is established to develop a multiaxis motion control IC, and it is shown in Figure1. It includes multiple servo controllers IP and one Nios II processor in a FPGA. Each servo controller IP performs the function of position/speed/current controller for each PMSM drive and Nios II processor executes the function of motion trajectory planning. In addition, the detailed inside architecture of the proposed multiaxis motion control IC in FPGA is presented in Figure 2. In servo controller IP, the vector control is adopted in the current loop,P controller is used in the speed loop, and fuzzy controller is applied in the position loop for each PMSM drive. However, the multiaxis motion control IC shown in Figure 1 can be applied multiaxis automatic equipment, such asXYZ table, SCARA robot arm, vertical-type robot arm, and CNC machine.Figure 1
FPGA-based multiaxis motion control IC and its applications.Figure 2
The inside architecture of FPGA-based multiaxis position/speed/current control IC.


## 2. Modelling, Control, and Motion Trajectory Design

Figure2 includes multiple servo controllers IPs and one Nios II processor in a FPGA. Each servo controller IP performs the function of position/speed/current controller for one PMSM drive and Nios II processor executes the function of motion trajectory planning. Detailed design methodology is described as follows.


### 2.1. Mathematical Model of Single-Axis Table

The typical mathematical model of a PMSM is described, in two-axisd-q synchronous rotating reference frame, as follows:
(1)
d
i
d
d
t
=
-
r
s
L
d
i
d
+
ω
e
L
q
L
d
i
q
+
1
L
d
v
d
,
d
i
q
d
t
=
-
ω
e
L
d
L
q
i
d
-
r
s
L
q
i
q
-
ω
e
λ
f
L
q
+
1
L
q
v
q
,
where v
d, v
q are the d- and q-axis voltages; i
d, i
q, are the d- and q-axis currents; r
s is the phase winding resistance; L
d, L
q are the d- and q-axis inductance; ω
e is the rotating speed of magnet flux; λ
f is the permanent magnet flux linkage.The current loop control of PMSM drive in Figure2 is based on a vector control approach. That is, if the i
d is controlled to 0, the PMSM will be decoupled and controlling a PMSM will be similar to controlling a DC motor. Therefore, after decoupling, the torque of PMSM can be written as the following equation:
(2)
T
e
=
3
P
4
λ
f
i
q
≜
K
t
i
q
with
(3)
K
t
=
3
P
4
λ
f
.
T
e is the motor torque and P is pole pairs. Thus, considering the mechanical load, the overall dynamic equation of linear table system is obtained by
(4)
T
e
-
T
L
=
J
m
2
π
r
b
d
2
s
p
i
d
t
2
+
B
m
2
π
r
b
d
s
p
i
d
t
.
K
t is force constant; J
m is the inertial value; B
m is damping ratio; T
L is the external torque; s
p
i represents the displacement in i-axis table; r
b is the lead of the ball screw.


### 2.2. Fuzzy Controller (FC) Design

The FC in this study uses singleton fuzzifier, triangular membership function, product-inference rule, and central average defuzzifier method. In Figure2, the tracking error e and the error change d
e are defined by
(5)
e
k
=
s
p
i
*
k
-
s
p
i
k
,
d
e
k
=
e
k
-
e
k
-
1
,
where u
f represents the output of the FC; S
p
i
*
(
k
), S
p
i
(
k
) represent ith-axis position command and ith-axis position feedback, respectively. The design procedure of the FC is described as follows. (a)
Takee, d
e as the input variable of FC, and define their linguist variables as E anddE. The linguist values of E and d
E are {
A
0, A
1, A
2, A
3, A
4, A
5, A
6
} and {
B
0, B
1, B
2, B
3, B
4, B
5, B
6
}, respectively. Each linguist value of E anddE is based on the symmetrical triangular membership function.
(b)
Compute the membership degree ofe and d
e. It is only two linguistic values which are excited (resulting in a nonzero membership) in any input value. Therefore, the membership degree μ
A
i
(
e
) can be straightforwardly obtained by
(6)
μ
A
i
e
=
e
i
+
1
-
e
2
,
μ
A
i
+
1
(
e
)
=
1
-
μ
A
i
(
e
)
ande
i
+
1
≜
-
6
+
2
*
(
i
+
1
). Similar results can be obtained in computing the membership degree μ
B
j
(
d
e
).
(c)
Select the initial FC rules by referring to the dynamic response characteristics, such as(7)
IF
e
is
A
i
and
Δ
e
is
B
j
THEN
u
f
is
c
j
,
i
,
for
i
,
j
=
0
~
6
,
whereA
i and B
j are fuzzy number and c
j
,
i is real number.
(d)
Establish the fuzzy systemu
f
(
e
,
d
e
) by using the singleton fuzzifier, product-inference rule, and central average defuzzifier method. Although there are total 49 fuzzy rules that will be inferred, actually only 4 fuzzy rules can be effectively excited to generate a nonzero output. Therefore the output of the fuzzy inference can be obtained by the following expression:
(8)
u
f
e
,
d
e
=
∑
n
=
i
i
+
1
∑
m
=
j
j
+
1
c
m
,
n
[
μ
A
n
e
*
μ
B
m
(
d
e
)
]
∑
n
=
i
i
+
1
∑
m
=
j
j
+
1
μ
A
n
e
*
μ
B
m
(
d
e
)
≜
∑
n
=
i
i
+
1
∑
m
=
j
j
+
1
c
m
,
n
*
d
n
,
m
,where d
n
,
m
≜
μ
A
n
e
*
μ
B
m
(
d
e
) and ∑
n
=
i
i
+
1
∑
m
=
j
j
+
1
d
n
,
m
=
1.


### 2.3. Motion Trajectory Planning

The circular, window, star, and helical circular motion trajectories are typically used [18] as the performance evaluation of the motion controller forXYZ table.(a)
Circular motion trajectory: it is computed as follows:(9)
x
i
=
r
sin
θ
i
,
y
i
=
r
cos
⁡
(
θ
i
)
withθ
i
=
θ
i
-
1
+
Δ
θ, where Δ
θ, r, x
i, y
i are angle increment, radius, x-axis trajectory command, and y-axis trajectory command, respectively.
(b)
Window motion trajectory: it is shown in Figure3(a). The formulation is derived as follows:
a-trajectory:(10)
x
i
=
x
i
-
1
,
y
i
=
S
+
y
i
-
1
,
b-trajectory:(11)
θ
i
:
6
4
π
⟶
2
π
,
θ
i
=
θ
i
-
1
+
Δ
θ
,
x
i
=
O
x
1
+
r
cos
⁡
θ
i
,
y
i
=
O
y
1
+
r
sin
θ
i
,
c-trajectory:(12)
x
i
=
S
+
x
i
-
1
,
y
i
=
y
i
-
1
,
d-trajectory:(13)
θ
i
:
π
⟶
6
4
π
,
θ
i
=
θ
i
-
1
+
Δ
θ
x
i
=
O
x
2
+
r
cos
⁡
θ
i
,
y
i
=
O
y
2
+
r
sin
θ
i
,
e-trajectory:(14)
x
i
=
x
i
-
1
,
y
i
=
-
S
+
y
i
-
1
,
f-trajectory:(15)
θ
i
:
1
2
π
⟶
π
,
θ
i
=
θ
i
-
1
+
Δ
θ
x
i
=
O
x
3
+
r
cos
⁡
θ
i
,
y
i
=
O
y
3
+
r
sin
θ
i
,
g-trajectory:(16)
x
i
=
-
S
+
x
i
-
1
,
y
i
=
y
i
-
1
,
h-trajectory:(17)
θ
i
:
0
⟶
1
2
π
,
θ
i
=
θ
i
-
1
+
Δ
θ
x
i
=
O
x
4
+
r
cos
⁡
θ
i
,
y
i
=
O
y
4
+
r
sin
θ
i
,
i-trajectory:(18)
x
i
=
x
i
-
1
,
y
i
=
S
+
y
i
-
1
,
whereS are position increment. In addition, the (
O
x
1
,
O
y
1
), (
O
x
2
,
O
y
2
), (
O
x
3
,
O
y
3
), (
O
x
4
,
O
y
4
) are arc center of b-, d-, f-, and h-trajectory in Figure 3(a) and r is the radius. The motion speed of the table is determined by Δ
θ.
(c)
Star motion trajectory: it is shown in Figure3(b). The formulation is derived as follows:
a-trajectory:(19)
x
i
=
S
+
x
i
-
1
,
y
i
=
y
i
-
1
,
b-trajectory:(20)
x
i
=
-
S
*
sin
5
4
°
+
x
i
-
1
,
y
i
=
-
S
*
sin
3
6
°
+
y
i
-
1
,
c-trajectory:(21)
x
i
=
S
*
sin
1
8
°
+
x
i
-
1
,
y
i
=
S
*
sin
7
2
°
+
y
i
-
1
,
d-trajectory:(22)
x
i
=
S
*
sin
1
8
°
+
x
i
-
1
,
y
i
=
-
S
*
sin
7
2
°
+
y
i
-
1
,Figure 3
(a) Window motion trajectory. (b) Star motion trajectory.
(a)
(b)e-trajectory:(23)
x
i
=
-
S
*
sin
5
4
°
+
x
i
-
1
,
y
i
=
S
*
sin
3
6
°
+
y
i
-
1
.
The motion speed of the table is determined byS.
(d)
Helical circular motion trajectory: it is computed as follows:(24)
x
i
=
r
sin
(
θ
i
)
y
i
=
r
cos
⁡
(
θ
i
)
z
i
=
z
i
-
1
+
Δ
z
withθ
i
=
θ
i
-
1
+
Δ
θ, where Δ
θ, Δ
z, r, x
i, y
i, z
i are angle increment, height increment, radius, x-axis trajectory command, y-axis trajectory command, and z-axis trajectory command, respectively.


## 2.1. Mathematical Model of Single-Axis Table

The typical mathematical model of a PMSM is described, in two-axisd-q synchronous rotating reference frame, as follows:
(1)
d
i
d
d
t
=
-
r
s
L
d
i
d
+
ω
e
L
q
L
d
i
q
+
1
L
d
v
d
,
d
i
q
d
t
=
-
ω
e
L
d
L
q
i
d
-
r
s
L
q
i
q
-
ω
e
λ
f
L
q
+
1
L
q
v
q
,
where v
d, v
q are the d- and q-axis voltages; i
d, i
q, are the d- and q-axis currents; r
s is the phase winding resistance; L
d, L
q are the d- and q-axis inductance; ω
e is the rotating speed of magnet flux; λ
f is the permanent magnet flux linkage.The current loop control of PMSM drive in Figure2 is based on a vector control approach. That is, if the i
d is controlled to 0, the PMSM will be decoupled and controlling a PMSM will be similar to controlling a DC motor. Therefore, after decoupling, the torque of PMSM can be written as the following equation:
(2)
T
e
=
3
P
4
λ
f
i
q
≜
K
t
i
q
with
(3)
K
t
=
3
P
4
λ
f
.
T
e is the motor torque and P is pole pairs. Thus, considering the mechanical load, the overall dynamic equation of linear table system is obtained by
(4)
T
e
-
T
L
=
J
m
2
π
r
b
d
2
s
p
i
d
t
2
+
B
m
2
π
r
b
d
s
p
i
d
t
.
K
t is force constant; J
m is the inertial value; B
m is damping ratio; T
L is the external torque; s
p
i represents the displacement in i-axis table; r
b is the lead of the ball screw.


## 2.2. Fuzzy Controller (FC) Design

The FC in this study uses singleton fuzzifier, triangular membership function, product-inference rule, and central average defuzzifier method. In Figure2, the tracking error e and the error change d
e are defined by
(5)
e
k
=
s
p
i
*
k
-
s
p
i
k
,
d
e
k
=
e
k
-
e
k
-
1
,
where u
f represents the output of the FC; S
p
i
*
(
k
), S
p
i
(
k
) represent ith-axis position command and ith-axis position feedback, respectively. The design procedure of the FC is described as follows. (a)
Takee, d
e as the input variable of FC, and define their linguist variables as E anddE. The linguist values of E and d
E are {
A
0, A
1, A
2, A
3, A
4, A
5, A
6
} and {
B
0, B
1, B
2, B
3, B
4, B
5, B
6
}, respectively. Each linguist value of E anddE is based on the symmetrical triangular membership function.
(b)
Compute the membership degree ofe and d
e. It is only two linguistic values which are excited (resulting in a nonzero membership) in any input value. Therefore, the membership degree μ
A
i
(
e
) can be straightforwardly obtained by
(6)
μ
A
i
e
=
e
i
+
1
-
e
2
,
μ
A
i
+
1
(
e
)
=
1
-
μ
A
i
(
e
)
ande
i
+
1
≜
-
6
+
2
*
(
i
+
1
). Similar results can be obtained in computing the membership degree μ
B
j
(
d
e
).
(c)
Select the initial FC rules by referring to the dynamic response characteristics, such as(7)
IF
e
is
A
i
and
Δ
e
is
B
j
THEN
u
f
is
c
j
,
i
,
for
i
,
j
=
0
~
6
,
whereA
i and B
j are fuzzy number and c
j
,
i is real number.
(d)
Establish the fuzzy systemu
f
(
e
,
d
e
) by using the singleton fuzzifier, product-inference rule, and central average defuzzifier method. Although there are total 49 fuzzy rules that will be inferred, actually only 4 fuzzy rules can be effectively excited to generate a nonzero output. Therefore the output of the fuzzy inference can be obtained by the following expression:
(8)
u
f
e
,
d
e
=
∑
n
=
i
i
+
1
∑
m
=
j
j
+
1
c
m
,
n
[
μ
A
n
e
*
μ
B
m
(
d
e
)
]
∑
n
=
i
i
+
1
∑
m
=
j
j
+
1
μ
A
n
e
*
μ
B
m
(
d
e
)
≜
∑
n
=
i
i
+
1
∑
m
=
j
j
+
1
c
m
,
n
*
d
n
,
m
,where d
n
,
m
≜
μ
A
n
e
*
μ
B
m
(
d
e
) and ∑
n
=
i
i
+
1
∑
m
=
j
j
+
1
d
n
,
m
=
1.


## 2.3. Motion Trajectory Planning

The circular, window, star, and helical circular motion trajectories are typically used [18] as the performance evaluation of the motion controller forXYZ table.(a)
Circular motion trajectory: it is computed as follows:(9)
x
i
=
r
sin
θ
i
,
y
i
=
r
cos
⁡
(
θ
i
)
withθ
i
=
θ
i
-
1
+
Δ
θ, where Δ
θ, r, x
i, y
i are angle increment, radius, x-axis trajectory command, and y-axis trajectory command, respectively.
(b)
Window motion trajectory: it is shown in Figure3(a). The formulation is derived as follows:
a-trajectory:(10)
x
i
=
x
i
-
1
,
y
i
=
S
+
y
i
-
1
,
b-trajectory:(11)
θ
i
:
6
4
π
⟶
2
π
,
θ
i
=
θ
i
-
1
+
Δ
θ
,
x
i
=
O
x
1
+
r
cos
⁡
θ
i
,
y
i
=
O
y
1
+
r
sin
θ
i
,
c-trajectory:(12)
x
i
=
S
+
x
i
-
1
,
y
i
=
y
i
-
1
,
d-trajectory:(13)
θ
i
:
π
⟶
6
4
π
,
θ
i
=
θ
i
-
1
+
Δ
θ
x
i
=
O
x
2
+
r
cos
⁡
θ
i
,
y
i
=
O
y
2
+
r
sin
θ
i
,
e-trajectory:(14)
x
i
=
x
i
-
1
,
y
i
=
-
S
+
y
i
-
1
,
f-trajectory:(15)
θ
i
:
1
2
π
⟶
π
,
θ
i
=
θ
i
-
1
+
Δ
θ
x
i
=
O
x
3
+
r
cos
⁡
θ
i
,
y
i
=
O
y
3
+
r
sin
θ
i
,
g-trajectory:(16)
x
i
=
-
S
+
x
i
-
1
,
y
i
=
y
i
-
1
,
h-trajectory:(17)
θ
i
:
0
⟶
1
2
π
,
θ
i
=
θ
i
-
1
+
Δ
θ
x
i
=
O
x
4
+
r
cos
⁡
θ
i
,
y
i
=
O
y
4
+
r
sin
θ
i
,
i-trajectory:(18)
x
i
=
x
i
-
1
,
y
i
=
S
+
y
i
-
1
,
whereS are position increment. In addition, the (
O
x
1
,
O
y
1
), (
O
x
2
,
O
y
2
), (
O
x
3
,
O
y
3
), (
O
x
4
,
O
y
4
) are arc center of b-, d-, f-, and h-trajectory in Figure 3(a) and r is the radius. The motion speed of the table is determined by Δ
θ.
(c)
Star motion trajectory: it is shown in Figure3(b). The formulation is derived as follows:
a-trajectory:(19)
x
i
=
S
+
x
i
-
1
,
y
i
=
y
i
-
1
,
b-trajectory:(20)
x
i
=
-
S
*
sin
5
4
°
+
x
i
-
1
,
y
i
=
-
S
*
sin
3
6
°
+
y
i
-
1
,
c-trajectory:(21)
x
i
=
S
*
sin
1
8
°
+
x
i
-
1
,
y
i
=
S
*
sin
7
2
°
+
y
i
-
1
,
d-trajectory:(22)
x
i
=
S
*
sin
1
8
°
+
x
i
-
1
,
y
i
=
-
S
*
sin
7
2
°
+
y
i
-
1
,Figure 3
(a) Window motion trajectory. (b) Star motion trajectory.
(a)
(b)e-trajectory:(23)
x
i
=
-
S
*
sin
5
4
°
+
x
i
-
1
,
y
i
=
S
*
sin
3
6
°
+
y
i
-
1
.
The motion speed of the table is determined byS.
(d)
Helical circular motion trajectory: it is computed as follows:(24)
x
i
=
r
sin
(
θ
i
)
y
i
=
r
cos
⁡
(
θ
i
)
z
i
=
z
i
-
1
+
Δ
z
withθ
i
=
θ
i
-
1
+
Δ
θ, where Δ
θ, Δ
z, r, x
i, y
i, z
i are angle increment, height increment, radius, x-axis trajectory command, y-axis trajectory command, and z-axis trajectory command, respectively.


## 3. Digital Circuit Design for Position/Speed/Current Controller IP

The proposed FPGA-based three-axis motion control IC forXYZ table is shown in Figure 4. In position/speed/current controller IP, the vector control is adopted in the current loop,P controller is used in the speed loop, and fuzzy controller is applied in the position loop. The FPGA herein uses Cyclone IV-EP4CE115, which is the product of Altera cooperation. There are 114,480 LEs (Logic Elements), 3,981,312 RAM bits, and 150 embedded multipliers in the Cyclone IV. In addition, a Nios II processor is embedded into FPGA to establish an SoC environment. The motion control IC comprises a Nios II embedded processor and multiple position/speed/current controller IP for multiaxis machine. The Nios II processor is utilized to perform the motion trajectory computation. The code in Nios processor is developed with C language. Main program establishes the initial parameters setting, the motion command setting, and so forth and the ISR (interrupt service routine) executes the motion trajectory computation, position command generation, and sending out to three controller IPs. Each internal digital circuit of position/speed/current controller IP is also shown in Figure 4 and it includes one circuit of position FC and speedP controller, one circuit of current controller and coordinate transformation (CCCT), one SVPWM, one ADC interface, and one QEP interface circuit. All circuits in Figure 4 are realized by hardware in FPGA, and the circuit behavior is described by VHDL. The sampling frequency in position, speed, and current control loop are designed with 2 kHz, 2 kHz, and 16 kHz, respectively. The operating clock of the designed FPGA controller is 50 MHz and the frequency divider generates another 12.5 MHz clock to supply all module circuits in Figure 4. A finite state machine (FSM) method is employed to model the algorithms of the position FC and speedP controller, the CCCT, and the SVPWM, which utilizes one adder, one multiplier, a look-up table, comparators, and registers to carry out the overall computation. It needs to spend 20 steps (1.6 μs), 24 steps (1.92 μs), and 18 steps (1.44 μs) to complete the computation of position/speed controller, CCCT, and SVPWM, respectively. The data type is designed with 16-bit length, 2’s complement, and Q15 format in the position/speed controller and CCCT, but 12-bit length, 2’s complement, and Q11 format in SVPWM. For detailed figures and description regarding CCCT and SVPWM refer to [4]. For an example of a three-axis motion control IC, overall circuit included a Nios II processor and three position/speed/current controllers IP consume 22,688 LEs (Logic Elements), 73 embedding multipliers, 241 IO pins, and 241,792 memory bits.Figure 4
Internal circuit design of the proposed FPGA-based multiaxis motion control IC.


## 4. ModelSim/Simulink Cosimulation and Simulation Results

The Simulink/ModelSim cosimulation architecture for the three-axis motion control system is shown in Figure5. Each axis system is driven by one PMSM. The SimPowerSystem blockset in the Simulink executes the three PMSMs and three IGBT-based inverters. The EDA Simulator Link for ModelSim executes the cosimulation using VHDL code running in ModelSim program. It carries out the function of three position/speed/current controller IPs with six works in Figure 5. The work-1, work-3, and work-5 perform the function of position and speed loop controller, and work-2, work-4, and work-6 accomplish the function of current vector controller which includes current PI controller, coordinate transformation (CCCT), and space vector pulse width modulation (SVPWM). The signals of three-phase current, rotor speed, and rotor position in PMSM-1 are, respectively, fed back to work-3 and work-1 to do the close-loop position control. The similar conditions of close-loop position control in PMSM-2 and PMSM-3 drive system are the same. The sampling frequency in current control loop is designed with 16 kHz but in position/speed control loop is 1 kHz. The motion trajectory described in Section 2.3 is planned within the block diagram of the Matlab embedded function in Figure 5. Matlab m-code is used to develop the program of the motion trajectory.Figure 5
Simulink/ModelSim cosimulation architecture for three-axis motion control system.In this simulation cases, the following motion trajectory will be carried out and tested: (1) single-axis position step response; (2) circular motion trajectory tracking (two-axis simultaneous motion); (3) window motion trajectory tracking (two-axis simultaneous motion); (4) star motion trajectory tracking (two-axis simultaneous motion); (5) helical circular motion trajectory tracking (three-axis simultaneous motion). Firstly, single-axis position step response is considered, and the step signal with 1.5 s and 5 mm amplitude is tested. The simulation results in position response and current response are presented in Figure6. In this simulation, the Kp and Ki gains in position controller are, respectively, chosen by (15000, 0) and (25000, 95) in 16bit-Q15 format. In Figure 6(a), the position responses with 0.03 seconds rising time and zero overshoot and zero which show a good response performance. In Figure 6(b), the current in i
d axis approaches zero which presents the success of the vector control in PMSM drive. Further, in the two-axis simultaneous motion trajectory, the circular motion trajectory control with center (
5
,
5
) mm and radius 10 mm is evaluated and the simulation results in motion trajectory tracking, tracking error, position response, and current response are shown in Figure 7. In this design, the Kp and Ki gains in position controller are, respectively, chosen by (
18000,0
), (
19000,95
) in 16bit-Q15 format. The tracking errors in Figure 7(b) show the maximum ±0.18 mm in x-axis table, maximum ±0.18 mm in y-axis table, and less than 0.1855 mm in overall circular motion tracking. It demonstrates a good tracking. Additionally, the current response of i
d-axis both in x- and y-axis motors all can be controlled to zero which presents the success of the vector controller. In the window tracking motion, the trajectory is designed as Figure 3(a) and its simulation results in motion trajectory tracking, tracking error, position response, and current response are shown in Figure 8. In this design, the Kp and Ki gains in position controller are, respectively, chosen by (
15000
,
0
), (
25000
,
95
) in 16bit-Q15 format. The tracking errors in Figure 8 show the maximum ±0.185 mm in x-axis table, maximum ±0.178 mm in y-axis table, and less than 0.19 mm in overall motion tracking. In the star tracking motion, the trajectory is designed as Figure 3(b) and its simulation results are shown in Figure 9. In this experiment, the Kp and Ki gains in position controller are, respectively, chosen by (15000, 0), (25000, 95) in 16bit-Q15 format. The tracking errors in Figure 9(b) show the maximum ±0.14 mm in x-axis table, maximum ±0.14 mm in y-axis table, and less than 0.17 mm in overall star motion tracking. The results show a good tracking response in both window and star motion trajectory. Finally, the three-axis simultaneous motion trajectory which is helical circular trajectory is evaluated, and their simulation tracking results are shown in Figure 10, respectively. In this design, the Kp and Ki gains in position controller are, respectively, chosen by (
18000,0
), (
19000,95
) in 16bit-Q15 format. In Figure 10(b), the tracking errors show that it can keep within ±0.185 mm in x- and y-axis table motion and ±0.19 mm in z-axis table motion which reveals a good tracking response. Therefore, Figure 16 shows a good tracking result in 3-axis motion tracking. Further, Figures 6~10 present that the three-axis motion control system tested through ModelSim/Simulink cosimulation is effectiveness and correctness. After confirming the success of the proposed three-axis position/speed/current controller IP, it will directly apply to FPGA to be further evaluated.Figure 6
Single-axis PMSM: (a) step position response; (b) current response.
(a)
(b)Figure 7
(a) Circular motion trajectory tracking; (b) tracking error; (c) position response; (d) current response.
(a)
(b)
(c)
(d)Figure 8
(a) Window motion trajectory tracking; (b) tracking error; (c) position response; (d) current response.
(a)
(b)
(c)
(d)Figure 9
(a) Star motion trajectory tracking; (b) tracking error; (c) position response; (d) current response.
(a)
(b)
(c)
(d)Figure 10
(a) Helical circular motion trajectory and (b) tracking results.
(a)
(b)


## 5. Experimental System and Results

### 5.1. Experimental System

The overall experimental system shown in Figure11 includes an FPGA control board, three sets of voltage source IPM-based (Intelligent Power Modules) inverter, and anXYZ table which is driven by three PMSMs and three ball-screws. The power, rating, voltage, current, and rating speed of PMSM are 200 W, 92 V, 1.6 A, and 3000 rpm, respectively. A 2500 ppr rotary encoder attached to PMSM is used to measure the motor’s electrical angle. Each ball-screw has 5 mm lead. Inside IPM, it has 6 sets of IGBT type power transistors with emitter of the rated voltage of 600 V, collector DC current rating of 20 A, and a short time (1 ms) rated current of 40 A. Photo coupler IC adopts TLP250 whose output has push-pull amplifier functions. The FPGA uses Cyclone IV-EP4CE115 which is the kernel of this system. There are 114,480 LEs (Logic Elements), 3,981,312 RAM bits, and 150 embedded multipliers in the Cyclone IV. Further, a Nios II processor can be embedded into FPGA to establish SoC environment.Figure 11
Experimental system.


### 5.2. Experimental Results

In experiment, the one-dimensional motion trajectory is firstly tested. The step signal with 1/8 Hz square wave and 5 mm amplitude is sent to thex-axis tables as the position command to cause tables motion. The experimental results in position response and current response using FC are shown in Figure 12. In Figure 12(a), the position response with 0.2 second rising time and 2% overshoot and near zero steady state zero which shows a good response performance. In Figure 12(b), the current in i
d axis approaches zero which reveals the success of the vector control in PMSM drive. To evaluate the tracking performance in multiaxis motion table, the indices are firstly defined as follows:
(25)
T
k
=
∑
i
=
1
n
S
p
i
*
k
-
S
p
i
x
2
,
m
t
e
=
∑
k
=
1
m
T
k
m
,
where T
(
k
), S
p
i
*
(
k
), S
p
i
(
k
), n, m, and m
t
e, respectively, represent instantaneous error, ith-axis position command, ith-axis position feedback, number of motion table, total acquisition data, and mean tracking error. Further, in two-dimensional motion trajectory, the circular motion trajectory control with center (50, 50) mm and radius 25 mm is evaluated and the experimental results in motion trajectory tracking, tracking error, position response, and current response using same FC are shown in Figure 13. The tracking errors in Figure 13(b) show the maximum ±0.46 mm in x-axis table, maximum ±0.35 mm in y-axis table, and 0.1759 mm mean tracking error in overall circular motion. It presents a good contour tracking result. Additional, the current response of i
d-axis both in x- and y-axis motors all can be controlled to zero which presents the success of the vector controller. In the window tracking motion, the trajectory is designed as Figure 3(a) and its experimental results in motion trajectory tracking, tracking error, position response, and current response are shown in Figure 14. The tracking errors in Figure 14 show the maximum ±0.2 mm in x-axis table, maximum ±0.2 mm in y-axis table, and 0.054 mm mean tracking error in overall motion. In the star tracking motion, the trajectory is designed as Figure 3(b) and its experimental results are shown in Figure 15. The tracking errors in Figure 15 show the maximum ±0.4 mm in x-axis table, maximum ±0.55 mm in y-axis table, and 0.0698 mm mean tracking error in overall star motion. However, the larger tracking error in both window and star motion trajectory occurred at the position of command suddenly changed; otherwise, the tracking error is very small. The results show a good contour tracking response in both window and star motion trajectory. Finally, the three-dimensional motion trajectory which is helical circular trajectory and “STUST” character trajectory are evaluated, and their experimental tracking results are shown in Figures 16 and 17, respectively. In Figure 16(b), the tracking errors show that it can keep within ±0.2 mm in x- and y-axis table motion, ±0.01 mm in z-axis table motion, and 0.1162 mm mean tracking error in overall helical circular motion which reveals a good tracking response. In performing the motion of “STUST” character, the z-axis table just runs the up and down motion, the “STUST” character is drawn by the simultaneous motion of x- and y-axis table. The tracking error in Figure 17 shows the maximum ±0.3 mm in x-axis, y-axis, and z-axis table and less than 0.3 mm in overall motion tracking. Therefore, Figures 16~17 show a good tracking result in 3D motion contour tracking. Therefore, Figures 12~17 present that the proposed FPGA-based multiaxis motion control IC is effectiveness and correctness.Figure 12
x-axis table: (a) position step response; (b) current response.
(a)
(b)Figure 13
(a) Circular motion trajectory tracking; (b) tracking error; (c) position response; (d) current response.
(a)
(b)
(c)
(d)Figure 14
(a) Window motion trajectory tracking; (b) tracking error; (c) position response; (d) current response.
(a)
(b)
(c)
(d)Figure 15
(a) Star motion trajectory tracking; (b) tracking error; (c) position response; (d) current response.
(a)
(b)
(c)
(d)Figure 16
(a) Helical circular motion trajectory and (b) tracking results.
(a)
(b)Figure 17
Motion trajectory tracking and tracking error of STUST character.
(a)
(b)


## 5.1. Experimental System

The overall experimental system shown in Figure11 includes an FPGA control board, three sets of voltage source IPM-based (Intelligent Power Modules) inverter, and anXYZ table which is driven by three PMSMs and three ball-screws. The power, rating, voltage, current, and rating speed of PMSM are 200 W, 92 V, 1.6 A, and 3000 rpm, respectively. A 2500 ppr rotary encoder attached to PMSM is used to measure the motor’s electrical angle. Each ball-screw has 5 mm lead. Inside IPM, it has 6 sets of IGBT type power transistors with emitter of the rated voltage of 600 V, collector DC current rating of 20 A, and a short time (1 ms) rated current of 40 A. Photo coupler IC adopts TLP250 whose output has push-pull amplifier functions. The FPGA uses Cyclone IV-EP4CE115 which is the kernel of this system. There are 114,480 LEs (Logic Elements), 3,981,312 RAM bits, and 150 embedded multipliers in the Cyclone IV. Further, a Nios II processor can be embedded into FPGA to establish SoC environment.Figure 11
Experimental system.


## 5.2. Experimental Results

In experiment, the one-dimensional motion trajectory is firstly tested. The step signal with 1/8 Hz square wave and 5 mm amplitude is sent to thex-axis tables as the position command to cause tables motion. The experimental results in position response and current response using FC are shown in Figure 12. In Figure 12(a), the position response with 0.2 second rising time and 2% overshoot and near zero steady state zero which shows a good response performance. In Figure 12(b), the current in i
d axis approaches zero which reveals the success of the vector control in PMSM drive. To evaluate the tracking performance in multiaxis motion table, the indices are firstly defined as follows:
(25)
T
k
=
∑
i
=
1
n
S
p
i
*
k
-
S
p
i
x
2
,
m
t
e
=
∑
k
=
1
m
T
k
m
,
where T
(
k
), S
p
i
*
(
k
), S
p
i
(
k
), n, m, and m
t
e, respectively, represent instantaneous error, ith-axis position command, ith-axis position feedback, number of motion table, total acquisition data, and mean tracking error. Further, in two-dimensional motion trajectory, the circular motion trajectory control with center (50, 50) mm and radius 25 mm is evaluated and the experimental results in motion trajectory tracking, tracking error, position response, and current response using same FC are shown in Figure 13. The tracking errors in Figure 13(b) show the maximum ±0.46 mm in x-axis table, maximum ±0.35 mm in y-axis table, and 0.1759 mm mean tracking error in overall circular motion. It presents a good contour tracking result. Additional, the current response of i
d-axis both in x- and y-axis motors all can be controlled to zero which presents the success of the vector controller. In the window tracking motion, the trajectory is designed as Figure 3(a) and its experimental results in motion trajectory tracking, tracking error, position response, and current response are shown in Figure 14. The tracking errors in Figure 14 show the maximum ±0.2 mm in x-axis table, maximum ±0.2 mm in y-axis table, and 0.054 mm mean tracking error in overall motion. In the star tracking motion, the trajectory is designed as Figure 3(b) and its experimental results are shown in Figure 15. The tracking errors in Figure 15 show the maximum ±0.4 mm in x-axis table, maximum ±0.55 mm in y-axis table, and 0.0698 mm mean tracking error in overall star motion. However, the larger tracking error in both window and star motion trajectory occurred at the position of command suddenly changed; otherwise, the tracking error is very small. The results show a good contour tracking response in both window and star motion trajectory. Finally, the three-dimensional motion trajectory which is helical circular trajectory and “STUST” character trajectory are evaluated, and their experimental tracking results are shown in Figures 16 and 17, respectively. In Figure 16(b), the tracking errors show that it can keep within ±0.2 mm in x- and y-axis table motion, ±0.01 mm in z-axis table motion, and 0.1162 mm mean tracking error in overall helical circular motion which reveals a good tracking response. In performing the motion of “STUST” character, the z-axis table just runs the up and down motion, the “STUST” character is drawn by the simultaneous motion of x- and y-axis table. The tracking error in Figure 17 shows the maximum ±0.3 mm in x-axis, y-axis, and z-axis table and less than 0.3 mm in overall motion tracking. Therefore, Figures 16~17 show a good tracking result in 3D motion contour tracking. Therefore, Figures 12~17 present that the proposed FPGA-based multiaxis motion control IC is effectiveness and correctness.Figure 12
x-axis table: (a) position step response; (b) current response.
(a)
(b)Figure 13
(a) Circular motion trajectory tracking; (b) tracking error; (c) position response; (d) current response.
(a)
(b)
(c)
(d)Figure 14
(a) Window motion trajectory tracking; (b) tracking error; (c) position response; (d) current response.
(a)
(b)
(c)
(d)Figure 15
(a) Star motion trajectory tracking; (b) tracking error; (c) position response; (d) current response.
(a)
(b)
(c)
(d)Figure 16
(a) Helical circular motion trajectory and (b) tracking results.
(a)
(b)Figure 17
Motion trajectory tracking and tracking error of STUST character.
(a)
(b)


## 6. Conclusions

The FPGA-based multiaxis motion controller has been successfully demonstrated from ModelSim/Simulink cosimulation to FPGA realization experiment in this paper. For a multiaxis motion controller system, DSP and FPGA all can provide a good solution in implementation. However, due to one DSP chip only can support one CPU inside and, 12 channels PWM output and 2 QEP output in its peripheral circuit, it is suitable for a two-axis motion controller system. If we want to realize a multiaxis motion controller system, it needs several DSP chips. In contrast with DSP, FPGA has the properties of fast computing power, parallel processing, and hardware-software codesign which cause the multiaxis motion controller system to be implemented by one FPGA chip. Finally, the work herein is summarized as follows.(a)
The functionalities required to build a multiaxis servo controller and motion trajectory planning can be integrated in one FPGA chip.
(b)
The computation of key algorithms, such as SVPWM, CCCT, and FC in PMSM drive can be completed within 2μs by FPGA implementation.
(c)
The VHDL code of the proposed multiaxis servo controller IP has been effectively verified from ModelSim/Simulink cosimulation results.
(d)
Some experimental results by position step response, circular, window, star, and helical circular motion trajectory tracking, the specific character (“STUST”) motion trajectory tracking, and so forth have revealed that the proposed FPGA-based multiaxis motion controller is effectiveness and correctness.



---

*Source: 202474-2015-08-26.xml*