• No results found

CHAPTER 5: OPPORTUNITIES CREATED BY PERVASIVE MICROPROCESSING

5.6 Servo control

In CNC systems, the numerical control (NC) loop uses the feedback from a digital encoder to control the position and velocities of the axis along the interpolated trajectories. Figure 50 (c)

Figure 52. The numerical control loop (a) and its mathematical implementation in Simulink (b)

116

shows the finite state machine of the interpolator program. Here, set-point external interrupt increments a counter whenever the interpolator requests a pulse while a timer interrupt controls the execution of the servo-control loops. The up-down counter keeps track of the position error as the difference between the reference pulses and the pulses from the digital encoder.In a single iteration of the servo-loop ISR, the position error is converted to a voltage (analog or PWM) by a DAC to drive the motor of the axis. The motor rotates in the direction that reduces the error. This scheme results in a proportional control of the position of the axis or, equivalently, a proportional-integral (PI) control of its velocity.

In CNC systems, the numerical control (NC) loop uses the feedback from a digital encoder to control the position and velocities of the axis along the interpolated trajectories. The control loop, presented in Fig. 52 (a), accepts the reference pulses from the interpolator and uses an up-down counter to compute the position error as the difference between the reference pulses and the pulses from the digital encoder. The position error is converted to a voltage (analog or PWM) by a DAC to drive the motor of the axis. The motor rotates in the direction that reduces the error. This scheme results in a proportional control of the position of the axis or, equivalently, a proportional-integral (PI) control of its velocity.

Figure 52 (b) shows an implementation of the mathematical model of the control-loop in Simulink. In this model, the servo loop is treated as a mixed discrete-analogue system controlled

Figure 53. Simulated velocity and position error responses of NC loop to a step input.

117

by two external clocks. One clock controls the execution of a discrete model of the interpolator while the other controls the execution of the servo-loop. The drive unit, however, is modeled with a continuous-time, first-order transfer function with drive constant gain K1 in rev/(sec.v) and time constant τ. Furthermore, any external torque is converted to a disturbance in the input voltage to the drives by the gain K2. Additionally, the motion of the motor is captured by the number of pulses per revolution of the encoder Ke and the conversion from position error to voltage in the DAC is given by the gain Kc.

Because the up-down counter behaves as a discrete time integrator, the NC loop is a second-order system with open loop gain:

1 c e

K K K K (5.1)

damping factor:

1 2 K

(5.2)

and natural frequency

K (5.3)

Figure 53. Shows the simulated velocity and position-error of the closed-loop system to a step input of constant-frequency pulses. The simulation is repeated for different open-loop gains with τ = 10 ms, reference pulses of 1 KHz and a servo-loop interrupt of 10 KHz. From the position error

Figure 54. Servo-controller breakout board design.

Printed Circuit Board (PCB) design (a) and circuit board assembly (b)

118

graph, it can be observed that large gains reduce the steady state following error, reduce the settling times, but increase the overshoot in the system.

The Simulink model in this section is a tool for the rapid design of the control-loop parameters, analysis and real-trajectory simulation of the machine tool. For example, a full control program that takes the part-data file and generates the reference pulses can be embedded into a Simulink model including different NC loops. The loops account for the dynamics and external torques on each axis in the machine. An alternative would be to have the interpolator micro processing unit provide the reference pulses to the Simulink model. This strategy can lead to the creation of machine-oriented CAM software where designers assess the performance of different machine tools in producing a specific part before manufacturing.

The servo-control algorithm was programmed on the Arduino Nano with the microprocessor ATmega328 and the Texas Instruments Launchpad C2000. The servo-loop ISR exhibited a maximum execution time of 76 μs in the Arduino Nano and 2 μs, in the TI Launchpad C2000, this allowed servo-frequencies of 10 kHz and 30 kHz respectively. Conventionally, the maximum interpolated frequency should be below the execution frequency of servo loop interrupt. The output voltage to the motor drive is sent in an 8-bit Pulse Width Modulation (PWM) signal in the Arduino Nano and a 16-bit PWM signal in the Launchpad C2000. The position and resolution of each platform is proportional to the resolution of the PWM signal and is inversely proportional to the

Figure 55. Connection between the interpolator and the servo controllers (SC).

Control setup for a two-axis CNC machine tool.

119

execution frequency of the servo-loop interrupt. For example, a motor with minimum velocity of 10 revolutions per second and a servo-loop interrupt frequency of 10 KHz has a position resolution of 0.036 degrees.

A plug-on servo-controller breakout board (See Figs. 54 (a) and (b)) was conveniently designed for the integration of the Arduino Nano with the PWM driver MC33936 from NXP USA Inc. and the LS7366R 32-bit quadrature counter from US Digital. The quadrature counter (interfaced via SPI communications) offloads the computations of the microcontroller. This solution is tailored to compact applications with basic level of performance and high flexibility.

Related documents