Home
Modular Servo System
Contents
1. Kp 0 0264 i 0 Kp 0 0064 Oli caaqcases eee DO lesscacees4 5 10 15 20 25 30 time s Fig 7 3 Response of the closed loop system with the P controller Modular Servo System User s Manual 39 The controls shown in Fig 7 4 do not reach the zero value It is due to the dead zone of the system which can be observed at the steady state characteristic shown in Fig 6 8 The dead zone of the normalized u is in the range from 0 15 to 0 15 Notice that the control saturates for K 0 0254 Controls 1 Y 18 ees cae See DE NEN 98 peeseaisss paient penes ege PR suns eee 0 4 peus A E Pe cag eg aga i esee eet edi eet mte rete in E zu B LSA s PANE Dt d ee ee 1 1 Pp ac Kos 0 012 LEAN Hee CT I X A I K I E I NA i DE ue 0 WE ana Se f hae or ee Elbe na ds pof L4 od f 0 2 a 299925 Ae 29992228 LT ns PA ue E P Sere SS P E p d d 0 4 H ERES Kp 0 0254 1 1 spice TU A E i o i y sail een ia Y A siue cbe EUBESEEES 4 i i V Hi uenis a a esee denis aan 1 L L L 0 5 10 15 20 25 30 time s Fig 7 4 Controls for different gains of the P controller In the table below the steady state error is shown for the gain coefficients applied in these experiments In accordance with theory if the K increases the steady state error decreases K 0 0064 0 0127 0 0254 E 20 9 1 4 8
2. Figure No 1 422 2 2 Fig 2 7 The response of the system 12 Modular Servo System User s Manual 3 Servo Control Window The user has a quick access to all basic functions of the modular servo control system from the Servo Control Window It includes tests drivers models and application examples Type at the Matlab prompt servo command and Servo Control Window shown in Fig 2 1 opens Simultaneously start m m file is executed which set the default values of the coefficients of the MSS K 186 rad s and T 1 04 s Also the sampling time T is set equal to 0 002 s The window contains four groups of the menu items Tools Basic Test Manual Setup Reset Encoders and Stop Experiment Drivers RTWT Device Driver Simulation Models linear and nonlinear Identification Basic Measurements Steady State Characteristics and Time Domain Identification e Demo Controllers PID Controller and State Feedback Controller applied to a position control and PID controller applied to a velocity control 3 1 Basic test The Basic Test tool was described in the previous section 3 2 Manual setup The Servo Manual Setup program gives access to the basic parameters of the laboratory modular servo setup The most important data transferred from the RT DAC PCI board and the measurements of the servo may be visualised Moreover the control signals can be set Double click the Manual Setup button and the s
3. If all parameters are set properly you can start the executable building process For this purpose press the Build push button on the RTW page Fig 5 4 Successful compilation and linking processes generate the following message Created Real Time Windows Target module MySystem rwd Successful completion of Real Time Workshop build procedure for model MySystem Otherwise an error massage is displayed in the MATLAB command window Modular Servo System User s Manual 30 6 Basic Assignments All experiments described in this manual are performed with servo system consisting of the following modules DC motor with tachogenerator inertia load encoder and gearbox with the output disk In one experiment additionally the backlash module is applied 6 1 Basic measurements In this section quality of measurements in the servo system is concerned The shaft angle is measured with high accuracy by an incremental encoder If the tachogenerator is not used the shaft angular velocity must be reconstructed from the angle measurements If the tachogenerator is used as a velocity sensor then its voltage signal comes together with disturbances therefore it must be filtered ETT vo_Basic_Measurement File Edit View Simulation Format Tools Help Dic Ha et Es S S E 5 Exema gt E ga 2 BEE Measurements Angle encoder iia calculated welocity Signal Calculate Generator Velocity Reset numiz den z fi
4. Modular Servo System MSS MATLAB 7 R14 SP2 SP3 MATLAB R2006a b R2007a R2008a b R2009a PCI version User s Manual www inteco com pl COPYRIGHT NOTICE Inteco Sp z o o All rights reserved No part of this publication may be reproduced stored in a retrieval system or transmitted in any form or by any means electronic mechanical photocopying recording or otherwise without the prior permission of Inteco Sp z o o ACKNOWLEDGEMENTS Inteco acknowledges all trademarks MICROSOFT WINDOWS are registered trademarks of Microsoft Corporation MATLAB Simulink RTWT and RTW are registered trademarks of Mathworks Inc Modular Servo System User s Manual Contents 1 INTRODUCTION AND GENERAL DESCRIPTION eere eee eene eese enne e tense sten aee ee tn nest eene eee eo a 5 TIS Product oVerVIe Ws ue edente eu ueneuneeeleteee e uide 5 1 2 Equipment and requirements isrann E A E nennen nennen etre enne cnn cnn netter tenere 6 1 3 Hardware installation Reenviar eee 7 14 Software Installat ON rM GM 7 2 STARTING TESTING AND STOPPING PROCEDURES eres eese eee eese tone setate eese eee ee ense ees 8 2 1 Statting procedure osito ertet teo Tit cute eM eec v eters ctore bise teme tete derer even 8 2 2 Testing and troubleshoOlmg us eee emere ci Re iain ree eO beet du cree Ubi ve euer reb eet terere eben 8 3 SERVO CONTROL WINDONMN ee es se sa seen saos obe
5. oo PD controller The main goal of the controller tuning is to obtain the standard second order system step response The general form of the second order transfer function is 2 O G G 7 5 2 s 260 5 0 If 0 lt lt 1 then the step response of G s exhibits an exponentially damped sinusoidal character with the following features Modular Servo System User s Manual 40 La ye e percentage overshoot p 100e e 2 settling time t 2 A Q0 41 6 For given p and f one can calculate the damping coefficient and natural frequency e time to peak 1 OQ Comparing a transfer function of the closed loop system which contains the coefficients of the controller with the standard transfer function G s one can calculate the controller coefficients EXAMPLE Assume that we would like to design a PD controller for the position control of the servo system as it is shown in Fig 7 5 Note that at the first glance the state feedback controller is used But remember that lt For this reason the applied controller is PD type t The requirements corresponding to the dynamics of the closed loop system are as follows e settling time 2 5 s e and maximal overshoot p lt 10 Reference Signal velocity Fig 7 5 Position control with the PD controller K The servo system has the transfer function G s pc The transfer function o
6. The discrete system is described by a discrete state equation x n DT Apx nT Bpu nT y nT Cpx nT The matrices A and B are calculated from the continuous state space model using the following well known relations To A e By eat C C I 0 For a discrete model of the DC motor matrices A and B have the form Modular Servo System User s Manual 54 ES i fet md A ng 1 T E B K QG T Q p 0 e K l e If we assume reachability of the pair A B and a control law in the form ul n T KCy In T y EnT 1 K k k we obtain the closed loop system shown in Fig 7 23 yalnTo y nTo q x n D79 Aqx n19 BgulnTo yInTo Cax nTo Fig 7 23 Closed loop system with the feedback gain The closed loop system is described by the equation x n 1 7 5 A By KC x nT Bp Ky nT Feedback gains for the deadbeat controller are calculated from the equation det A1 A BKC loco 0 Design method We can design the deadbeat controller using a simulation method The following steps are necessary in this case 1 choose the sampling time 7 2 create the discrete model 3 calculate feedback gains 4 simulate the closed loop discrete system 5 if the control overruns saturation limits increase the sampling time T and repeat the steps from 1 to 5 EXAMPLE This example shows how to design the deadbeat controller Modular Se
7. Encoder Description The property returns two digits They are equal to the number of impulses generated by the corresponding encoders The encoder counters are 24 bit numbers so the values of this property is from 2 to 27 1 When an encoder counter is reset the value is set to zero The incremental encoders generate 4096 pulses per rotation The values of the Encoder property should be converted into physical units See ResetEncoder Angle AngleScaleCoeff 8 4 Angle Purpose Read the angle of the encoders Synopsis angle_rad get sv Angle Description The property returns two angles of the corresponding encoders To calculate the angle the encoder counters are multiplied by the values defined as the AngleScaleCoeff property The angles are expressed in radians See Encoder AngleScaleCoeff 8 5 AngleScaleCoeff Purpose Read the coefficients applied to convert the encoder counter values into physical units Synopsis scale_coeff get sv AngleScaleCoeff Description The property returns two digits They are equal to the coefficients applied to convert encoder impulses into radians The incremental encoders generate 4096 pulses per rotation so the coefficients are equal to 2 pi 4096 See Encoder Angle 8 6 PWM Purpose Set the direction and duty cycle of the PWM wave Synopsis PWM get sv PWM set sv PWM NewPWM Modular Servo System User s Manual
8. 0 0 1 R 1000 calculate coefficients of the LQ controller K S Tambda 1qry A B C D Q R oo oe type K in Matlab command window K For the default values K 186 rad s and T 1 04 s we obtain K 0 2236 0 054 To perform the real time experiment click the State feedback controller button When the model opens see Fig 7 26 check parameters of the reference signal Build the model click Simulation connect to target and Start real time code option to start experiment The results are given in Fig 7 27 Notice that the reference signal is reached with accuracy equal to 0 58 and without overshoots The control signal saturates Modular Servo System User s Manual 61 p Servo LQ Ix Elle Edit View Simulation Format Tools Help DOS Ha tela y po Estemal Eg Odo BRE amp State feedback controller he E HA Angle amp Referenc n iS 5 N Calculate amp velocity Signal Saturation em Veloso Generatori velocity tacho Reset 1 Er H D osst1 fiterd velocit ej 7 Simple filter Reset Nema Encoders Real time only Servo s gt Ready 100 LU Ti lodeS 4A Fig 7 26 Real time model of the servo with the LQ controller control filterd velocity n Fig 7 27 Results of the position control with a continuous LQ controller Modular Servo System User s Manual 62 7 4 2 The discrete case If we introduce the sampling period T th
9. 7 and K of the linear model of the servo system described by the transfer function a 88 ie 6 1 u s T s that the states of the model fit to the experimentally measured states The step input signal u t 1 is applied to the servo system and the velocity vs time is acquired The surface method is applied to find the system parameters 6 3 1 Identification task by the surface method The velocity signal is denoted as x t Applying the model 6 1 the required parameters K and T can be calculated using the following relations K limx t t gt eo K t T T3 where K lim K x A M t s 0 The surface method is the useful identification algorithm in the presence of disturbances In this case the integral formula filtrates the measurement noises Fig 6 9 shows a typical application of this method to a DC servo identification problem x t w t Fig 6 9 Surface method in the presence of disturbances w t Modular Servo System User s Manual 35 6 3 2 Time domain identification experiment In this experiment MSS includes the following modules the DC motor with tachogenerator inertia load encoder module and gearbox module with the output disk The magnetic break module can be added but in such a case the identified parameters of the system will be different To start the identification experiment type servo at the MATLAB prompt and Servo Control Window appears Now dou
10. Convert voltage into velocity Volt2Vel 20 4 Volt 2 Plot data subplot 211 plot Control VelEnc 2 Control VelEnc 2 x grid title Encoder velocity vs PWM xlabel PWM control value ylabel Velocity rad s subplot 212 plot Control Volt2Vel Control Volt2Vel x grid title Tacho velocity vs PWM xlabel PWM control value ylabel Tacho velocity rad s end Assign data to the structure returned by the function ChStat Control Control ChStat TachoVelocity VelEnc 2 ChStat EncoderVelocity Volt2Vel 9 Switch off the control set sv Stop The diagrams generated by the call servo pwm2rpm r 0 5 0 5 19 are shown below The diagrams present the velocity of the shaft as function of the control signal The control signal changes from 0 5 to 40 5 The velocity value is obtained in two ways At the upper diagram the velocity is calculated from the encoder positions The lower diagram presents the velocity obtained from the tachogenerator Modular Servo System User s Manual 73 velocity vs PWM characteristic 8 xl Velocity rad s Tacho velocity rad s 100 L 1 L i L i L L L 5 0 4 0 3 02 0 1 a 0 1 0 2 0 3 0 4 0 5 PWM control value Fig 8 1 Result of the servo_pwm2rpm function call The values on the diagram may vary from an experiment to an experiment as t
11. K 0 15 and K 0 03 iBix leamos ABE Velocity amp Reference filtered control Fig 7 17 The results of the PID velocity control Build the model and run the real time code The results of the experiment are given in Fig 7 17 One can see that the disturbances of the motor load are introduced manually after five seconds from the start and remain active in tha period of 15 seconds Note that the control increases in this time interval The results are stored in the VelCtrl variable stored in the Matlab workspace Type at the Matlab prompt plot VelCtrl time VelCtrl signals 1 values 2 r VelCtrl time VelCtrl signals 1 values 1 k grid xlabel time s title Reference velocity red measured velocity black The plot is shown in Fig 7 18 In this scale the differences between the diagrams are unvisible The details of the reference velocity and the measured velocity are shown in Fig 7 19 Modular Servo System User s Manual 49 Reference velocity red measured velocity black 15 20 25 30 time s Fig 7 18 Reference and measured velocity Reference velocity red measured velocity black 40 39 8 39 6 39 4 39 2 39 38 8 38 6 38 4 L L Ll 12 2 12 3 12 4 12 5 12 6 12 7 12 8 12 9 time s Fig 7 19 Zoomed data The tracking error of the velocity at 12 5 seconds is equal to 1 Of course this error
12. Read the base address of the RT DAC PCI board Synopsis BaseAddress get sv BaseAddress Description The base address of RT DAC PCI board is determined by computer Each CServo object has to know the base address of the board When a CServo object is created the base address is detected automatically The detection procedure detects the base address of the first RT DAC PCI board plugged into the PCI slots Example Create the CServo object sv CServo Display their properties by typing the command SV Type BaseAddress Bitstream ver Encoder Reset Encoder Input voltage PWM PWM Prescaler Thermal status Thermal flag Angle Time Read the base address BA get sv BaseAddress 8 2 BitstreamVersion CSERVO Object 54272 D400 Hex x402 0 46606 bit 0 1123 0 1123 V 0 0 0 0 0 1 0 71 4927 rad 31 657 sec Purpose Read the version of the logic stored in the RT DAC PCI board Synopsis Version get sv BitstreamVersion Description The property determines the version of the logic design of the RT DAC PCI board The modular servo models may vary and the detection of the logic design version makes it possible to check if the logic design is compatible with the physical model 8 3 Encoder Purpose Read the incremental encoder registers Modular Servo System User s Manual 67 Synopsis enc get sv
13. Therm Flag MySystem Servo Display Therm Flag X Display Version MySystem Servo Display Version X ot MySystem Pot ET Velocity Scope MySystem Velocity Scope Trigger signa Go to block calculated velocity Duration 300000 Delay o pus o E Trigger Source manual Mode normal y Trigger signal Pork 1 Element any v Aim when connect to target Direction rising Level 0 4 Hold off 0 Revert Help Apply Close Fig 5 3 External Signal amp Triggering window 5 2 Code generation and the build process Once a model of the system has been designed the code for real time mode can be generated compiled linked and downloaded into the computer The code is generated by the use of Target Language Compiler TLC see description of the Simulink Target Language The make file is used to build and download object files to the target hardware automatically First you have to specify the simulation parameters of your Simulink model in the Simulation parameters dialog box The RTW page appears when you select the RTW tab Fig 5 4 The RTW page allows you to set the real time build options and then to start the building process of the executable file Modular Servo System User s Manual 28 Simulation Parameters MySystem m x Workspace 1 0 Diagnostics Advanced Real Time Workshop Category Target configuration Y Build Configuration System target file ttwin tle Browse Templat
14. a first order inertial system T Ot 0 t K v t where the motor time constant T and motor gain K are given by pR K K BR K K The transfer function has the form Modular Servo System User s Manual 22 Os Ko eg v s 7 T s l The transfer function for the motor position has the form as Ko oum v s B s T s 1 The control applied in the system is a PWM signal that s way we assume the dimensionless control signal as the scaled input voltage u t v f v The admissible controls satisfy lu t lt 1 Defining also K K sm V max we obtain transfer functions in the forms Velocity transfer function Angle transfer function Qs K S u s E T s l1 G s G s Gs K E u s E s T s 1 The model can be written using a state space notation Let x col x x be the state vector where x is the angle in rad determining the position of the motor shaft and x is the respective angular velocity in rad s Time t is measured in s There are the following state equations dye eis Xx ax t bu where a jpa gt 0 T T s Ss The equivalent classical matrix state space notation has the form where x Ax Bu y Cx The system can be classified as a multivariable SIMO because it has two measurable state variables and one control variable The parameters T and K must be identified by a user Modu
15. and displayed Fig 2 5 Figure No 1 B ni x File Edit view Insert Tools Window Help isaskar 9952 Glose this figure to terminate the test Angles rad Time s Fig 2 5 Angle measurement test e To check whether the potentiometer works correctly double click the Check Reference Pot button Next click the Yes and turn the potentiometer right and left Fig 2 6 shows an example of the proper measurements of the potentiometer position Modular Servo System User s Manual 10 igi x File Edit View Insert Tools Window Help OSM SIR AAS PER Close this figure to terminate the test Voltage V Time s Fig 2 6 Position of the reference potentiometer In the next step of the basic tests one can check whether the control and measurements of the angle and velocity in MSS are correct This experiment is not performed in real time mode e Double click the Control Impulse Response button and start experiment clicking the Yes button BasicTestFunction Step 5 x The motor is going to operate Do you want to start The results of experiments are shown in Fig 2 7 The control impulse has a square wave form The first part of the control signal is positive and the second one is negative Note that angle and velocity signals are positive at the beginning and next fall down to the negative values It means that the measurements are correct Modular Servo System User s Manual 11
16. ey o l t 3 l ay 4 I Gg UO o P 7 Quis ssp decere AO A le e 2 n 4 m 38 o _ 2 C i 2 4 Al o e pee a t 4Q E 5 l 5 I o E l c E l UM IM rhe eere Bed o l 2 o 8 A gt o 200 150 Fig 6 3 Comparison of the velocity measurements 32 Modular Servo System User s Manual Filtered velocity red Butterworth filter blue simple filter Filtered velocity red Butterworth filter blue simple filter 200 4_ 40 40 02 40 04 40 06 40 08 40 1 40 12 40 14 40 16 40 18 40 2 time s press any key time s press any key Fig 6 4 Comparison of the velocity measurements 6 2 Steady state characteristics of the DC servo Double click the Static characteristics button in Servo Control Window The window given in Fig 6 5 opens In this window one defines the minimal and maximal control values and a number of measured points Also the control order can be set as Ascending Descending or Reverse Measure Velocity vs PWM 1 O xl Minimal control value 1 0 Maximal control value 1 0 Control order Reverse m No of measured points 51 Help ACUSE Fig 6 5 Parameters of measurement of static characteristics The Run button starts the experiment The constant value of the control activates the DC motor so long as a steady state of the shaft angular velocity is achieved Then the veloci
17. if temperature rises The backlash in a system deacreases control performance and in most applications introduces oscillations to the controlled system At the beginning the backlash have to be added to existing servo system Add this module between the inertia and the encoder modules in the system chain It is important that encoder measures an angle after the backlash module To test a behaviour of the real time system with the backlash module for different gains of the P controller click PID control continuous button in Servo Control Window The model given in Fig 7 1 opens Type K 0 1024 0 0 at the MATLAB prompt It sets the proportional coefficient K of the P controller Assuming a desired range of the change of the output disk equal to pi 2 set the reference input signal equal to 25 pi 2 it is the measured angle at the input to the gearbox Also set the frequency of the reference input to 0 05 Hz and sample time to 0 002 s e Build the model e Click the Simulation Connect to target and Start real time code options to start the experiment The results are given in Fig 7 12 and Fig 7 13 Position control with P controller 80 Olea Altas 20L T E En 20 CORRA La En fe AG te DOAJ 0L 80 0 time s Fig 7 12 Position control with the backlash module K 0 1024 Notice that there are
18. infinite settling time However in applications we frequently encounter the situation when the termination moment of the control process is so far away that it does not affect the current control actions The infinite time optimal control problem is then posed The cost function is replaced by the formula J u fle eect u t Ru t dt 7 3 Then the optimal scalar control u and the optimal trajectory vector y are given u K y y 7 4 where K is the feedback matrix The optimal control problem is now defined as follows find the gain K such that the feedback law 7 4 minimises the cost function 7 3 subject to the state equation 7 2 The calculation of the control variable which minimizes the criterion 7 3 is a dynamic optimisation problem This problem can be solved by variation calculus applying the maximum principle due to the Bellman optimisation principle The procedure returns the optimal feedback matrix K the matrix S the unique positive definite solution to the associated matrix Riccati equation SA ATS SBR BTS Q0 0 Due to the quadratic appearance of S there is more than one solution and S must be positive definite to select the correct one The procedure returns also the matrix E the closed loop roots E eig A B K C The vector K can be calculated by a numeric iterative formula on the basis of the Riccati equation The associated closed loop system e A BKC e is asymptotically stable To
19. previous example Modular Servo System User s Manual 64 Angle amp Reference amp velocity 5 x 68 922 hse oes Angle amp ref control Fig 7 28 Results of the position control by the discrete LQ controller Modular Servo System User s Manual 65 8 Description of the Modular Servo class properties The CServo is a MATLAB class which gives the access to all the features of the RT DAC PCI board equipped with the logic for the MSS model The RT DAC PCI board is an interface between the control software executed by a PC computer and the power interface electronic of the modular servo model The logic on the board contains the following blocks e incremental encoder registers two 24 bit registers to measure the position of the incremental encoders There are two identical encoder inputs that may be applied to measure the shaft positions of two modular servo blocks e incremental encoder reset logic The incremental encoders generate different output waves when the encoder rotates clockwise and counter clockwise The encoders are not able to detect the reference zero position To determine the zero position the incremental encoder registers have to be set to zero by the computer program e PWM generation block generates the Pulse Width Modulation output signal Simultaneously the direction signal and the brake signal are generated to control the power interface module The PWM prescaler determin
20. the tachogenerator The filter applied in other models is not discrete one and can not be used here However it is interesting how the controller works without filtering of the velocity signal Set the amplitude of the input signal to 25 pi 2 as in the previous example the frequency of the reference signal to 0 05 Hz Set simulation time equal to 60 s and time range in the scope also equal to 60 s Due to the fact that the model includes variables K and T and some settings are changed rebuild it Click Simulation Connect to target Click the Start real time code option to start the experiment The results are shown in Fig 7 25 Modular Servo System User s Manual 57 Angle amp Reference amp velocity 0 x jano sp ABB Oak Angle amp ref control Fig 7 25 Results of the position control using the deadbeat controller Note that the system does not reach the reference angle in two steps In fact the servo is a nonlinear system and it is only approximated by a linear model Notice that this control is significant only during two first sampling intervals 7 4 Optimal design method LQ controller The linear quadratic problem LQ problem is a central one in the theory and applications of optimal control There are two versions of the LQ problem the open loop and the closed loop optimal control problems Either the optimal control is given as an explicit function of time for fixed initial conditions or
21. y 0 5 10 15 20 25 30 time s Fig 7 15 Control signal 7 2 PID Velocity control The task of the velocity control is to keep the desired velocity in the presence of disturbances The disturbances can be introduced as a change of the velocity reference signal or as a change of the motor load To disturb the reference velocity the potentiometer can be used The load disturbances can be introduced by braking slightly the inertia load of the system In the example the load disturbances are introduced manually Click the Velocity control button in Servo Control Window and model shown in Fig 7 16 opens Velocity amp Reference gt 1 0 2841 filtered control PID velocity control peo sp Pi Signal Generator PID Control 1 E 595 0 4 Reset Normal Reset Encoders Saturation real time only Simple fi velocity tacho Fig 7 16 PID velocity control in the real time system d to rad Angle Tencoad adds Calculate Velocity 1 gt El 0 05s 1 Simple filter Reference amp Velocity Control filterd elocity Modular Servo System User s Manual 48 Set the sine reference velocity amplitude equal to 40 rad s and frequency equal to 0 1 Hz Simulation time set equal to 30 s The Gain of the potentiometer set equal to zero The coefficients of the PID controller set to the following values
22. 68 Description The property determines the duty cycle and direction of the PWM wave The PWM wave and the direction signals are used to control the DC drive so in fact this property is responsible for the DC motor control signal The NewPWM variable is a scalars in the range from 1 to 1 The value of 1 0 0 and 1 mean respectively the maximum control in a given direction zero control and the maximum control in the opposite direction to that defined by 1 The PWM wave is not generated if the thermal flag is set and the power amplifier is overheated See PWMPrescaler Therm ThermFlag Example set sv PWM 0 3 8 7 PWMPrescaler Purpose Determine the frequency of the PWM wave Synopsis Prescaler get sv PWMPrescaler set sv PWMPrescaler NewPrescaler Description The prescaler value can vary from 0 to 63 The O value generates the maximal PWM frequency The value 63 generates the minimal frequency The frequency of the generated PWM wave is given by the formula PWM trequency 4OMHz 1023 Prescaler 1 See PWM 8 8 Stop Purpose Sets the control signal to zero Synopsis set sv Stop Description This property can be called only by the set method It sets the zero control of the DC motor and is equivalent to the set sv PWM 0 call See PWM 8 9 ResetEncoder Purpose Reset the encoder counters Synopsis set sv ResetEncoder ResetFlags Mo
23. Displays the number of the PCI bus where the current RT DAC PCI board is plugged in The parameter may be useful to distinguish boards when more then one board is used Slot number The number of the PCI slot where the current RT DAC PCI board is plugged in The parameter may be useful to distinguish boards when more then one board is used Base address The base address of the selected RT DAC PCI board The RT DAC PCI board occupies 256 bytes of the I O address space of the microprocessor The base address is equal to the beginning of the occupied I O range The I O space is assigned to the board by the computer operating system and may differ from one computer to another The base address is given in the decimal and hexadecimal forms Logic version The number of the configuration logic of the on board FPGA chip A logic version corresponds to the configuration of the RT DAC PCI boards defined by this logic Application Modular Servo System User s Manual 14 The name of the application the board is dedicated for The name contains four characters In the case of the MSS it has to be SERV string I O driver status The status of the driver that allows the access to the I O address space of the microprocessor The status displayed has to be OK string In other case the driver HAS TO BE INSTALLED e Encoders frame The state of the encoder channels is given in the Encoder frame Channel 0 Channel 1 The values of the encoder coun
24. K els S where error K proportionality coefficient K integration coefficient and K derivation coefficient P controller A goal of the control is to track a reference signal which is defined as a square wave In this section the P controller is investigated Modular Servo System User s Manual 38 Fig 7 2 Position servo control with the P controller The diagram of the closed loop system is shown in Fig 7 2 It is well known that increasing gain leads to oscillations To test the real time system for different gains of the P controller click PID control continuous button in Servo Control Window The model given in Fig 7 1 opens We start with a small value of the gain of the P controller Type K 0 0064 0 0 at the MATLAB prompt It set proportional coefficient K of the P controller Assuming a desired range of the change of the output disk equal to pi 2 set reference input signal equal to 25 pi 2 it is the measured angle at the input to the gearbox Also set frequency of the reference input to 0 05 Hz and sample time to 0 002 s e Build the model e Click the Simulation Connect to target and Start real time code options to start experiment Next repeat the experiment for the new setting K 20 0127 and K 0 0254 The results of all experiments are given in Fig 7 3 and Fig 7 4 Note that oscillations of the system response appear if K 0 0127and K 20 0254 Position control with P controller 80
25. User s Manual The manual e shows step by step how to design and generate your own real time controller in MATLAB Simulink environment e contains the library of ready to use real time controllers and e includes the set of preprogrammed experiments 1 1 Product overview The MSS setup Fig 1 1 consists of several modules mounted at the metal rail and coupled with small clutches The modules are arranged in the chain The DC motor together with tachogenerator opens the chain The gearbox with the output disk closes the chain The potentiometer module is located outside the chain For example the DC motor can drive activates the following modules inertia backlash encoder module magnetic brake and the gearbox with the output disk The rotation angle of the DC motor shaft is measured using an incremental encoder Anywhere the rotational angle measurement is required we can place the encoder A tachogenerator is connected directly to the DC motor and generates a voltage signal proportional to the angular velocity Tachogenerator DC motor Modular Servo System User s Manual 5 Encoder Magnetic Gearbox with brake output disk Fig 1 1 The MSS setup The servomechanism is connected to a computer where a control algorithm is realized based on measurements of angle and angular velocity The system has no inner feedback for dead zone compensation The accuracy of measu
26. ack routines when the user selects a menu item i3 Servo File Edit View Simulation Format Tools Help Reset Encoders Modular Servo Device Driver Linear Simulation Model Basic Measurements Static Characteristic Time domain identification Control PID O x continous State Feedback Control continous State Feedback Control discrete Nonlinear Simulation Model Fig 2 1 The Servo Control Window The Servo Control Window contains testing tools drivers models and demo applications See section 3 for a detailed description 2 2 Testing and troubleshooting This section explains how to perform the tests These tests allow checking if mechanical assembling and wiring has been done correctly The tests have to be performed obligatorily after assembling the system They are also necessary if an incorrect operation of the system takes place The tests are helpful to look for reasons of errors when the system fails The tests have been designed to validate the existence and sequence of measurements and controls They do not relate to accuracy of the signals First you have to be aware that all signals are transferred in a proper way Five testing steps are applied Modular Servo System User s Manual 8 e Double click the Basic Tests button The following window appears Fig 2 2 E Servo_BasicTest ini x File Edit View Simulation Format Tools Help Fig 2 2 The Basic Tests window T
27. ain of the model and the vector which contains the static characteristics of the servo system Refer to section 4 for the details x Nonlinear Simulation Model p Subsystem mask r Parameters Initial conditions angle velocity o Gain c 206 0 Control Static characteristic velocity control vpwm pwm Cancel Help Apply Nonlinear Simulation Model Fig 3 6 Nonlinear Simulation Model and its mask The simulation models are running in the normal simulation mode Choose Fixed step solver options and set Fixed step size equal to 0 002 It is gt necessary because the default value of the sampling time of all real time models is equal to 0 002 s Modular Servo System User s Manual 19 3 5 Identification The consecutive buttons in the group Identification of the Servo Control Window perform the following tasks Basic Measurements contains a real time Simulink model where a saw shape control signal is given as the input of the servo system and four velocities are plotted in a scope measurements reconstructed from encoder e measurement directly from tachogenerator e filtered tachogenerator voltage using low pass Butterworth filter e filtered tachogenerator voltage using simple first order filter The experiment allows to decide which kind of velocity measurements can be used in following experiments Plot basic measurements push button activat
28. aracteristic of DC servo Ele Edit view Insert Tools Window Help 200 r r r r r r r OSBSIRA7 12990 LU d d ik us E A ABO EE pe ey ee le oe tats eee le he aly See EE QE RI Measured characteristic I i i i i p l l i 1 I l I l l l TOO p e Ea AN I 1 L A I 2 l l l l i l l B Cl E A A I l l l l i i I l gt p I l 1 w l 8 d ES AA A ale ete Seen 9 l l Y l l I 1 g 5 l 1 gl I E eee eh he cdi A EErEE TETEE i gt i l P l l l l pa lt LY ago l l l I a 1 LA d 1 l l I 1 2 OO pesce ss puce epp eet pe prep NF UE l E ie l l l l 1 cer um PE es EM e MUT coe ee l l 200 l l i l l i l i l 1 0 8 0 6 0 4 0 2 0 02 0 4 0 6 0 8 1 a of 96 2 0 wa GG mE al u normalised u normalised Fig 6 7 Collecting points of the static Fig 6 8 Averaged and shifted static characteristic characteristic Building a new static characteristics is a seldom operation Please do not forget to save the old characteristics with an appropriate description in a safe place The details are included in the plot_stat m file which executes all operations mentioned above Modular Servo System User s Manual 34 The characteristics saved in the servo stat mat file is used in the construction of a nonlinear model of the servo system 6 3 Identification in time domain The task is to find the parameters
29. ase example Assume that sampling time for discrete system T 0 1 s In Servo Control Window double click the State feedback control discrete button To design the LQ controller click the Calculate LQ controller button It executes the servo calc lq d m file presented below State space representation of servo A 0 1 0 1 Ts 0 Ks Ts 1 0 0 1 zeros 2 1 B D oe set sampling time TO 0 1 calculate discrete model from continuous Ad Bd c2d A B TO oe oe set Q and R matrices Q 50 0 0 1 R 1000 design discrete LQ controller K S lambda dlqry Ad Bd C D Q R K For the default values K 186 rad s and T 1 04 s we obtain K 0 139 0 0395 To perform the real time experiment click the State feedback controller button and the model shown in Fig 7 24 opens It is the same model as was previously applied to the deadbeat control Set the frequency of the reference signal to 0 1 Hz the simulation time to 30 s and the time range of the scope to 30 s These settings correspond to the values which have been assumed for the continuous LQ controller Build model click the Simulation connect to target and the Start real time code options to start experiment The results are shown in Fig 7 27 They are similar to these for the continuous controller The reference signal is reached with accuracy equal to 1 and without overshoots The control signal saturates as in the
30. ated If the thermal flag is set and the power interface is overheated the RT DAC PCI board automatically switches off the PWM control signal e Analog inputs frame The Analog inputs frame displays two measured analog signals Potentiometer Presents the voltage at the output of the potentiometer block Tacho Presents the voltage at the output of the tachogenerator Modular Servo System User s Manual 16 3 3 RTWT Driver The main driver is located in the RTWT Device Driver column The driver is a software so between for the real time MATLAB environment and the RT DAC PCI I O board This driver serves the control and measurement signals Click the Modular Servo Device Driver button and the driver window opens Fig 3 2 Servo_DevDriv EIE File Edit View Simulation Format Tools Help Ole j Imi Y 999999 Extemal 7 Control Reset Reset Encoders Ready 10095 Fig 3 2 RTWT Device Driver When one wants to build his own application he has to copy this driver to a new Simulink diagram Do not introduce changes inside the original driver They can be done only inside its copy The device driver has two inputs control u t c 141 and signal Reset If the Reset signal changes to one the encoders are reset and do not work If the Reset signal is equal to zero encoders work in the standard way It means when switching occurs encoders reset and start measure when the switch returns to the zero
31. ation parameters page for MATLAB 7 04 and higher versions Modular Servo System User s Manual 29 The Solver page appears when you select the Solver tab Fig 5 6 The Solver page allows you to set the simulation parameters Several parameters and options are available in the window The Fixed step size editable text box is set to 0 002 this is the sampling period in seconds The Fixed step solver is obligatory for real time applications If you use an D gt arbitrary block from the discrete Simulink library or a block from the driver library remember that different sampling periods must have a common divider The Start time has to be set to O The solver has to be selected In our example the fifth order integration method ode5 is chosen i Configuration Parameters MySystem Configuration Select Simulation time Solver Start time 0 0 Stop time 55 Data Import Export T ptimization Diagnostics EE A Sample Time Type Fixed step v Solver ode5 Dormand Prince Data Integrity Conversion Connectivity Compatibility Tasking mode for periodic sample times SingleT asking Model Referencing C Higher priority value indicates higher task priority Hardware Implementation zy Model Referencing i i Real Time Workshop Comments Sumhals Solver options Periodic sample time constraint Unconstrained Fixed step size fundamental sample time 0 002 v Fig 5 6 Simulation parameters
32. ble click the Time domain identification button The model shown in Fig 6 10 opens Build model in the case if it has not been done before Next select the Simulation Connect to target option and click the Simulation Start real time code The servo starts to move and one can observe the velocities displayed in the screen see Fig 6 11 Servo T ident File Edit View Simulation Format Tools Help OISHS kt SB Li Sho Extemal Dal calculated velocity 1 filter II Simple filter Velocity Normal Real time Fig 6 10 Real time Simulink model for identification 01x legmiooe op amgug Gar calculated velocity filter Il Fig 6 11 Step response of the servo Modular Servo System User s Manual 36 Click the Calculate model button This action starts the plot ident m file where the surface method is applied and the parameters of the servo model are calculated Consequently Fig 6 12 opens and two plots are displayed in the screen velocity obtained from the measurements red e velocity calculated from the model black At the top of the figure the obtained coefficients and the Mean square error denoted by J corresponding to data fitting are displayed The coefficients are also displayed in the Matlab window LT ons File Edit View Insert Tools Window Help JOSH S RAAL Er Ks 186 6377 and Ts 21 0889 J 0 0101 200 g 100 velocity rad s time sec Fig 6 12 Mea
33. creen shown in Fig 3 1 opens The application contains four frames e RT DAC PCI board Encoders Control and Analog inputs All data presented by the Servo Manual Setup program are updated 10 times per second e RT DAC PCI board frame The RT DAC PCI board frame presents the main parameters of the RT DAC PCI I O board No of detected boards Presents the number of detected RT DAC PCI boards If the number is equal to zero it means that the software has not detect any RT DAC PCI board When more then one board is detected the Board list must be used to select the board that communicates with the MSS control program Modular Servo System User s Manual 13 Board Contains the list applied to select the board currently used by the program The list contains a single entry for each RT DAC PCI board installed in the computer A new selection at the list automatically changes values of the remaining parameters ao gt RT DACA PCI board m Control No of detected boards 1 A 0 22 Board Board 1 i Bus number Slot number PM prescaler 2 Thermal flag status M J Base address Logic version Application 120 driver status Ok r Encoders Analog inputs Value Angle rad Reset Voltage V Channel 0 0 0 00 E Potentiometer 0 34 Channel 1 27914 42 82 Tacho 0 60 neo Fig 3 1 View of the Servo Manual Setup window Bus number
34. d 1 Bd 2 Ad 2 2 Bd 1 Ad 1 2 Bd 2 Ad 1 1 Bd 2 X Ad 1 1 Ad 2 2 Ad 1 1 Ad 2 2 K ZNX Now coefficients of the controller are saved in K checking if the control saturates in the first sample time The variables K andT are stored in the MATLAB workspace after the execution of the above m file In our case for K 186 rad s K 0 0127 0 0091 and T 0 7950 and T 1 04 s we obtain Now double click the State feedback controller buttons to perform the real time experiment and the model depicted in Fig 7 24 opens Modular Servo System User s Manual 56 Eiser vo LQ D File Edit View Simulation Format Tools Help Dic et S cl wm Exema v DR 9 8 m0 EA TD y TO is sampling iie State Controller discrete Angle amp Referen Calculate amp velocity Signal Velocity1 Generator Normal Encoders Real time only Fig 7 24 State feedback controller a discrete model This model differs in details from the other models Due to the fact that the model is discrete and the sampling time 7 can vary from experiment to experiment 7 is read from the Matlab workspace Variable T is located in the Simulink model in the following places in Fixed step size in tag Solver which is located in Simulation Simulation Parameters option in all Zero Order Hold blocks and in the mask of the Servo device driver There is no filter connected to the output of
35. d steady state error are as follows Py 12 5 t 2 2 23 s and e 0 33 96 The overshoot is a little greater than the assumed one but the settling time is fine and the steady state error is perfect We can conclude that the goal of the control is satisfied and that the PD controller just designed works well Response of real system with corrected PD controller 50 T T T T T T T T FIL i IM LIS eee Toran rere aoe iR I JR eme EE RED EE EE eae cane ae nue lac at nae MB Or CES GAD MM MEE ais MEM Ll aaa ices inl ance ae a a a TM a EM eun Mil snos A exu Md ee m E Pen T A e a R 30 4 1 1 1 iode Lassen Lans 49 ___ deb Vd 50 0 1 2 3 4 5 6 7 8 9 10 time s Fig 7 10 Response of the real system with the corrected PD controller Position control with the backlash module In this section position control problem is considered when the backlash exists in the servo system as it is shown in Fig 7 11 a K s s sT 1 ref Backlash Fig 7 11 Position servo control with the backlash and P controller Modular Servo System User s Manual 45 The backlash is present in a number of mechanical and hydraulic systems In many cases backlash is necessary to proper work of a mechanical system A gearbox without backlash will not work
36. dular Servo System User s Manual 69 Description The property is used to reset the encoder registers The ResetFlags is a 1x2 vector Each element of this vector is responsible for one encoder register If the element is equal to 1 the appropriate register is set to zero If the element is equal to 0 the appropriate register counts encoder impulses See Encoder Example To reset only the first encoder register execute the command set sv ResetEncoder 10 8 10 Voltage Purpose Read two voltage values Synopsis Volt get sv Voltage Description Returns the voltage of two analog inputs Usually the analog inputs are applied to measure the position of the external potentiometer and the output of the tachogenerator 8 11 Therm Purpose Read thermal status flag of the power amplifier Synopsis Therm get sv Therm Description Returns the thermal flag of the power amplifier When the temperature of a power amplifier is too high the flag is set to 1 See ThermF lag 8 12 ThermFlag Purpose Control an automatic power down of the power amplifiers Synopsis ThermFlag get sv ThermFlag set sv ThermFlag NewThermFlag Description If the ThermFlag and NewThermFlag are both equal to the DC motor is not excited by the PWM wave when the power interface is overheated See Therm Modular Servo System User s Manual 70 8 13 Time Purpose Return time informati
37. e makefile servo win vc tmf Make command maket Generate code only Stateflow options Solver DK Cancel Help Apply Fig 5 4 RTW page of the Simulation parameters dialog box MATLAB 6 5 The system target file name is rtwin tlc It manages the code generation process The servo_win_vc tmf template make file is devoted to C code generation using the Microsoft Visual C compiler The servo_win_watc tmf template file has to be applied if the Open Watcom 1 3 compiler is used If the Matlab 7 0 4 or higher version is used a third party compiler is not required The built in Open Watcom compiler is used to creating real time executable code for RTWT The Configuration parameters page for MATLAB 7 04 is shown in Fig 5 5 Notice that rtwin tmf template makefile is used This file is default one for RTWT building process i Configuration Parameters Tank3 Relay Configuration Target selection i Solver Data Import Export Optimization Language t Diagnostics Description Real Time Windows Target System target file ERT Browse r Documentation TP Generate HTML report Launch report after code generation completes Model Referencing Hardware Implementation Model Referencing TLC options Oe HESETRDENM chen Make command make rtw Template makefile rtvin tmf Generate code only Build Build process Fig 5 5 Configur
38. easured point is plotted and saved Often we choose the Decimation parameter value equal to 5 This is a good choice to get enough points to describe the signal behaviour and to save the computer memory In this case the time space of the plot is equal to 0 01 s Velocity Scope parameters ES 5 xj Velocity Scope parameters m x General Data history Tip try right clicking on axes General Data history Tip try right clicking on axes Axes Limit data points to last 12000 Number of axes 3 floating scope Time range 0 v Save data to workspace Tick labels bottom axis only v Variable name S Sampling Format Structure with time 2 DK Cancel Help Apply Fig 5 2 Setting the parameters of the Scope block Modular Servo System User s Manual 27 When the Simulink model is ready click the Tools External Mode Control Panel option and next click the Signal Triggering button The window presented in Fig 5 3 opens Select Select All check button set Source as manual set Duration equal to the number of samples you intend to collect and close the window MySystem External Signal amp Triggering j 5 x Signal selection Block Path im v Select all X q Clear all X Display PWM estes care Dilo PUM X Display Prescaler MySystem Servo Display Prescaler fon X Display Reset MySysten Servo Display Reset X Display Status MySystem Servo Display Status C off X Display
39. en the model can be discretized The discrete model of the DC motor has the form x n DT Apx nT B u nT 7 5 yla Cpx nT where the matrices Aj B and C are in the form En To 1 T i e K T CT 1 e A e S ES B syo S Tm 0 e K l e The matrix A is the fundamental solution of the differential equation 7 5 calculated for the sampling period 7 The explicit values of the matrices A and B of the servo system can be obtained numerically by the use of c2d function C2d converts a continuous state representation to the discrete corresponding to the continuous The procedure is a part of Control System Toolbox One must simply type the command Ap Bj c2d A B To The optimal feedback law u nT Ke nT e nT y ylnT minimizes the cost function J u Y e n O ne n u n Ru n 7 6 n 0 subject to the state equation 7 5 The dlgry function from the Control System Toolbox is used to solve the discrete time linear quadratic control problem The synopsis of the dlgry and qry programs are identical The d qr also solves and returns matrix S the unique positive definite solution to the associated discrete iterative matrix Riccati equation Si A S Ap ADS B R B5S B5 BLS Ao 0 The feedback matrix is derived from S by K R BP SB BpSAp Modular Servo System User s Manual 63 EXAMPLE A goal of the control is the same as in the continuous c
40. ere ener nenne 35 6 3 2 Time domain identification experiment eee eese eese eene tne nennen entente enne nee 36 Ts ADVANCED ASSIGNMENTS ee eitees reote no esee oo ro a eese eU osese TRU Ron a E PER Vae ROSE a Eere Co aSr Pe ea eaa E eS 38 FAAP DD position CODtrOL oi err eoe brida 38 diz PID Velocity Control i o ERO BO aet oto sien ile eie SERIE 48 1 3 Multivariable control design oer e ftetit de e URS 51 3 4I Pole placement method e e etat ep ero gre tb ote e pt etes 51 7 3 2 Deadbeat controller eese nnn nnn nnn nnn nnn nhanh hn nns nsns asas asas asas asas asas asas aaa 54 7 4 Optimal design method LQ controller sese ennemis 58 7 4 1 The continuous Case nnne nnn nn nnn nnn nnn nana nnnnnnnnnononnononononnnnonononononononononononinininons 59 7 4 2 The discrete Casei iieri eee a nono nono nono nono no nnnono S RESEPTI EEEE aneno Sr e ie Ere Nea 63 8 DESCRIPTION OF THE MODULAR SERVO CLASS PROPERTIES eeee esee eene een neue 66 S L Base Adra tato detener 67 8 2 OA eee etie iecte dece a eie e SERERE E NOEUS 67 8 3 Encoder EANDEM eedem ee EMG e us 67 MIU EE 68 8 5 AngleScaleCoeff sse e gt teri Ieri ed aree et e Perieg sterben 68 8 6 PWM eerte NN 68 5 1 PWMPreseal r i5 iere ica 69 8 8 Stop iie eee E 69 5 9 ResetBncOod8r euo eere ert ren eter biete pen Cete rete ipee t eoe eerie rem ipte bie epe eee dy 69 8 10 Voltag
41. es note RU RR ide e e M UP ii 70 SIT Therme eee eter tie ete e eco eite bete em iste eie isses es 70 8 12 ThermFlag oo Rod ette ie poete tee bles epa nitens eerta 70 SEN EG E NC CNO 71 8 14 Quick reference tables acini et eect istic aot Ope nent i perii pires 71 Modular Servo System User s Manual 3 8 15 CServo Example eet tu coe toc 71 9 SOME TECHNICAL DA TA sco oec eep see eei ep ehe ee nonna oae espe doen ee bs ae sssrin obras ba eaae epe osas ep sorsod bao Pe TUR 75 Modular Servo System User s Manual 4 Modular Servo System 1 Introduction and general description The Modular Servo System MSS consists of the Inteco digital servomechanism and open architecture software environment for real time control experiments The main concept of the MSS is to create a rapid and direct path from the control system design to hardware implementation The MSS supports the real time design and implementation of advanced control methods using MATLAB and Simulink tools and extends the MATLAB environment in the solution of digital servomechanism control problems The integrated software supports all phases of a control system development on line process identification e control system modelling design and simulation e real time implementation of control algorithms The Modular Servo System uses standard PC hardware platforms and Microsoft Windows operating systems Besides the hardware and the related software you obtain the
42. es the frequency of the PWM wave e power interface thermal flags the thermal flags can be used to disable the operation of the overheated power amplifier e interface to the on board analog to digital converter The A D converter is applied to measure the position of the external potentiometer and to measure the output voltage of the tachogenerator All the parameters and measured variables from the RT DAC PCI board are accessible by appropriate properties of the CServo class In the MATLAB environment the object of the CServo class is created by the command object name CServo The get method is called to read a value of the property of the object property value get object name property_name The set method is called to set new value of the given property set object name property name new property value The display method is applied to display the property values when the object name is entered in the MATLAB command window This section describes all the properties of the CServo class The description consists of the following fields Provides short description of the property Shows the format of the method calls Description Describes what the property does and the restrictions subjected to the property Describes arguments of the set method Refers to other related properties Provides examples how the property can be used Modular Servo System User s Manual 66 8 1 BaseAddress Purpose
43. es the plot basic m file to plot measurements visible in the scope in the previous experiment Static Characteristics performs experiment aimed to measure of the static characteristics of the loaded DC motor angular velocity rad s vs input voltage dimensionless in the steady state The characteristics can be measured for the servo system with or without magnetic brake module The measurements are stored in the ChStat mat file Plot amp Save Characteristics uses plot stat m file which plots measured characteristics performs some normalisations of the data and saves characteristics in servo chstat mat file Time Domain Identification opens the real time Simulink model which starts identification based on a step system response The button dentify Model takes advantage of identification data and calculates coefficients of a linear model of the servo system The surface method is applied by the identification procedure 3 6 Demo Controllers The respective buttons in the column Demo Controllers perform the following tasks Position control PID Control Continous contains the Simulink model for real time experiments in closed loop with PID position controller and simulation model of the PID controlled servo system State Feedback Control opens the Simulink model to start real time experiments for closed loop system with state feedback This model can be used for experiments with LQ or deadbeat controllers Also sim
44. esigner but they must satisfy the above conditions It is most easily accomplished by picking the matrix Q to be diagonal with all diagonal elements positive or zero Some positive weight IRIz0 must be selected for the control otherwise the solution will include infinite control gains The values of elements of Q and R matrices weakly correspond to the performance specification A certain amount of trial and error is required with a simulation program to achieve a Satisfactory result A few guidelines can be recommended For example if all states are to be kept under close regulation and Q are diagonal with entries so selected that a fixed percentage change of each variable makes an equal contribution to the cost The matrix R is also diagonal If the maximum deviations of the servomechanism outputs are y Yoma and the maximum deviation of control is u then the cost is Q 11 y Q 22 y Ru max The coefficients of the Q and R matrices can be set related to the rule Modular Servo System User s Manual 59 1 u max y OM 009 tcc and R Y max Yos This rule can be modified to satisfy desired root locations and transient response for selected values of weights One must avoid saturation effects both of outputs and control Due to the differences in methods of analysis problem formulation and the form of results we strongly distinguish the linear quadratic problem with a finite settling time from that with a
45. f the s T s PD controller is K s 2 K Kj s The default values of the system coefficients are K 186 rad s and T 1 04 s Closing the control system we obtain the transfer function in the form Modular Servo System User s Manual 41 p s T G s KK 1 K K Cue mu uer NL E T T S S Substituting values for the coefficients into the transfer function we obtain 178 846 K G s P s 5 178 846 K p 0 9615 178 846 K The following relationships are obtained by comparing the transfer function with the standard transfer function of the second order system 178 846 K 0 260 178 846 K 0 9615 Considering the formula and the condition for the settling time t 2 5 s one obtains the inequality K 2 0 0125 Consequently respecting the formula and the condition p lt 10 related to the assumed percentage overshoot one can calculate an unknown value as 0 5912 later 2 7039 and K 0 0409 To check if the behaviour of the closed loop system is consistent with requirements one can use the simulation method Type at the Matlab prompt K 0 0409 0 0 0125 to save the coefficients of the PD controller in the workspace Click the P D controller amp linear model button The model depicted in Fig 7 6 opens Note that the linear model of the servo is applied The simulation results are shown in Fig 7 7 Angle amp Ref PID controller simulation Refere
46. he first step in testing of the MSS is to check if the RT DAC PCI I O board is installed properly e Double click the Detect RTDAC PCI board button One of the messages shown in Fig 2 3 opens If the board has been correctly installed the base address and number of logic version of the board are displayed BasicTestFunction Step 1 15 x BasicTestFunction Step 1 lol x Detected RT DAC4 PCI board C Base address 54272 D400 Hex O Can not detect any RT DACA PCI board Version 403 Hex Fig 2 3 Result of the step 1 If the board is not detected check if the board is put into the slot properly The boards are tested very precisely before sending to a customer and only wrong assembly procedure invokes errors In the next step one can reset encoders One sets the initial position of the servo system e Double click the Reset Angle Encoders button When the window Fig 2 4 opens click the Yes option The encoders are reset and zero position of the servo system are stored Modular Servo System User s Manual 9 BasicTestFunction Step 2 x Move the Servo system to the origin position Do you want to set the origin angles of the load Yes No Cancel Fig 2 4 The Reset Encoders window The next step of the testing procedure refers to the angle measurement e Double click the Check Angles button next click the Yes button and rotate the inertia load by hand The rotational angle of the inertia is measured
47. hey depend on the configuration of the modular servo set up Modular Servo System User s Manual 74 9 Some technical data 68 5 25 66 20 20 66 7 15 Brass inertia load 2 030 kg 0 055 kg Aluminium wheels 0 05 kg Fig 9 1 Dimensions and weights of the MSS mechanical elements Data sheet of the DC motor is available at http www buehlermotor com cgi bin sr exe productpageus amp productpage 54 The gearbox ratio N 25 Modular Servo System User s Manual 75
48. iment with the new values of k and k The experimental results are shown in Fig 7 22 Notice that the response of the system is faster and more accurate The reference angle is reached with accuracy equal to 2 3 and the settling time is 2 5 s These results outperform the previous one In both experiments the control saturates despite that the goals of the design are achieved lolx 65 2099 ABE 8S 7 Angle amp ref control filterd velocity D Fig 7 21 Experiment of the closed loop system A 2 2 and A 3 Modular Servo System User s Manual 53 iBix jemios e ABB SA Angle amp ref control filterd velocity zug Fig 7 22 Experiment of the closed loop system 4 2 4 and A 2 5 7 3 2 Deadbeat controller It is the control method unique to discrete systems in which we calculate feedback gains in such a way that the roots of the closed system are equal to zero This control strategy has the property that it drives the states of a closed loop system from arbitrary values to zero in at most N steps dim A N It is the fastest possible discrete controller The sampling time TO is the only design parameter The magnitude of the control variable u can be decreased by increasing the sampling time TO or vice versa For a given range of the reference variable step a suitable sample time can be determined The main problem of the design is the saturation of the system actuators
49. is model will test the installation by running Real Time Workshop Real Time Windows Target and the Real Time Windows Target kernel In the MATLAB window type rtvdp Next build and run the real time model To build the control application that operates in the real time mode the user has to e create a Simulink model of the control system which consists of the Modular Servo Device Driver and other blocks selected from the Simulink library e build the executable file under RTWT e start the real time code to run from the Simulation Start real time code pull down menus 5 1 Creating a model The simplest way to create a Simulink model of the control system is to use one of the models available from the Servo Control Window as a template For example click on the Basic Measurements button and save it as MySystem mdl name The MySystem Simulink model is shown in Fig 5 1 Now you can modify the model You have absolute freedom to modify the model and to develop your own control system Remember to leave the Servo driver block in the window This is necessary to work in RTWT environment Though it is not obligatory we recommend you to leave the scope You need a scope to watch how the system runs The saturation blocks are built in the Servo driver block They limit currents to DC motor for safety reasons However they are not visible for the user who may amaze at the saturation of controls Other blocks remaining in the window are no
50. lar Servo System User s Manual 23 The default values assumed for identification experiments are as follows Vax 12 V T 1 04 s K 186 rad s which gives a 0 961 s and b 2178 8 rad s These values have been identified by the manufacturer for the DC motor with the tachogenerator loaded by the inertia module and connected to the gearbox module equipped with the output disk 4 2 Nonlinear model Very often small changes of the state variables are assumed Therefore the control system can be considered as a linear one However in some applications nonlinearities in the control loop have to be taken into account This includes non linear static characteristics such as hysteresis and saturation which may occur if the following devices are applied operational amplifiers actuators finite word length in A D and D A converters Often the signal constraint first appears for the control variable We will assume a nonlinear model of the DC motor in the form X X X c u g x where the state variables x x and control u are defined as in the linear model The function g is the inverted steady state characteristics of the system which can be determined experimentally see section 6 2 The original steady state characteristics see Fig 6 8 is obtained from measurements The results of measurements undergo a preliminary treatment consisting of scaling to express them in appropriate units and a shift to rem
51. n Gao eto snae eb pa e beta Eae EE EE Sa eee RR e DE ER eR Oe V PRSE EUER OP ORE FEE OPEN RR esst 13 Bl Basic MEET E rei Mods TU UT 13 32 Manual NON 13 3 3 RIWT Driveri 5 eet de cia dte ds 17 34 Simulation Models 5 5 ee Rete ettet eec eee ete redet edes rtnedeeebekece de tede beds 18 3 5 IdentifiCdtion i ite hee MGR cee A etui ise i tesi S E i steer tette cs 20 3 6 Demo Controllers dades neos 20 4 MATHEMATICAL MODEL OF THE SERVO SYSTEM cccccccsssssssscccssssssssccccsessssssseccccssssssssseees 22 4 T Tanear Model iicet NT 22 4 2 Nonlinear model ccccnnnnnnnnnnnnncnonononnnnnnnnonononononononononononononononnnnnnnnnonononnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnanananananesos 24 5 RTWT MODEL ne 26 51 Creating a model ues de eee edite is 26 5 2 Code generation and the build process ooonocnnccnnocnonnconnconoconocononononononn nono conc onn SEa SENESE EE eiere 28 6 BASIC ASSIGNMEDENTIS iiie eeeoeeseoo eo sess eet ve o Verb ET e Vena eee ee sh Su Quad be eo sue e Pb on ee oe Saarest du Tu deos ese sanan eri nao peg 31 6 1 Basic measurements eet petet o 31 6 2 Steady state characteristics of the DC servo ccooooccocccnoncconocononnnnoncconnnononccnnnnnnnn ccoo nnnnnn enne en nnne nnne 33 6 3 Identification in time domain eerte eee crono EE Peer ee UE Ue ven Eee v waco ee Exe Eee ee Eee eo veu Pe eee ee EV es 35 6 3 1 Identification task by the surface method cess
52. nce Signal gt Ki velocity Kd Linear Simulation Model Fig 7 6 Simulation model of the closed loop system with the PD controller Modular Servo System User s Manual 42 TT ixi 65292 4ABB 92 7 Fig 7 7 Simulation results of the system with the PD controller The percentage overshoot is too large namely 16 4 However the settling time is equal to 2 4 s what is a satisfactory result The steady state error is equal to 1 2 what shows that the goal of the control is satisfied but the requirement related to the percentage overshoot is missed Before redesigning a controller a real time experiment should be performed Click the P D control continuous button Click PID controller and the model presented in Fig 7 1 opens Build it and start the real time code The results are presented in Fig 7 8 Notice that the response of the real system always differs slightly from the simulated one Angle amp Reference amp velocity nix anlo Lp datu 93 Angle amp ref filterd velocity itj Fig 7 8 Results of the real time experiment with the PD controller Modular Servo System User s Manual 43 To see in details differences between the real time and simulation responses of the closed loop system execute the servo plot pid m file This file is included in the Servo Toolbox but is accessible only from Matlab Command Window The plot is depicted in Fig 7 9 The table below include
53. normal position It is important that the Reset switch works only when the real time code is executed Modular Servo System User s Manual 17 Block Parameters Servo x The mask of the Servo block r Subsystem mask presented in Fig 3 3 contains base address of the RT DAC PCI board Parameters automatically detected with the help Base Address RTDACPCIBaseAddress function RTDAC4PCIBaseddess ts and the sampling period which default Sampling Period value is set to 0 002 sec If one wants npo to change the default sampling time i he must do it in this mask also _ Cancel He sw Fig 3 3 Mask of the device driver The details of the device driver are depicted in Fig 3 4 The driver uses functions which communicates directly with a logic applied at the RTDAC PCI board Notice that the driver is ready to use a second optional encoder as well Measurements Parameters 0 Reset Encoder ResetEncoder ResetEncoderGain Bitstream Version Display Version Display Reset 2 Ly 0 PWMPrescalerSource PWMPrescaler PWMPrescalerGain Display Prescaler Therm Status PWM Therm Status Display Status 1 gt y ThemFlagSource ThermFlag ThermFlagGain Display Therm Flag Control Encoder Encoder Convert to rad 1 1024 PPR A Angle PT PWMC l onto Saturation PWM PWMGain Display PWM Display Encoder Convert to rad s Tacho 1 0 25s 1 Simple filter
54. odel shown in Fig 7 20 opens Assuming a desired range of the change of the output disk position equal to pi 2 set the reference input signal equal to 25 pi 2 it is the measured angle at the input to the gearbox Also set the frequency of the reference input equal to 0 1 Hz and sample time equal to 0 002 s e Build the model e Click the Simulation Connect to target and Start real time code options to start the experiment The results are presented in Fig 7 21 Notice that the response of the system is slow and not accurate The reference angle is reached with accuracy equal to 6 and the settling time is about 4 s We can change the roots of the closed loop system to make the system faster Assuming A 4 and A 2 5 we obtain k 20 1118 and k 0 0449 Modular Servo System User s Manual 52 State feedback controller gt ngle amp rely gt gt j rad to rad s oooo 1 Angle encoder gt E ee 1 E gt gt contri Angle amp Reference i E Saturati Calculate amp velocity Signal aon Velocity Generator1 velocity tacho Reset 1 1 a gt 0 0551 filterd velocity 5 pe Ress Simple filter Reset Normal Encoders Real time only Fig 7 20 Real time model with state feedback controller Type at the Matlab prompt K 0 0335 0 0226 and repeat the exper
55. on Synopsis T get sv Time Description The CServo object contains the time counter When a CServo object is created the time counter is set to zero Each reference to the Time property updates its value The value is equal to the number of milliseconds which elapsed since the object was created 8 14 Quick reference table BaseAddress NES Read the base address of the RT DAC PCI board BitvireiniVERi Read the version of the logic design for the RT A DAC PCI board Encoder O R Read the incremental encoder registers Angle OR Read the angles of the encoders AngleScaleCoeff Read the coefficient applied to convert encoder d positions into radians PWM R S Read set the parameters of the PWM waves PWMPrescaler R S Read set the frequency of the PWM waves Stop Set the control signal to zero ResetEncoder Reset the encoder counters or read the reset flags Voltage Read the input voltages Therm Read the thermal flags of the power amplifiers Read set the automatic power down flag of the power amplifier ThermFlag Time Read time information e R read only property S allowed only set operation R S property may be read and set 8 15 CServo Example To familiarise a reader with the CServo class this section presents an M file example that uses the properties of the CServo class to measure the static characteristics of the DC Modular Servo System User s Manual 71 motor see section 6 The static charac
56. oscillations in the system The oscillations are far from the harmonic shape They are generated as the result of a limit cycle in the system The control shown in Fig 7 13 is saturated It is the well known fact that decreasing the proportional gain of the controller can correct this unfavourable behaviour of the servo system Modular Servo System User s Manual 46 Controls 1 T x ow T T LN o ny ah A EI n Wh Ihe A eee 0 8L e lO GO cre PERSE R9 ala 2 117317 SRM MAREM SERM A PA adone Jae l I I I y TA AAT OSE HEH HR rp thf bt Su de TT sa d iN Ea Hou A i H po foo 1 I I I 0 5 10 15 20 25 30 time s Repeat the experiment for K 80 Fig 7 13 Control signal 0 0128 The results are shown in Fig Position control with P controller 7 14 and Fig 7 15 60 40 20 time s 30 Fig 7 14 Position control with backlash module K 0 0128 Notice that oscillations are not present in this case The desired position is reached with 2 8 accuracy The control does not saturate We conclude that the closed loop system behaviour is satisfactory Modular Servo System User s Manual 47 Controls 1 j j D O inno defe Pee aac IS aia z W prm mde a8 n E E Eu RUE E
57. ove the bias The function g is presented in Fig 4 2 An interesting property of the g function is that it is discontinuous at zero and shows distinct effects of dry friction in a vicinity of the origin The static characteristics was obtained for the system consisting of DC motor inertia load encoder and gearbox modules If a magnetic break module is added to the system a measured characteristics are quite different The c coefficient was identified and c 206 rad s Modular Servo System User s Manual 24 Figure No 1 1 D 1 1 1 a 1 i 1 1 1 i 1 1 1 1 1 D e 1 D 1 1 1 D i 1 1 i 1 1 ta p 1 1 1 1 da ee ee eet ii is eee eee o iii AA Tere eee Coe eee Cee eet Cee es eee eee eee ee o enn ere eres See eee Pee ee Cee re cree eee eee ee Fig 4 2 Function g x is the inverted static characteristics of the servo 25 Modular Servo System User s Manual 5 RTWT model In this section the process of building your own control system is described The Real Time Windows Target RTWT toolbox is used An example how to use the MSS software will be shown in section 6 In this section some hints how to proceed in the RTWT environment are given Before start test your MATLAB configuration by building and running an example of real time application Real time Windows Target Toolbox includes the rtvdp mdl model Running th
58. pair A B is controllable It is clear that closed loop system has to be stable and it is a sine qua non assumption of the design The state matrix of the closed loop system is A A BKC For the case of the DC motor the matrix A is given as 0 1 A Kk _1 K k T T and the characteristics equation has the form Lt K ky Ke T T By means of the feedback gains the location of roots of the characteristics equation may be changed From the Vieta s formula we obtain a 0 1 K k Uta jan a S S and we can calculate k and k from Modular Servo System User s Manual 51 _ AAT k 2 GU AT 1 7 1 K K It is clear that we can require the desired behaviour of the closed loop system but we have to keep the control between appropriate limits lu r 1 When the control variable saturates it is necessary to be sure that the system behaves properly k EXAMPLE Assume that we would like to design a closed loop system without oscillations A possible selection of the roots is A 2 and A 2 3 For the identified parameters an example K 186 rad s and T 1 04 s we can calculate k k from formula 7 1 k 0 0335 and k 0 0226 Then we simulate the closed loop system with the feedback gains k k Perform the following steps e type K 0 0335 0 0226 and servo at the MATLAB prompt e Double click the State feedback control continuous and State feedback controller buttons The m
59. puter system based on INTEL or AMD processor e Specialised RT DAC PCI D I O board e Power Interface unit Software Modular Servo System User s Manual 6 e MS Windows 2000 XP MATLAB 7 R14 SP2 SP3 R2006a b R2007a R2008a b or R2009a appropriate Simulink Real Time Workshop and Real Time Windows Target toolboxes MSS Control Simulation Toolbox The Modular Servo Toolbox supports Matlab 7 R14 SP2 SP3 MATLAB ES R2006a b R2007a and R2008a b and R2009a Manuals e Installation Manual e User s Manual The experiments and corresponding to them measurements have been conducted by the use of the standard INTECO system Every new system D gt manufactured and developed by INTECO can be slightly different to the standard It explains why a user can obtain results that are not identical to these given in the manual 1 3 Hardware installation Hardware installation is described in the Installation Manual 1 4 Software installation Insert the installation CD and proceed step by step following displayed commands Software installation is described in the Installation Manual Modular Servo System User s Manual 7 2 Starting testing and stopping procedures 2 1 Starting procedure Invoke MATLAB by double clicking on the MATLAB icon The MATLAB command window opens Then simply type Servo Servo Control Window opens see Fig 2 1 The pushbuttons indicate actions that execute callb
60. r 3 Set up RT DAC Analog Inputs Fig 3 4 Interior of the RTWT device driver 3 4 Simulation Models There are two simulation models available for the servo system The first one is a linear model and the second one is nonlinear The linear model is used to design controllers The nonlinear model is used to check the quality of the designed control system Linear and Nolinear Simulation Model the simulation models of the servo are located under these buttons The external view of the simulation models is identical as the model described in the Modular Servo Device Driver except the Reset Encoder input and reference Potentiometer output which are not used in the simulation mode Modular Servo System User s Manual 18 Linear Simulation Model x r Subsystem mask r Parameters Initial conditions angle vel oo Velocity E Cancel Help Control Linear Simulation Model Fig 3 5 Linear Simulation Model and its mask The vector of the initial conditions of the state variables of the simulation model is the parameter available in the mask The model has no constrained control as in the case of the real servo system D gt If you use the linear simulation model in a closed loop remember that control should satisfy u lt 1 You can include the Saturation block to limit the control In the case of the nonlinear simulation model two additional parameters appear The g
61. rement of velocity is 5 while the accuracy of angle measurement is 0 1 The armature voltage of the DC motor is controlled by PWM signal For this reason the dimensionless control signal is the scaled input voltage u t v t Vax The admissible controls satisfy lu t lt 1 and v 12 V The measurement system is based on RTDAC PCI acquisition board equipped with A D converters The I O board communicates with the power interface unit The whole logic necessary to activate and read the encoder signals and to generate the appropriate sequence of PWM pulses to control the DC motor is configured in the Xilinx chip of the RT DAC PCI board All functions of the board are accessed from the Modular Servo Toolbox which operates directly in the MATLAB Simulink environment max max Features e The set up is fully integrated with MATLAB Simulink and operates in real time in MS Windows 2000 XP e Real time control algorithms can be rapidly prototyped No C code programming is required e The software includes complete dynamic models e The User s Manual contains a number of pre programmed experiments familiarising the user with the system in a fast way 1 2 Equipment and requirements The following minimum configuration is required Hardware e MSS including the following modules Input Potentiometer DC Motor with Tachogenerator Gearbox with output disk Magnetic Brake Inertia Load Digital Encoder Backlash module e Com
62. rol MaxControl NoOfPoints CtrlDirection lower CtrlDirection NoOfPoints max 1 NoO0fPoints 1 9 Calculate control step Step MaxControl MinControl NoOfPoints Switch CtrlDirection case a Ctrl MinControl Step MaxControl case d Ctrl MaxControl Step MinControl case r Ctrl MinControl Step MaxControl MaxControl Step MinControl otherwise This should not happen error The CtrlDirection must be A D or R FigNum figure Visible on A NumberTitle off Name Velocity vs PWM characteristic Menubar none SV CServo Control VelEnc Optionally set the PWM prescaler set sv pwmprescaler 20 oe Modular Servo System User s Manual 72 for i 1 length Ctrl 9 Set a new control value set sv PWM Ctrl i 9 Reset encoders set sv ResetEncoder 1 1 set sv ResetEncoder 0 0 pause 5 AuxEnc get sv Encoder TimeBeg gettime pause 2 Calculate velocity based on the encoder positions VelEnc i 2 pi get sv Encoder AuxEnc 4096 gettime TimeBeg 1000 rad s Control i get sv PWM Volt i get sv Voltage Perform 10000 A D conversions and calculate average values AuxVolt 0 0 for j 1 10000 AuxVolt AuxVolt get sv Voltage end Volt i AuxVolt 10000
63. rvo System User s Manual 55 A goal of the control is to track a reference signal the angle of the motor shaft The reference signal is assumed to be a square wave Type servo at the MATLAB prompt and then double click the State feedback control discrete button To design the controller click the Calculate deadbeat controller button It executes the servo calc db m file where a coefficients of deadbeat controller are calculated according to the algorithm shown above The body of this file is listed below Note the comments in the file o oe A oe oe oe Continuous linear model of the servo system Parameters of the servo are read from workspace O 1 O 1 Ts B 0 Ks Ts C 1 0 O 1 D zerostC 2 d If the distance to the reference signal is big control value in the first sample time is big too Due to we are looking for such a TO when control does not saturate we must assume the maximum change of oe the reference signal delta ref 2 25 pi 0 amp amp it is maximal change of the reference signal we start look for TO T020 1 for i 1 200 TO T0 0 005 Discrete model for sampling time TO oo Ad Bd c2d A B TO ole oe oe oe oe u 1 2K delta ref if abs K delta_ref lt 1 K TO amp amp write K and TO in Matlab command window return end end Now we calculate a coeffitients of deadbeat controller using the formula eig Ad Bd K 0 Z B
64. s the details read from the figure Simulation Real time experiment t s 24 3 Po 26 16 5 8 14 Steady state error 96 0 2 4 02 LT ixl File Edit View Insert Tools Window Help hn GEB kA 2 7 22 Responses of simulation model black and real system red time s Fig 7 9 Comparison of the real time and simulation experiments with the PD controller The overshoot of the real time experiment is small but the steady state error is too large and the settling time is too long We are trying to increase proportional coefficient K of the PD controller It will increase the overshoot that is an admissible step and decrease the steady state error to a value which is required and shorten the settling time what is required also Type at Matlab prompt K 0 0609 O 0 0125 and repeat the real time experiment with the PD controller and observe the results in the scope of the model To see all details of responses vs time type the following commands a l1 bl length PD C time t PD C time a b a 1 b 10 t 2 t 1 S plot only first 10 seconds of response t t a b plot t PD_C signals 1 values a b 1 b t PD_C signals 1 va lues a b 2 k grid Modular Servo System User s Manual 44 title Responses of real system with corrected PD controller xlabel time s The plot which is obtained is shown in Fig 7 10 The values of the percentage overshoot settling time an
65. solve the LQ controller problem the gry function from the Control System Toolbox can be used The synopsis of qry is K S E Iqry A B CD Q R In this case the matrix of weights Q relate the outputs y instead of the state x For the servomechanism D is the row matrix with two zero elements The function qry computes the equivalent O R and calls qr The control u is not constrained This assumption can not be satisfied for a real physical system One must remember that if the control u saturates then it not satisfies the LQ problem To return to the LQ problem the amplitude of the u signal should be diminished In such a case a designer tunes the relative weights between state and control variables To perform that the simulation tools are recommended Modular Servo System User s Manual 60 EXAMPLE The goal of the control is to track a reference signal which is defined as a square wave Set the amplitude of the reference input signal equal to 25 pi 2 Set the frequency of the reference input to 0 1 Hz and sample time to 0 002 s Type Servo at the MATLAB prompt and then double click the State feedback control continuous button To design LQ controller click the Calculate LQ controller button It executes servo calc lq m file presented below State space representation of servo A 0 1 0 1 Ts 0 Ks Ts 1 0 0 1 B G D zeros 2 1 Set Q and R matrices These values can be changed by a user Q 50
66. sured red and modelled black velocities gt Remember that your servo can be different to the system described in this manual The time domain identification has to be performed before any experiment Modular Servo System User s Manual 37 7 Advanced Assignments 7 1 PID position control A PID controller is the most common form of feedback In process control today more than 95 of the control loops are of a PID type in principle a PI control The PID controllers are today present in all areas where control is used In our case only P and PD controllers are concerned The servo itself behaves as an integrator In this section a problem of the position control of the servo is concerned The background to simple tuning methods is introduced All real time experiments related to the PID position control are performed using the model given in Fig 7 1 PID controller Angle amp ref control Angle encoder Angle amp Reference amp velocity rad to rad s ba Calculate Velocity1 0000 gt gt LA Signal Ki Saturation n Generator ts Reset Normal Encoders Real time only velocity tacho filterd v elocit Simple filter El lt Q Kd Fig 7 1 Real time model of the servo with the PID controller The transfer function of a continuous PID controller used in this manual has the form K Knee B K L 45
67. t necessary for our new project Creating your own model on the basis of an old example ensures that all internal options of the model are set properly These options are required to proceed with compiling and linking in a proper way To put the Servo Device Driver into the real time code a special make file is required This file is included in the MSS software Modular Servo System User s Manual 26 5 MySystem File Edit Yiew Simulation Format Tools Help D B e s85s 3 5c6x 5 fs Enema al e gi e BBE Measurements d to rad Angle encoder calculated velocity Signal Calculate Generator Velocity Reset af El 9 z num z den z filter Buttenwort filter 3 filter II Simple filter Velocity Scope Fig 5 1 The MySystem Simulink model You can apply most of the blocks from the Simulink library However some of them cannot be used see RTW or RTWT references manual The scope block properties are important for appropriate data acquisition and supervising how the system runs The Scope block properties are defined in the Scope property window see Fig 5 2 This window opens after the selection of the Scope Properties tab You can gather measurement data to the Matlab Workspace marking the Save data to workspace checkbox The data is placed under Variable name The variable format can be set as structure or matrix The default Sampling Decimation parameter value is set to 1 This means that each m
68. teristics is a diagram showing the relation between DC motor control signal and the motor shaft velocity The M file changes the control signal and waits until the MSS reaches steady state The velocity of the shaft is obtained in two Ways e the M file measures the output voltage from the tachogenerator e the M file measures the encoder position in two time points and calculates the velocity as the difference of positions divided by the time period between the time points The M file is written in the M function form The name of the M function is Servo PWM2RPM The function requires two parameters e CtriDirection a string that selects how to change the control value The A string causes the control is changed in ascending manner from 1 to 1 the D string causes the control is changed in descending order from 1 to 1 and the R string causes reverse double changes from 1 to 1 and after that from 1 to 1 e MinControl MaxControl minimal and maximal control signal values The control signal changes within the region defined by these values e NoOfPoints number of characteristics points within the MinControl MaxControl range The exact number of points of the characteristics declared by this parameter is enlarged to two points namely MinControl and MaxControl The body of this function is given below The comments within the function describe the main stages function ChStat Servo PWM2RPM CtrlDirection MinCont
69. ters the angles expressed in radians and the encoder reset flags are displayed in the Channel 0 and Channel 1 row In this version MSS may use a single encoder module In such a case only one channel presents the current data Value The values of the encoder counters are given in the respective columns The values are 24 bit integer numbers When an encoder remains in the reset state the corresponding value is equal to zero Angle rad The angular positions of the encoders expressed in radians are given in the respective columns When the encoder remains in the reset state the corresponding angle is equal to zero Reset When the checkbox is selected the corresponding encoder remains in the reset state The checkbox has to be unchecked to allow the encoder to count the position e Control frame The Control frame allows to change the control signal Edit field slider The control edit box and the slider are applied to set a new control value The control value may vary from 1 0 to 1 0 STOP The pushbutton is applied to switch off the control signal When pressed the control value is set to zero PWM prescaler The divider of the PWM reference signal The frequency of the PWM control is equal to 40 Fom 1 PWMprescaler KHz Thermal flag status Modular Servo System User s Manual 15 The thermal flag and the thermal status of the power amplifier If the thermal status box is checked the power interface is overhe
70. the optimal controller is synthesised Further only the second case is considered The main result of the finite dimensional linear quadratic theory is that under suitable assumptions the optimal feedback controller is linear with respect to the state and constant with respect to time The synthesis of the discrete and continuous LQ controller is presented below For a very small value of the sampling time the response of the discrete system converges to the response of the corresponding continuous system The most important question for a designer of a control system as far as LQ control problem is concerned is how to select the weighting factors in the cost function Modular Servo System User s Manual 58 Let us examine separately the continuous and discrete LQ problems 7 4 1 The continuous case The dynamical model of the DC motor is described by the linear differential equations x Ax Bu y Cx where the matrices A B and C have the form 0 1 0 i A y L B 4 C 7 2 0 0 1 T T The desired input time history of the state vector is given by y t y t y Hence the error vector e is defined e t y y t A typical quadratic cost function performance index has the form 10 2 fle Oct Rua where e matrix O 20 O is a nonnegative definite matrix e matrix R gt O Risa positive definite matrix e the A B pair is controllable The weighting matrices Q and R are selected by a d
71. tter Buttenwort filter 1 filter II Simple filter Velocity Scope 100 Fig 6 1 Simulink model of Basic Measurements The Signal generator block produces a saw shape control signal for the servo system This shape was selected to demonstrate the full range of the control values The velocity measurements are shown in Fig 6 2 One can see that the most disturbed is signal obtained directly from the tachogenerator The reconstructed velocity from encoder measurements of the angle is the best one Two types of the filters are applied the fourth order Buterworth filter and a simple first order filter Details and differences between the measurements are shown in Fig 6 3 and Fig 6 4 A user can choose which one of the velocity measurement will be used in his own real time experiments Modular Servo System User s Manual 31 10 x a wi gt a Q E y gt px En m p a a Q EJ i velocity tacho XM gt Fig 6 2 Velocity measurements N E Sd poer e o lt 2 A MESSER ERE ba ES E A o amp 8 5 A A a d o z o Y o A IS SS ee 3 i gt o o E E 2 a la T n Y S 3 Ta o no 9 c a PA E TSS oli S 3 X 9 PE miedos sume Se c o TE 5 Du tee ae rm 3 S Q o a x E no es I A 3 2 S 2 g 2 a e EA EE ee e S o 9 o T o l o I o E E o O oie T0 E gt l E I 2 Eheebecsbeccdeucdescgo AMA
72. ty is measured and the control value is changed to the next constant value and DC motor is activated again These steps are repeated to the end of the control range Simultaneously the measurements are displayed in the screen see Fig 6 6 There are two sources of DC motor velocity the reconstruction from the incremental encoder pulses and the tachogenerator voltage After the identification process the measurements are saved in the ChStat mat file Modular Servo System User s Manual 33 velocity vs PWM characteristic E Bl x Enkoder velocity vs PWM 200 Velocity rad s 4 08 06 04 02 02 04 06 08 1 PWM control Tacho AAN Tacho velocity rad s 1 08 06 04 02 02 04 O06 08 1 PWM control value Fig 6 6 Visualisation of measurements the static characteristic When the measurements are completed close the window and double click the Plot amp save button The ChStat mat file is loaded and the static characteristics is plotted see Fig 6 7 Notice that when the characteristics is measured in Reverse mode the control is changed from to 1 and in the reverse order The plots are slightly different Next the characteristics are averaged and shifted to zero for a number of points to diminish influence of the dry friction Next the plot see Fig 6 6 is drawn and the characteristic is saved in the servo chstat mat file If this file exists it is overwritten lol xl Static ch
73. ulation model of the closed loop system is included under this button Modular Servo System User s Manual 20 All the Simulink models mentioned above are examples of position control problems Calculate LQ controller uses Servo calc lq m file to obtain state feedback controller coefficients by solving the appropriate LQ problem In the Servo calc Iq m file one can set matrices of the objective function to obtain appropriate behaviour of the system Velocity control PID Controller opens the Simulink model to start real time experiments for the closed loop system with velocity PID controller Modular Servo System User s Manual 21 4 Mathematical model of the servo system 4 1 Linear Model A DC motor with a negligible armature inductance Fig 4 1 R Fig 4 1 Diagram of the DC motor is described by two classical equations electrical v t Ri t K lt and mechanical JO t K i t Batt where v t is the input voltage i t is the armature current w t is the angular velocity of the rotor R is the resistance of the armature winding J is the inertia moment of the moving parts B is the damping coefficient due to the viscous friction K t is the back EMF and 7 K i t is the electromechanical torque This model is linear because the static and dry kinetic friction as well as the saturation are neglected By combining the electrical and mechanical equations we obtain the equation of
74. varies in time but it is rather small as far as the error of the velocity measurements is concerned Modular Servo System User s Manual 50 7 3 Multivariable control design The section demonstrates how properties of a closed loop system are influenced by the design parameters the closed loop roots and sampling period Two methods of the closed loop systems design are shown The first is based on the pole placement and is applied for continuous systems The second control method known as deadbeat control is used for discrete systems 7 3 1 Pole placement method A closed loop system with feedback gains from the states is analysed The approach we wish to apply is the pole placement It means that we can change the closed loop system roots There are different ways of achieving this One of the design methods is described below The continuous time system is represented by the state equation x Ax Bu y Cx The state controller realises a linear feedback control law in the form u K y y where K is the feedback gain matrix and y is the desired output vector We request that the roots of the closed system are equal to 4 A fixed The design methods consist in finding K that the roots of the closed loop system are in the desired locations That means we assume dynamic properties of the closed system It can be shown that there exists a linear feedback that gives a closed loop system with roots specified if and only if the
Download Pdf Manuals
Related Search
Related Contents
Downloading HomeLights Suza Maytag MZC31T15DW Use and Care Manual V - AC Service e.g., operating system, hardware specifications - Lukas GREENBRQDK WIRING THE T'MER OPERATING INSTRUCTIONS curso 2011-2012 mecanismo de seguridad para redes móviles hm207 11a Comprobaciones antes de la puesta en marcha Copyright © All rights reserved.
Failed to retrieve file