Review on Embedded Methods in Parameter Estimation and Auto-tuning of Permanent Magnet Synchronous Servo Machine Driven Industrial Systems

— In this paper, embedded methods of parameter estimation and auto-tuning processes are investigated for industrial servo systems driven by permanent magnet synchronous machines (PMSM). The main purpose is to detect and compensate deviations in parameters and tune of industrial servo systems with a certain working routine. mechanical constraints and main parameters of both electrical and mechanical are defined and explained. In addition to these basics, embeddable control structures and system models in the literature are classified and generalized. Disturbance detection methods and filtering approaches are explained and exemplified. All these executions run on a digital processor and critical application examples in the literature and the embedded hardware they run on are compared.

offered solutions about parameter estimation and auto-tune process in the current literature for servo drive systems are defined and systematized considering embedded concepts.
A well-tuned servo system is robust and has the fastest possible response with minimum overshoot and steady state error. But, even a well-tuned servo system can lose its accuracy with disturbances from mechanical dynamics of the drive train or environmental effects. Parameter estimation and tuning of the whole system can be done by controller-driver via motor with using reflections from load to motor shaft. There are two strategies for operating the parameter estimation and tuning process as known off-line and on-line. Off-line tuning the servo system means that defining process is done under the no-load or dummy (dysfunctional) motions [1]. This type of tuning can be done by using some previous information (commission) or without any information (selfcommission). On-line tuning means that defining process is done during the loaded motions. This type tuning is more complicated than off-line tuning because it needs dynamic measurements and decision mechanism in parallel with the work done by servo system [2]- [4]. The generalized flow charts of both strategies are shown in

OFF-LINE TUNING Start
Most of the disturbance effects can be detected by observation (manually or algorithmic) or using a model that contains observable state variables [5]. The conventional way of off-line process to obtain servo system's characteristic is to use pre-defined routines such as voltage/current injections, applying specific motion profiles, torque measurements, movements pushing the boundaries, specific position tracking or regular movements when system is no-loaded, stand-still or dysfunctional moving condition [6]. After initialization, system calculates the critical parameters, which are electrical, mechanical, model based or state variables, with measured data from applied routines. The determined parameters of the servo system are integrated into the controller/driver side and system is updated with respect to the new dynamics. When we look at the on-line process, it keeps going the functional motion (with load) with detecting and calculating the disturbance properties, which are mainly frequency, amplitude and bandwidth, as a parallel process. In this process, since the under-load system is not suitable for signal injection or specific profiles (in order not to impair the functional motion), existing and measured under loaded signals are used for calculations. Because of this challenge, Fourier transform based signal analysis, model based estimator, observer, predictor, iteration algorithms, adaptive mechanism, filtering techniques are used to determine the disturbance properties [7], [8]. Also, there are filter based scanning approaches for detecting the disturbance's characteristics [9]. After detecting disturbance properties, a filtering operation, which is mostly notch filters (in some applications low-pass and high pass topologies are used), is used for suppressing the disturbance during functional motion (under load). Some of the designers try to combine detection of the properties of the disturbance and suppression operation in cascaded step. In this case, common approach is observer/estimator/predictor strategy. In this approach, designed structure, which is represented by state-space equations (position, speed, voltage/current) and time dependent data collected from system, traces the system dynamics and evaluate the near future data from previous data using trajectory. Kalman filter based observers/estimators/predictors are basically used for this approach [10], [11]. Another useful approach, which is known as Model Referenced Adaptive System (MRAS), is creating and controlling/driving an adjustable model in parallel with the actual system and comparing and iterative evaluating the data from model and actual system for parameter calculation and tuning the system. MRAS based systems can be derived with changing measured signal type (speed, torque, current etc.). Generally, it is preferred in sensorless systems [12]. Some of which contain Artificial Intelligent (AI) based structures, such as Fuzzy logic, Neural Network (NN) strategies and Swarm Intelligence (SI) based self-organized systems but they need a higher computing capability and have implementation challenges as an embedded structure because of the hardware limits (FPGA is one of the solutions for such designs) [13]. The method map on system complexity versus application graph is given in the Fig.2. We can mathematically scale system complexity from first order differential equations to non-linear behavior. As the mathematical expression of the system gets more complex, the scope of the application expands. Undesired cases with mathematical models and their effects on the parameters of the system must be defined for starting the tuning process. After defining the mathematical model, the system must overcome the situations that will cause critical problems in the parameter estimation process described below.

A. Rank Deficient Problem
Rank deficient problem can be defined as, in one operation step, the parameters can be calculated as much as the number of rank of the math equation set. This means that, in statespace representation of a servo system, the parameter matrices are multiplicand of the states of system. If one of the states and input are zero with relevant row, the rank of the system will be decreased by one. This means that, one of the parameters is also missed in the analysis. To overcome this problem, the system must be observable and controllable [14].

B. Persistent/Insufficient Excitation Problem
Persistent excitation problem can be defined as, input and output signals, which provide information to the parameter estimation and tuning process, must contain sufficient data and must be fast enough to ensure continuity. In order not to fall into this problem in servo systems, the speeds of the loops (or bandwidths) in the system should be designed from small to large while control logic moving from the most outer loop to the inside loops. Also, analog to digital conversions, speed of sensor measurements and feedback lines should be fast enough with respect to required operation [15].

C.Rotor Position and Nonlinearity Problem
Rotor position and nonlinearity problem can be defined as, aligning the magnetic axes of magnets with phases in PMSM- based systems (rotor position information in the software) is critical for the correct operation of the dynamic equations of the machine. Also, friction caused deviations and offsets in the drive train cause nonlinearities in the system. In addition, nonlinear current or voltage characteristics caused by the inverter on the driver side should be considered in processes. All these nonlinear effects create unstable system dynamics if they are ignored. To overcome this problem, nonlinear effects must be consider in the mathematical operation using linearized functions or precalculated offsets [16], [17].

II. MECHANICAL ISSUES AND FRICTION
Mechanical deviations and vibrations caused by them are seen in the system dynamics are generally occurs due to friction. This affects system parameters and tunes. If the mechanical issues and friction characteristics for parameter estimation and auto-tuning are known, the control system can be designed more effectively.

A. Mechanical Issues
A servo drive train can be characterized with three parts as traction, transmission and load. Traction part contains controller, driver and servo motor. Load side can be defined with different motion profiles as linear, circular, contour and custom motions. There are also several mechanical interfaces such as, pulley-belt, lead-screw, rack-pinion, belt-wheel, gearwheel and direct drive for the transmission as shown in Fig.3. These structures contain several mechanical parts such as rolling mill, long shafts, large inertia, bearings, elastic couplings, rail, damping elements, belt, gears [18]. These components create backlash, vibration (at resonance frequency or random), friction and then these effects are seen by motor side as reflected inertia, viscous friction and torque, which can cause slow response, noisy operation, oscillation, torque overload, over speed, position errors etc. [19]- [22]. These critical issues, that cause motion deviation and mechanical distortion, are shown in Fig.4. These issues should be compensated by controller/driver structure using motion detection-filtering methods. These methods should be optimized, embeddable and run on a digital processor for industrial applications. According to this embedded system approach, electrical and mechanical parameters of the system and auxiliary variables, which are used for modeling or defining the reflections must be defined in the controller side as shown in Table 1.

B. Friction
Friction is a complicated phenomenon that exists in the contact surface among shaft, end caps, pistons, gears, belts and the cylinder wall. It is non-linear and may result in steadystate errors, limit cycles, motion deviations and poor performance. Generally, friction behavior is divided into two categories namely static and dynamic friction. The static friction force occurs when the body is at resting state or stationary, which limit the performance in precise motion control. Dynamic friction occurs when surfaces are in motion [23]. In addition, the Coulomb friction is a constant friction contribution and thereby independent of the velocity. The viscous friction is interrelated to the velocity, while it is expressed as a function of viscous friction coefficient, , multiplied with the velocity [24]. Friction phenomenon influencing the operation at low velocities is the Stribeck effect [25]. The Stribeck effect is a friction contribution at low velocities, which is decreasing exponentially from the variation between the stiction (maximum static friction level) and the Coulomb force to zero. The most common characteristics of the friction in servo systems are given in Fig.5 [26]- [28].

III. MODELING
Modeling of the servo drive train have critical role in parameter estimation and tuning operation. Modeling can be categorized in three main parts: motor model, mechanical model and the controller/driver model.  [29] mathematical model with respect to rotating d-q frame is given in (1) and (2)

Servo Motor
voltage/current ( , , , ), speed and torque expressions with respect to rotating frame are given below in (3)(4)(5)(6) with the parameters presented in Table I.
For the field-oriented control (FOC), current is kept zero to provide stator current vector kept along direction ( is linearly proportional to the current in closed loop control). Also, for simplicity we can select SPMSM ( = = ). The state-space model can be represented as in (7)(8)(9).
Where, the states are = [ ] , input = and disturbance = . In this case, the rank of the system is equal to 2. This means that, 2 parameters can be calculated in each operating cycle. But with this operation, we encounter the rank deficient problem mentioned earlier. Parameters to be calculated based on the current are missed. The trick to overcome this problem is to give an current that is very close to zero (not necessarily a constant value, it can be in sine or custom form with specific algorithm supported calculations) but never zero. If system in (7) and (8) operates with current, that's amplitude is slightly larger than zero (0 + ), it is to make the rank number 3 and solve 3 parameters in one process step [30]- [32]. This is an important approach for parameter estimation in FOC based servo systems.

B. Mechanical Model
Mechanical implementation of servo systems can be created in two alternative ways using the flywheel model ( = 0, ≠ 0) or as motor and load mechanical coupled mass system. Flywheel model has a specific load profile based on flywheel parameters (inertia and friction). They are preferred as a model in servo systems with direct drive structure. In more complex transmissions, two-mass (motor-load) or multi-mass models are used as shown in Fig.6. In two mass model approach, there are two sides connected together with an elastic or rigid coupling, can be defined with two critical parameters as stiffness ( ) and damping ( ). Both driver and load sides have dependent torque ( ), inertia ( ), speed ( ) and position ( ) [8], [33], [34].  [35]. Parameter estimation and tuning control actions are run as model-based structures. This controller works with a mathematical model of a plant (only motor or motor with load) and observer, predictor, estimator or adaptive structure. In driver side, three phase inverter with sine PWM or space vector PWM techniques are commonly used. Also, specific vector tables for DTC or look-up tables for model-based control systems are used. Generic control strategies are given in Fig.7 [36]- [38].

IV. DISTURBANCE DETECTION
A disturbance signal has three main characteristics: frequency, amplitude and bandwidth. Another critical data about disturbance is the type of formation, which can be in the form of a specific periodic or non-periodic function. In addition, non-periodic formations can be categorized as, pure random, limited random, changing in certain order or dependent to any system's variable (electrical or mechanical).

A. Frequency Domain Analysis Based Techniques
The main works of frequency analysis techniques concentrate around Frequency Response Function (FRF). In Fourier transformation-based techniques, detection system contains two main parts as signal analyzer in the frequency domain and filter (both detection and compensation). There are two main approaches as direct and transform via transfer function.

1) Direct Fourier Transform Methods
The work flow of this method contains three basic processes. The first one is to collect the position, speed, current/voltage or torque error data (whichever has functional data) which is saved and Fourier analysis method is applied [39]- [41]. At this step classical FFT or DFT computation takes much more time in real time systems. In order to overcome this challenge, designers choose the resolution according to overall system requirements. For this purpose, shifted DFT (SDFT) (DFT computing is done when the frequency window is shifted with fixed length) or DWT techniques are in use. Similar approach is used in sweep frequency response analysis (SFRA), in which the plant is excited by a sine wave with consecutive frequency intervals (generally, 5-10 Hz increment is selected and then the plant is excited, and the results are evaluated in the frequency domain) [21]. The aim is to decrease the computing time by decreasing the frequency resolution of the system (i.e. 2048 point data with Advantech 610H industrial control computer takes 3ms for traditional DFT, 0.1ms for SDFT) [4].
The second step is, to collect and to sort data with respect to the amplitude and center frequency. In this stage, it is known that the controlled variables (position speed, current/voltage, torque) are oscillating at several different resonance frequencies. So, in the sorted data, the most dominant frequency (or the one with the biggest amplitude) refers to the resonance frequency, which is sourced by mismatch, distortion or disturbance, of the system and other ones are vibrations or frictions sourced. The last step is filtering the significant frequencies with side lobes (details represented in section V), as shown in Fig. 8 [42].

2) Transfer Function Estimation with Fourier Transform
Another useful approach in same manner is to obtain the transfer function (TF) of the plant in frequency domain using DFT and the most basic methods are empirical transfer function estimate (ETFE), Welch's averaged periodogram TF estimation, impulse response TF estimation and timefrequency decomposition [43]. Stable results are obtained with this technique, but there is a need for hardware that can work with microprocessors and memory units with high processing capability. The parameters obtained in the frequency domain can be used directly in digital filters and can be integrated with look-up tables.

B. Model Based Estimator/Observer/Predictor
The main aim for this technique is to calculate the system parameters or control variables using linear or nonlinear mathematical model of the plant in time or frequency domains. For this purpose, servo system dynamic behavior must be modeled and executed in the software. Estimator, observer or predictor uses measured data from the physical plant and model data and evaluates with statistical methods and system specific calculations. The basic difference between estimators and predictors is the type of input and produced data.

1) Model Referenced Adaptive System (MRAS)
MRAS can be evaluated in a separate category. An adjustable model (model with unknown parameters), which is running parallel to the reference model is updated iteratively. This process performs parameter calculation by using the difference (error) of the signals coming from the reference model and the signals produced by the adjustable model through an adaptive process block, which compares and equalizes these parameters with the reference system by minimizing the error.

2) Observers
In observers, the operation is based on data or error tracking or comparison of model data and real data with parallel process [44]. The main purpose is to calculate parameters, which cannot be measured or accessed in the real system, through the model of the system. If the effects of disturbances are defined previously and inserted into the model, accuracy of the observer increases. While reduced order observers are used to calculate these fundamental mechanical parameters , , (or ) [45], [46], generally, conventional observers work with an estimator or predictor block (i.e. Kalman filter) [47]. Also, adaptive, sliding-mode, disturbance observers are the basic embeddable techniques for parameter estimation and tuning process [48], [49].

3) Estimators
Estimators create the output data with respect to created trajectory from background information (i.e. regression vector). In servo system dynamics, estimators are heavily used because most of the servo systems are used in industrial

4) Predictors
Predictors use data that may contain limited randomness, system specific assumptions and background data for calculating the parameters. It covers the process in two main steps such as prediction and update. In the prediction step, measured and background data is used for parameter calculation after that if there exist any system specific assumptions or probabilities (i.e. Gaussian distributed noises, constant mean and covariance noises, characterized disturbances etc.), it adds these randomness data to the calculation and tries to find the best result during the update stage. Predictors are preferable for advanced servo systems (i.e. underwater systems, military applications) contain observer with predictor controller. The single structures of the mentioned parameter determination techniques are given in Fig. 9 [51], [52].

C.Input Configured Excitation Methods
Predefined routines are applied to the system in these parameter estimation and auto-tuning operations that are based on excitation. Applied signal sets are selected according to the dynamics of the system (servo motor type, controller, mechanical load characteristic). The aim is to determine as many parameters of the system as possible at each excitation.
Generally, this technique is used in off-line parameter estimation and tuning stages because the system is idle.

1) Basic Signal Injection
The simplest application (in single or two mass systems) is to obtain basic signals step, pulse, sine, ramp or square responses with relevant excitations. This simple method is often used to tune the PID controller coefficients or to calculate the series resistance ( ) and inductance values ( , ) of the motor windings [53]. Also, combinations of these basic signals can be used for calculating more specific parameters such as , , , as in [54] with PID controller coefficients. These excitation types can be physical references such as speed, torque, position, or phase current/voltages. As the structure of the servo system becomes more complex, non-linear effects and delays in the system increase [16]. This situation makes it difficult to estimate parameters with simple signal injection processes.

2) Custom Signal Injection
In more complex cases (such as more than two-mass system, more than two motion transmitter elements in the system, frictions and vibrations, nonlinear effects or mismatches etc.), custom signal injection specific to the characteristics of the servo system can be applied [55], [56]. For example, in a fixed-torque servo system operating in a wide speed range (60 rpm-6000rpm), it is necessary to make several excitations up to the boundary speed values while calculating the parameters of the system. Parameters determined by the lower end (60 rpm) or medium range (3000 rpm) speed excitation may cause deviations at high speed values. This is also valid for torque, position, voltage/current measurements.

3) PRBS Injection
Another approach is to use a pseudo random binary set (PRBS). This method is often used as disturbance detection (finding the center frequency of disturbance peaks). In this method, the system is stimulated with a PRBS multiplier. The aim is to generate data that helps to estimate system parameters by making random excitations in the entire frequency band. The advantage of PRBS is to minimize the motion, which is convenient for mechanics with limited stroke. PRBS can be applied both, an open loop identification as a random disturbance signal and closed loop identification for unstable plants [57], [58].

D.Other Embeddable Methods
AI based methods are used for online parameter estimation or auto-tuning operations. The most common methods are neural network (NN), fuzzy logic, genetic algorithm (GA) and particle swarm (optimization) (PS). They use the information of servo systems such as position, motion, torque and mechanical dynamics and constrain as input. It determines the parameters of the system and tuned motion trajectory using methods such as learning, prediction, filtering and mapping [59]- [61] for embedded applications. In some specific applications, which's thermal sensitivity is important, values vary in proportional to temperature and , values

Adaptive mechanism
Calculated Parameters + -  [60] or to utilize the temperature sensitive parameters to predict the temperature of system [62]. Another method is to use the current ripple in parameter estimation, which is similar to the input configured excitation method as mentioned earlier. However in this method there is no excitation, the electrical peaks created during the routine operation of the servo motor are used [63].

V. FILTERS AND COMPENSATORS
Filters are essential elements in a servo drive system for both detecting and compensating disturbances. Each distortion has specific period, amplitude and duration. Various modifications of filter-based methods are applied to the servo systems. There are two main filter type for operations such as band pass filter for detecting the disturbance signal and band stop (band reject) for eliminating disturbance.

A. Notch Filters and Compensation
Notch filters (band reject) are the most common filter types that use basic filtering or adaptive designs. There are three critical parameters for the filters, center frequency ( ), bandwidth (BW) and depth (Q factor). According to servo system complexity, there can be more than one disturbance such as low frequency vibrations, resonance, periodic oscillations etc., with different frequencies and amplitudes. Online adaptive notch filter (OANF), iterative tuning of notch filter and robust online adaptive notch filter (ROANF) versions are used to solve these problems [64]- [66]. The general structure of a notch filter in the embedded servo system and a 2 nd order specific notch filter design is given in Fig. 10.

B. Biquad Filters and Compensation
Another filtering approach of the servo system is Biquad filters [67]. This filter type is used for multi-purpose operations as it can be made operable like low-pass, high-pass, band-pass, band-reject by changing the filter coefficients. This flexibility generally provides an advantage in disturbance detection and compensation, thanks to its wide range, However, the topology remains same in the notch filter structure, the performance is insufficient in low and high frequency bands [68].

VI. SYSTEM MANAGEMENT
Control parameter estimation and tune operations of industrial servo systems generally run by a DSP microcontroller. The switching frequency of the servo drive and the control method (i.e. V/f, Hysteresis, FOC, DTC with parameter estimation and tuning algorithms) are important factors for selecting an offthe-shelf DSP. While a single core processor is sufficient for basic systems (single motorload with low level control and tuning), dual core processors are used in mechanical systems that require multiple movements and more advanced on-line tuning techniques with estimators/predictors. As the nonlinearities formed in the system (sourced by inverter, gears, couplings etc.) and the complexity on the load side increase (cascaded mechanical contacts), the number of loops in the control and tuning blocks increases and this situation requires FPGA-based solutions. A summarized comparison hardware systems and embedded applications in the literature are given in Table 2 [21], [36], [69], [70].  In an optimized embedded system design, the industrial drive, parameter calculation and auto-tuning operations are divided into software blocks called macros. These macros run sequentially or within each other [71]. After creating macros TF2 TFn for the embedded system, they are run on a computer operating system (32 or 64 bit) as part of software in the loop (SIL) testing. If an error is detected, the macros are revised. After finalized macros, a processor is selected that contains the memory unit suitable for the total code size of the macros. In order to determine the most suitable processor, the operating frequencies of the macros, their connections with each other, and the sequence of operations are determined.
According to system software flowchart, the maximum operation frequency of the processor is selected. Dual or quad core processors are preferred for operations that require simultaneous parallel flow [72], [73]. After the appropriate processor is selected, macros are run on the processor as part of the process in the loop (PIL) tests. Selected processor and macros are verified. In case of error, macros or processor can be revised [74]. In the final stage, the embedded hardware is designed by finalizing the processor and peripherals on which the macros will run. The designed structure is verified within the scope of hardware in the loop (HIL) tests by connecting to a real time and faster (i.e. FPGA based Speedgoat) parallel computer [75]. An application example, macros of conventional sensored FOC of PMSM and RLS algorithm-based parameter estimation and auto-tuning is given in Table 3. In this application, RLS's macros run in parallel with FOC's macros. The 'RLS Function' macro runs inside the 'Electrical and Mechanical Parameters calculator' macros, respectively. The 'Control Gains Calculator' macro works by using the results produced by the 'Electrical and Mechanical Parameter Calculator' macros. This application (at 10kHz PWM frequency) was run on TI Delfino MCU F28379D dual core, 32bit, 200MHz, 1Mb Flash DSP.

VII. CONCLUSION
In this review study, parameter estimation and auto-tune processes of industrial servo driven mechanical systems were examined. In this context, the most used models of the components (servo motor, controller/driver and mechanics) were presented and reviewed. Commonly used approaches in the literature are described with examples. Some of the common concepts found in the literature (Model based, Observer, Estimator and Predictor) are explained and classified. The filter structures were reviewed. The most used notch filter was explained with a simulation example. In many studies, the mechanical model (two mass) used in problem definition with similar properties. In the solution part, many studies have been carried out with over specification hardware (computer interface). For this reason, the optimal systems in the literature are summarized in a table and the design line of an optimal embedded industrial system is systematized and explained with an FOC and RLS estimation based example. In future studies, the definition of the problem can be expanded by adding existing non-linear effects coming from friction, driver side or mechanical side, and more compact embedded solutions can be offered at the solution stage. This expansion will result in higher capacity (multi-core DSP and FPGA) hardware requirements.