Robots are complex electromechanical systems where several electric drives are used to control the movement of articulated structures. The design of axis control systems for robots can be greatly facilitated by the Electric Drives library, which can model complete axes including motor drives, speed reducers, mechanical model of the arm, and controllers in the same diagram.

This case study presents the modeling and simulation of a six-degrees-of-freedom
robot manipulator using Electric Drives library blocks in combination
with Simulink^{®} blocks. The two main joints models are built using
brushless DC motor drives that are connected to the rest of the manipulator
through speed reducers (a model included in the Electric Drives library).
The control system, which consists essentially of two position control
loops, is built with Simulink blocks. The inner speed and torque
control loops are already included in the drive model. The rest of
the manipulator and its load are represented by two Simulink nonlinear
models, one for each motor drive.

Detailed modeling is presented to demonstrate the versatility of the Electric Drives library. The operation of the joints using typical trajectories is simulated and results are presented.

The robot considered in this example is a general-purpose six-degrees-of-freedom robot manipulator
(GMF S-360) of parallelogram linkage type. Six-Degrees-of-Freedom Robot Manipulator shows the structure
of the robot and its workspace. The robot has six axes. The three
axes (Θ_{1}, Θ_{2},
Θ_{3}) shown in the figure are for arm positioning
and the others (α, β, γ) are for orientation of
the end effector. In the horizontal plane, the robot can cover a 300
degree arc (Θ_{1} = -150° to Θ_{1} =
150°).

The robot's axes are driven by brushless DC motors that are modeled by permanent-magnet synchronous motors fed by PWM inverters (AC6 drive model). Speed reducers of belt type and gearbox are used to transmit torque from the motors to the joints.

**Six-Degrees-of-Freedom Robot Manipulator**

We will consider in particular the two first joints (axis 1 and axis 2), which drive the entire robot and its load. The first axis uses a 2 kW brushless DC motor and a 1:130 speed reducer. The second axis uses a 1 kW brushless DC motor and a 1:100 speed reducer. Brushless DC Motor Drive for Position Control of Robot Joint shows a simplified diagram of the position control system for one robot link.

The control system consists of three control loops connected
in a cascade configuration: an outer position loop includes an inner
speed control loop and an innermost current control loop. The PM synchronous
motor is fed by a three-phase PWM inverter operating in current-controlled
mode. Field-orientation scheme is used to decouple the variables so
that flux and torque can be separately controlled by stator direct-axis
current i_{ds} and quadrature-axis current i_{qs,} respectively.
The quadrature-axis current reference i_{qs}*
(which represents the torque command) is provided by the speed control
loop. The direct-axis current reference i_{ds}*
is kept equal to 0.

A speed/position sensor is used to provide the information required by the speed and position control loops. The rotor position is also required for coordinates conversion (dq to abc).

Each motor drives the rest of the robot structure, including the other links and the load, through a speed reducer.

**Brushless DC Motor Drive for Position Control
of Robot Joint**

The entire drive system for the robot's two first joints, including motor drives, speed reducers, equivalent loads, and controllers is available in the Robot Axis Control Using Brushless DC Motor Drives example.

The brushless DC motor drives are represented by two AC6 (PM Synchronous Motor Drive) blocks from the Electric Drives library. This block models a complete brushless DC motor drive including a permanent-magnet synchronous motor (PMSM), an IGBT inverter, speed controller, and current controller. The AC6 inputs are the speed commands and the outputs are the motor speed, which are fed to the inputs of the speed reducers.

The speed reducers are modeled by two Speed Reducer blocks from the Electric Drives library. The inputs for these blocks are the motors' speeds, and the outputs are the torques from the low-speed sides, which are applied to the robot structure model. The speed reducers are characterized by their ratio and inertia and the stiffness and damping of input and output shafts.

The speed reducers' output shafts are connected to the T_{1} and
T_{2} inputs of a Robot block that represents
the rest of the robot structure. This block calculates the effective
torque reflected to each joint. For each joint (numbered i), we can
consider globally the other links effects as a single load reflecting
to the joint a torque that is composed of three terms

$${T}_{L}={J}_{i}\frac{{d}^{2}{\theta}_{i}}{d{t}^{2}}+{C}_{i}\frac{d{\theta}_{i}}{dt}+{G}_{i}\cdot {\theta}_{i}$$ | (1) |

where Θ_{i} is joint angular position,
J_{i} is inertia, C_{i} is
centrifugal and Coriolis coefficient, and G_{i} is
gravitational coefficient.

The Robot model is built with Simulink blocks.

In this diagram, the parameters J_{1}, C_{1},
G_{1}, J_{2}, C_{2},
and G_{2 }are functions of joint positions. Implement
them by using polynomials or lookup tables.

The joint positions Θ_{1} and Θ_{2} are
controlled by outer control loops that force Θ_{1} and
Θ_{2} to follow the references imposed by
the trajectories of the manipulator. Various algorithms can be used
for these control loops. The most popular ones are proportional-derivative,
computed torque, and adaptive. In this example, proportional-derivative
controllers are implemented for both axes.

Cubic polynomial test trajectories for robot motion are generated by the Trajectory Generator block.

The test trajectories consist of a movement from position 6
to position 3 in the workspace (Θ_{2} varying
from -π/4 to π/4) while rotating around axis 1 from one
position to another (Θ_{1} varying from
-π/6 to π/6). The parameters to be specified for this
block are initial position [Θ_{1ini}, Θ_{2ini}],
final position [Θ_{1fin}, Θ_{2fin}],
and move time. The following figure shows the changes of robot structure
during the programmed movement.

The variation of inertia due to structure changes is reflected
to axis 1 as an inertia varying as a function of Θ_{2} (from
215 kgm^{2} to 340 kgm^{2} passing
by a minimum of 170 kgm^{2}). The inertia
reflected to axis 2 is a constant (J_{2} = 50
kgm^{2}). These inertia variations are represented
by nonlinear functions implemented in the Robot block.

The test trajectories described above constitute one of the most demanding trajectories for the motor drive of the first and second joints. They are used here to evaluate the tracking performance of the two electric drive systems.

In the example, the manipulator is programmed to rotate from
-30° to 30° during 1.5 seconds, and at the same time the
arm is moved from the back position (Θ_{2} =
-45°) to the most advanced position (Θ_{2} =
45°). The simulation is run using a time step of 1 µs.

The responses of the manipulator and the motor drives 1 and 2 are displayed on three scopes connected to the output variables of the AC6 and Robot blocks.

During the movement, the joint positions Θ_{1} and
Θ_{2} follow the imposed cubic trajectories
with low tracking error.

The brushless DC motor drives behave very well during the test trajectories. The DC bus voltages are maintained at relatively constant levels during the deceleration of the motors. The developed torques are proportional to the motor currents' amplitudes. This demonstrates the good operation of the field-oriented control algorithms.

[1] Miller, T. J. E., *Brushless
Permanent-Magnet and Reluctance Motor Drives*, Clarendon
Press, Oxford, 1989.

[2] Spong, M. W., and Vidyasagar, M., *Robot
Dynamics and Control*, John Wiley & Sons, New York,
1989.