Automatic tuning of Electro-Optical Director MARCUS BERNER Masters’ Degree Project Stockholm, Sweden June 2009 XR-EE-RT 2009:012 Abstract Directors designed for observation and fire control in naval environments consist of a mechanical pedestal moved by two electrical motors. To meet the high demands on director precision, a servo solution based on feedback control is used. The digital servo controller has to be tuned to meet demands on performance and stability. This report presents methods for automatic tuning, intended to replace today’s manual tuning procedures. System identification based on relay feedback and recursive least-squares approximations are combined with the Ziegler-Nichols and AMIGO tuning procedures for PI controllers are evaluated. Evaluations are performed in simulations, for which a SIMULINK model is constructed. Results indicate that the automatic tuning may perform well compared to the manual tuning used today, and that it could bring considerable reduction in the time required for tuning. Keywords– Automatic tuning, Relay feedback, Recursive Least Squares approximation, Ziegler-Nichols, AMIGO, Anti-windup 1 Acknowledgements I would like to thank both my supervisor Fredrik Södersröm at Saab Systems and my examinator Mikael Johansson at KTH for all the support and good feedback during the project. Contents 1 Introduction 1.1 Auto-tuning . . . . . . . . . . . . 1.2 Problem formulation . . . . . . . 1.3 System Overview . . . . . . . . . 1.3.1 Director structure . . . . 1.3.2 Servo sensors . . . . . . . 1.3.3 Servo system architecture 1.4 Thesis outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 7 8 9 9 10 11 11 2 Modeling 2.1 Controller . . . . . . . . . . . . . . . . 2.2 Motors . . . . . . . . . . . . . . . . . . 2.3 Commutation routine . . . . . . . . . 2.4 Motor control electronics . . . . . . . . 2.5 One-phase motor equivalent . . . . . . 2.6 Mechanics . . . . . . . . . . . . . . . . 2.7 Decoupled SISO model . . . . . . . . . 2.8 Resonances due to non-stiff mechanics 2.9 Disturbances . . . . . . . . . . . . . . 2.9.1 Ship movements . . . . . . . . 2.9.2 Wind . . . . . . . . . . . . . . 2.9.3 Friction torque . . . . . . . . . 2.10 Measurement Noise . . . . . . . . . . . 2.10.1 Gyro signal noise . . . . . . . . 2.10.2 Resolver signal noise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 13 14 16 18 20 21 22 23 24 24 24 26 26 26 32 . . . . . . . . . . . . . . 3 Model Validation 34 3.1 Triangular wave input . . . . . . . . . . . . . . . . . . . . . . 34 3.2 Relay feedback test . . . . . . . . . . . . . . . . . . . . . . . . 37 3.3 Step response . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 2 CONTENTS 3 4 System identification 4.1 Identification of frequency response with a frequency response analyzer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Relay feedback identification . . . . . . . . . . . . . . . . . . 4.2.1 Additional time delay due to sampling . . . . . . . . . 4.2.2 Recursive frequency and amplitude estimation . . . . 4.2.3 Oscillation estimation convergence . . . . . . . . . . . 4.2.4 Results from simulation . . . . . . . . . . . . . . . . . 4.2.5 Robustness to resonances . . . . . . . . . . . . . . . . 4.2.6 Sensitivity to signal noise . . . . . . . . . . . . . . . . 4.3 Parameter fitting with Recursive Least-squares (RLS) algorithm 4.3.1 Model structure . . . . . . . . . . . . . . . . . . . . . 4.3.2 Control signal . . . . . . . . . . . . . . . . . . . . . . . 4.3.3 Identification results . . . . . . . . . . . . . . . . . . . 45 5 Control Design 5.1 The PID-controller . . . . . . . 5.2 Ziegler-Nichols Tuning based on 5.3 AMIGO Tuning . . . . . . . . . 5.4 Gyro Loop properties . . . . . 5.5 Anti-Windup . . . . . . . . . . 66 66 67 67 69 71 . . . . . . . . . relay feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 49 49 50 52 52 55 56 59 61 62 63 6 Simulation Results 72 6.1 Reference following . . . . . . . . . . . . . . . . . . . . . . . . 72 6.2 Disturbance suppression . . . . . . . . . . . . . . . . . . . . . 72 7 Conclusions 77 7.1 Proposals for system modifications . . . . . . . . . . . . . . . 77 7.2 Future work . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 A Extract from motor data sheets 80 B Optimal weighting of AWGN signals 81 C Transfer of torque over a non-stiff axle 84 List of Figures 1.1 1.2 1.3 1.4 Electro-optical director EOS-500. . . . . . . Optronic tracking system main components. Pedestal motion angles. . . . . . . . . . . . Servo system architecture. . . . . . . . . . . . . . . 9 10 10 11 2.1 2.2 2.3 Control algorithm cycle. . . . . . . . . . . . . . . . . . . . . . Model of digital controller with AD/DA converters. . . . . . . Torque (τ ) generated by the stator field (Bstator ) and the rotor field (Bstator ) seperated by an angle of (δ). . . . . . . . Approximation of motor electronics. . . . . . . . . . . . . . . Direction of the magnetic field from the phases in the stator (ēR , ēS , ēT ) and the total magnetic field (ēB ). . . . . . . . . . Commutation routine functionality. . . . . . . . . . . . . . . . Voltages in the PWM circuit. . . . . . . . . . . . . . . . . . . Linear approximation of the PWM circuit. . . . . . . . . . . . Feedback loop TR-Driv. . . . . . . . . . . . . . . . . . . . . . One-phase approximation of the commutation routine, TRDriv and motor. . . . . . . . . . . . . . . . . . . . . . . . . . Model of rotating mass with applied torque. . . . . . . . . . . Model of simplified system. . . . . . . . . . . . . . . . . . . . Ship movements. . . . . . . . . . . . . . . . . . . . . . . . . . System model with disturbances from ship movements (R), wind (W ), friction torque (F ) and signal noise (NG , NR ). . . Gyro signal channel model. . . . . . . . . . . . . . . . . . . . Noise in azimuth gyro signals. . . . . . . . . . . . . . . . . . Correlation of the azimuth gyro noise. . . . . . . . . . . . . . Periodogram of the azimuth gyro noise. . . . . . . . . . . . . Noise in elevation gyro signals. . . . . . . . . . . . . . . . . . Auto-correlation estimate of resolver signal noise. . . . . . . . 13 14 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.17 2.18 2.19 2.20 3.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Gyro signal from low frequency triangular wave input experiment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 15 16 17 18 18 19 19 20 21 22 24 25 27 28 29 30 32 33 35 LIST OF FIGURES 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 4.10 4.11 4.12 4.13 Gyro signal from experiment and simulation with the control signal in Figure 3.1 and 21 Nm Coulomb friction torque. . . . Approximated angular acceleration at different control signal levels with a rectangular wave input in simulation (upper) and real experiment (lower). . . . . . . . . . . . . . . . . . . . Block diagram of a process with relay feedback. . . . . . . . . Friction torque model used in simulation compared to standard Coulomb friction torque. . . . . . . . . . . . . . . . . . . Resulting gain and oscillation frequency of azimuth gyro from relay feedback. . . . . . . . . . . . . . . . . . . . . . . . . . . Resulting gain and oscillation frequency of elevation gyro from relay feedback. . . . . . . . . . . . . . . . . . . . . . . . Azimuth gyro step response for different step amplitudes. . . Azimuth gyro step response for 7.5V and 10V steps compared to respective integrator approximation. . . . . . . . . . . . . . Block diagram of system during measurements of the frequency response with the frequency response analyzer. . . . . Frequency response of the open loop with controller given by eq. 4.9 estimated by the frequency response analyzer with different disturbance levels compared to the linear model. . . Frequency response of the system estimated by the frequency response analyzer with different disturbance levels compared to the linear model. . . . . . . . . . . . . . . . . . . . . . . . . Frequency response estimate generated by frequency response analyzer measurements on the simulation model. . . . . . . . Control signal (u) in oscillating system with output (y) under relay feedback with a sampled relay. . . . . . . . . . . . . . . Gyro signal at start of a relay feedback test. . . . . . . . . . . Estimation convergence of oscillation amplitude and frequency in azimuth gyro relay feedback. . . . . . . . . . . . . . . . . . Oscillation amplitude and frequency for simulation of azimuth gyro relay feedback with different relay amplitudes. . . . . . . Oscillation amplitude and frequency for simulation of elevation gyro relay feedback with different relay amplitudes. . . . Control signal amplitude required to saturate the PWM with a current feedback gain of 1.6. . . . . . . . . . . . . . . . . . . Oscillation estimation results from simulation of azimuth gyro relay feedback with a resonance frequency of fr Hz. . . . . . . Oscillation estimation results from simulation of elevation gyro relay feedback with a resonance frequency of fr Hz. . . . Oscillation estimation results from simulation of azimuth gyro relay feedback with different levels of white signal noise. . . . 5 36 38 38 40 41 42 43 44 45 47 48 49 50 52 53 54 54 55 56 57 57 LIST OF FIGURES 4.14 Oscillation estimation results from simulation of elevation gyro relay feedback with different levels of white signal noise. 4.15 Oscillation estimation results from simulation of azimuth gyro relay feedback with different levels of 50Hz signal noise. . . . 4.16 Oscillation estimation results from simulation of elevation gyro relay feedback with different levels of 50Hz signal noise. 4.17 Model parameter convergence from simulations in azimuth with RLS for model (4.33). . . . . . . . . . . . . . . . . . . . 4.18 Model parameter convergence from simulations in elevation with RLS for model (4.33) . . . . . . . . . . . . . . . . . . . . 4.19 Model parameter convergence from simulations in elevation with RLS for model (4.33) and a control signal limit of 1.5V. 4.20 Model parameter convergence from triangular wave experiment data in azimuth with RLS for Model 2 (4.33). . . . . . . 5.1 5.2 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 Bode diagram of nominal open azimuth gyro loop with a time delay of 3/512s and PI controller parameters from Table 5.4. Bode diagram of nominal closed azimuth gyro loop with PI controller parameters from Table 5.4. . . . . . . . . . . . . . . Step response (1 rad/s) of closed azimuth gyro loop for different controllers. . . . . . . . . . . . . . . . . . . . . . . . . . Step response (1 rad/s) of closed elevation gyro loop for different controllers. . . . . . . . . . . . . . . . . . . . . . . . . . Step response (0.1 rad/s) of closed azimuth gyro loop for different controllers. . . . . . . . . . . . . . . . . . . . . . . . . . Step response (0.1 rad/s) of closed elevation gyro loop for different controllers. . . . . . . . . . . . . . . . . . . . . . . . Azimuth gyro loop responce to a 20 Nm torque step disturbance. Elevation gyro loop responce to a 5 Nm torque step disturbance. Azimuth gyro loop suppression of a sinusoidal angle disturbance with amplitude 0.5 rad and frequency 1 rad/s. . . . . . Elevation gyro loop suppression of a sinusoidal angle disturbance with amplitude 0.5 rad and frequency 1 rad/s. . . . . . C.1 Model of a non-stiff axel. . . . . . . . . . . . . . . . . . . . . C.2 Bond graph of the non-stiff axle. . . . . . . . . . . . . . . . . 6 58 58 59 63 64 64 65 70 70 73 73 74 74 75 75 75 76 84 85 Chapter 1 Introduction A director is a combination of sensors used for observation or target trajectory tracking. The sensors can for example be radars, cameras or lasers. Often a combination of sensors is used to get more information of the target position. Common for the sensors used is that they have a narrow field of view and thus have to be directed toward the target. To be able to direct the sensors they are mounted on a pedestal. The pedestal has two motors allowing it to be directed in the demanded direction. With a narrow field of view and distant targets a small deviation in angle can result in lost targets. This puts high demands on precision requiring a servo system based on feedback. The directors can have different configurations of sensors and hence different dynamic properties. The directors may also differ in components like motors and bearings. Thus every configuration must be tuned individually to achieve acceptable performance and to guarantee stability. Today the tuning is done manually by measuring the frequency responses. From the results a suitable controller is designed. This method is time consuming and requires experience. A desirable feature would be if the tuning could be performed automatically in the controller software. 1.1 Auto-tuning Automatic tuning or auto-tuning is basically a built in function for tuning the controller parameters. The tuning can be initiated by the operator but it performes all tests and designs automatically. Thus a minimal experience in servo controller design is required to perform the tuning. The advantages are fast tuning with minimal experience. The drawback may be that the identification and control design leaves no room for the flexibility of manual tuning. Auto-tuning is normally performed in three steps. The procedure is similar to how manual black or gray box identification and tuning is done 7 CHAPTER 1. INTRODUCTION 8 manually. 1. A disturbance is generated. The most common disturbance is a transient, e.g., a step or pulse, on the input. 2. The response of the system is evaluated. A system model can then be fitted to the data. Other information, needed for the control design, can also be extracted. 3. Controller parameters are computed based on the information from the evaluation. The experiments can be performed in open- or closed loop, depending on the nature of the system and operative conditions. 1.2 Problem formulation The goal of this thesis is to investigate the possibility of applying autotuning on the electro-optical director EOS-500 developed by Saab Systems. The tuning algorithm should be applicable on the current hardware configuration. This poses the following constraints on the algorithm: • Measurable states are restricted to the gyro and resolver signals described in section 1.3.2. • The algorithm must be executed at exactly 512 Hz. • The algorithm must be recursive due to the systems inability to store large batches of data. The aim is to answer the questions: • Are the advantages sufficient to motivate automatic tuning over the manual tuning used today? • Can the auto-tuning algorithm be made robust to variations in the system? • What modifications could be made to make auto-tuning and control in general perform better? Testing and evaluation is carried out in simulations. The system is modR eled and a simulation model is constructed in SIMULINK . The controller R is represented with an embedded MATLAB block executing at 512 Hz with an additional time delay. Two different approaches of system identification are tested. CHAPTER 1. INTRODUCTION 9 The first approach is based on relay feedback [2]. It is a feedback based method for detecting the amplitude margin and frequency where the phaseshift is −180 degrees. The pre-tuning is minimal but the results are limited in terms of received system knowledge. The second approach is based on model parameter fitting with the Recursive least-squares estimation (RLS) algorithm [3]. This is merely a recursive variation of linear regression often used in adaptive control. The method can potentially give more system information compared to relay feedback but requires a suitable model structure. The performance of some different linear control design methods will be compared in simulations. The evaluation will comprise reference following, disturbance suppression and robustness. The advantage of anti-windup will also be invesigated. 1.3 System Overview The director is mounted on the deck of a naval ship and is a part of a combat system consisting of radars, weapons, command stations etc. EOS500, seen in Figure 1.1, is designed to be compact and light weight. The main structure of the pedestal is similar to the larger radar directors and has inherited much of their servo system architecture. Figure 1.1: Electro-optical director EOS-500. 1.3.1 Director structure The sensors used for target tracking are mounted on a pedestal. The pedestal can turn both in azimuth and elevation. The two axes of the pedestal are mounted with ball bearings and directly connected to electrical motors. By turning the pedestal the optronic sensors can be directed freely in azimuth but the elevation has mechanical limitations of +85◦ to −35◦ . CHAPTER 1. INTRODUCTION 10 Rate gyro Elevation motor Optronic sensors Elevation resolver Azimuth motor Azimuth resolver Figure 1.2: Optronic tracking system main components. There are two resolvers, one for each axis, measuring the angular positions. There is also a gyro measuring the angular velocity, mounted together with the optronic sensors. 1.3.2 Servo sensors The direction of the system is managed in a spherical coordinate system. That way each axis of the director only moves in one of the coordinates, like illustrated in Figure 1.3. el az Figure 1.3: Pedestal motion angles. By using these coordinates in feedback the motion in azimuth and elevation can be seen as two separate SISO (Single input, Single output) systems. There is still some coupling between the two axes due to, e.g., the gyroscopic effects of rotating bodies. These effects can however be neglected due to the slow velocities used in operation. The resolvers measure the angles relative to the ship deck where the CHAPTER 1. INTRODUCTION 11 director is mounted. When the director is mounted on a steady platform the angle measured by the resolver is the integral of the velocity measured by the gyro. When in operation this is normally not the case because the ship movements are picked up by the gyro but not by the resolvers. 1.3.3 Servo system architecture The purpose of the servo system is to control the director position or velocity with the use of feedback from the gyro and resolvers. Desired values for the angles or angular velocities are sent to the controller from the Combat Management System (CMS). The local controller will then use feedback from the gyro and resolvers to follow the demanded values. The controller is run on a standard PC with Windows XP. From the controller, current references are sent through a D/A-converter to an analog motor control card named TR-Driv. The control card supplies the motor with voltage to achieve the demanded current. Controller PC State reference from Combat Management System Director TR-Driv Current refernce Voltage Angles (Resolver) Angular rates (Rate gyro) Figure 1.4: Servo system architecture. 1.4 Thesis outline The thesis is divided into the chapters described below. In Chapter 2 the system is broken down into its components for mathematical modeling. The result will be used to construct the simulation model and the design of the identification algorithm. In Chapter 3 simulation results are compared to measurements from the real system for validation. Chapter 4 describes the identification methods used and why some methods are not suitable for the system. CHAPTER 1. INTRODUCTION 12 Chapter 5 reviews the different control design methods used based on the identification results. In Chapter 6 the performance of the controllers are evaluated by simulation results. In Chapter 7 the conclusions from the results are presented together with proposals for future work. Chapter 2 Modeling To produce the simulation model the system will be broken down into its components for mathematical modeling. Some simplifications will be made. Some of them are due to lack of process knowledge and some are made when it can be argued that the effects on the model behavior are minimal compared to the simplicity gained. 2.1 Controller The algorithm in the controller PC is executed at a rate of 512 Hz. Every cycle is executed in the four steps illustrated in Figure 2.1. 3. Apply the comuted control 2. Compute the new control signal 512 Hz 1. Read one sample from the gyro & resolvers 4. Wait Figure 2.1: Control algorithm cycle. 13 CHAPTER 2. MODELING 14 1. The values from the gyro and resolvers are sampled and quantized. 2. The values from step one and old sample values are used to compute a new control signal. 3. When the new control signal is computed it is applied through a D/Aconverter to the motor control card. The output is constant until the next value is computed in the following cycle. 4. In the remaining time of the cycle no computations are made. The system waits for the next sample. The digital controller can be modeled as in Figure 2.2. The sampling and quantizers represents the A/D-converters and the (Pulse Amplitude Modulator) PAM the D/A-converter. The delay is due to the time of computation. The time delay can not exceed one sampling period since that would imply that the computations take more than one sampling period, which is not possible. The delay can be assumed to be constant if the same algorithm is executed in every sample. Digital servo controller Gyro Sampling Quantizer Resolver Sampling Digital filtering Control effort e-sT PAM Quantizer Reference from CMS (Digital) Figure 2.2: Model of digital controller with AD/DA converters. The reference from the CMS typically has a lower sampling rate (∽ 50 Hz) than the local controller. 2.2 Motors The motors used to control the pedestal are three-phase brushless DC (BLDC) motors. A three-phase BLDC motor consists of a stator and a rotor. The stator is the static part that is fixed to the mounting and the rotor is the rotating part. The stator consists of a number of windings. When current runs through the windings an electromagnetic field is induced. Each of the three electrical phases has a set of windings distributed around the stator in such a way that CHAPTER 2. MODELING 15 the magnetic fields generated by each phase are separated by 2π/3 radians. By applying different currents in the different windings the strength and direction of the resulting magnetic field can be controlled, due to its super positioning property. The rotor consists of permanent magnets. Thus no current runs from the stator to the rotor. When a magnetic field is induced in the stator, torque, trying to align the magnetic fields in the stator and rotor, will arise. The torque (τ ) depends on the strength of the stator and rotor fields and the difference in angle (δ) as described in (2.1) and illustrated in Figure 2.3. τ ∝ |Bstator | · |Brotor | · sin (δ) (2.1) Since the rotor has permanent magnets, the magnetic field has constant magnitude and the direction depends only on the alignment of the motor. The controllable parameters are therefore reduced to Bstator and δ. Thus (2.1) can be reduced to (2.2). τ ∝ |Bstator | · sin (δ) (2.2) Brotor Bstator ! Figure 2.3: Torque (τ ) generated by the stator field (Bstator ) and the rotor field (Bstator ) seperated by an angle of (δ). To generate the current, voltage is applied to the three phases (R, S and T ). The electronics can be approximated with the symmetrical circuit in Figure 2.4. The resistors represent the resistance in the wires and the inductor comes from the magnetic fields generated in the windings. The circuit has no ground or zero. Thus the sum of the currents must be zero according to Kirchoff’s first law. iR + iS + iT = 0 (2.3) CHAPTER 2. MODELING 16 UR iR L R R iT L R L UT iS US Figure 2.4: Approximation of motor electronics. When the motor is turning, voltage is induced in the stator windings. This voltage is called Back EMF (Electromotive force) and works against the motor velocity, acting as a brake. The EMF is proportional to the angular velocity. 2.3 Commutation routine The magnetic field generated in each phase in the stator is proportional to the current running through the winding. The voltages applied to the three phases are used to control the strength and direction off the total stator field. Because the phases are evenly distributed the direction of the field from each phase will be separated by 2π/3 radians as illustrated in Figure 2.5. The total field will be the sum of the three fields. Btot ēB = BR ēR + BS ēS + BT ēT (2.4) With a perfectly symmetric motor the relation between the current and the magnetic field strength will be the same for all phases. This implies that to fulfill (2.3), the sum of the field strengths must be zero. BR + BS + BT = 0 (2.5) The preferred way to choose the fields would be: BR = B · sin (ϑ) BS = B · sin (ϑ + 23 π) BT = B · sin (ϑ + 43 π) = −BR − BS (2.6) CHAPTER 2. MODELING 17 eB eS ! eR 2 3 2 3 eT Figure 2.5: Direction of the magnetic field from the phases in the stator (ēR , ēS , ēT ) and the total magnetic field (ēB ). If the contribution to the magnetic field from each phase could be chosen like in (2.6) the resulting field would be: |B̄stator | = 32 B (2.7) φ = π2 − ϑ There are now two parameters (B and ϑ) used to adjust the fields in the stator phases. The only reason for applying current in the motor is to generate torque. Thus it is desirable to keep the torque to current ratio as high as possible. According to (2.2) that is achieved when: π (2.8) 2 If the rotor field angle (ϕ) is known, the value of ϑ that gives the highest torque to current ration can be derived by (2.9). sin (δ) = 1 → δ = ϑ = −ϕ (2.9) Now the only parameter is B, which will be proportional to the torque. Because the magnetic field is proportional to the current, torque can be controlled by applying the phase currents as in (2.10). iR = I · sin (−ϕ) iS = I · sin ( 23 π − ϕ) ⇒τ ∝I (2.10) iT = −iR − iS The currents are not directly adjustable. They are controlled by the motor control card TR-Driv described in section 2.4. TR-Driv takes scaled current references for two of the phases as inputs (iRref , iSref ). CHAPTER 2. MODELING 18 The output from the controller algorithm (u) is a scaled torque reference for each motor. By using the measurement of the motor angel from the resolver (ϕ), iRref and iSref can be computed according to (2.10). This is done by the commutation routine that is integrated in the controller software illustrated in Figure 2.6. Controller algorithm u iRref Commutation iS ref Figure 2.6: Commutation routine functionality. 2.4 Motor control electronics The motor control uses PWM (Pulse Width Modulation). This is a very commonly used technique in power electronics. The principle is to only use two levels of voltage instead of various levels and switch between the levels very fast. A triangular wave with a frequency of 19.2 kHz and magnitude of 10V is generated in the hardware. The triangular wave is compared to a reference voltage (uref ). If the reference voltage gets below the voltage of the triangular wave, the voltage of the power supply (Umax ) is applied. Otherwise the used voltage is the same as the ground of the power supply. The voltages in the PWM circuit are illustrated in Figure 2.7. Output U max V 0V t +10V uref t -10V Figure 2.7: Voltages in the PWM circuit. The electrical circuit in the motor has low-pass characteristics. The switching frequency of the PWM can be considered to be so high that only the average of the output voltage has any effect on the current. By neglecting CHAPTER 2. MODELING 19 the high frequency content of the PWM output, the relation between uref and U can be approximated by (2.11). Umax Umax , |uref | ≤ 10 20 · uref + 2 (2.11) Umean = 0 , uref < −10 Umax , uref > 10 The motor has no connection to ground. Because the voltages between the phases are relative to each other an equal potential offset to all the phases has no effect. Thus the offset in (2.11) can be removed without affecting the behavior of the model. The relation between uref and U can now be approximated by a gain and saturation as in (2.12) and Figure 2.8. Umax , |uref | ≤ 10 20 · uref U= (2.12) Umax 2 · sgn(uref ) , |uref | > 10 u ref PWM u ref U U 10 U max 20 Figure 2.8: Linear approximation of the PWM circuit. The outputs from the controller software are desired values of the currents. To be able to control the current and thereby the torque in the motor the hardware has built in current feedback. This will increase the bandwidth compared to direct voltage control. The input is a scaled current reference (iref ) and the actual current is measured, forming a closed loops like in Figure 2.9. i Kj iref !5 uref U Ka ! 10 U max 20 Figure 2.9: Feedback loop TR-Driv. Approximate values of Ka and Kj are: Ka ≈ 60 Kj ≈ 1.6 (2.13) CHAPTER 2. MODELING 20 Each of the three phases has a PWM circuit. For phase one and two the reference comes from the commutation routine. The commutated phase references are converted with a DA-converter and used as input to TR-Driv. The third reference is generated in the control card so that the sum of the currents are zero. 2.5 One-phase motor equivalent If the commutation routine works perfectly as described in section 2.3, the simplified model of TR-Driv in section 2.4 is considered accurate and the motor is symmetrical, a one-phase approximation like in Figure 2.10 can be made. The simplifications may not capture all dynamics. It is however sufficient considering the limited knowledge and detail in modeling of TRDriv. With a more detailed modeling of TR-Driv a three-phase model may be needed to capture eventual non expected behavior. UR i Rref u Commutation Routine "Kj US TR-Driv iSref #5 u U Ka Motor UT # 10 1 R ! sL U max 20 i Kt "E Figure 2.10: One-phase approximation of the commutation routine, TR-Driv and motor. CHAPTER 2. MODELING 21 ! r V J r Figure 2.11: Model of rotating mass with applied torque. 2.6 Mechanics When torque is generated by the motor the axis starts to accelerate. The energy consumed in the motor is transformed into kinetic energy in the mass of the moving parts. The amount of kinetic energy depends on the angular velocity and moment of inertia (J). The relationship between torque (τ ) and angular acceleration (ϕ̈) is given by (2.14). 1 τ (2.14) J If the center of mass of the elevating part is not in the center of rotation it will act as a disturbance. Torque will be generated by gravity and control has to be applied to keep it steady. Counterweights are therefore used to move the center of gravity to the axis of rotation. The balancing will be assumed to be perfect and the disturbance due to unbalanced mass is zero. The counterweights will however increase the total mass and thereby the moment of inertia. The moment of inertia of a point mass (m) with the distance r to the center of rotation is computed as in (2.15). ϕ̈ = Jm = mr 2 (2.15) The moment of inertia for an entire rotating body can thus be computed like in (2.16), where r̄ is the point in space, r is the perpendicular distance to the rotation axis and ρ(r̄) is the density at r̄. CHAPTER 2. MODELING 22 J= ZZZ r 2 ρ(r̄)dV (2.16) V To compute the exact value of J for the director would require very detailed information about every component. It is not necessary for the purpose at hand. The values used in the simulation model will instead be approximations based on the total weight and size. The following values are used in the model: Jaz ≈ 3 kg m2 Jel ≈ 2 kg m2 (2.17) Another assumption is that the pedestal is stiff. This is however not valid for the larger radar directors. Because they are much heavier, the torque will make the axis between the motor and moving mass distort if the acceleration is sufficient. This can cause problems at higher frequencies where the system can get oscillatory under feedback. No such behavior has been detected on EOS-500 at relevant frequencies. 2.7 Decoupled SISO model By combining the component models, the pedestal motion in azimuth and elevation can be modeled as decoupled SISO-systems as in Figure 2.12. #Kj Electronics Mechanics $5 u i 1 R $ 10 Ka $ 10 Gyro Motor control U max 20 ! " ! Kt ! Resolver sL 1 J # Kb Back EMF Figure 2.12: Model of simplified system. If none of the signals are saturated the model is linear and can be expressed as a transfer function from the control signal to the angular velocity by (2.18). Go (s) = Kb + s Ka Umax 20 Ka Kj JUmax JR + s2 JL + Kt 20Kt Kt (2.18) CHAPTER 2. MODELING 23 With the parameters from the data sheets in appendix A, the approximation made in (2.17) and the used power supply voltage of 80V , the functions in (2.19) and (2.20) can be derived. Gaz (s) ≈ 0.0064s2 240 + 175s + 7.6 (2.19) 240 (2.20) 0.01s2 + 59s + 13 Both systems are second order and very stiff. The poles of respective systems are placed as follows. Gel (s) ≈ Poles of azimuth transfer function: p1 ≈ −0.043 p2 ≈ −2.7 · 104 (2.21) Poles of elevation transfer function: p1 ≈ −0.22 p2 ≈ −6.0 · 103 (2.22) The systems can therefore be approximated by (2.23) and (2.24) while in the linear region. 2.8 Gaz (s) ≈ 1.37 s + 0.043 (2.23) Gel (s) ≈ 4.06 s + 0.22 (2.24) Resonances due to non-stiff mechanics There may be many sources of model errors due to the lack of system knowledge and simplifications made. The larger radar directors have a resonance at 30 − 60 Hz. This comes from lack of stiffness in the pedestal and mountings. One way of modeling the non-stiff pedestal is derived in Appendix C. The additional dynamics caused by the pedestal not being completely stiff may potentially include complex conjugated poles. These poles will yield mechanical resonances and possibly an oscillating closed loop system if performance is pushed without applying specially designed compensation filters. Because EOS-500 is both lighter and more compact than the radar directors the problem with resonances will not be as severe, but they still needs to be considered. The influence of these resonances on identification and control will be investigated both for robustness reasons and as a step in transferring the auto-tuning to the radar directors. CHAPTER 2. MODELING 2.9 24 Disturbances A large part of the control effort will be used to compensate for disturbances acting on the system. Some of them will be modelled to enable investigations of different controllers suppression properties through simulations. 2.9.1 Ship movements When the ship is out at sea it will not be steady. The different ship motions are illustrated in Figure 2.13. Heave Pitch Roll Yaw Figure 2.13: Ship movements. Because the director is mounted on the ship deck it will follow the ship’s movements. The resolvers will however not pick up these movements due to the fact that the sensors are mounted on the ship and measures the angles in the ship coordinate system. The motion will though be picked up by the rate gyro. If the information gained from the servo sensors on the director is not complemented with information about the ship position, only the gyro signal can be used in feedback to compensate. The movements, denoted R in Figure 2.14, have low frequency. A normal test signal is the low frequency sinusoidal in (2.25). π t rad (2.25) R = 0.5 sin 3 2.9.2 Wind When winds hits the director, torque will be generated, just like the force from the sails on a sailing boat. Wind is a bigger problem with the larger radar directors. The radar dish has a size and shape that can capture a lot of wind compared to the smoother shaped of EOS-500. The disturbance from wind must however be considered. The wind is modeled as a torque disturbance, denoted W in Figure 2.14. Wind can have very different characteristics e.g., constant, steps or pulse, see [12]. 25 d dt " $R NR Resolver CHAPTER 2. MODELING ! $ f (&) $ Kb u % 10 Ka $Kj % 10 %5 U max 20 R 1 sL i Kt # F W 1 J " NG " Gyro Figure 2.14: System model with disturbances from ship movements (R), wind (W ), friction torque (F ) and signal noise (NG , NR ). CHAPTER 2. MODELING 2.9.3 26 Friction torque The director must be able to withstand heavy mechanical strain. The ball bearings must therefore be tight to prevent vibrations from causing too much wear. The tight bearings unfortunately have a lot of friction torque. This can be a serious problem when using the electrical motors. With the high friction torque and limited torque, lot of the control effort will be spent on overcoming the friction torque. The friction torque can, like the wind, be seen as a torque disturbance. One distinction between friction torque and the other disturbances discussed is the strong dependence of the internal states of the system. There are many different friction torque models. A good summary of the most common models can be found in [5]. The starting point of the friction torque model used in simulations will be Coulomb friction torque, see (2.26). The friction torque model will be based on experiment data. Some modifications will therefore be made to the Coulomb friction torque model in chapter 3 to better fit the real system behaviour. , ϕ̇ < 0 fc 0 , ϕ̇ = 0 F = (2.26) −fc , ϕ̇ > 0 Due to how the bearings are constructed the friction torque is not even around the orbit. In some positions it is higher than other. The friction torque is also dependent on temperature. When the temperature changes the material in the bearing components will expand or contract. This will have effects on friction torque because the bearing gets tighter or looser. Temperature can also change the properties of the lubrication, thus affecting the friction torque. 2.10 Measurement Noise The measured signals from the resolvers and gyro are quantized and noisy. This may have effects both on identification and control performance. Thus it will be modeled based on measurements to enable simulation of these influences. 2.10.1 Gyro signal noise There are two gyro signals available for each axis of the pedestal. The two signals comes from the same gyro but are scaled differently before the DA converter. This is done to get better resolution at low speeds. The two signals can also be combined to reduce noise. An approximation of the two gyro signal channels is depicted in Figure 2.15 CHAPTER 2. MODELING 27 N1 ~ 1 4 4 ! 2.6 Gyro 1 a 1 a"b ~ 2 ˆ b ! 2.6 N2 Software Figure 2.15: Gyro signal channel model. The saturations come from the DA converters. The fact that the DA converters also quantize the signals will here be neglected. This is because the noise levels are much higher than the quantizer steps. The gyro signals may also contain an offset due to gyro drift. There are algorithms to compensate for this drift. These algorithms will here be considered perfect. To model the noise, measurement data will be used. The measurements are made indoors with the director mounted on a steady platform. By keeping the control signal at zero the system is at rest and the measured signal is noise only. The offset in the signal is compensated by subtracting the mean value from each sample. Azimuth gyro noise The 2000 sample azimuth noise signals in Figure 2.16 will be used to model the noise. The straight forward approach would be to approximate the variance by the mean square as in (2.27) and (2.28), then combine the two signals as described in Appendix B. The combined noise N3 , is then given by (2.29). 2000 1 X 2 N1 (l) ≈ 2.13 · 10−6 2000 (2.27) 2000 1 X 2 N2 (l) ≈ 1.82 · 10−6 = 2000 (2.28) s21 = l=1 s22 l=1 By combining the two signals the estimated variance (eq. 2.30) is reduced, but not as much as expected (eq. 2.31). This indicates some correlation between N1 and N2 . N3 = s22 N1 + s21 N2 s21 + s22 (2.29) CHAPTER 2. MODELING 28 N1 −3 x 10 rad/s 5 0 −5 0 200 400 600 800 1000 1200 sample 1400 1600 1800 2000 1400 1600 1800 2000 N −3 2 x 10 rad/s 5 0 −5 0 200 400 600 800 1000 1200 sample Figure 2.16: Noise in azimuth gyro signals. 2000 1 X 2 N3 (l) ≈ 1.17 · 10−6 2000 (2.30) l=1 s21 s22 ≈ 0.98 · 10−6 + s22 ) (s21 (2.31) The autocorrelation of each signal and the cross-correlation between them are depicted in Figure 2.17. The autocorrelation indicates that both N1 and N2 consist of an uncorrelated part and a part with high correlation, like a single frequency sinusoidal. The cross-correlation indicates that the white part of N1 and N2 are uncorrelated with each other while the correlated parts seems almost identical. This indicates that the correlated part originate from the same source. The spectra of the noise signals in Figure 2.18 reveals two sinusoidal waves at approximately 1.5 Hz and 49 Hz. The noise signal can be approximated by (2.32). The 49 Hz disturbance most likely comes from the power grid. This part of the disturbances may vary with different sources of powers and how the wiring is done. CHAPTER 2. MODELING 29 −7 −7 −7 x 10 x 10 15 15 15 10 10 10 N N 2 1 N 1 (k) 20 2 20 r (k) 20 N 5 5 0 0 0 −5 −5 −5 −2000 −1000 0 1000 lag (k) 2000 −2000 −1000 r r (k) x 10 0 1000 lag (k) 2000 5 −2000 −1000 0 1000 lag (k) 2000 Figure 2.17: Correlation of the azimuth gyro noise. N1 ≈ A11 sin (3πt) + A12 sin (98πt) + W1 W1 ∼ N (0, σ12 ) N2 ≈ A21 sin (3πt + φ1 ) + A22 sin (98πt + φ2 ) + W2 W2 ∼ N (0, σ22 ) N3 ≈ A31 sin (3πt + Ψ1 ) + A32 sin (98πt + Ψ2 ) + W3 W3 ∼ N (0, σ32 ) (2.32) The relation between the periodogram amplitude (P ) and the sinusoidal √ amplitude (A) is given by: A = 2 P . The values of Anm received from the periodograms in Figure 2.18 can be found in Table 2.1. Parameter A11 A12 A21 A22 A31 A32 Approximated value (rad/s) 5.38 · 10−4 7.32 · 10−4 4.20 · 10−4 6.57 · 10−4 4.74 · 10−4 6.90 · 10−4 Table 2.1: Approximated amplitudes of sinusoidals in the azimuth gyro signal noise If N1 and N2 are combined like in (2.29) the theoretical sinusoidal amplitudes in N3 are given by (2.33). A3m 1 = 2 s2 + s21 q s42 A21m + s41 A22m + 2s22 s21 A1m A2m cos (φm ) (2.33) An estimate of the phase-shift between the channels is given by (2.34). 2 4 2 4 2 2 2 2 −1 (s2 + s1 ) A3m − s2 A1m − s1 A2m φm = cos (2.34) 2s22 s21 A1m A2m CHAPTER 2. MODELING 30 −7 x 10 1 1 N P (e j2π f ) 1.5 0.5 0 0 50 100 150 frequency (Hz) 200 250 300 50 100 150 frequency (Hz) 200 250 300 50 100 150 frequency (Hz) 200 250 300 −7 x 10 2 1 N P (e j2π f ) 1.5 0.5 0 0 −7 x 10 3 1 N P (e j2π f ) 1.5 0.5 0 0 Figure 2.18: Periodogram of the azimuth gyro noise. CHAPTER 2. MODELING 31 Using the values in Table 2.1, (2.27) and (2.28), gives the phase-shift estimations as shown in (2.35). φ̂1 ≈ 0.076 rad φ̂2 ≈ 0.13 rad (2.35) Such small phase differences can be neglected and the weighted averaging between the sinusoidal parts can be approximated by weighted averaging of the amplitudes. Thus the optimal weighting of the sinusoidal signals is to only use the one with least amplitude. Approximations of the white noise variance in the noise signal are given in (2.36). σ̃12 = s21 − 21 A211 − 21 A212 ≈ 1.71 · 10−6 σ̃22 = s22 − 12 A221 − 21 A222 ≈ 1.51 · 10−6 σ̃32 = s23 − 12 A231 − 21 A232 ≈ 8.24 · 10−7 (2.36) The reduction of white noise is very close to what could be expected, see (2.37). s42 σ̃12 + s41 σ̃22 = 8.03 · 10−7 ≈ σ̃32 (s21 + s22 )2 (2.37) The complete model of the azimuth gyro noise can be found in (2.38). NGaz (n) ≈ 5 · 10−4 sin 2 (n)] ≈ 8 · 10−7 E[Waz 3π fs n E[Waz (n)Waz (n + k)] = 0, + 7 · 10−4 sin 98π fs n + Waz (n) (2.38) k 6= 0 Elevation gyro noise The elevation gyro noise in Figure 2.19 can be modeled in a similar way as for the azimuth signal. The same sequence of measured data yields the noise model in (2.39). NGel (n) ≈ 0.0013 sin 98π n + Wel (n) fs (2.39) E[Wel2 (n)] ≈ 8 · 10−7 E[Wel (n)Wel (n + k)] = 0, k 6= 0 The white parts of the azimuth and elevation noise have similar power. The source of the low frequency disturbance detected in azimuth is unknown. The lack of that part in elevation may depend on that the measurements CHAPTER 2. MODELING 32 N1 −3 x 10 rad/s 5 0 −5 0 200 400 600 800 1000 1200 sample N2 1400 1600 1800 2000 400 600 800 1000 1200 sample 1400 1600 1800 2000 −3 x 10 rad/s 5 0 −5 0 200 Figure 2.19: Noise in elevation gyro signals. were not performed simultaneously and the disturbance was generated from an external source only present during the azimuth measurement. There is some difference in power of the 49 Hz disturbance between azimuth and elevation. If the disturbance is generated by the power grid this difference may depend on the power consumption of the motors in the different measurements. These explanations are only speculations but will not be investigated further here. 2.10.2 Resolver signal noise Compared to the quantization resolution the noise level of the gyro signal is much higher than the resolver signal. The effects of the quantizer can thus not be neglected. The overall noise level is however relatively low. The variance estimated from a 2000 sample measurement with the system steady can be seen in (2.40) below. σ̃r2 = 2000 1 X 2 NR (n) ≈ 2.9 · 10−9 2000 (2.40) n=1 The noise has low correlation between the samples. This is illustrated by the auto-correlation estimate from the same measurement in Figure 2.20. CHAPTER 2. MODELING 33 −9 3 x 10 2.5 2 R 1 N r (k) 1.5 0.5 0 −0.5 −1 −1.5 −1000 −800 −600 −400 −200 0 200 k (samples) 400 600 800 1000 Figure 2.20: Auto-correlation estimate of resolver signal noise. Chapter 3 Model Validation To ensure that the main dynamics and limiting factors of the system are captured by the simulation model, some experiment data will be compared to simulation results. The data from real measurements are limited, especially in elevation where open loop experiments are not suitable, due to the mechanical limitations. 3.1 Triangular wave input A low frequency triangular wave is used as input in azimuth. Because the triangular wave has most of its energy at low frequencies the current can be assumed to follow the reference when the PWM is not saturated. The generated torque is then given by (3.1). τ≈ Kt u Kj (3.1) From the experiment results depicted in Figure 3.1 an approximate value of the Coulomb friction torque can be determined. With a gradually increasing torque and the system at rest, the Coulomb friction torque is obtained as the level of torque which makes the system move. From the measurements that is approximatlly when the control signal reaches 5V. The Coulomb friction torque approximation can then be obtained by (3.2). fc ≈ 6.6 Kt u≈ · 5 ≈ 21 Nm Kj 1.6 (3.2) Simulation results with the Coulomb friction torque level in (3.2) and the same control signal as in Figure 3.1 are depicted in Figure 3.2. The level of control signal needed to get the system moving seems to be the same. That is expected since the level of friction torque was derived from the same 34 CHAPTER 3. MODEL VALIDATION 35 angular velocity (rad/s) 2 1 0 -1 -2 -3 0 2 4 6 8 10 time (s) 12 14 16 18 20 0 2 4 6 8 10 time (s) 12 14 16 18 20 control signal 10 Fc5 0 -Fc-5 -10 Figure 3.1: Gyro signal from low frequency triangular wave input experiment. CHAPTER 3. MODEL VALIDATION 36 experiment. The gain of the simulation model seems to be higher than the actual system. There can be many reasons for that. The moment of inertia was approximated based on the total size and weight of the system, thus it is not very exact. A higher moment of inertia would not affect the level of torque required to get the system moving, but it would affect the gain. A model change is however not motivated due to the uncertainties in the friction torque model and lack of measurement data. Even if the error lies in the friction torque model the data available is not enough to motivate a more complex friction torque model. The simulation results can thus be considered acceptable with respect to the above measurement. 3 Simulation Experiment 2 angular velocity (rad/s) 1 0 −1 −2 −3 0 2 4 6 8 10 time (s) 12 14 16 18 20 Figure 3.2: Gyro signal from experiment and simulation with the control signal in Figure 3.1 and 21 Nm Coulomb friction torque. If none of the internal states are saturated the system is expected to act like a first order system according to section 2.7. The angular acceleration is then given by (3.3). ω̇ ≈ 1.37u − 0.043ω (3.3) At reachable velocities the approximation given by (3.4) can be made. 1.37u >> 0.043ω ⇒ ω̇ ≈ 1.37u (3.4) With the 5V of the control signal used to overcome the friction torque, three different modes (3.5a, 3.5b, 3.5c) can be expected. CHAPTER 3. MODEL VALIDATION 37 ω=0 ⇒ ω̇ = 0 |u| < 5 ω > 0 ⇒ ω̇ = 1.37(u − 5) ω < 0 ⇒ ω̇ = 1.37(u + 5) (3.5a) (3.5b) (3.5c) How the angular acceleration depends on the control signal is illustrated in Figure 3.3, both for simulation and experiment data. The angular acceleration can be computed by differentiating the gyro signal. Unfortunately this amplifies the noise a lot. The noise can be removed from the simulation model but not from the real measurements. To reduce the noise, the gyro signal is therefore low-pass filtered before differentiating. Not unexpected, the approximation is almost a perfect match for the simulation results. The exceptions are the loops at the endpoint where the control signal is close to 10V or −10V. This depends on that the PWM circuit gets saturated when the back EMF and the control signal gets too high. In the real experiment data, the same thing can be observed but only at control signals close to −10V and not to the same extent as in the simulations. By looking at the angular velocity from the experiments in Figure 3.1 it can be seen that it is higher in the negative direction. The difference most likely depends on non symmetrical friction torque. At low frequancies the suspected saturation in the PWM circuit occurs when the condition in (3.6) is fulfilled. R Umax · sgn(u) − ωKb < ·u 2 Kj (3.6) From Figure 3.3 it seems like the PWM is saturated when the control signal drops below −9V. With the constants used in the simulation model the required angular velocity to saturate the PWM is given by (3.7). ω< R Kj ·u− Umax 2 Kb · sgn(u) ≈ 1.38 rad/s (3.7) The critical level (3.7) is reached in the negative but not in the positive direction during the measurement. When the power supply voltage is not sufficient, the increased control signal will not result in a higher acceleration. This results in the loops seen at the end points in Figure 3.3.. 3.2 Relay feedback test Relay feedback experiments were performed both in azimuth and elevation. The relay feedback set up is illustrated in Figure 3.4. CHAPTER 3. MODEL VALIDATION 38 2 angular acceleration (rad/s ) Simulation Results 5 0 −5 −10 −5 0 control signal (u) 5 10 5 10 2 angular acceleration (rad/s ) Experiment Data 5 0 −5 −10 −5 0 control signal (u) Figure 3.3: Approximated angular acceleration at different control signal levels with a rectangular wave input in simulation (upper) and real experiment (lower). d r ! e u y d 1 Figure 3.4: Block diagram of a process with relay feedback. CHAPTER 3. MODEL VALIDATION The experiment scheme can be described by (3.8). u = d · sgn(e) e=r−y ⇒ u = −d · sgn(y) r=0 39 (3.8) If the system has a phase shift of −π radians at any frequency (ωπ ) it will get into sustained oscillations at that frequency. The input will then be a rectangular wave with the same frequency and the same amplitude as the relay (d). By expressing a rectangular wave with amplitude d as a Fourier series it can be seen that it is a sinusoidal with the same frequency and amplitude 4d/π and higher frequency transients with lower amplitude. Because the system has low-pass properties the transients will be damped much more and the output will be close to a single frequency sinus. Since the control signal has opposite sign of the output the phase shift will be −π radians. With oscillation amplitude A the gain of the system at ωπ can be approximated by (3.9). Aπ (3.9) 4d The output in the relay experiments are the gyro signals. In the linear region the system is expected to behave like a first order systems with a delay, see (3.10). Kπ ≈ Ĝ(s) = α −sL e s+β (3.10) The system pole is very slow. Thus the expected oscillation frequency can be given by (3.11). ωπ π arctan (3.11) + ωπ L = π ⇒ {ωπ >> β} ⇒ ωπ ≈ β 2L The delay depends on the computation time in the controller. There may also be some additional delay caused by the DA/AD converters. To get similar results in simulation as in experiments, the delay is set to three period times of the controller. It is important to notice that the delay may also be caused by some un-modeled dynamics. To be sure of this, further investigation would be required. 3 ≈ 0.006 s (3.12) 512 At the low velocity oscillations generated by the relay feedback the friction torque seems to have almost no effect. This behavior may be better described with a displacement friction torque model [5]. The measurement L̂ ≈ CHAPTER 3. MODEL VALIDATION 40 data available is not sufficient to create such a model. It is however important to capture this properties to enable simulations of the relay feedback and the oscillations generated with a too small amplitude margin in feedback control. The new friction torque model is depicted in Figure 3.5. It should be kept in mind that this model is simplified due to lack of measurement data. friction torque (Nm) 30 20 10 0 −10 modified Coulomb friction torque Coulomb friction torque −20 −30 −3 −2 −1 0 velocity (rad/s) 1 2 3 Figure 3.5: Friction torque model used in simulation compared to standard Coulomb friction torque. With the model structure in (3.10) and the approximation that β is small, the value of α can be derived from the relay feedback results as follows. Aπωπ (3.13) 4d The resulting α̂ from both simulation and experiments in azimuth, seen in Figure 3.6, matches the linear model in (2.23) very well. The system seems to behave in a linear fashion and according to the model for all tested values of d. The results from relay feedback in elevation, seen in Figure 3.7, distinguish from azimuth. At a relay amplitude of 2.5 the value of α̂ is close to expected from (2.24). The system gain decreases with an increased value of d both in simulation and experiments. This is probably because the PWM gets saturated. α̂ = Kπ ωπ = 3.3 Step response Due to the mechanical limitations in elevation, open loop step response experiments can not be performed without hitting the end points. There are no such limitations in azimuth. The resulting azimuth gyro signals from CHAPTER 3. MODEL VALIDATION 41 1 2 A π f / 2d 1.5 Experiment Simulation 0.5 0 0 2 4 6 relay amplitude (d) 8 10 12 frequency (Hz) 60 40 20 0 Experiment Simulation 0 2 4 6 relay amplitude (d) 8 10 12 Figure 3.6: Resulting gain and oscillation frequency of azimuth gyro from relay feedback. CHAPTER 3. MODEL VALIDATION 42 5 Experiment Simulation 3 2 A π f / 2d 4 2 1 0 0 2 4 6 relay amplitude (d) 8 10 12 frequency (Hz) 50 40 30 20 Experiment Simulation 10 0 0 2 4 6 relay amplitude (d) 8 10 12 Figure 3.7: Resulting gain and oscillation frequency of elevation gyro from relay feedback. CHAPTER 3. MODEL VALIDATION 43 tests with different amplitudes of steps are depicted in Figure 3.8. The reason that the signals are noisy at high velocities is because the gyro signal is saturated and the velocity is approximated by differentiating the resolver signal. 5 angular velocity (rad/s) 4 3 10V 2 7.5V 5V 1 4.5V 0 −1 2.5V 0 2 1V 4 6 8 10 12 14 time (s) Figure 3.8: Azimuth gyro step response for different step amplitudes. Steps up to 5V does not have a very high influence on the system due to friction torque. This concurs with the results from the triangular wave experiment. With 5V of control signal used up by friction torque and a system that is almost an integrator with a gain of 1.37, according to (2.23), the expected 7.5V and 10V step responses are given by (3.14). 1.37(7.5 − 5)t = 3.4t, u = 7.5V (3.14) ϕ̇(t) = 1.37(10 − 5)t = 6.8t, u = 10V In Figure 3.9 a comparison between the step responses and the integrators is made. The integrators are almost perfect matches of the step responses at low velocities. The reason that the system is damped at higher velocities is because the power supply voltage is not enough to generate the demanded current due to the back EMF. The difference between maximum velocity in the 7.5V and 10V tests is very small. This also matches the model. The main limiting factor of achievable velocity is the available voltage from the power supply. When the velocity increases, so does the back EMF. The system can not accelerate more when the maximum voltage of the power supply is needed to generate the torque required to overcome the friction torque. CHAPTER 3. MODEL VALIDATION 44 3.5 7.5V step response 10V step response 3.4 t 6.8 t 3 angular velocity (rad/s) 2.5 2 1.5 1 0.5 0 −0.5 0 0.05 0.1 0.15 0.2 0.25 time (s) 0.3 0.35 0.4 0.45 0.5 Figure 3.9: Azimuth gyro step response for 7.5V and 10V steps compared to respective integrator approximation. Chapter 4 System identification Like mentioned in the introduction, the system identification algorithm in the auto-tuning must be recursive. This is because large batches of data can not be stored in the current controller implementation. A limited number of variables may however be stored and used by the algorithm. This chapter will initially describe how the identification is performed in the currently used manual tuning. Some different proposals for automatic identification algorithms applicable on the system will then be reviewed. 4.1 Identification of frequency response with a frequency response analyzer The control design is today based on a measurement of the frequency response. The measurement is performed with an apparatus called frequency response analyzer. The frequency response analyzer is physically connected to the system as depicted in Figure 4.1. FRA Figure 4.1: Block diagram of system during measurements of the frequency response with the frequency response analyzer. A sinusoidal disturbance is generated in the frequency response analyzer 45 CHAPTER 4. SYSTEM IDENTIFICATION 46 and added to the control signal. Since the system has feedback from the coarse gyro signal, with zero as reference, the controller will try to compensate for the disturbance. The gyro output signal is a voltage with a span from −10V to 10V where 1V corresponds to ∼ 0.26 rad/s. The frequency response analyzer measures the disturbed control signal (x) and controller output (y). If both the system G(s), and controller F (s), are linear, x and y can be described by (4.1). x(t) = Ax sin (ωt + ϕx ) (4.1) y(t) = Ay sin (ωt + ϕy ) The open loop transfer function is given by (4.2). G(jω)F (jω) = − Y (jω) X(jω) (4.2) By estimating the amplitude and phase of x and y the gain and phase of the open loop can be derived by (4.3) and (4.4). |G(jω)F (jω)| = Ay Ax (4.3) arg (G(jω)F (jω)) = π + ϕy − ϕx (4.4) To estimate amplitude and phase of x(t) and y(t) the signals are first multiplied by a sine and cosine of the same frequency. Each signals is thereby divided into two signals like in (4.5). a1 (t) = x(t) · sin (ωt) = Ax cos (ϕx ) sin2 (ωt) + cos (ϕx ) sin (ωt) cos (ωt) a2 (t) = x(t) · cos (ωt) = Ax sin (ϕx ) cos2 (ωt) + cos (ϕx ) sin (ωt) cos (ωt) (4.5) By averaging a1 (t) and a2 (t) over a number of periods the results ā1 and ā2 are given by (4.6). ā1 = ā2 = Ax 2 Ax 2 cos (ϕx ) sin (ϕx ) (4.6) The amplitude can now be determined from (4.7) and the phase from (4.8). q q 4ā21 + 4ā22 = A2x sin2 (ϕx ) + cos2 (ϕx ) = Ax (4.7) arctan ā2 ā1 = arctan sin (ϕx ) cos (ϕx ) = ϕx (4.8) CHAPTER 4. SYSTEM IDENTIFICATION 47 The results from frequency response analyzer measurements in azimuth with different disturbance amplitudes and the controller given by (4.9) compared to the linear model in (2.23) with the same controller and a time delay of 3/512 seconds are depicted in Figure 4.2. The gain is scaled so that the output is in rad/s. F (s) = s + 20π s + 2π (4.9) Gain 20 0 Gain (dB) −20 −40 −60 −80 3V 5V 7V 9V Linear model −100 0 10 1 10 frequency (Hz) 2 10 Phase 50 0 Phase (deg) −50 −100 −150 −200 −250 −300 −350 0 10 3V 5V 7V 9V Linear model 1 10 frequency (Hz) 2 10 Figure 4.2: Frequency response of the open loop with controller given by eq. 4.9 estimated by the frequency response analyzer with different disturbance levels compared to the linear model. Because the controller is known and linear, it can be compensated for to get the frequency response of the system alone by filtering the open system trough the inverse of the controller. The resulting frequency response from the above measurement can be seen in Figure 4.3. It can be seen in Figure 4.3 that the results differ a lot between the frequency response analyzer measurements and the derived linear model. The measured gain is much higher and the phase lag is lower for low frequencies. This implies that the model is incorrect or the measurement is faulty. It is important to remember that the frequency response is only valid for linear systems. Nonlinearities like saturations or friction torque will distort CHAPTER 4. SYSTEM IDENTIFICATION 48 Gain 0 Gain (dB) −20 −40 −60 −80 3V 5V 7V 9V Linear model −100 0 10 1 10 frequency (Hz) 2 10 Phase 100 Phase (deg) 0 −100 −200 −300 −400 0 10 3V 5V 7V 9V Linear model 1 10 frequency (Hz) 2 10 Figure 4.3: Frequency response of the system estimated by the frequency response analyzer with different disturbance levels compared to the linear model. the single frequency signals, thus affecting the frequency content. The results from simulations of a frequency response analyzer measurement compared to the linear model are depicted in Figure 4.4. Here it can be seen that the friction torque not only affects the gain, which is intuitive, but also the phase. One of the main concerns with the frequency response analyzer measurement is the lack of control over internal signal levels. The disturbance amplitude can be used for tuning these levels but because the system has feedback the input level will be highly dependent on the open loop dynamics. The best way to investigate whether the measurement results are faulty or not would be to store the actual input and output of the system during a measurement. This way the results could not only be verified or discarded, but in the latter case the new information would probably help identifying the cause of the error. If the logging of data is not possible during frequency response analyzer measurements a similar experiment could easily be performed in software. CHAPTER 4. SYSTEM IDENTIFICATION 49 Gain 20 Simulation with 21Nm friction torque Simulation with no friction torque Linear model Gain (dB) 0 −20 −40 −60 0 10 1 10 frequency (Hz) 2 10 Phase −50 Phase (deg) −100 −150 −200 −250 −300 −350 0 10 Simulation with 21Nm friction torque Simulation with no friction torque Linear model 1 10 frequency (Hz) 2 10 Figure 4.4: Frequency response estimate generated by frequency response analyzer measurements on the simulation model. 4.2 Relay feedback identification The relay feedback test, described in section 3.2, has many advantages and is frequently used for auto-tuning. It has only one tuning parameter which makes it easy to implement on any system with minor adjustments. Some issues, depending on the digital implementation and demand of a recursive identification, must however be considered as well as robustness to model errors and noise sensitivity. 4.2.1 Additional time delay due to sampling In the relay feedback the input and output is supposed to have different signs at all time. If the relay, like in this case, is implemented in a sampled controller the sign of the output will switch at the first sample after sign switch of the output. This will cause an additional time delay like illustrated in Figure 4.5 where the circles represents the samples. This additional time delay can take values between 0 s and 1/fs s and will affect the phase of the system. The frequencies of system oscillations will be lower and the gain higher if the system has low-pass characteristics, which is assumed to be the case. If the sampling time is not a multiple of the oscillation period the addi- CHAPTER 4. SYSTEM IDENTIFICATION 50 Figure 4.5: Control signal (u) in oscillating system with output (y) under relay feedback with a sampled relay. tional time delay will vary between the zero-crossings. If the delay increase the oscillation frequency will decrease. The only stable frequencies are thus ones with half period times that are multiples of the sampling time. If the sampling frequency is much higher than the oscillation frequency this can be neglected because of the small phase lag caused by a delay of one sampling period. The results from relay gyro feedback both in simulation and real experiments verify this by only containing the frequencies 256/6 Hz and 256/7 Hz both in azimuth and elevation. An approximation of the time delay can easily be made by linear interpolation between the samples before and after the crossing by (4.10). This will give a good approximation if the output is a sinusoidal and the sampling frequency is at least ten times the output frequency. T̂sd = 4.2.2 |y(n − 1)| fs |y(n) − y(n − 1)| (4.10) Recursive frequency and amplitude estimation The frequency and amplitude of the oscillations must be estimated recursively because the system identification can not save a large amount of data. The proposed method is similar to Pizarenko’s method, described in [6]. Pizarenko’s method can be used to estimate the amplitude, frequency and noise level of a sampled sinusoidal with white noise. The method uses the eigenvectors of the 3x3 correlation matrix. In this case only the amplitude and frequency is of interest. The signal model is a sinusoidal with unknown phase and added white noise, see (4.11). CHAPTER 4. SYSTEM IDENTIFICATION 51 Y (n) = A sin(2π ffs n + φ) + W (n) rW (k) = σ 2 δ(k) φ ∼ U (0, 2π) (4.11) The auto-correlation of the signal for a lag of 0 to 2 samples are given by (4.12). rY (0) = E Y (n)2 = A2 2 + σ2 rY (1) = E [Y (n)Y (n + 1)] = E Y 2 = rY (2) = E [Y (n)Y (n + 2)] = A2 2 A2 2 cos (2π ffs ) (4.12) cos (4π ffs ) From the correlation the relations in (4.13) and (4.14) can be derived. q rY2 (2) + 8rY2 (1) − rY (2) = A2 2 = A2 2 = A2 2 = A2 q cos2 (4π ffs ) + 8 cos2 (2π ffs ) − cos (4π ffs ) q cos2 (4π ffs ) + 4 cos (4π ffs ) + 4 − cos (4π ffs ) ! r 2 f f cos (4π fs ) + 2 − cos (4π fs ) (4.13) arccos 2 f f rY (1) = arccos cos (2π ) = 2π 2 A fs fs (4.14) The amplitude and frequency can thus be estimated with rY (1) and rY (2) only, according to (4.15) and (4.16). This way the number of parameters to estimate are reduced from three to two compared to Pizarenko’s method. rq A= rY2 (2) + 8rY2 (1) − rY (2) fs · arccos A22 rY (1) f= 2π The correlation estimate in (4.17) will be used. r̂Y (k) = N X 1 y(n)y(n − k) N −k n=k+1 (4.15) (4.16) (4.17) CHAPTER 4. SYSTEM IDENTIFICATION 52 The estimation of rY (1) and rY (2) can be performed recursively as shown in (4.18). The only parameters that need to be saved are: the output signal two samples back, a sample counter (N ) and the estimates of rY (1) and rY (2) from the previous sample. The output signal is already stored to enable filtering so there are only three additional parameters. r̂Y (k)n = 4.2.3 1 1− N −k r̂Y (k)n−1 + 1 y(n)y(n − k) N −k (4.18) Oscillation estimation convergence Because the signal is periodic with high frequency, the estimation convergence is expected to be very fast. If the estimation is initiated at the start of the relay test the convergence is dependent on how fast the system goes into sustained oscillations. As illustrated in Figure 4.6, the sustained oscillations appears almost immediate after the test is initiated and does therefore not affect the convergence to the extent that it has to be dealt with. 0.08 angular velocity (rad/s) 0.06 0.04 0.02 0 −0.02 −0.04 −0.06 −0.08 0.02 0.04 0.06 0.08 time (s) 0.1 0.12 0.14 Figure 4.6: Gyro signal at start of a relay feedback test. The convergence of the amplitude and frequency estimates from azimuth gyro relay feedback can be seen in Figure 4.7. The convergence is like predicted very fast. 4.2.4 Results from simulation If the system behavior is similar to an integrator with a time delay at the oscillation frequency, as assumed in this case, the oscillation period should be independent of the relay amplitude and the oscillation amplitude should be proportional to the relay amplitude. Due to additional delays caused by 53 0.06 0.04 0.02 Oscillation frequency estimate Oscillation amplitude estimate CHAPTER 4. SYSTEM IDENTIFICATION 0 0 0.05 0.1 0.15 0.2 0.25 time (s) 0.3 0.35 0.4 0.45 0.5 0 0.05 0.1 0.15 0.2 0.25 time (s) 0.3 0.35 0.4 0.45 0.5 60 40 20 0 Figure 4.7: Estimation convergence of oscillation amplitude and frequency in azimuth gyro relay feedback. sampling the frequency may however vary to some extent. By multiplying the amplitude and frequency, a measure more linearly dependent of the relay amplitude is received. The simulation results from azimuth relay feedback with different relay amplitudes in Figure 4.8 verifies the above predictions. The same thing holds for tests performed on the real system. Since the frequency does not vary a lot this only implies that the system behaves linearly. With a richer variation of frequencies, information of system order could be extracted. The linear relation between relay amplitude and oscillation amplitude does however only seem to be valid up to a relay amplitude of about 2V in elevation. The same holds for both simulations, seen in Figure 4.9, and experiments, which most likely comes from poor tuning of the current feedback in TR-Driv. The control signal is a scaled reference for the current. If the maximum voltage is not sufficient to reach the demanded current the PWM circuit will saturate. With a scaling factor (Kj ) of 1.6, the motor data from Appendix A and a maximum voltage of ±40V, the control signal amplitude for different frequencies required to saturate the PWM are given in Figure 4.10. With the present limit of 10V on the control signal only about 1/5 can actually be used in elevation. At higher control signal levels the PWM will saturate and increasing the level will not have any effect on the system. This is not desirable and can be avoided in three ways. CHAPTER 4. SYSTEM IDENTIFICATION 54 A 0.1 0.05 frequency (Hz) 0 0 1 2 3 4 5 6 relay amplitude 7 8 9 10 0 1 2 3 4 5 6 relay amplitude 7 8 9 10 0 1 2 3 4 5 6 relay amplitude 7 8 9 10 45 40 35 A⋅f 4 2 0 Figure 4.8: Oscillation amplitude and frequency for simulation of azimuth gyro relay feedback with different relay amplitudes. A 0.05 frequency (Hz) 0 0 1 2 3 4 5 6 relay amplitude 7 8 9 10 0 1 2 3 4 5 6 relay amplitude 7 8 9 10 0 1 2 3 4 5 6 relay amplitude 7 8 9 10 45 40 A⋅f 2 1 0 Figure 4.9: Oscillation amplitude and frequency for simulation of elevation gyro relay feedback with different relay amplitudes. CHAPTER 4. SYSTEM IDENTIFICATION 55 14 Azimuth Elevation Control signal amplitude (V) 12 10 8 6 4 2 0 0 10 20 30 40 50 60 Frequency (Hz) 70 80 90 100 Figure 4.10: Control signal amplitude required to saturate the PWM with a current feedback gain of 1.6. • Increase the voltage from the power supply. • Decrease the maximum control signal. • Increase the current scaling factor (Kj ). To increase the voltage will not only get rid of the problem but also make the system faster. The problem is that by increasing the voltage enough the achievable current is twice the specified maximum current for the motor and will thus probably cause the motor to burn up. The two latter alternatives will have the same effect and the preferred method is the one which is easiest from an implementation perspective. The results from gyro relay feedback in experiments and simulation gives a fast converging and good estimate of the system gain and frequency where the system phase is −180 degrees. To detect saturations like the one occurring in elevation the relay amplitude can start at a low gain and gradually be increased until the system gain starts to diminish. This can both be used to detect the saturation level and to avoid the effects it will have on the identification. It would however be preferred to tune the system to get rid of the saturation. 4.2.5 Robustness to resonances The resonances detected in the radar directors and described in section 2.8 may affect the relay feedback test. The model error between the torque and CHAPTER 4. SYSTEM IDENTIFICATION 56 angular velocity will here be described by a linear system with two complex conjugated poles and a zero at the same frequency. The effects on the relay feedback test are evaluated by simulation with resonance frequencies of 30Hz and 60Hz. The frequencies are chosen to be both higher and lower than the self oscillation frequency of the system and close to the ones of the radar director. The results are depicted in Figure 4.11 and 4.12. Oscillation amplitude estimate 0.25 f = 60 Hz 0.2 r f = 30 Hz r 0.15 no resonance 0.1 0.05 0 0 1 2 3 4 5 time (s) 6 7 8 9 10 Oscillation frequency estimate 70 f = 60 Hz 60 r f = 30 Hz r 50 no resonance 40 30 20 10 0 1 2 3 4 5 time (s) 6 7 8 9 10 Figure 4.11: Oscillation estimation results from simulation of azimuth gyro relay feedback with a resonance frequency of fr Hz. The resonance causes the phase to drop at the resonance frequency. The phase drop in the used resonance model is very steep and has very little influence on the phase at lower frequencies. This explains why the 30Hz resonance causes the relay feedback oscillation frequency to drop and thus the amplitude to increase while the 60Hz resonance does not have any influence on the oscillation frequency. The convergence of the oscillation approximation is still fast and the test seems to be robust. It should be kept in mind that even though the relay feedback test seems robust when it comes to finding the frequency and gain where the system has −180 degrees phase lag, the information received may not be sufficient for good control design. 4.2.6 Sensitivity to signal noise The gyro signal levels in relay feedback are relatively low. This makes it extra important to investigate the influence of signal noise. The gyro sig- Oscillation amplitude estimate CHAPTER 4. SYSTEM IDENTIFICATION 57 0.25 0.2 fr = 60 Hz fr = 30 Hz 0.15 no resonance 0.1 0.05 Oscillation frequency estimate 0 0 1 2 3 4 5 time (s) 6 7 8 9 10 70 fr = 60 Hz 60 fr = 30 Hz no resonance 50 40 30 20 0 1 2 3 4 5 time (s) 6 7 8 9 10 Figure 4.12: Oscillation estimation results from simulation of elevation gyro relay feedback with a resonance frequency of fr Hz. 0.08 0.06 0.04 σ = 0.01 σ = 0.001 σ = 0.0001 0.02 Oscillation frequency estimate Oscillation amplitude estimate nal noise in the measured signals described in section 2.10.1 shows both white noise and 50Hz content. The noise levels may vary depending on how the wiring is done and the surrounding environment. Simulations of relay feedback with different levels of white noise and 50Hz sinusoidal noise are therefore performed and the results are depicted in Figure 4.13 to 4.16. 0 0 0.1 0.2 0.3 0.4 0.5 time (s) 0.6 0.7 0.8 0.9 1 60 40 σ = 0.01 σ = 0.001 σ = 0.0001 20 0 0 0.1 0.2 0.3 0.4 0.5 time (s) 0.6 0.7 0.8 0.9 1 Figure 4.13: Oscillation estimation results from simulation of azimuth gyro relay feedback with different levels of white signal noise. The influence of white noise on the test results and estimation conver- CHAPTER 4. SYSTEM IDENTIFICATION 58 Oscillation amplitude estimate 0.05 0.04 0.03 σ = 0.01 σ = 0.001 σ = 0.0001 0.02 0.01 Oscillation frequency estimate 0 0 0.1 0.2 0.3 0.4 0.5 time (s) 0.6 0.7 0.8 0.9 1 60 50 40 σ = 0.01 σ = 0.001 σ = 0.0001 30 20 0 0.1 0.2 0.3 0.4 0.5 time (s) 0.6 0.7 0.8 0.9 1 Figure 4.14: Oscillation estimation results from simulation of elevation gyro relay feedback with different levels of white signal noise. Oscillation amplitude estimate 0.1 0.08 0.06 0.04 A50 = 0.1 A50 = 0.01 0.02 A 50 0 0 0.1 0.2 0.3 0.4 0.5 time (s) 0.6 0.7 0.8 = 0.001 0.9 1 Oscillation frequency estimate 70 60 50 40 A50 = 0.1 30 A50 = 0.01 20 10 A50 = 0.001 0 0.1 0.2 0.3 0.4 0.5 time (s) 0.6 0.7 0.8 0.9 1 Figure 4.15: Oscillation estimation results from simulation of azimuth gyro relay feedback with different levels of 50Hz signal noise. CHAPTER 4. SYSTEM IDENTIFICATION 59 Oscillation amplitude estimate 0.06 0.05 0.04 0.03 A50 = 0.1 0.02 A50 = 0.01 0.01 0 A50 = 0.001 0 0.1 0.2 0.3 0.4 0.5 time (s) 0.6 0.7 0.8 0.9 1 Oscillation frequency estimate 70 60 50 40 A50 = 0.1 A50 = 0.01 30 A50 = 0.001 20 0 0.1 0.2 0.3 0.4 0.5 time (s) 0.6 0.7 0.8 0.9 1 Figure 4.16: Oscillation estimation results from simulation of elevation gyro relay feedback with different levels of 50Hz signal noise. gence seems to be very small for much higher levels than those detected in the system. The problems start to occur when the noise level gets close to the actual signal level. Then the noise will cause frequent zero crossings which will interrupt the periodicity of the control signal. The 50Hz sinusoidal signals have a larger impact on the results than the white noise. The differences in the results caused by the tested amplitudes, which are much higher than the ones detected in the system, are moderate. Because the sinusoidal noise has high correlation with near by samples it will affect the correlation estimates used to detect the oscillations. 4.3 Parameter fitting with Recursive Least-squares (RLS) algorithm The prior knowledge of the system can be used to form a system model structure. A model that is linearly dependent of measurable or observable states can be written on the form (4.19). This does not preclude a non-linear model because the states themselves can be non-linearly dependent. CHAPTER 4. SYSTEM IDENTIFICATION y =θ·x= θ1 θ2 . . . θN 60 x1 x2 .. . xN N X θn xn = n=1 (4.19) If a larger number of samples than the model order is available, model parameters that gives a perfect fit can normally not be found. The parameters can then be chosen so that the square error is minimized according to (4.20). min θ M X m=1 (y(m) − θ · x(m))2 (4.20) The solution to 4.20 is given by the LMS (least mean square approximation) [9] given by (4.21) and (4.22). A= x1 (1) x1 (2) .. . x2 (1) x2 (2) .. . ... ... xN (1) xN (2) .. . x1 (M ) x2 (M ) . . . xN (M ) ,y = y(1) y(2) .. . y(M ) θ̂ = A+ y (4.21) (4.22) If A has full rank the solution is given by (4.23). θ̂ = AT A −1 AT y (4.23) The above solution can unfortunately not be implemented directly because of the lack of possibility to store data. The recursive RLS (Recursive Least-squares) algorithm [3] will instead be used. This algorithm, eq. 4.244.26, will give the same results as the LMS approximation when the amount of data grows, and only the states from the previous sample are needed. The algorithm is often used in adaptive control. A forgetting factor putting less weight on minimizing the square error in old samples is then normally used. This is not needed here since the system is assumed to be time invariant during the identification. θ̂(m) = θ̂(m − 1) + K(m) y(m) − xT (m)θ̂(m − 1) (4.24) −1 K(m) = P (m − 1)x(m) I + xT (m)P (m − 1)x(m) P (m) = I − K(m)xT (m) P (m − 1) (4.25) (4.26) CHAPTER 4. SYSTEM IDENTIFICATION 61 The RLS identification requires more tuning than the relay feedback. To perform the test a suitable model structure and input signal must be derived. The test can both be performed in open and closed loop. This is also something that needs to be considered from case to case. The parameters that needs to be stored are the elements in the matrix P and the estimation of θ from the previous sample. For a model with N parameters the total number of extra values to store is N (N + 1) if the states in the model are already stored. For the first sample initial values needs to be assigned. The fastest convergence is achieved if the initial values are chosen such that the elements of P −1 are small and θ is close to the final value. 4.3.1 Model structure The aim of the RLS identification is to estimate the system in the linear region where none of the states are saturated. This is because a general model that includes the internal saturations can not be written in form (4.19) and it is desirable to lie in the linear region during operation. For a first order linear system (4.27) with constant control signal between samples as assumed in this case the equivalent discrete model in (4.28) can be derived. α U (s) s+β β β α 1 − e− fs u(n) y(n + 1) = e− fs y(n) + β Y (s) = (4.27) (4.28) By RLS estimation of θ1 and θ2 in 4.29 the continuous linear model parameters can thus be approximated. β = −fs ln (θ1 ) y(n + 1) = θ1 y(n) + θ2 u(n) ⇒ (4.29) α = βθ−2 β 1−e fs The system has a lot of friction torque which is not included in the model 4.28. Even if only the linear model without friction torque is required the friction torque should be represented in the identification model. Otherwise the model structure is too poor and the parameters will not converge. The alternative model (4.30) and (4.31) will thus give better parameter convergence with Coulomb friction torque. β y(n + 1) = e− fs y(n) + β α 1 − e− fs (u(n) − uf sgn(y(n))) β (4.30) CHAPTER 4. SYSTEM IDENTIFICATION 62 β = −fs ln (θ1 ) α = βθ−2 β y(n + 1) = θ1 y(n) + θ2 u(n) + θ3 sgn(y(n)) ⇒ 1−e fs u = − θ3 f (4.31) θ2 Since relatively small deviations in β has a much lower impact on the system behavior than α and uf , it will not convert as fast. Because there is some dynamics between the input and the friction torque and the fact that the Coulomb friction torque model is not accurate, β may even convert to the wrong value depending on the control signal. Like shown in chapter 5, β can be excluded from the control design. Thus a third model structure, given by (4.32) and (4.33), was introduced that showed to give even better convergence for both α and uf . y(n + 1) = y(n) + α (u(n) − uf sgn(y(n))) fs y(n + 1) = y(n) + θ1 u(n) + θ2 sgn(y(n)) ⇒ 4.3.2 Control signal α = fs θ1 (4.32) (4.33) uf = − θθ22 The first thing that needs to be considered is if the identification should be performed in open or closed loop. Normally open loop is to prefer in identification but in this case closed loop will be used. This way the sufficient signal levels can be used without jeopardizing hitting the mechanical limits in elevation angle. To perform tests in closed loop a controller is needed that provides a stable closed loop with sufficient bandwidth. This pre-tuning can preferably be performed with a relay feedback test. Since the relay feedback estimates the amplitude margin a P-controller can be designed and used in feedback. When performing identification in closed loop the correlation between the input and output due to feedback sometimes affect identifiability. This does however not seems to be a problem in this case due to the reference levels used and absence of un-modeled disturbances. The reference signal now has to be determined. A commonly used signal in identification is white noise because of its rich frequency content. A control signal that gives good parameter convergence has shown to be bandpass filtered white noise. The filter used is given by (4.34) where Kt can be used to set the signal power. CHAPTER 4. SYSTEM IDENTIFICATION Kt 63 s (s + 2π)3 (4.34) The main reason for filtering out the very low frequencies is to keep the resolver signal low. This is important to make sure not to hit the mechanical angle limits in elevation. 4.3.3 Identification results The results from simulations with gyro feedback and a P-controller designed from the relay feedback results are depicted in Figure 4.17-4.19. A band-pass filtered white noise signal with different power levels was used as reference. The convergence of the parameters in azimuth are fast and the final values are close to the nominal if the signal levels are not too low. The reason for the offset from the nominal gain depends on saturations in TR-Driv. 1.5 α 1 nominal 2 σ = 0.2 2 σ = 0.5 0.5 σ2 = 0.8 σ2 = 1.1 0 0 1 2 3 4 5 time (s) 6 7 8 9 10 6 5 u f 4 nominal 3 2 σ = 0.2 2 2 σ = 0.5 σ2 = 0.8 1 2 σ = 1.1 0 0 1 2 3 4 5 time (s) 6 7 8 9 10 Figure 4.17: Model parameter convergence from simulations in azimuth with RLS for model (4.33). In elevation the parameters does not seem to convert to the correct values. The reason for this is that TR-Driv saturates at much lower control signals in elevation than in azimuth. This can be helped by limiting the control signal in the controller. With a limit on the control signal of 1.5V the results in Figure 4.19 are obtained. The estimation does not seem to be sensitive to signal noise at moderate levels. The high gain of the controller will however saturate the control signal if the noise level gets too high. These problems start to affect the CHAPTER 4. SYSTEM IDENTIFICATION 64 5 nominal 4 2 σ = 0.2 2 3 σ = 0.5 2 σ = 1.1 2 α σ = 0.8 2 1 0 0 0.5 1 1.5 2 2.5 time (s) 3 3.5 4 4.5 5 7 nominal 6 2 σ = 0.2 5 σ = 0.5 4 σ = 0.8 2 f 2 2 u σ = 1.1 3 2 1 0 0 0.5 1 1.5 2 2.5 time (s) 3 3.5 4 4.5 5 Figure 4.18: Model parameter convergence from simulations in elevation with RLS for model (4.33) . 5 4 3 2 α nominal 2 1 σ = 0.2 0 σ = 0.5 2 2 σ = 0.8 −1 −2 2 σ = 1.1 0 0.5 1 1.5 2 2.5 tme (s) 3 3.5 4 4.5 5 0.8 u f 0.6 nominal 0.4 σ2 = 0.2 σ2 = 0.5 0.2 2 σ = 0.8 2 σ = 1.1 0 0 0.5 1 1.5 2 2.5 time (s) 3 3.5 4 4.5 5 Figure 4.19: Model parameter convergence from simulations in elevation with RLS for model (4.33) and a control signal limit of 1.5V. CHAPTER 4. SYSTEM IDENTIFICATION 65 parameter convergence bias at levels much higher than those detected in the system. Since the identification is performed with low frequency signals the high frequency resonances does not disturb the identification. The resonances will however not be detected in the estimated model. The results from a RLS approximation with model 4.33 and the data from the triangular wave experiment are depicted in Figure 4.20. 7 α u Parameter approximation 6 f 5 4 3 2 1 0 0 2 4 6 8 10 time (s) 12 14 16 18 20 Figure 4.20: Model parameter convergence from triangular wave experiment data in azimuth with RLS for Model 2 (4.33). The real experiment data also shows fast convergence. The estimated gain from the experiment data is lower than the model. This may depend on saturations in the PWM because the triangular experiment was performed without feedback and with higher signal levels. Chapter 5 Control Design Since the system model is of first order in its linear region a simple PI controller with anti-windup will be used. To motivate a more advanced control scheme the system has to be modeled more in detail than what is possible with the proposed identification methods to better capture the behavior outside the linear region and the influence of disturbances. 5.1 The PID-controller The alternative to the textbook PID controller in (5.1) will here be used. The difference is that the derivative of the reference signal is removed. This makes the controller less sensitive to discontinuous reference signals like steps. Z d 1 t e(t)dt − Td y(t) (5.1) u(t) = K e(t) + Ti dt The derivative part will also be low pass filtered like below. Otherwise the signal noise will yield a high control signal due to its high frequency content. sY ≈ s Y 1 + sTd /N (5.2) Since the controller is digitally implemented the PID controller given by (5.1), (5.2) must be discretized. The discrete approximation in (5.3) to (5.6), where fs is the controller sampling frequency, proposed in [3] will be used. u(n) = uP (n) + uI (n) + uD (n) (5.3) uP (n) = Ke(n) (5.4) 66 CHAPTER 5. CONTROL DESIGN 67 uI (n) = uI (n − 1) + uD (n) = K e(n) Ti fs (5.5) KTd N fs Td fs uD (n − 1) + (y(n) − y(n − 1)) Td fs + N Td fs + N (5.6) The value of N is suggested to be between 3 and 20. The filter acting on the derivative part should be chosen based on how fast the system is and the noise level. 5.2 Ziegler-Nichols Tuning based on relay feedback With Ziegler-Nichols ultimate-sensitivity method [3] the PID parameters can be tuned with the two parameters received from the relay feedback test, namely the system gain (K180 ) and frequency (f180 ) where the phase lag is 180 degrees. The tuning rules are given by Table 5.1. Controller Type K Ti P 0.5 K180 PI 0.45 K180 1 1.2f180 PID 0.6 K180 1 2f180 Td 1 8f180 Table 5.1: Ziegler-Nichols tuning rules for relay feedback results. The controller parameters received by Ziegler-Nichols tuning of the nominal system are depicted in Table 5.4 and 5.5. The slow dynamics and relatively short time delay yield a controller with a very high integral gain. This will give a closed loop system with very good suppression of load disturbances, e.g., Coulomb friction torque. The friction torque will however act as transient disturbances when the director velocity switches sign. 5.3 AMIGO Tuning The AMIGO PID tuning rules [1] for model (3.10) are proposed as an alternative to Ziegler-Nichols tuning. The PID parameters are chosen according to Table (5.2). The AMIGO tuning is based on results from MIGO tuning [1] on a large test batch of linear process models. CHAPTER 5. CONTROL DESIGN Controller Type 68 K 0.15β α PI + 0.35 αL − Ti 1 αβ(L+ β1 )2 13L 1+12Lβ+7L2 β 2 0.35L + 0.4βL+0.8 βL+0.1 L 0.2βL+0.45 αL PID Td 0.5L 0.3βL+1 Table 5.2: AMIGO tuning rules for a first order system with time delay. Since both the linear damping (β) and time delay (L) can be considered small, the PID parameters can be approximated by Table 5.3 with almost the same result. Controller Type K Ti Td PI 0.35 αL 13.35L PID 0.45 αL 8L 0.5L Table 5.3: Approximation of AMIGO tuning rules for a slow first order system with a small time delay. PI ZN-tuning PI AMIGO-tuning PID ZN-tuning PID AMIGO-tuning K 88.7 43.9 118.7 56.5 Ti 1.95 · 10−2 7.82 · 10−2 1.17 · 10−2 4.69 · 10−2 2.93 · 10−3 2.93 · 10−3 Td Table 5.4: Controller parameters tuned based on the nominal azimuth system with a time delay of 3/512 s. The controller parameters received by AMIGO tuning of the nominal system are depicted in Table 5.4 and 5.5. The resulting PID/PI controller is less aggressive than the one received from Ziegler-Nichols tuning. The most significant difference is the integrator gain. As seen in section 4.3 the estimation of system integration gain (α) may converge to a lower value when friction torque is introduced. This will give a larger gain in the controller, thus potentially make the closed loop unstable. Because the linear damping is relatively small a good approximation of α CHAPTER 5. CONTROL DESIGN 69 PI ZN-tuning PI AMIGO-tuning PID ZN-tuning PID AMIGO-tuning K 29.7 14.7 39.6 18.9 Ti 1.95 · 10−2 7.82 · 10−2 1.17 · 10−2 4.69 · 10−2 2.93 · 10−3 2.93 · 10−3 Td Table 5.5: Controller parameters tuned based on the nominal elevation system with a time delay of 3/512 s. can be made based on relay feedback results. This approximation should always be compared to the estimation from RLS to verify that the difference is not too big. 5.4 Gyro Loop properties Since both the azimuth and elevation gyro loop have near identical properties, except for very low frequencies, with a controller tuned by one of the above rules, only azimuth will be treated here. In this case the system is close to an integrator and has a small time delay. The tuning rules give a small derivative gain for the PID controller. Since the system is slow the derivative part of the controller will amplify the measurement noise to the control signal more than it contributes to the stability. A more robust controller that uses less control signal is thus received by a PI controller. The azimuth open loop gyro loops with PI controllers tuned by Ziegler-Nichols and AMIGO are depicted in Figure 5.1. A comparison of some open loop properties are depicted in Table 5.6. Amplitude margin (Am ): Phase margin (ϕm ): Crossover frequency (fc ): Ziegler-Nichols AMIGO 5.6dB 12.5dB 25o 58o 20Hz 10Hz Table 5.6: Properties of nominal open azimuth gyro loop with a time delay of 3/512s and PI controller parameters from Table 5.4. The crossover frequency is strongly connected to the closed loop bandwidth. The Ziegler-Nichols tuning gives a higher bandwidth but at the cost CHAPTER 5. CONTROL DESIGN 70 100 Ziegler−Nichols AMIGO Gain (dB) 50 0 −50 −1 10 0 1 10 10 2 10 frequency (Hz) −100 Phase (deg) −150 −200 −250 Ziegler−Nichols AMIGO −300 −350 −1 10 0 1 10 10 2 10 frequency (Hz) Figure 5.1: Bode diagram of nominal open azimuth gyro loop with a time delay of 3/512s and PI controller parameters from Table 5.4. of low stability margins. This can also be seen in the closed loop, Figure 5.2. The bandwidth is higher with the Ziegler-Nichols tuned controller but at frequencies close to the bandwidth the closed loop gain is higher than 0dB. This indicates a more sluggish behavior of the closed loop system than if an AMIGO tuned controller were to be used. Gain (dB) 10 0 −10 Ziegler−Nichols AMIGO −20 −30 −1 10 0 1 10 10 2 10 frequency (Hz) Phase (deg) 0 −100 −200 Ziegler−Nichols AMIGO −300 −1 10 0 1 10 10 2 10 frequency (Hz) Figure 5.2: Bode diagram of nominal closed azimuth gyro loop with PI controller parameters from Table 5.4. CHAPTER 5. CONTROL DESIGN 5.5 71 Anti-Windup Both the controller given by Ziegler-Nichols tuning and AMIGO tuning have a very high integral gain. That will give an open loop with high gain at low frequencies and thereby good suppression of load disturbances like friction torque. The large integral action will unfortunately also result in integral windup [1] due to saturations in the actuators. When the actuators are saturated an increasing control signal will not go through to the output, thus not making the system reach the reference faster. A controller with an integrator will still increase the control signal until the reference is reached. If the integrator gain is large, its contribution to the control signal will be higher than demanded to stay at the reference when it is reached. The only way for a linear controller with an integrator to compensate for this is to make the output go beyond the reference. This may cause an oscillatory system with overshoot in step response. Anti-windup is one way of dealing with this problem. The level of the control signal that is going through to the output (ua ) is measured or estimated with an observer. An additional feedback from to the control signal (u) and ua is introduced to the controller output (uF ) according to (5.7). Z 1 t (ua − u)dt (5.7) u = uF + Tt The saturations in this case are, the limit of ±10V on the control signal and the limited voltage from the power supply. The first is measurable while the latter is not. The saturation of the current feedback in TR-Driv will not have the same affect on the output. If the current feedback is saturated the PWM will also saturate due to the high gain of open current loop. This will break the feedback and should be avoided by tuning TR-Driv to the available voltage and motor impedance. Due to the high gain of the integrator, a small or moderate addition to the control signal caused by integral windup will be compensated quickly and without large overshoots. This makes the anti-windup performance less sensitive to saturation observer errors. Hence a satisfactory observer will be given by (5.8) where us is the control signal required to saturate the PWM at 0Hz, see Figure 4.10. This level can be estimated with a relay feedback test if the time constant of the motor electronics is known. ûa = sgn(u) · min(10, |u|, |us |) (5.8) Tt = Ti (5.9) There is no general method of choosing Tt for a PI-controller. In this case (5.9) has shown to be a good choice and will thus be used. Chapter 6 Simulation Results The purpose of the gyro loop is both to provide good reference following and disturbance suppression. This will be tested by simulations in azimuth and elevation with the controllers designed in chapter 5 based on the model identified with the methods in chapter 4. The anti-windup is enabled in all results if nothing else is stated. 6.1 Reference following The reference following properties are evaluated by step responses simulations of the gyro loop. The results depicted in Figure 6.1 and 6.2 really emphasize advantages of anti-windup. The high overshoot and oscillating settling is almost damped completely without sacrificing rise time. The two controllers seem to have equivalent performance. The 1 rad/s can be considered as a large step. Thus the control signal will be saturated until the reference is reached for both controllers. This is the reason for the rise time being the same. When the step size is reduced to 0.1 rad/s the difference in performance between the controllers is better illustrated, see Figure 6.3 and 6.4. 6.2 Disturbance suppression The modeled disturbances are ship movements, friction torque and wind. The two latter can be considered as torque disturbances while the ship movements act directly on the position in the earth relative coordinate system used by the gyro. How well the gyro loop can compensate for wind disturbances is tested by applying a torque step disturbance on the system with gyro feedback and zero as reference. The results, depicted in Figure 6.5 and 6.6, shows that the Ziegler-Nichols tuned controller outperforms the AMIGO tuned controller. 72 CHAPTER 6. SIMULATION RESULTS 73 1.8 1.6 Angular velocity (rad/s) 1.4 1.2 1 0.8 0.6 Reference Ziegler−Nichols Ziegler−Nichols with anti−windup AMIGO AMIGO with anti−windup 0.4 0.2 0 −0.2 0 0.1 0.2 0.3 0.4 0.5 time (s) 0.6 0.7 0.8 0.9 1 Figure 6.1: Step response (1 rad/s) of closed azimuth gyro loop for different controllers. 1.8 1.6 1.4 Angular velocity (rad/s) 1.2 1 0.8 0.6 0.4 Reference Ziegler−Nichols Ziegler−Nichols with anti−windup AMIGO AMIGO with anti−windup 0.2 0 −0.2 0 0.5 1 1.5 time (s) Figure 6.2: Step response (1 rad/s) of closed elevation gyro loop for different controllers. CHAPTER 6. SIMULATION RESULTS 74 0.12 0.1 Angular velocity (rad/s) 0.08 0.06 0.04 0.02 Reference Ziegler−Nichols with anti−windup AMIGO with anti−windup 0 −0.02 0 0.1 0.2 0.3 0.4 0.5 time (s) 0.6 0.7 0.8 0.9 1 Figure 6.3: Step response (0.1 rad/s) of closed azimuth gyro loop for different controllers. 0.12 0.1 Angular velocity (rad/s) 0.08 0.06 0.04 0.02 Reference Ziegler−Nichols with anti−windup AMIGO with anti−windup 0 −0.02 0 0.1 0.2 0.3 0.4 0.5 time (s) 0.6 0.7 0.8 0.9 1 Figure 6.4: Step response (0.1 rad/s) of closed elevation gyro loop for different controllers. CHAPTER 6. SIMULATION RESULTS 75 −3 0.12 14 Ziegler−Nichols with anti−windup AMIGO with anti−windup Ziegler−Nichols with anti−windup AMIGO with anti−windup 12 0.08 10 0.06 8 Angle (rad) Angular velocity (rad/s) 0.1 x 10 0.04 0.02 6 4 0 2 −0.02 0 −0.04 0.8 1 1.2 1.4 time (s) 1.6 1.8 −2 2 0 0.5 1 1.5 time (s) 2 2.5 3 Figure 6.5: Azimuth gyro loop responce to a 20 Nm torque step disturbance. −3 0.05 6 Ziegler−Nichols with anti−windup AMIGO with anti−windup Ziegler−Nichols with anti−windup AMIGO with anti−windup 5 4 0.03 Angle (rad) Angular velocity (rad/s) 0.04 x 10 0.02 3 2 0.01 1 0 0 −0.01 0.8 1 1.2 1.4 time (s) 1.6 1.8 2 0 0.5 1 1.5 time (s) 2 2.5 3 Figure 6.6: Elevation gyro loop responce to a 5 Nm torque step disturbance. It is important that the gyro can compensate well for ship movements. Because the entire pedestal is moving together with the ship, these motions are not detected by the resolvers. In simulations a sinusoidal disturbance with amplitude 0.5 rad and frequency 1 rad/s is introduced like R in Figure 2.14. The gyro loop is closed and has zero reference. The results are depicted in Figure 6.7 and 6.8. 0.1 0.015 Ziegler−Nichols with anti−windup AMIGO with anti−windup 0.08 Ziegler−Nichols with anti−windup AMIGO with anti−windup 0.01 0.04 0.005 0.02 Angle (rad) Angular velocity (rad/s) 0.06 0 −0.02 0 −0.005 −0.04 −0.06 −0.01 −0.08 −0.1 0 2 4 6 time (s) 8 10 −0.015 0 2 4 6 8 10 time (s) Figure 6.7: Azimuth gyro loop suppression of a sinusoidal angle disturbance with amplitude 0.5 rad and frequency 1 rad/s. Just like the case with wind disturbances, the Ziegler-Nichols tuned controller outperforms the one tuned with the AMIGO rules when it comes to ship movements. How well the movements are suppressed is strongly con- CHAPTER 6. SIMULATION RESULTS 76 −3 x 10 Ziegler−Nichols with anti−windup AMIGO with anti−windup 0.06 Ziegler−Nichols with anti−windup AMIGO with anti−windup 8 6 0.04 Angle (rad) Angular velocity (rad/s) 4 0.02 0 2 0 −2 −0.02 −4 −0.04 −6 −0.06 −8 0 1 2 3 4 5 time (s) 6 7 8 9 10 0 1 2 3 4 5 time (s) 6 7 8 9 10 Figure 6.8: Elevation gyro loop suppression of a sinusoidal angle disturbance with amplitude 0.5 rad and frequency 1 rad/s. nected to the torque step results. Without friction torque the gyro loop can suppress the movements by a factor of almost 7000 with the Ziegler-Nichols controller and 1000 with the AMIGO controller. This is because of the high open loop gain at the low frequencies of the disturbance. When the direction of movements changes the friction torque will rapidly change, thus acting as a step disturbance. This will generate transients with high frequency content causing the spikes seen in the gyro signal. Chapter 7 Conclusions The proposed automatic identification methods seem to give a very fast and accurate estimate of the system behavior assuming there are no resonances. The frequency response analyzer measurements can identify the resonances but due to nonlinearities like friction torque and saturations, the result may be distorted. Because there are no detected resonances in EOS-500 the automatic identification seem to be a good replacement for the frequency response analyzer measurements based on simulation results. Ziegler-Nichols tuning gives a higher bandwidth than AMIGO tuning but the stability margins may be too small. A combination between the two designs would probably be the best tradeoff. This must however be evaluated based on how well the tuning works on the real system. The limiting factors of achievable control performance are friction torque, limited control signals and the time delay. A rule of thumb is that the achievable closed loop bandwidth for a system with a time delay (T ) is limited to 1/T rad/s [8]. With Ziegler-Nichols the bandwidth is close to the limit. To get better suppression of movement disturbances with a linear controller the delay has to be reduced. 7.1 Proposals for system modifications To enable higher performance a number of modifications could be performed. The friction torque is very high compared to the available torque from the motors. If the friction torque could be reduced, the reference following and the disturbance suppression would be better. Reduced friction torque would also require less torque from the motors, thus extending their life time. The available torque could easily be increased by increasing the power supply voltage. This can only be made to the extent that the motor peak 77 CHAPTER 7. CONCLUSIONS 78 current does not get exceeded. The advantages must though be weighted against the effects on motor wear. One of the main limiting factors is the time delay. If it could be reduced a more aggressive controller could be used. This would probably require a major redesign of the servo architecture. The current feedback gain (Kj ) in the motor control cards (TR-Driv) needs to be adjusted so that the PWM does not saturate and the entire control signal can be used. This does not seem to be the case in elevation. The saturation of the gyro signal at ±2.6 rad/s caused by the AD converter seem to be a poor balance. The quantizer resolution is very high compared to the signal noise so the limit could be extended to make sure that no saturation will occur without loosing valuable information. If the gyro signal saturate, feedback is lost and this not desirable. 7.2 Future work The natural next step is to try the auto-tuning procedure on the real system. The simulations indicate good results but this is no guarantee that this will be the case in reality. If model errors or resonances cause bad performance the tuning may need to be complemented by methods to deal with those problems. To make deeper investigations a more detailed model would be needed. It would require more measurements on the system and preferable measuring of internal states. If measuring of internal states could be available in control, performance could probably be increased. If there for example were a way for the controller to know when TR-Driv is saturated it could be used for Anti-Windup or even more advanced supervising features that could enable better performance. Since one of the largest problems is to suppress disturbances caused by friction torque the first measure should be to decrease the friction torque it self. Better performance could probably also be achieved with a more advanced, adaptive friction torque compensation. Before any further control design work, some of the proposed system modifications should be considered. Bibliography [1] Karl J. Åström, Tore Hägglund Advanced PID Control, Instrumentation, Systems, and Automation Society (2006) [2] Karl J. Åström, Björn Wittenmark Adaptive Control, Second Edition, Addison-Wesley (1995) [3] Karl J. Åström, Björn Wittenmark Computer-Controlled Systems, Prentice Hall (1997) [4] Padmaraja Yedamale Brushless DC (BLDC) Motor Fundamentals, Microchip Technology Inc. (2003) [5] H. Olsson, K.J Åström, C. Canudas de Wit, M. Gäfvert, P. Lischinsky Friction Models and Friction Compensation, (1997) [6] Monson H. Hayes Statistical Digital Signal Processing and Modeling, John Wiley & Sons, Inc. (1996) [7] Hassan K. Khalil Nonlinear Systems, Third Edition, Prentice Hall (2002) [8] Mikael Johansson Lecture notes in Control Theory and Practice, (2008) [9] L. Råde, B. Westergren Mathematics Handbook for Science and Engineering, Studentlitteratur (2004) [10] T. Glad, L. Ljung Reglerteknik, Grundläggande teori, Studentlitteratur (2006) [11] T. Glad, L. Ljung Reglerteori, Flervariabla och olinjära metoder, Studentlitteratur (2003) [12] Jun Chen, Michael C. Hui, Y. L. Xu A comparative study of stationary and non-stationary wind models using field measurements, Springer (2005) 79 Appendix A Extract from motor data sheets Resistance (R) Inductance (L) Back-EMF constant (Kb ) Torque sensitivity (Kt ) Peak current (Ip ) Value 5.25 14 7.6 6.6 16.5 Tolerance ±10% ±30% ±10% ±10% − unit Ω mH V /rad/s N m/A A Table A.1: Azimuth motor data. Resistance (R) Inductance (L) Back-EMF constant (Kb ) Torque sensitivity (Kt ) Peak current (Ip ) Value 32 66 13 13 3.125 Tolerance ±12, 5% ±30% ±10% ±10% − unit Ω mH V /rad/s N m/A A Table A.2: Elevation motor data. 80 Appendix B Optimal weighting of AWGN signals Given measurements of the same signal that has passed through different AWGN (Additive white Gaussian noise) channels variance can be reduced by weighted averaging. Given two measured values: x̃1 (n) = x(n) + W1 (n) (B.1) x̃2 (n) = x(n) + W2 (n) (B.2) Where x(n) is the real value and W1 (n), W2 (n) are uncorrelated widesense stationary processes given by: W1 (n) ∼ N (0, σ12 ) (B.3) rW1 (k) = σ12 δ(k) (B.4) W2 (n) ∼ N (0, σ22 ) (B.5) rW2 (k) = σ22 δ(k) (B.6) The approximation of x(n) based on the two measurements is given by: x̂(n) = a · x̃1 (n) + b · x̃1 (n) a+b 81 (B.7) APPENDIX B. OPTIMAL WEIGHTING OF AWGN SIGNALS 82 The stochastic variables X, Y and Z are introduced: X = x̃1 (n) (B.8) Y = x̃2 (n) a·X +b·Y b X +γ·Y Z = x̂(n) = = γ= = a+b a 1+γ (B.9) (B.10) E[X] = x(n), V ar[X] = σ12 (B.11) E[Y ] = x(n), V ar[Y ] = σ22 (B.12) E[Z] = 1 (E[X] + γE[Y ]) = x(n) 1+γ (B.13) i h V ar[Z] = E (Z − E(Z))2 = E Z 2 − 2ZE[Z] + E[Z]2 1 E (1+γ)2 = E Z 2 − x2 (n) = = σ12 +γ 2 σ22 (1+γ)2 X 2 + 2γXY + γ 2 Y 2 − x2 (n) (B.14) The value of γ that minimizes the variance of Z can be choosen by solving the optimization problem: min γ V ar[Z] (B.15) Solution to B.15: Extreme point: 2γσ22 − 2σ12 d V ar[Z] = =0⇒ dγ (1 + γ)3 γ= (B.16) σ12 σ22 (B.17) Proof of minimum: d V ar[Z] σ12 = dγ γ= 2 +ǫ σ 2 2ǫσ22 1+ σ12 σ22 +ǫ 3 ( > 0, ǫ > 0 < 0, −1 − σ12 σ22 <ǫ<0 (B.18) APPENDIX B. OPTIMAL WEIGHTING OF AWGN SIGNALS γ= b = a σ12 σ22 ⇒ a = σ22 83 (B.19) b = σ12 By using the optimal weighting in (B.19) the variance is reduced to: V ar[Z] = σ12 σ22 σ12 + σ22 (B.20) Appendix C Transfer of torque over a non-stiff axle When torque from a motor is transferred through an axle to accelerate a mass the axle will twist. The system can be modeled as two masses connected by a spring and a damper as depicted in Figure C.1. k 1 !1 J2 J1 2 b Figure C.1: Model of a non-stiff axel. The first mass is the rotor of the motor with a moment of inertia of J1 . The second mass is the object that is to be accelerated with a moment of inertia of J2 . The object is to control the angular velocity of the second mass (ω2 ) with the torque from the motor (τ1 ). To get a Laplace transfer function of the system with τ1 as input and ω2 as output the bond graph in Figure C.2 is used. 84 APPENDIX C. TRANSFER OF TORQUE OVER A NON-STIFF AXLE85 I : J1 !1 2 Se 1 s1 !1 3 "! C: 1 k 3 p1 !1 4 "! !2 I : J2 3 s2 5 R:b "! Figure C.2: Bond graph of the non-stiff axle. The relations derived from each point in the bond graph are derived below. s1 : τ1 = τ2 + τ3 Z t 1 τ2 dt ω1 = J1 (C.1a) (C.1b) p1 : ω1 = ω2 + ∆ω Z t 1 τ3 dt ω2 = J2 (C.2a) (C.2b) τ3 = τ4 + τ5 (C.3a) τ5 = b · ∆ω (C.3b) s2 : τ̇4 = k · ∆ω (C.3c) The above relations can be combined to the transfer function from τ1 to ω2 in (C.4). ! 1 1 bs + k (C.4) J2 2 J1 + J2 s JJ1+J s + bs + k 1 2