Full text
Master Thesis E ER RA AS SM MU US S M MU UN ND DU US S M MA AS ST TE ER R o of f M Me ec ch ha an ni ic ca al l E En ng gi in ne ee er ri in ng g Mr. NGUYEN HUU NGHIA 2005-2007 (First course)
POLYTECHNICAL UNIVERSITY OF CATALONIA BARCELONA M Ma as st te er r T Th he es si is s E ER RA AS SM MU US S M MU UN ND DU US S M Ma as st te er r o of f M Me ec ch ha an ni ic ca al l E En ng gi in ne ee er ri in ng g M MO OD DE EL LL LI IN NG G, , S SI IM MU UL LA AT TI IO ON N, , A AN ND D C CA AL LI IB BR RA AT TI IO ON N O OF F T TW WI IN N R RO OT TO OR R M MI IM MO O S SY YS ST TE EM M Author: Nguyen, Huu Nghia Advisor: Prof. Puig Cayuela, Vicenç June 2007
i Abstract Helicopter is an aircraft that plays important role in transporting products, people…in society nowadays. It is complex mechanical equipment that corresponds many fields such as fluid mechanics, mechanics, control…Design it probably easy but fabrication and control it are not simple problem. The aim of research is to obtain a simulation and control model for the setup that has the principle of function like a real helicopter in laboratory in Automatic Control Department in Technical University Catalonia – Barcelona. This setup names Twin Rotor Multi Inputs - Multi Outputs System (TRMS) is manufactured by the Feedback Instruments Limited Company. It serves as a guide for the control tasks and provides useful information about the physical behavior of the system. It is also useful setup for study and practice of students to have a clearer look. On the main originalities of the present master thesis is the use on a control oriented model based on the use of a model that has linear structure but parameters varying with the operating point. This type of model is known as Linear Parameter Varying model (shortly, LPV model). Two procedures to obtain such a model are proposed. One based of rearranging the non-linear equations in such a way that the LPV parameters appear linearly. The second is based on linearizing the non-linear model around different operating points and the interpolation the parameters between them. Finally, the LPV model for the TRMS system obtained using either of the procedures described above can be calibrated using standard parameter estimation algorithms available in the Identification Toolbox in MATLAB.
ii Acknowledgment The thesis was done in Automatic Control Department of Technical University of Catalonia (UPC) of Barcelona - Spain. The work was supervised by Prof. Puig Cayuela Vicenç. I would like to express my thanks and gratitude to Prof. Puig Cayuela Vicenç for continuous support, the helpful advice, and the valuable guidance throughout the work. I would like to express my thanks to Prof. Jean-Claude Boyer, coordinator of Erasmus Mundus Master of Mechanical Engineering (EMMME), created a very good environment for us to study in INSA of Lyon - France as well as Prof. Ana Barjau, coordinator of EMMME in Spain, helped us very much during the courses. I thank all the professors, members in two institutes (INSA of Lyon, UPC of Barcelona) helped us during studying such as teaching, organization, and registration…for the courses. My thanks are also to the staffs who taught and encouraged my study in Department of Mechanical Engineering in Cantho University-Vietnam. I would like to commemorate Prof. Jean-Paul Long, responsible of the EMMME in INSA, has just forever gone to another world. He taught and deeply conveyed the knowledge to us during the courses. Finally, I would like to express my special thanks to my family and friends for the patience and encouragement. Barcelona, June 2007. Nguyen Huu Nghia
iii
iv Table of contents Abstract .................................................................................................................................. i Acknowledgment................................................................................................................... ii Table of contents.................................................................................................................. iv List of figures .........................................................................................................................v List of tables..........................................................................................................................vi 1. INTRODUCTION................................................................................................................. 1 1.1 Motivation....................................................................................................................... 1 1.2 Project objective............................................................................................................. 5 1.3 Content of chapters ........................................................................................................ 6 2. MODELLING THE SYSTEM ............................................................................................... 7 2.1 Description of the system ............................................................................................... 7 2.2 Characteristics of the motors.......................................................................................... 9 2.2.1 Main motor ..............................................................................................................10 2.2.2 Tail rotor ..................................................................................................................10 2.3 Equations of system ......................................................................................................11 2.3.1 Physical model ........................................................................................................11 2.3.2 Mathematical model ................................................................................................12 3. SIMULATOR OF TRMS SYSTEM......................................................................................19 3.1 Simulink TRMS system .................................................................................................19 3.2 Some basic concepts of mathematical models for control..............................................21 3.2.1 State........................................................................................................................22 3.2.2 State variables.........................................................................................................22 3.2.3 State vvector ...........................................................................................................22 3.2.4 State space .............................................................................................................22 3.2.5 State pace equation.................................................................................................22 3.3 Linear parameter varying (LPV) model for controlling the TRMS system........................24 4. CALIBRATION OF TRMS SYSTEM CONTROL MODEL..................................................31 4.1 Introduction ...................................................................................................................31 4.2 Calibration of LPV model using Matlab (pem command) ...............................................31 4.2.1 Pem and mathematical model .................................................................................31 4.2.2 Implementation method ...........................................................................................33 4.2.3 The results of calibration..........................................................................................37 4.3 Calibration of a LPV model coming from linearization toolbox .......................................45 5. CONCLUSION AND FUTURE WORK...............................................................................54 A. APPENDIX ........................................................................................................................55 References............................................................................................................................67
v List of figures Figure 1.1 Model of aerodynamic force .....................................................................................1 Figure 1.2 Helicopter UH-1........................................................................................................2 Figure 1.3 Main rotor Blade system...........................................................................................3 Figure 1.4 Tail rotor blade .........................................................................................................3 Figure 2.1 The twin rotor MIMO system.................................................................................... 7 Figure 2.2 Aerodynamic model of the TRMS............................................................................ 8 Figure 2.3 Position sensor.........................................................................................................9 Figure 2.4 Measuring of main rotor characteristics ....................................................................10 Figure 2.5 Measuring of tail rotor characteristics .......................................................................11 Figure 2.6 Schematic diagram of TRMS....................................................................................12 Figure 2.7 Side view of TRMS...................................................................................................13 Figure 2.8 Top view of TRMS....................................................................................................16 Figure 3.1 Simulink in Matlab of TRMS .....................................................................................20 Figure 3.2 Subsystem of TRMS.................................................................................................21 Figure 3.3 Simulator of TRMS ...................................................................................................27 Figure 3.4 Horizontal signal outputs ..........................................................................................28 Figure 3.5 Vertical signal outputs ..............................................................................................28 Figure 3.6 Horizontal position of LPV2 and Simulink model.......................................................29 Figure 3.7 Vertical position of LPV2 and simulink model ...........................................................29 Figure 4.1 Function Fcn ............................................................................................................33 Figure 4.2 Calculating coefficients in state space ......................................................................36 Figure 4.3 Operating points of the system.................................................................................37 Figure 4.4 The 1 st operating point calibration.............................................................................38 Figure 4.5 The 2 nd operating point calibration............................................................................39 Figure 4.6 The 3 rd operating point calibration ............................................................................40 Figure 4.7 the 4 th operating point calibration..............................................................................41 Figure 4.8 Estimated coefficients of matrix A.............................................................................43 Figure 4.9 Estimated coefficients of matrix B.............................................................................44 Figure 4.10 Linearization toolbox window..................................................................................46 Figure 4.11 The 1 st operating point calibration by linearization tool............................................47 Figure 4.12 The 2 nd operating point calibration by linearization tool...........................................48 Figure 4.13 The 3 rd operating point calibration by linearization tool ...........................................49 Figure 4.14 The 4 th operating point calibration by linearization tool............................................50 Figure 4.15 Estimated coefficients of matrix A by linearization ..................................................52 Figure 4.16 Estimated coefficients of matrix B by linearization ..................................................53
vi List of tables Table 2.1 TRMS model parameters in vertical axis....................................................................15 Table 2.2 TRMS model parameters in horizontal axis ...............................................................18 Table 4.1 Result of the calibration .............................................................................................42 Table 4.2 Stable points..............................................................................................................42 Table 4.3 Result of calibration by linearization tool....................................................................51
1. INTRODUCTION page 1 1. INTRODUCTION 1.1 Motivation Helicopter is an aircraft which is lifted and propelled by one or more horizontal rotors consisting of two or more rotor blades. It has the ability to take off and land vertically and to maintain a steady hover in the air over a single point on the ground. This allows the helicopter to land and to take off from, including heliports in the middle of busy cities and rugged terrain in remote areas. The helicopter is used for rescue, medical evacuation and as an observation platform. Other operation that involve the use of helicopters are fire fighting, tours, as an aerial crane, logging, personnel, personnel transport, electronic news gathering, law enforcement, military and for pleasure. In reality, helicopters can land everywhere that only need the ground lager than 1.5 times the helicopters´ blades. Helicopter like aircraft can fly due to aerodynamic force or Zhukovski force. That is the different pressure between top surface and bottom surface of the blade when the air flows cover it. Figure 1.1 Model of aerodynamic force. The air flows around the blade that has lift and simultaneously appears drag. At the bottom of the blade has pressure higher than the top, recently, there is a force from the bottom to the top and is perpendicular with the blade. This different depends on blade’s profile, angle of attack-angle of flowing air (the cute angle measured between the chord of an airfoil and the relative wind) and rotation of the blades. So the blades rotate with certain speed that is enough for helicopter flying due to aerodynamic force, it means this force higher than helicopter’s weight. The shape and the angle of attack move through the air will determine how much lift force is created. After the helicopter lifted off the ground, the pilot can tilt the blades, causing the helicopter to tip forward or backward or sideward. Lift Thrus Weight Drag
2. MODELLINGTHE SYSTEM page 8 Figure 2.2 Aerodynamic model of the TRMS. The state of the beam is described by four process variables: horizontal and vertical angles measured by position sensors fitted at the pivot, and two corresponding angular velocities. The tacho-generators are used to measure the angular velocities of rotors. In a real helicopter, the aerodynamic force is controlled by changing the angle of attack but in this model the aerodynamic forces are controlled by varying the speed of rotors, the angle of attack is fixed. A change in the voltage value results in a change of rotation speed of the propeller which results in a change of the corresponding position of the beam. Optical encoders: the light beams emitted by two light sources (A and B) go through two rings of slits on the disc. The slits have a phase difference, so that the electric outputs of the receivers (A and B) are rectangular waves with a phase difference. The sign of the phase difference allows the direction of rotation to be determined.
2. MODELLINGTHE SYSTEM page 9 Figure 2.3 Position sensor The control signal flows from the computer through the D/A converter of the data acquisition board. The D/A outputs is wired to the power amplifier output which drives the DC motor. The power amplifier and encoder interface are located in the TRMS box. This box is equipped with two switches: the main power switch and cutting off switch the DC motor power. 2.2 Characteristics of the motors It is necessary to identify the following non-linear functions: • Two non-linear inputs characteristics determining dependence of DC-motor rotational speed on voltage: W m =P(u rr ), w t =P(u tt ) • Tow non-linear characteristics determining dependence of propeller thrust on DC-motor rotational speeds: F h =F h (w t ), F v =F v (w m )
2. MODELLINGTHE SYSTEM page 10 The static characteristics of the propellers should be measured in the case when not delivered with the equipment documentation or if the propellers were changed by user. In this case a proper electronic balance with voltage output [0-10V] is needed. The recommended range of input force is from 0 to 2 N. 2.2.1 Main motor Having the main motor’s characteristics is done by experiment. Making the measurements is correct, first block the beam so that it can rotate around the vertical axis. Place the electronic balance under the beam in such a way that it is pulled vertically up by the propeller. To balance the beam in the horizontal position attaches the beam. Connect the voltage output of the electronic balance to A/D input No.3 of the PLC-812PG or RT-DAC data acquisition board. Figure 2.4 Measuring of main rotor characteristics The result we obtain: rrrrrrrrrrrrrrm uuuuuuuw 41.128345.6364.123826.12973.59999.90)( 23456 ++−−+= mmmmmmv wwwwwwF 2243649512 10.544.910.632.110.123.410.09.110.48.3)( −−−−− +−++−= 2.2.2 Tail rotor To balance the beam in the horizontal position attaches the beam. Connect the voltage output of the electronic balance to A/D input No.3 of the PLC-812PG or RT-DAC data acquisition board.
2. MODELLINGTHE SYSTEM page 11 Figure 2.5 Measuring of tail rotor characteristic The result after measuring ttttttttttttt uuuuuuw 83.379627.26215.428369.1942020)( 2355 ++−−= tttttth wwwwwwF 8080.010.808.110.511.210.595.110.3)( 2437411514 +−+−−= −−−− The rotational speed and the forces of the two rotors have the polynomial of the voltage. They are used in the subsystem and are the non-linear input characteristics. 2.3 Equations of system 2.3.1 Physical model The static characteristics of the DC motors with propellers are non-linear function which connects between a linear dynamic system and static non-linearity and the input voltage is limited to the range +/-10 volts. The linear part is in the form of first order transfer functions G h =1/(T h S+1) and G v =1/(T v S+1). The non-linear function u tt and u rr are characteristics of the DC motors. The non-linear relations between the rotor’s velocity and the resulting aerodynamic force can be approximated the quadratic functions: F h = sign(w t )k h . 2 t w F v = sign(w m )k v . 2 m w k h, k v are positive constants. Figure 2.6 presents the characteristic of the system. There are two propellers driven by DC motors at the end of the pivot. The articulated joint allows the beam to rotate in such a way that its ends move on spherical surfaces.
2. MODELLINGTHE SYSTEM page 12 Figure 2.6 Schematic diagram of TRMS The physical model is developed under some simplifying assumptions: the dynamics of the propeller subsystem is first order differential equations; friction of the system is of the viscous type and propeller-air subsystem accordance with the postulates of flow theory. 2.3.2 Mathematical model Solving the system is considered the rotation of the beam in the vertical plane around the horizontal axis. Applying the Newton’s second law of motion we obtain: 2 2 dt d JM v vv θ = ∑ ∑ = = == 4 1 8 1 , i i vivviv JJMM To determine these elements on above equation, consider the figure below and these parameters are described in the Table 1: F h - θ h F v θ v l m l t l cb l b z -y
2. MODELLINGTHE SYSTEM page 13 Figure 2.7 Side view of TRMS. Moments of gravity forces (M v1 ) applied to the beam and making it rotates around horizontal axis, consider the solution shown in Figure 2.7. +− ++− ++= vcbcbb b vmmsmr m ttstr t v lml m lmm m lmm m M θθ sin 2 cos 22 1 It can be expressed as M v1 =g {[A-B] cosθ v – C sinθ v } Where: += ++= ++= cbtbb b mmsmr m ttstr t lml m C lmm m B lmm m A 2 2 2 Moments of propulsive forces (M v2 ) applied to the beam F v θ v l m l t z y m ms g+m m g m ts g+m tr g m m g m t g l b l cb m b g m cb g
2. MODELLINGTHE SYSTEM page 14 M v2 = l m F v (w m ) Moment of the centrifugal forces (M v3 ) corresponding to the motion of the beam around the vertical axis. vvcbcbb b msmr m ttstr t hv lml m mm m lmm m M θθω cossin 222 2 3 ++ +++ ++−= Or in the compact form: vvhv CBAM θθω cossin)( 2 3 ++−= Where dt d h h θ ω = (1) Moment of friction (M v4 ) depends on the angular velocity of the beam around the horizontal axis. vvv kM ω −= 4 Where dt d v v θ ω = (2) According to fig 2.7 we can calculate components of the moment of inertia relative to the horizontal axis. 3 3 2 2 2 2 b bb cbcbcb m mm mmrmr l mJ lmJ l mJ lmJ = = = = 3 2 2 t tt ttrtr l mJ lmJ = = 22 22 2 ttstststs mmsms ms ms lmrmJ lmr m J += +=
2. MODELLINGTHE SYSTEM page 15 Table 2.1 TRMS model parameters in vertical axis Symbo l Parameter Value Unit M v Total moment of force in vertical plane f(θ v ) Nm M v1 Moments of gravity force f(θ v ) Nm M v2 Moments of propulsive force f(θ v ) Nm M v3 Moment of the centrifugal force f(θ v ) Nm M v4 Moment of friction f(θ v ) Nm J v Sum of moments of inertia relative to the horizontal axis 0.055864 kg- 2 m mr J Moments of inertia of the main DC-motor with main rotor 0.013132 kg- 2 m J m Moment of inertia of main part of the beam 0.000278 kg- 2 m J cb Moment of inertia of the counter weight 0.001149 kg- 2 m J b Moment of inertia of the counter-weight beam 0.000495 kg- 2 m J tr Moment of inertia of the tail motor with the tail rotor 0.012875 kg- 2 m J t Moment of inertia of the tail part of the beam 0.000322 kg- 2 m J ms Moment of inertia of the main shield 0.015622 kg- 2 m J ts Moment of inertia of the tail shield 0.011962 kg- 2 m θ v The pitch angle of the beam rad θ h The yaw angle of the beam rad ω v The angular velocity of the beam around the vertical axis f(θ v ) rad/s ω h The angular velocity of the beam around the horizontal axis f(θ h ) rad/s k v Constant 0.00545371 Nms/rad k h Constant 0.055864 Nms/rad w m The rotational velocity of main rotor f(u tt ) rad/s w t The rotational velocity of tail rotor f(u rr ) rad/s m mr Mass of the main DC-motor with main rotor 0.228 kg m m Mass of the main DC-motor with main rotor 0.0145 kg m tr Mass of the tail motor with the tail rotor 0.206 kg m t Mass of the tail part of the beam 0.0155 kg m cb Mass of the counter weight 0.068 kg m b Mass of the counter-weight beam 0.022 kg m ms Mass of the main shield 0.225 kg m ts Mass of the tail shield 0.165 kg l m The length of main part of the beam 0.24 m l t The length of the tail part of the beam 0.25 m l b The length of the counter-weight beam 0.26 m l cb The distance between the counter-weight and the joint 0.13 m g Gravitational acceleration 9.81 m/ 2 s r ms Radius of main shield 0.155 m r ts Radius of tail shield 0.10 m
2. MODELLINGTHE SYSTEM page 16 Similarity, we can describe the motion of the beam around vertical axis as figure below Figure 2.8 Top view of TRMS From Newton’s second law and the parameters in the Table 2: 2 2 dt d JM h hh θ = ∑ ∑ = = == 3 1 8 1 , i i hihhih JJMM Moments of forces (M h1 ) applied to the beam and making it rotate around vertical axis M h1 = l m F h (w t )cosθ v Moment of friction (Mh2) depends on the angular velocity of the beam around the vertical axis. hhh kM ω −= 2 According to Figure 2.7 we can calculate components of the moment of inertia relative to the horizontal axis. x y F h θ h lt lm
2. MODELLINGTHE SYSTEM page 17 ( ) ( ) ( ) ( ) ( ) ( ) ( ) 2 2 8 2 2 7 2 6 2 5 2 4 2 3 3 2 2 2 1 cos cos 2 sin cos )cos( sin 3 cos 3 cos 3 vmtmmsmsh vttsts ts h vcbcbh vmtmrh vttrh vbh vt t h vm m h lmrmJ lmr m J lmJ lmJ lmJ l m J l m J l m J θ θ θ θ θ θ θ θ += += = = = = = = Or in compact form FEDJ vvh ++= θθ 22 sincos Where D, E, F is constant: 22 22 22 2 ) 3 () 3 ( 3 ts ts msms ttstr t mmsmr m cbcbb b r m rmF lmm m lmm m E lml m D += +++++= += Using all above equations we find: v vhvvvvmvm vv J CBACBAgkwFl dt d dt dS θωθθω θ 2sin)( 2 1 )sincos)(()( 2 2 2 ++−−−+− == (3) v v dt d ω θ = , v ttr vv J J S ω ω += (4)
3. SIMULATOR OF TRMS SYSTEM page 24 Where A(t) is called the state space matrix, B(t) the input matrix, C(t) the output matrix, and D(t) the direct state transmission matrix. 3.3 Linear Parameter Varying (LPV) model for controlling the TRMS system Most of the existing control techniques are based in linear models. However, as we know the above equations of the TRMS system are non-linear. To solve these we have a lot of methods such as: perturbation methods, harmonic balance method, and numerical integration methods. • Perturbation methods: base on the hypothesis that the non-linearity is small, they allow to transform the system into several linear systems, for which an analytical solution is obtained. • Harmonic balance method: the solution is expanded in a truncated Fourier series, transforming the problem into an algebraic one. It’s a frequency domain method. • Numerical integration methods: time domain methods where the time is discrete. All these methods are useful for simulation but not for control. The idea in this master thesis is to use a model that is linear in the structure but preserves the non-linearity by obtaining how parameters vary with the operating point. This kind of model is known as a linear parameter varying (LPV) model. An LPV model for the TRMS system can be obtained by rearranging the non-linear equations presented in chapter 2: trrttvvh v v rrrttvh h h ubuauaaaa dt d dt d ubuauaaa dt d dt d 414645444342 2226252422 ~ ~ +++++= = ++++= = ωθω ω ω θ ωω ω ω θ (4.6) rrr rr ttt tt ubua dt du ubua dt du 6166 5155 += += Where
3. SIMULATOR OF TRMS SYSTEM page 25 mvmrv vv h wJDFDE a FED k a ) ~ sin())() ~ (cos)(( ) ~ (cos) ~ (sin 00 2 24 0 2 0 2 22 θθθθ θθθθ −+−−− = +−+− − = FED J a FED uFl a vv vmr mr vv tthvt +−+− − −= +−+− − = ) ~ (cos) ~ (sin ) ~ cos( 1 ) ~ (cos) ~ (sin )() ~ cos( 0 2 0 2 0 26 0 2 0 2 0 25 θθθθ θθ τ θθθθ θθ vv vv v hv J CBAg a J wCBA a ) ~ ( ) ~ sin() ~ cos()(( )) ~ (2sin()( 2 1 0 00 43 0 42 θθ θθθθ θθ − −−−− = −++− = v tr tr v v J J a J k a τ 1 45 44 −= −= mr tr v rrvm a a J uFl a τ τ 1 1 )( 66 55 46 −= −= = mr rmr tr ttr v tr tr ttr h vmr mr rmr uk b uk b J Juk b J Juk b τ τ τ θθ τ )( )( )( ) ~ cos()( 62 51 41 0 22 = = = − =
3. SIMULATOR OF TRMS SYSTEM page 26 All equations of this model can be described by state space (in code file .. ω =w ) + = r t rr tt v v h h rr tt v v h h u u b b b b u u w w a a aaaaa aaaa u u w w 62 51 41 22 66 55 4645444342 26252422 . . . . . 0 0 0 00 0 00 ~ 00000 00000 0 001000 00 000010 ~ θ θ θ θ =000100 000001 C 0 = D The LPV model is implemented as an S-function (named LPV2, see Appendix) of MATLAB/SIMULINK. We will use this model to compare how well approximates the nonlinear simulation is. The comparison between LPV2 model and the non-linear system TRMS using MATLAB/SIMULINK is presented in figure 3.3.
3. SIMULATOR OF TRMS SYSTEM page 27 Figure 3.3 Simulator of TRMS We can know the movements of two directions (horizontal and vertical) in our model by plotting the graphs from scope block (horizontal and vertical signal outputs). From the inputs runs the Simulink and we obtained the results.
3. SIMULATOR OF TRMS SYSTEM page 28 Figure 3.4 Horizontal signal outputs The signal outputs in horizontal direction show us behaviour of the system. From that we can know our system function at certain range that correspond the inputs (red colour) and will be stable after. Figure 3.5 Vertical signal outputs
3. SIMULATOR OF TRMS SYSTEM page 29 Vertical position (cyan colour) is the movement of the beam in vertical plan. Like horizontal position our system will function around some positions and keep stably at certain points. The LPV2 model is applied in our system by using state space method that is compared with the non-linear model as figure below. Figure 3.6 Horizontal position of LPV2 and Simulink model Figure 3.7 Vertical position of LPV2 (red) and Simulink model
3. SIMULATOR OF TRMS SYSTEM page 30 In figure 3 there are different values of vertical position because in model LPV2 that divided by 0 so avoiding this problem we change the coordinates. To obtain exactly the vertical horizontal between them we can offset again to get the same result. Once the simulator for the non-linear and LPV models is finished, we have all the tools to simulate their behaviour. To control the real system we need to calibrate both models using real data. This step will be done in next chapter.
4. CALIBRATION OF TRMS SYSTEM CONTROL MODEL page 31 4. CALIBRATION OF TRMS SYSTEM CONTROL MODEL 4.1. Introduction Calibration of the TRMS systems control model is done by using the identification toolbox in Matlab. Two different control models will be considered: - the linear parameter varying (LPV) model presented in chapter 3. - a linear model around a given operating point obtained using linearization The aim of this chapter is to tune the calibration algorithm using data coming from the helicopter simulation generated using SIMULINK model. Once the calibration algorithm has been validated, it will be applied using real data. 4.2. Calibration of LPV model using MATLAB (pem command) 4.2.1. Pem and mathematical model To calibrate the LPV model a set of experiments at different operating points will be performed in the TRMS system. Using data coming from these experiments and parameter estimation algorithms from Identification Toolbox in MATLAB parameters will be estimated. Once the parameters for each operating point have been obtained the variation of their value can be interpolated obtaining the LPV model. The parameter estimation algorithm used in MATLAB is the Pem (prediction-error minimization) algorithm. This algorithm allows to estimate low-order continuous-time process models, linear state-space, and polynomial models. Pem also refine initial parameter estimates for all linear and nonlinear parametric models. Pem uses optimization to minimize the cost function that is a function of weighted sum of squares of the errors, defined as follows for scalar outputs: )(),( 2 1 teHGV N t N = ∑ = Where e(t) is the difference between the measured output and the predicted output of the model. For a linear model, this error is defined by the following equation: [ ] )()()()()( 1 tuqGtyqHte −= − e(t) is a vector and the cost function V N (G,H) is a scalar value. The subscript N indicates that the cost function is a function of the number of data samples and becomes more accurate for larger values of N. G (t) is a operator that takes the input to the output and captures the system dynamics or G is a transfer function between u(t) and y(t). H is an operator that
4. CALIBRATION OF TRMS SYSTEM CONTROL MODEL page 32 describes the properties of the additive output disturbance and is the noise model. For multioutput models, the previous equation is more complex. The LPV model of TRMS is presented in chapter 3 with the equations rewriting (see detail in index): + = r t rr tt v v h h rr tt v v h h u u b b b b u u w w a a aaaaa aaaa u u w w 62 51 41 22 66 55 4645444342 26252422 . . . . . 0 0 0 00 0 00 ~ 00000 00000 0 001000 00 000010 ~ θ θ θ θ =000100 000001 C 0 = D Where: mvmrv vv h wJDFDE a FED k a ) ~ sin())() ~ (cos)(( ) ~ (cos) ~ (sin 00 2 24 0 2 0 2 22 θθθθ θθθθ −+−−− = +−+− − = FED J a FED uFl a vv vmr mr vv tthvt +−+− − −= +−+− − = ) ~ (cos) ~ (sin ) ~ cos( 1 ) ~ (cos) ~ (sin )() ~ cos( 0 2 0 2 0 26 0 2 0 2 0 25 θθθθ θθ τ θθθθ θθ vv vv v hv J CBAg a J wCBA a ) ~ ( ) ~ sin() ~ cos()(( )) ~ (2sin()( 2 1 0 00 43 0 42 θθ θθθθ θθ − −−−− = −++− = v tr tr v v J J a J k a τ 1 45 44 −= −=
4. CALIBRATION OF TRMS SYSTEM CONTROL MODEL page 33 mr tr v rrvm a a J uFl a τ τ 1 1 )( 66 55 46 −= −= = mr rmr tr ttr v tr tr ttr h vmr mr rmr uk b uk b J Juk b J Juk b τ τ τ θθ τ )( )( )( ) ~ cos()( 62 51 41 0 22 = = = − = From this analysis the structure of the system matrices can be inferred. This structural information will be used during the parameter estimation process using pem algorithm. 4.2.2. Implementation method • In the first step we need to calculate the coefficients of matrix A and B for calibrating the model by pem command in Matlab. From the Simulink and all equations of the coefficients (a 22 , a 24 ...) we use the block Fcn in Simulink Library Browser to get them. Figure 4.1 Function Fcn All functions will be calculated easily by this block. They receive the inputs and calculate outputs so we can extract values into Matlab. The simulink connects the blocks for calculation in figure 4.2. For example, the coefficient a22 (output) need to be calculated and the input here is θ. The function of a22 will be put in block and will give the values of a22. For other coefficients, we can similarity calculate. • The second step is estimating state space model with structured parameterization:
4. CALIBRATION OF TRMS SYSTEM CONTROL MODEL page 40 • The 3 rd step 0.10-0.15 Figure 4.6 The 3 rd operating point calibration The preceding plot shows that the model output is in reasonable agreement with the measured output: there is an agreement of 98.1% (horizontal position) and 97.85% (vertical position) percent between the model and the validation data.
4. CALIBRATION OF TRMS SYSTEM CONTROL MODEL page 41 • The 4 th step 0.15-0.20 Figure 4.7 The 4 th operating point calibration The preceding plot shows that the model output is in reasonable agreement with the measured output: there is an agreement of 97.58% (horizontal position) and 96.74% (vertical position) percent between the model and the validation data.
4. CALIBRATION OF TRMS SYSTEM CONTROL MODEL page 42 Table 4.1 Result of the calibration Matrices A B 1 0.05 0 0 0 0 0 0 0 1+0.05a 22 0 0.05a 24 0.05a 25 0.05a 26 0 0.05b 22 0 0 1 0.05 0 0 0 0 0 0.05a 42 0.05a 43 1+0.05a 44 0.05a 45 0.05a 46 0.05b 41 0 0 0 0 0 1+0.05a 55 0 0.05b 51 0 State space 0 0 0 0 0 1+0.05a 66 0 0.05b 62 1 0.05 0 0 0 0 0 0 0 0.98107 0 -0.00042 -86.718 -0.00032 0 0.096487 0 0 1 0.05 0 0 0 0 0 -0.00087 -0.05804 0.99511 -7.4081 0.00062 365.05 0 0 0 0 0 0.68308 0 18.7 0 1 st Operating point 0 0 0 0 0 0.96225 0 1.1429 1 0.05 0 0 0 0 0 0 0 0.98149 0 -0.00138 -88.728 -0.00014 0 0.19788 0 0 1 0.05 0 0 0 0 0 -0.00384 -0.05751 0.99508 -12.085 2.26E-03 1317.9 0 0 0 0 0 0.61856 0 43.854 0 2 nd Operating point 0 0 0 0 0 0.96425 0 3.3504 1 0.05 0 0 0 0 0 0 0 0.98161 0 -0.00227 -166.99 -0.00021 0 0.75132 0 0 1 0.05 0 0 0 0 0 0.00034 -0.05620 0.99512 -43.589 5.33E-03 9138.2 0 0 0 0 0 0.27619 0 160.9 0 3 rd Operating point 0 0 0 0 0 0.96544 0 5.5425 1 0.05 0 0 0 0 0 0 0 0.98254 0 -0.00312 -224.16 -0.00018 0 1.275 0 0 1 0.05 0 0 0 0 0 0.58318 -0.02029 1.006 -226.94 1.14E-02 19774 0 0 0 0 0 0.13892 0 243.16 0 4 th Operating point 0 0 0 0 0 0.96667 0 7.665 Table 4.2 Stable points Stable points of the positions from simulation θ v θ h 1 st Operating point -0.92572912253694 0.105774462 2 nd Operating point -0.91345518281618 0.217876897 3 rd Operating point -0.88973319573281 0.316503334 4 th Operating point -0.85044590846964 0.387291297
4. CALIBRATION OF TRMS SYSTEM CONTROL MODEL page 43 We will plot some of coefficients in state space to see the parameters function around the operating point range. Figure 4.8 Estimated coefficients of matrix A
4. CALIBRATION OF TRMS SYSTEM CONTROL MODEL page 44 Figure 4.9 Estimated coefficients of matrix B
4. CALIBRATION OF TRMS SYSTEM CONTROL MODEL page 45 This model is non-linear that is applied to solve linear method but all coefficients are really non-linear and we can see from the graph they change around the operating points. Repeating the calibration that is described so far using real data coming from the real TRMS system, physical parameters of the real system can be estimated. 4.3. Calibration of a LPV model coming from linearization toolbox An alternative way to obtain an LPV model is to linearize the non-linear system around different operating points. This can be automatically done using the linearization toolbox in Matlab/Simulink. The procedure is as follows: From the window Simulink we choose button tools and linear analysis on tool bar. Matlab will automatically extract the value of the coefficients that we used block to calculate above. After that we realize the calibration. This operating point is at t=180 and it is estimated with 4 steps from 0.001-0.20. The results are in table 4.2.
4. CALIBRATION OF TRMS SYSTEM CONTROL MODEL page 46 Figure 4.10 Linearization toolbox window
4. CALIBRATION OF TRMS SYSTEM CONTROL MODEL page 47 • The first step 0.001-0.05 • • • • • • • • Figure 4.11 The 1 st operating point calibration by linearization tool The measured and estimated values are fit together. Horizontal position is 97.41% and vertical is 97.63%
4. CALIBRATION OF TRMS SYSTEM CONTROL MODEL page 48 • The second step 0.05.0.10 Figure 4.12 The 2 nd operating point calibration by linearization tool The measured and estimated values are fit together. Horizontal position is 85.71% and vertical is 80.62%
4. CALIBRATION OF TRMS SYSTEM CONTROL MODEL page 49 • The 3 rd step Figure 4.13 The 3 rd operating point calibration by linearization tool The measured and estimated values are fit together. Horizontal position is 85.38% and vertical is 82.1%
APPENDIX page 56 3. v v dt d ω θ = ~ where tt v tr vv u J J S ... += ω 4. +−+−++− −−−− +−= ))(( 1 )) ~ (2sin()( 2 1 ~ ~)) ~ sin() ~ cos()(()( 0 2 00 tttrtt trv tr vh v v vv vv v v v rr v rrvmv uuku J J CBA J J CBAg J k u J uFl dt d τ θθωθ θ θθθθ ω ω 5. t tr ttr tttr tt u uk udt du ττ )(1 +−= We consider the inputs are non-linear. 6. r mr rrm rr mr rr u uk u dt du ττ )(1 +−=
APPENDIX page 57 *** by Maple: 1. IN LPV2 WE HAVE THE VALUES OF THE MODEL g = 9.81 lb = 0.26 lcb = 0.13 lm = 0.24 lt = 0.25 mb = 0.022 mcb = 0.068 mm = 0.0145 mmr = 0.228 mms = 0.225 mt = 0.0155 mtr = 0.206 mts = 0.165 rms = 0.155 rts = 0.1 taomr = 1.432 taotr = 0.3842 A=(mt/2 + mtr +mts)*lt B=(mm/2+mmr+mms)*lm C=(mb/2)*lb + mcb*lcb D=(mb/3+mmr+mms)*lm 2 E=(mm/3+mmr+mms)*lm 2 + (mt/3+mtr+mts)*lt 2 F=mms*rms 2 + (mts/2)*rts 2 jtr = 0.00001*1.6543 kbal= 5/(2.895 *2048) jmr = 0.00001*2.65 jv = 0.055846 kv = 0.00545371
APPENDIX page 58 kh = 0.0095 jh = Dsin(x) 2 + Ecos(x) 2 +F 2. DEFINITION THE PARAMETER TO OBTAIN LPV2 MODEL We put the parameters equally 0 (1) (2) (3) (4) (5) (6) h h v v tt rr x x w x x w x u x u θ θ θ = = = + = = = % % 22 24 25 26 22 42 43 44 45 46 41 55 51 66 61 h h h h v tt rr r v v v h v v tt rr t tt tt t rr rr r d dt da a a u a u b u dt d dt d a a a a u a u b u dt du a u b u dt du a u b u dt θ ω ωω ω θω ωω θ ω = = + + + + = = + + + + + = + = + % %
APPENDIX page 59 STATE SPACE 22 24 25 26 22 42 43 44 45 46 41 55 51 66 62 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 hh hh v t v v r v tt tt rr rr wa a a a bw u a a a a a b w u w a bu u a b u u θθ θ θ = + & & % & % & & & 1 0 0 0 0 0 0 0 1 0 0 0 C =
APPENDIX page 60 %% LPV2.m %%________ Programe LPV2 %%________ From the non-linear equations %%________ Using S-FUNCTION function [sys,x0,str,ts] = sfuntmpl(t,x,u,flag); switch flag, %%%%%%%%%%%%%%%%%% % Initialization % %%%%%%%%%%%%%%%%%% case 0, [sys,x0,str,ts]=mdlInitializeSizes; %%%%%%%%%%%%%%% % Derivatives % %%%%%%%%%%%%%%% case 1, sys=mdlDerivatives(t,x,u); %%%%%%%%%% % Update % %%%%%%%%%% case 2, sys=mdlUpdate(t,x,u); %%%%%%%%%%% % Outputs % %%%%%%%%%%% case 3, sys=mdlOutputs(t,x,u); %%%%%%%%%%%%%%%%%%%%%%% % GetTimeOfNextVarHit % %%%%%%%%%%%%%%%%%%%%%%% case 4, sys=mdlGetTimeOfNextVarHit(t,x,u); %%%%%%%%%%%%% % Terminate % %%%%%%%%%%%%% case 9, sys=mdlTerminate(t,x,u); %%%%%%%%%%%%%%%%%%%% % Unexpected flags % %%%%%%%%%%%%%%%%%%%% otherwise error(['Unhandled flag = ',num2str(flag)]); end % end sfuntmpl function [sys,x0,str,ts]=mdlInitializeSizes %Here define the number of inputs, outputs and states sizes = simsizes; sizes.NumContStates = 6; %No. State sizes.NumDiscStates = 0; sizes.NumOutputs = 6; %No. ouputs (this case is 6 states) sizes.NumInputs = 2; %No. inputs sizes.DirFeedthrough = 1;
APPENDIX page 61 sizes.NumSampleTimes = 1; % at least one sample time is needed sys = simsizes(sizes); % Inicial parameters % x0 = []; THETA_0=0.5225; %initial condition 30º=0.5225 x0=[0 0 THETA_0 0 0 0]; % str is always an empty matrix str = []; % initialize the array of sample times ts = [0 0]; % end mdlInitializeSizes function sys=mdlDerivatives(t,x,u) %initial variables g=9.81; lb=0.26; lcb=0.13; lm=0.24; lt=0.25; mb=0.022; mcb=0.068; mm=0.0145; mmr=0.228; mms=0.225; mt=0.0155; mtr=0.206; mts=0.165; rms=0.155; rts=0.1; taomr=1.432; %cte time of main rotor taotr=0.3842; %cte time of tail rotor THETA_0=0.5225; A = (mt/2+mtr+mts)*lt; %0.09488; B = (mm/2+mmr+mms)*lm; %0.11046; C = (mb/2)*lb+mcb*lcb; D = (mb/3*lb^2)+(mcb*lcb^2); %0.0016449; E = (mm/3+mmr+mms)*lm^2 + (mt/3+mtr+mts)*lt^2; F = mms*rms^2+(mts/2)*rts^2; jtr=0.00001*1.6543; jmr=0.00001*2.65; jv= 0.055846; kv= 0.00545371; kh= 0.0095; kbal = 5/(2.895*2048); jh = D*sin(x(3)-THETA_0)^2+E*cos(x(3)-THETA_0)^2+F; %horizontal inertia % Polinomials
APPENDIX page 62 pwt = [2020 -194.69 -4283.15 262.27 3796.83 0]; %POLINOMIAl of FUNCION of U_TT pfh = [-.00000000000003 -.00000000001595 .00000025121766 - .00018087473021 .08010909850208 0]; % polinomio en funcion de wt pwm = [90.99 599.73 -129.26 -1238.64 +63.45 1283.41 0]; %POLINOMIO EN FUNCION DE U_RR pfv = [-.00000000000348 .00000000109079 .0000041231489 - .0001632767956 .095447585 0]; %polinomio en funcion de wm % Funciones wt_utt = polyval(pwt,x(5)); %------Characteristic the tail rotor(look MANUAL) liminf=-1381; limsup=1630; wt=max(min(wt_utt,limsup),liminf); fh = kbal*polyval(pfh,x(5)); wm_urr = polyval(pwm,x(6));%x(6)=urr %------Characteristic the main rotor(look MANUAL) liminfp=-568; limsupp=668; wm=max(min(wm_urr,limsupp),liminfp); fv = kbal*polyval(pfv,x(6)); % ESTADOS x = [th,wh,tv,wv,utt,urr] % urr=Wm = x(5); % utt=Wt = x(6); % %Consider non-linear inputs krm_ur=90.99*(u(2))^6+599.73*(u(2))^5-129.26*(u(2))^4- 1238.64*(u(2))^3+63.45*(u(2))^2+1283.41*(u(2)); krt_ut=2020*u(1)^5-194.69*u(1)^4- 4283.15*u(1)^3+262.27*u(1)^2+3796.83*u(1); % % Implement the differential equations of no-linear model % % % sys(1) = x(2); % % % sys(2) = lt*cos(x(3)-THETA_0)*(fh)/jh - (kh/jh)*x(2) + ((E- D)*(cos(x(3)-THETA_0)^2)-(F+D))*jmr*(sin(x(3)- THETA_0)/jh^2)*x(4)*x(6)+ ((jmr*cos(x(3)-THETA_0))/(jh*taomr)) * (- x(6) + krm_ur); % % % sys(3) = x(4); % % % sys(4) = lm*(fv/jv) - (kv/jv)*x(4) + (g*((A-B)*cos(x(3)- THETA_0)-C*sin(x(3)-THETA_0))/(jv)) - (0.5*(x(2)^2)*(A+B+C)*sin(2*(x(3)-THETA_0)))/(jv)+... % % % (jtr/(jv*taotr))*( -x(5) + krt_ut); % % % sys(5) = -1/taotr*(x(5)-krt_ut); % % % sys(6) = -1/taomr*(x(6)-krm_ur);
APPENDIX page 63 % ____OBTAIN THE LPV2 MODEL __ pwt = [2020 -194.69 -4283.15 262.27 3796.83]; pfh = [-.00000000000003 -.00000000001595 .00000025121766 - .00018087473021 .08010909850208]; pwm = [90.99 599.73 -129.26 -1238.64 +63.45 1283.41]; pfv = [-.00000000000348 .00000000109079 .0000041231489 - .0001632767956 .095447585]; sys(1) = [0 1 0 0 0 0]*x; a22 = -kh/jh; a24 = ((E-D)*(cos(x(3)-THETA_0)^2)-(F+D))*jmr*(sin(x(3)- THETA_0)/jh^2)*x(6); a25 = kbal*lt*cos(x(3)-THETA_0)*(polyval(pfh,x(5)))/jh; a26 = -jmr*cos(x(3)-THETA_0)/(jh*taomr); sys(2) = [0 a22 0 a24 a25 a26]*x+[0 ((jmr*cos(x(3)- THETA_0))/(jh*taomr))*polyval(pwm,u(2))]*u; sys(3) = [0 0 0 1 0 0]*x; a42 = -0.5*x(2)*(A+B+C)*sin(2*(x(3)-THETA_0))/jv; a43 = g*((A-B)*cos(x(3)-THETA_0)-C*sin(x(3)-THETA_0))/(jv*x(3)); % *x(3) a44 = -kv/jv; a45 = -(jtr/(jv*taotr)); a46 = kbal*lm*polyval(pfv,x(6))/jv; sys(4) = [0 a42 a43 a44 a45 a46]*x+ [((jtr*polyval(pwt,u(1)))/jv/taotr) 0]*u; sys(5) = [0 0 0 0 -1/taotr 0 ]*x + [(1/taotr)*polyval(pwt,u(1)) 0 ]*u; sys(6) = [0 0 0 0 0 -1/taomr]*x + [ 0 (1/taomr)*polyval(pwm,u(2))]*u; % end mdlDerivatives function sys=mdlUpdate(t,x,u) sys = []; % end mdlUpdate function sys=mdlOutputs(t,x,u) lb =0.26; lcb=0.13; lm =0.236; lt =0.25; mb =0.022; mcb=0.068; mm =0.0145; mmr=0.228; mms=0.225; mt =0.0155; mtr=0.206; mts=0.165; rms=0.155; rts=0.1;
APPENDIX page 64 D = (mb/3*lb^2)+(mcb*lcb^2); %0.0016449; E = (mm/3+mmr+mms)*lm^2 + (mt/3+mtr+mts)*lt^2; F = mms*rms^2+(mts/2)*rts^2; jh= D*sin(x(3))^2+E*cos(x(3))^2+F; jtr=0.00001*1.6543; jmr=0.00001*2.65; jv = 0.055846; THETA_0=0.5225; % DECLAIRE THE OUTPUTS OF MODEL sys(1) = x(1); sys(2) = x(2); sys(3) = x(3) + THETA_0; sys(4) = x(4); sys(5) = x(5); sys(6) = x(6); % end mdlOutputs function sys=mdlGetTimeOfNextVarHit(t,x,u) sampleTime = 1; % Example, set the next hit to be one second later. sys = t + sampleTime; % end mdlGetTimeOfNextVarHit function sys=mdlTerminate(t,x,u) sys = []; % end mdlTerminate
APPENDIX page 65 % CALIRATION m.file y1=theta_h; y2=theta_v; u1=ut; u2=ur; g=9.81; lb=0.26; lcb=0.13; lm=0.24; lt=0.25; mb=0.022; mcb=0.068; mm=0.0145; mmr=0.228; mms=0.225; mt=0.0155; mtr=0.206; mts=0.165; rms=0.155; rts=0.1; taomr=1.432; taotr=0.3842; THETA_0=0.5225; jtr=0.00001*1.6543; jmr=0.00001*2.65; jv= 0.055846; kv= 0.00545371; kh= 0.0095; kbal = 5/(2.895*2048); % Creating a data file trms=iddata([detrend(y1(4000:8000),'constant') detrend(y2(4000:8000), 'constant')],[detrend(u1(4000:8000),'constant') detrend(u2(4000:8000),'constant')]); a22n=mean(a22) a24n=mean(a24) a25n=mean(a25) a26n=mean(a26) a42n=mean(a42) a43n=mean(a43) a46n=mean(a46) b22n=mean(b22) b41n=mean(b41) b51n=mean(b51) b62n=mean(b62) a44=-kv/jv; a45=-jtr/(taotr*jv); a55=-1/taotr; a66=-1/taomr; % Construct Matrices to calibrate