5.4 Labwork 4 Direct Digital Controller Design and Implementation: Swinging Crane 5.4.1 Apparatus PCS1 apparatus, CODAS-II, Victor-II and Analogue I/O card 5.4.2 Introduction When the PCS1 carriage module is inverted, ie in the crane position, the apparatus mimics an overhead crane or a grab. In practice the grab is moved out over the material/goods to be raised, the grab is then lowered and then raise the material. The problem is that if the top of the grab is moved suddenly, the other end starts to swing violently and it takes a long time before the oscillations have died away and the material can be hoisted safely. The object of this labwork is to devise a control law that will allow the grab to reach a steady-state as fast as possible after a demand change in its horizontal position. The dynamics of the system are essentially those of a pendulum and because of the very low damping, the system shows a pronounced resonance at the natural frequency of the rod/mass combination. Conventional analogue control of such a system using lead or lag compensators is very difficult. The best approach is to use a 'notch' filter, ie a filter that has a anti-resonance. By placing the notch near the natural frequency of the 'crane', the overall frequency response characteristic is smoothed out and then a simple compensator can be employed to satisfy the design criteria. However this approach will not be pursued here and it is left for students to explore this method for themselves. Rather than attempt to control the system using analogue methods, discrete controllers will be designed and implemented. The nature of the system lends itself very well to such methods which result in simple, robust and effective control, for example - deadbeat controller. 5.4.3 Sample Time Selection and Design Objectives Many of the arguments regarding sample time selection discussed in Labwork 3 for the inverted pendulum are not applicable for the apparatus in this position. Although the system is very oscillatory, it is stable, and even with a sluggish servo the system can be brought to rest. In the inverted pendulum mode, however, it would not be possible to "catch" the pendulum before it topples over completely if the servo behaviour were too slow or if the sample time were too long. In the case of the crane problem we can design an effective controller with a much slower sampling rate. For this system we can choose a more demanding design objective, ie dead-beat control with steady-state set-point following, ie a compensator with integral action. Dead-beat control brings the system to rest in a finite number of samples. As the system is second order, we can theoretically achieve dead-beat behaviour in two sample intervals. Now, as the system oscillates naturally with a period of 0.94s, it seems natural to try to bring it to rest in a half period. These arguments lead to a sample time of 0.94/4 = 0.235s. In VICTOR-II the nearest sample time one can choose is 0.22s. Page 5.17 In this application we can neglect the dynamics of the servo as it is so much faster and better behaved than the crane. Furthermore as a first approximation we can neglect the damping in the pendulum. The transfer function relating the centre of mass of the rod/mass assembly to the carriage position is assumed to be Gp ( s ) 1 1 s 2 / n2 1 1 0. 0264s 2 Assuming that n is 6.16 rad/s. Enter this transfer function into CODAS-II and select a sample time of 0.22s. Transform the plant transfer function to the z-domain (<F5>). The resulting pulsed transfer function is approximately Gp (s) n2 s2 n2 This is transformed again using CODASII as explained. Alternatively, you can do this by analysis following similar lines to the example done for pg 5.13, ref 1. Gp (z) Z R |S1 e |T s sT U |V |W R |S |T n2 z 1 1 n2 Z z s s2 n2 s2 n2 U |V |W Again a partial fraction is required of the term inside the curly brackets. 1 n2 1 s 2 2 2 s s n s s n2 The Z cos( )) l q z z 1 1z(z 2cos( )z z Gp (z) 2 1 2cosz z2 (z 1)(z cos ) 1 2cos( )z z2 1 cos z zcos (1 cos )(z 1) 1 2cosz z2 1 2cosz z2 For the pendulum = T = 6.155 x 0.22 = 1.354 cos = 0.215 Hence Gp ( z) 0.785 ( z 1) 1 0. 43 z z2 Select the root-locus domain and you will observe that there are a pair of poles present on the unit-circle. These poles represent the oscillatory dynamics of the pendulum. A sample rate of four times the natural frequency would make these poles on the unit circle pure imaginary. Page 5.18 5.4.4 Dead-Beat Controller Design Using Simplified Plant Model To design this compensator, we allow Gc(z) to cancel the two poles on the unit circle. This effectively produces a notch filter that cancels the pendulum resonance (see later). Cancelling the plant zero on the unit circle, would result in a marginally stable controller (pg 311, ref 1). For steady-state set point following, the closed-loop transfer function will be F ( z) 0. 5 ( z 1) z2 The compensator, Gc(z) is given by - Gc ( z) 1 F ( z) Gp 1 F ( z) Gc ( z) 0. 637 (1 0. 43 z z2 ) ( z 1)( z 0. 5 ) Hence Enter the plant and compensator transfer functions into CODAS-II and examine the closed-loop time response. Also examine the control effort (<U>). Save the CODAS model to file as "crane1". 5.4.5 Procedure Place the PCS1 carriage module into the 'crane' position, ie where the pendulum is hanging down vertically. Connect the 26 way cable to the PCS1 control console. Switch on the power to the PCS1 unit and start up VICTOR-II Select the DDC mode with a sample time of 0.22s. Change the manual output to 40%, the set-point to 40% and the excitation to 20%. Enter the compensator transfer function. Save the settings to a file as "crane1". Before switching to Auto press <G> to remind yourself of how oscillatory this system is. Press <G> again and wait for the system to settle, or stop it swinging with your hand. Now switch VICTOR-II to Auto and repeat. Freeze the display and measure the settling time. Is it the same as the simulation? How does the observed response compare with the simulation? 5.4.6 Frequency Response of Plant and Compensator Using CODAS-II load the file "crane1". Select the frequency domain <F8> and the Bode Gain View (<V>). Press <F3> to select compensator and the plant. Draw the frequency response of the overall open-loop system. Notice that the curve is smooth with no sharp resonances or anti resonances below the Nyquist frequency. Now press <F4> to look at the plant alone and draw its open-loop frequency response. Now change the plant denominator to unity, bring in the compensator (<F3>). This time when you press <G> you will see the frequency response of the compensator on its own. You will observe that the compensator has an anti-resonance that cancels the plant resonance. Page 5.19 5.4.7 Dead-Beat Controller Design Using Plant Model with Damping Modify the plant transfer function in CODAS-II to incorporate damping, ie Gp ( s ) 1 1 0. 0011s 0. 0264s 2 In the next sections we shall design a controller that takes into account the damping in the actual system. 5.4.7.1 Ringing Pole Problem When damping is introduced in the plant transfer function, the poles and zeros all move inside the unit circle, ie Gp ( z ) 0.76(z+0.97) z 0. 41z 0. 91 2 If a dead-beat controller is designed using the above model where the zero at z=-0.9 is cancelled, the compensator will have a pole at z=-0.9. The resulting compensator is Gc ( z ) 1. 32( z2 0. 41z 0. 91) ( z 1)( z 0. 97 ) Enter the above compensator into VICTOR, make sure the deviation is zero and switch to Auto. Do not at this stage press <G> to excite the system. You will already observe an oscillatory mode occurring even in this quiescent state. We will introduce a step change in the set-point, but be ready to switch back to manual if the oscillations in the rig become too violent. Press <G> now and observe the response. You probably are back in manual by now!. Clearly, cancelling a zero on the real negative axis is not advisable. In fact there is very little advantage to be gained by cancelling any plant zeros at all. 5.4.7.2 Correct Design Approach to Avoid Ringing Pole Problem This time the compensator is designed without cancelling the zero at z=-0.97. The resulting compensator is Gc ( z) 0. 67 ( z2 0. 41z 0. 91) ( z 1)( z 0. 5 ) Try the response with this compensator and compare the results with those obtained with the simpler plant model. Is the behaviour closer to the modelled response?. Try refining the plant model so that the correlation between the actual crane and the simulation is close. 5.4.8 References Ref 1: Golten JW, Verwer AA, "Control System Design and Simulation", McGraw Hill, 1991 Page 5.20