State-Feedback Control Algorithms For A CNC Machine: Dora Sabau, Petru Dobra
State-Feedback Control Algorithms For A CNC Machine: Dora Sabau, Petru Dobra
   Abstract—The controller of a small size Computer Numerical          In this paper, a MIMO model with two inputs and two
Controlled (CNC) system is designed and tested. The system is       outputs is taken into consideration. In chapter 2, based on
considered to have a Multi Input Multi Output(MIMO) model           the acquired data consisting on the input and the output
and two control design techniques are presented for it: Pole-
placement and Linear Quadratic Regulator(LQR). The LQR              signals from the machine, a mathematical model is obtained.
problem is proposed to be solved by choosing the weights matrices   The parameter identification results, obtained using System
using the total energy of the system. The simulation results are    Identification ToolBox from Matlab, are presented in chapter
evaluated and the controller that meets the desired behavior is     3. Chapter 4 focuses on designing and simulating two state-
implemented on the real machine.                                    feedback control techniques: pole-placement method and Lin-
   Index Terms—LQR, Pole-placement, energy, MIMO, CNC,
control                                                             ear Quadratic Regulator(LQR) and chapter 5 and 6 show the
                                                                    experimental results and the conclusions.
                      I. I NTRODUCTION
   Numerical control machines started to be used since 1950s.
Because of the rapid development of the industry, these ma-                II. MATHEMATICAL MODEL FOR CNC
chines were improved annually. Currently, Computer Numeri-
cal Control(CNC) machines are very popular in the industrial
field in domains such as: aeronautical industry, energy and            The workstation in the laboratory, which represents a small-
power technology and manufacturing industry. These machines         size CNC machine is shown in Fig.1.
provide a high level of automation and consistent motion
control, accuracy, high precision and power, fast machining in
accordance with modern tools [1]. CNC systems are, regularly,
compound of: the machine itself and the command system.
The control system incorporates new techniques which reduce
the allocated time to a project and allow a complex control
of the process. The requirements these control systems have
nowadays are: precise control of the position, with safe veloc-
ity control and good acceleration and deceleration properties
[2]. In order to meet these requirements, the controller that is
used has to give good precision and to have high resolution
[3], [4].
   As shown in literature [5], [6], conventional Proportional-
Integrative-Derivative(PID) controller, State-Feedback con-
trol, Feed-Forward control, Linear Quadratic Regulator(LQR),                            Fig. 1: CNC machine
Fuzzy Logic Control or even more advanced control tech-
niques such as optimized PD control using genetic algorithms
or adaptive control, are used to control CNC machines.                 The positioning system compounds of three axes of trans-
   In order to obtain the control law for positioning systems       lation: X, Y and Z. Z-axis is driven by a stepper motor
with translation axes, it is important to have a mathematical       and has the role to place the tool at the right distance on
model for the process [7]. For this, two particular directions      the vertical direction. X and Y-axis are driven by BrushLess
are taken into consideration. The first one is to consider the      Direct Current(BLDC) motors which receive commands from
system as a decoupled one, which means each axis is handled         MC206X controller. The controller is connected to the PC via
as an independent process. The second approach takes into           an USB link, as shown in Fig.2 and can be programmed using
consideration the coupled-axis, so the process is treated in        TrioBasic programming Language, which gives the possibility
terms of Multi-Input-Multi-Output(MIMO) model [8].                  to develop control commands fast and easy.
  The purpose of this paper is to consider a mathematical             The behavior analysis and the control design algorithm will
model for 2D positioning system(taking into consideration X         be made using state space model:
and Y-axis) in order to design a control law for it.                                    (
                                                                                          ẋ = Ax + Bu
                                                                                                                              (4)
                                                                                          y = Cx + Du
                                                                       The notations used are as follows:
                                                                       • x-state vector
                                                                       • A-the state matrix
                                                                       • B-the input matrix
                                                                       • u-the vector of the input signals
                                                                       • C-the output matrix
                                                                       • y-the vector of the output signals
                                                                       • D-the direct transfer
                                                                       The state space variables are considered the measured
                                                                    variables: the rotor speed and position for each axis. The input
                                                                    signals vector is represented by the command signal ’u’ for
Fig. 3: Block diagram representation for the model used for         each axis. The outputs are considered only the variables that
                   parameters estimation                            need to be controlled: the position of each axis.
                                                                                                                   
   The system can be represented, as shown in Fig.3, by a                                      x1 (t)          ωx (t)
Multi-Input-Multi-Output process with two inputs and two                                     x2 (t)  θx (t) 
                                                                                     x(t) = x3 (t) = ωy (t)
                                                                                                                              (5)
outputs, as it follows:
   • Inputs: ux , uy -represent the drive command, where index                                 x4 (t)          θy (t)
     x or y suggest the corresponding axis.
                                                                                                             
                                                                                                       ux (t)
   • Outputs: θx , θy -represent the position of rotors of the                              u(t) =                               (6)
                                                                                                       uy (t)
     motors that drive each axis.                                                                            
   Also, we have the designations that suggest the type of the                                         θ (t)
                                                                                            y(t) = x                             (7)
signal or the relationship between signals:                                                            θy (t)
   • ωx , ωy : angular velocity;                                      Transforming the transfer function model represented in
   • Hωx ux , Hωy uy , Hθx ωx ,Hθy ωy the transfer functions from   Fig.3 into a state space model with the previous notations and
     u to ω and from ω to θ, for each axis                          considerations, we obtain:
   • Hωx uy , Hωy ux the mutual effect between the two axes
                                                                                               1
                                                                                           − TM        0   0      0
                                                                                                                   
   The block diagram represented in Fig.3 illustrates the                                        x
                                                                                                                                616
                                                                                                             
                              0
                             1 0 0                                                     −40.85    0     0      0
                       C=                                   (10)
                              0
                             0 0 1                                                    1          0    0      0
                                                                                   A=                          ;
                                                                                    0          0 −87.81 0
                              0 0                                                        0        0    1      0
                         D=                                 (11)
                              0 0                                                                              
                                                                                                   1.05 0.267
              III. PARAMETER I DENTIFICATION                                                     0         0 
                                                                                      B = 103 ∗ 
                                                                                                0.0245 2.188 ;
                                                                                                                               (17)
   Using TrioBasic commands, we have the measured signal
obtained by following a path at the maximum speed of the                                             0      0
                                                                                                               
rotor of each axis. The acquired data signals are represented                                        0 1 0 0
                                                                                              C=                  ;
in Fig.4, with the mention that the signals are scaled for a                                         0 0 0 1
good representation of all the signals in the same figure.
                                                                                                               
                                                                                                           0 0
                                                                                                     D=           ;
                                                                                                           0 0
                                                                                      IV. C ONTROLLER DESIGN
                                                                    A. Pole Placement
                                                                       Closed-loop pole assignment is a common technique used to
                                                                    design controllers for MIMO processes. Specifying the closed
                                                                    loop eigenvalues, a state-feedback matrix K is computed, so
                                                                    that the closed loop system satisfies the condition [11]:
(A − BK)x = λi Ix (18)
                                                                                                                                 617
B. LQR Problem                                                                   +2xT P T (Ax + B(−R−1 B T P x)) = 0              (31)
   Another way to design a controller for a MIMO process is            which gives the Ricatti equation mentioned above.
using LQR problem. This problem is based on optimal control,           Since we have the Ricatti equation, we have solved the
which is concerned with operating a system at minimum cost.          optimal control problem. The feedback control law is:
In this case, the system dynamics is described using linear
                                                                              1
differential equations (state space model) and the cost function       u = − R−1 B T (2P (t)x) = −R−1 B T P (t)x = −Kx (32)
is represented by a quadratic function as the following one:                  2
                Z ∞                                                  where K is the gain matrix.
                                                                        Like in the pole-placement case, if we want to implement a
            J=        (xT (t)Qx(t) + uT (t)Ru(t))dt         (22)
                 0                                                   tracking controller, it is necessary to compute a matrix N the
where Q defines the weights on the state and is a semi-defined       reference signals is multiplied by, so that the stationary error
symmetric matrix and R defines the weights on the control            is null.
input.
  The aim is to minimize the cost function J and to find the                           N = −(C(A − BK)−1 B)−1                     (33)
optimal control law u* that should be used [12].                       In many cases, the weight matrix Q or R is chosen through
  Based on the scientific articles in the literature, it turns out   successive attempts, so that the results fulfill the requirements.
that regardless of the matrix Q and matrix R, the minimum              This paper propose a method to chose the weights of matrix
cost function is obtained by solving a Ricatti equation [13]:        Q using the energy of the system [8], [14].
                                                                       Having:
        −Ṗ (t) = Q − P T BR−1 B T P + AT P + P A            (23)      • the general differential equation of a motor, correspond-
                                                                                                                                   618
        Fig. 6: Simulink Model for feedback control
V. E XPERIMENTAL RESULTS
                                                                                                                               619
                                                                          reason for the error occurrence is the ball screw translational
                                                                          axis construction and the friction that appears.
                                                                             In this paper, two methods for designing a controller for an
                                                                          small size CNC system are presented. Both of the methods
                                                                          are good for a MIMO system and both of them are easy to
                                                                          implement. For the LQR problem, an energy based algorithm
                                                                          of choosing the weight matrices was proposed. At the first
                                                                          simulation, the controller seemed to work good but slower
                                                                          than the one obtained with pole placement algorithm. Starting
                                                                          from the parameters obtained using energy based matrix, the
                                                                          weights were modified in order to obtain almost the same
                                                                          result as in the first method. So, the energy based LQR seems
                                                                          to be a good technique in terms of control and stability, but if
                                                                          more precise performances is needed, several tests are needed.
                                                                          So, based on this, we can emphasis that choosing Q and R is
    Fig. 10: Results with and without using the designed                  part art, part science.
                  controller-squares drawn                                   As a future development, other tests and control algorithms
                                                                          have to be tried in order to obtain a better fitting. Also,
                                                                          friction models and compensation should be done for the same
                                                                          purpose.
                                                                                                        R EFERENCES
                                                                           [1] Kücük Hüseyin Koc, Emine Seda Erdinler, Ender Hazir, and Emel
                                                                               Öztürk. Effect of cnc application parameters on wooden surface quality.
                                                                               Measurement, 107:12–18, 2017.
                                                                           [2] Armin Afkhamifar, Dario Antonelli, and Paolo Chiabert. Variational
                                                                               analysis for cnc milling process. Procedia CIRP, 43:118–123, 2016.
                                                                           [3] Xianfeng Chen and Weiming Zhang. Research on the interpolation
                                                                               technology of cnc system. Procedia engineering, 174:1252–1256, 2017.
                                                                           [4] Zhiqian Sang and Xun Xu. The framework of a cloud-based cnc system.
                                                                               Procedia CIRP, 63:82–88, 2017.
                                                                           [5] SK Jha et al. Comparative study of different classical and modern control
                                                                               techniques for the position control of sophisticated mechatronic system.
                                                                               Procedia Computer Science, 93:1038–1045, 2016.
                                                                           [6] Zhen-yuan Jia, Jian-wei Ma, De-ning Song, Fu-ji Wang, and Wei
                                                                               Liu. A review of contouring-error reduction method in multi-axis cnc
                                                                               machining. International Journal of Machine Tools and Manufacture,
                                                                               2017.
    Fig. 11: Results with and without using the designed                   [7] Kaan Erkorkmaz and Wilson Wong. Rapid identification technique
                   controller-circles drawn                                    for virtual cnc drives. International Journal of Machine Tools and
                                                                               Manufacture, 47(9):1381–1392, 2007.
                                                                           [8] Yoram Koren. Cross-coupled biaxial computer control for manufacturing
   In the figures above, it can be seen that in each case a small              systems. Journal of Dynamic Systems, Measurement, and Control,
error exists. For each case, a fit performance parameter was                   102(4):265–272, 1980.
                                                                           [9] Dumitru Popescu, Amira Gharbi, Dan Stefanoiu, and Pierre Borne.
calculated and the result were represented in Table.1.                         Linear identification of closed-loop systems. Process Control Design
                                                                               for Industrial Applications, pages 21–92, 2017.
                   Using designed controller   No designed   controller   [10] Lennart Ljung. System identification. In Signal analysis and prediction,
                   X Axis       Y Axis         X Axis        Y Axis            pages 163–173. Springer, 1998.
 Circle   R=1cm    93.2%          96%           92%          92.7%        [11] Honghai Wang, Jianchang Liu, Xia Yu, Shubin Tan, and Yu Zhang.
          R=2cm     95%           98%           93%           97%              New results on pid controller design of discrete-time systems via pole
 Square   L=3cm     80%           80%           79%           76%              placement. IFAC-PapersOnLine, 50(1):6703–6708, 2017.
          L=5cm    84.5%          86%           82%          84.1%        [12] Stefano Longo, Eric C Kerrigan, and George A Constantinides.
                                                                               Constrained lqr for low-precision data representation. Automatica,
                                                                               50(1):162–168, 2014.
      TABLE I: Fit parameter calculated for each case                     [13] Loı̈c Bourdin and Emmanuel Trélat. Linear–quadratic optimal sampled-
                                                                               data control problems: Convergence result and riccati theory. Automat-
                                                                               ica, 79:273–281, 2017.
                      VI. C ONCLUSION                                     [14] João Marcos Kanieski, Emerson Giovani Carati, and Rafael Cardoso.
                                                                               An energy based lqr tuning approach applied for uninterruptible power
  As a conclusion, based on the latest results presented in                    supplies. In Circuits and Systems (LASCAS), 2010 First IEEE Latin
the end of the previous chapter, we can say that the designed                  American Symposium on, pages 41–44. IEEE, 2010.
controller gives a better precision in terms of following a path.         [15] Trio motion technology motion coordinator technical reference manual.
                                                                               2008.
However, we also observed that the error is bigger in case                [16] Mariana Ratiu and Alexandru Rus. Modeling of the trajectory-generating
of square path and that could be because at the corners of                     equipments. In Engineering of Modern Electric Systems (EMES), 2017
the square the acceleration and deceleration are big. Also, a                  14th International Conference on, pages 216–219. IEEE, 2017.
620