S_LOOP: SINGLE-LOOP FEEDBACK CONTROL SYSTEM ANALYSIS by Michelle Gretzinger, Daniel Zyngier and Thoma Marlin INTRODUCTION One of the challenge to the engineer learning proce control i relating theoretical concept to the time-domain behavior of dynamic ytem. Thi menu-driven, interactive oftware package provide learning experience for ingle-variable feedback ytem, including tability analyi, frequency repone, and time-domain dynamic performance. Many of the olved example in the textbook can be repeated and extended uing thi oftware. The baic deign of the oftware enable the uer to ue imple menu to enter parameter, elect pecific calculation and diplay reult. No programming i required. To provide a imple yet flexible ytem, the proce dynamic are repreented by a general tranfer function model, fourth order with lead and dead time, and the controller i limited to a proportional-integral-derivative (PID) feedback algorithm. The uer can tailor thi ytem by etting elected parameter to zero. SYSTEM STRUCTURE The overall tructure of the ytem i given in Figure, and the main Main Menu i hown in Figure. The Main Menu appear when the program i firt executed and remain the principle interface throughout the eion. In a typical eion, the uer firt define the proce and controller through Submenu -; then, he/he elect calculation through the remaining ubmenu. An important feature i the ue of the ame model for all calculation, o that the uer can clearly relate the frequency repone analyi to time-domain behavior. Diturbance Diturbance model D() ( lead _ d d ( )( )( d K e d d d ) ) d d Manipulated variable MV() ( lead ( )( )( Proce feedback model K e p ) PID controller model K T c d TI ) Controlled variable CV() Set point - SP() Figure. Block diagram of the dynamic ytem in S_LOOP.
************************************************************ * S_LOOP: SINGLE LOOP CONTROL SYSTEM ANALYSIS * * * * McMASTER UNIVERSITY CHEMICAL ENGINEERING * * * * Verion 4.0 * * * * MAIN MENU * ************************************************************ SELECT THE APPROPRIATE MENU ITEM ) Modify Feedback Proce Model Parameter ) Modify Diturbance Proce Model Parameter ) Modify PID Controller Tuning Contant 4) Plot Pole of Cloed Loop Sytem 5) Bode Plot for GOL for Stability Analyi 6) Bode Plot for Proce, Gp 7) Bode Plot for Cloed Loop Repone 8) Dynamic Simulation of Sytem 0) Quit to Matlab Pleae enter the deired election: Figure. Main Menu for the S_LOOP oftware. PROCESS AND CONTROLLER DATA The uer enter the proce and controller parameter in the firt three Submenu. Submenu ) Proce Model - The proce model, G p (), parameter are entered uing Submenu. Recall that the proce model define the dynamic between the manipulated variable and the controlled variable. Any parameter can be et to zero without cauing numerical error. Note that uer can alo define noie, which i ued only for the meaurement of the controlled variable in the timedomain imulation. ) Diturbance Model - The diturbance model, G d (), parameter are entered through Submenu. Recall that the diturbance model define the dynamic between the diturbance and the controlled variable. Any parameter can be et to zero without cauing numerical error. ) Submenu : PID Controller - The control algorithm i Old Faithful, the proportional-integralderivative or PID controller. Thi i by far the mot widely ued controller in indutry. It ha three adjutable tuning parameter, which are defined in Submenu : the gain (K c ), the integral time (T I ), and the derivative time (T d ). The uer can turn off the controller by etting K c 0. If the uer et the integral time to zero, the integral mode i removed from the algorithm (a divide by zero doe not occur). The uer can elect a PID controller implemented a a continuou controller (really digital executed every tep in the dynamic imulation) or a digital controller (executed at the period defined by the uer.
ANALYSIS AND SIMULATION The remaining Submenu enable the uer to elect from the following analyi calculation for the proce and control ytem previouly defined through Submenu -. The following frequency repone analye can be computed without the uer having to perform calculation involving complex number. The emphai i on undertanding concept, not hand calculation Submenu 4) Pole - Solve for and plot the root of the characteritic equation (i.e., the pole) of the cloed-loop ytem to evaluate tability. The program calculate the pole, plot them, and print the pole value. Thi can only be done if the characteritic equation i a polynomial in and doe not contain a dead time. If a dead time occur in the feedback proce model, a meage i provided to the uer explaining that the calculation cannot be performed. Thi analyi i performed for the ytem defined through menu and. If the PID controller gain i et to zero, the cloed-loop analyi become an open-loop analyi of the proce model. 0.4 POLES OF CLOSED LOOP SYSTEM 0. 0. 0. Imaginary 0-0. -0. -0. -0.4-0.8-0.6-0.4-0. 0 0. 0.4 0.6 0.8 Real The pole are: -0.66-0.0778 0.504i -0.0778-0.504i -0.088 5) Bode Stability - Calculate the frequency repone diplayed a a Bode plot of G OL (j)g p (j)g v (j)g c (j)g (j). The program provide a plot and the value for the frequency and amplitude ratio at the firt croing of -80 degree within the frequency defined by the uer. With the controller defined with a P-only with a gain of.0 (K c, T I 0, and T d 0), thi plot can be ued for tuning uing the Ziegler-Nichol method. With the PID controller tuned to any value thought appropriate, thi plot can be ued to determine
the tability of the cloed loop ytem. 0 BODE PLOT OF GOL Amplitude Ratio 0 0 0-0 - 0-0 0 Frequency, w (rad/time) -50 Phae Angle (degree) -00-50 -00-50 0-0 - 0 0 Frequency, w (rad/time) ************************************************* Critical frequency and amplitude ratio from Bode plot of GOL ************************************************* Caution: ) cro check with plot becaue of poible MATLAB error in calculating the phae angle ) the program find the firt croing of -80 The critical frequency i between 0.5 and 0.58 The amplitude ratio at the critical frequency i 0.98 6) Proce Frequency Repone - Calculate the frequency repone of the proce model alone, i.e., G p (j), diplayed a a Bode plot over the frequency range defined by the uer. Alo, you can plot the ine input and output at any frequency. (The ine plot at the point picked by the uer i available in MATLAB, but not Octave.) 0 0 FREQUENCY 0.664 rad/time & AMP RATIO 0.60 0-0 - 0-0 - 0-0 0 Pre RETURN to go back to menu Input, magnitude et 0.5 0-0.5-0 00 00 00 Output 0.5 0-0.5-0 00 00 00 4
7) Cloed-loop Frequency Repone - Calculate the amplitude ratio of the cloed-loop control ytem to evaluate the control performance over the frequency range defined by the uer. The uer can elect the input to be either a diturbance or et point.. Alo, you can plot the ine input and output at any frequency. (The ine plot at the point picked by the uer i available in MATLAB, but not Octave.) 0 0 FREQUENCY 0.00957 rad/time & AMP RATIO 0.065985 Amplitude Ratio, CV / D 0-5 0-0 0-0 - 0-0 0 0 0 Pre RETURN to go back to menu Diturb., magnitude 0.5 0-0.5-0 000 000 000 4000 5000 6000 CV 0.5 0-0.5-0 000 000 000 4000 5000 6000 8) Dynamic Simulation - Calculate the cloed-loop dynamic repone in the time-domain to a tep input, which i introduced a a tep at 5% of the total imulation time. If the combination of the total time and time tep, t, yield a large number of tep, the imulation would be unnecearily time conuming. Therefore, the program check thee input automatically and enure that the number of tep i le than the maximum allowed. If the program reet the time tep, the oftware diplay a meage to the uer and change the value diplayed in the menu. The uer can elect the ize of the deired input tep, and et all other to zero. The type of input can be one of the following. a) proce reaction curve (tep in the manipulated variable with the controller off), b) diturbance, or c) et point change. The controller can be elected to be a continuou PID (executed every imulation time tep) or a digital PID (executed at the period elected by the uer). 5
The variable are plotted in deviation variable from their initial value of 0.0. The manipulated variable doe not oberve any bound, although all final element have limit in a real plant. The control performance metric IAE of the controlled variable i reported in the figure, except for tranient where the tep i made in the manipulated variable for a proce reaction curve experiment. 0.4 S-LOOP plot deviation variable (IAE 7.505) Controlled Variable 0. 0. 0. 0 0 0 40 60 80 00 0 40 Time 0 Manipulated Variable -0-0 -0 0 0 40 60 80 00 0 40 Time ************************************************************* * S_LOOP: SINGLE LOOP CONTROL SYSTEM DYNAMIC SIMULATION * * * * Hint: ) All input are tep at 5% of total time * * ) If Entry 5 i non-zero, PID controller * * i turned off * * ) Select Time tep (delta t) to approximate * * a) for the mallet time contant, * * (delta t) / tau 0.05 * * b) dead time/ (delta t) integer * * 4) Uually, (total time) / (time tep) < 000 * * 5) Digital controller exec time integer of * * imulation delta time * ************************************************************* SELECT THE APPROPRIATE MENU ITEM PRESENT VALUES ) Total imulation time 0.00 ) Time tep for imulation 0.00 ) Set point change 0.00 4) Diturbance change 0.80 5) Proce reaction curve MV input 0.00 6) Select continuou/digital controller, currently continuou (Controller executed every imulation time tep) 7) Execute dynamic imulation 8) Return to main menu Enter the deired election: 6
SAMPLE SESSION After entering MATLAB, the uer mut define the MATLAB path where the _loop m-file are tored; naturally, the path will be different for every intallation. After the correct directory ha been defined, the uer type _loop and trike enter in the MATLAB window to begin the program. The Main Menu will appear on the creen, indicating that the S_LOOP program i running. For thi ample eion, entrie for Example 9. from the textbook are dicued. The eential data are ummarized in the following. CV ( ) G p ( ) MV ( ) ( p K p 0.09 ) (5 ) CV ( ) Gd ( ) D( ) ( d K d ) ( 5 ) Firt, the uer mut enter the data from the attached table into the program. Thi i done for the proce parameter (Submenu ), the diturbance (Submenu ), and the controller (Submenu ). Note that program return to the Main Menu imply by triking the "enter" with a blank entry from any Submenu. Submenu ) The proce model defined in Submenu include all proce and intrumentation element in the feedback loop. The tacit aumption i that the ingle model between the manipulated and controlled variable include the proce and final element, i.e., G p ()G' p ()G v (), and that the enor contribute negligible dynamic, i.e., G ().0. The third order mixing ytem can be repreented in the S_LOOP format uing the following 0.09 0.09 0.09 (5 ) (5 ) (5 ) (5 ) (5 0 K p ( ) ( ) ( ) ) Thu, K p 0.09, lead 0, 0, 5, 5 and.0. We will enter K n 0 to remove noie from the dynamic imulation. ) The diturbance model i entered via Submenu. In thi cae, only the teady-tate gain i different from the proce model, although in other cae many parameter may be different. Thu, K d.0, lead_d 0, d 0, d 5, d 5 and d.0. ) The controller tuning i of K c 0, T I and T d 0.80 i entered through Submenu. At any time the uer wihe to turn off the controller, the controller gain can be et to zero (K c 0). 7
8) The purpoe of the exercie i to evaluate the dynamic repone; thu, Submenu 8 i elected. The uer may elect the total time, here 00 to be conitent with Figure 9.6. The time tep i elected to give good accuracy without exceeding the maximum tep; thu, 0.0 i elected. Thi give t/ 0.04, which hould provide reaonable accuracy. Note that for ytem with dead time, which thi example doe not have, the dead time i approximated a an integer multiple of the tep ize. Submenu Continuing in Submenu 8, the uer ha the option of a unit tep in the et point, diturbance, or manipulated variable (a proce reaction curve). The uer elect the deired input by entering a non-zero value for the changing input and zero value for the other input. If the uer enter a nonzero value for the manipulated variable, the feedback controller i automatically turned off. The PID controller i elected to be continuou. The imulation i tarted by electing Submenu item 7. The reult are automatically plotted on the creen and can be compared with the anwer in Example 9. and Figure 9.6. Although Example 9. doe not deal with other apect of the ytem behavior, they are dicued here to demontrate all program feature. 4) The root of the characteritic equation are the exponent of the time-domain olution for the dynamic. For thi ytem, the characteritic equation i.09 G ()Gc() ( 5 0 0. ) 0 p 8 Firt, the program rearrange thi equation into a polynomial form; the uer doe not have to perform thi reformulation. The root for thi equation are -0.66, -0.0778 0.504i, -0.0778-0.504i, and -0.088. Since all real part are negative, the ytem i (bounded input-output) table. Alo, ince two root are complex the ytem i underdamped, a can be een in the dynamic repone. If the controller gain i et to zero, the root of the proce tranfer function, G p (), are evaluated. 5) The Bode plot of the tranfer function including all element in the feedback path, G OL (), i evaluated via thi Submenu. Recall that thi tranfer function can be ued to i) evaluate the tuning by Zeigler-Nichol method by etting G c ().0 (K c.0, T I 0, and T d 0) or ) teting the tability of the ytem by checking the amplitude ratio at the critical frequency with any controller, G c (). Since the controller tuning ha been entered, G OL () i given in the following..09 () G p()gc() ( 5 0 0. ) GOL 80 For the parameter in the example, the Bode plot demontrate that G OL (j c ) <.0 at the critical frequency, i.e., the frequency at which the phae angle equal -80. The program provide the uer with value of the critical frequency (0.5 rad/min) and amplitude ratio (0.9) in the MATLAB window. Therefore, the ytem i table. 8
6) The Bode plot of the proce, G p (j), i evaluated. Thi can be ued in determining how the proce without control would affect a ine diturbance. 7) The cloed-loop Bode diagram i evaluated in thi Submenu. Recall that thi frequency repone give the amplitude of the controlled variable relative to the input for a range of frequencie. The uer mut enter the choice of et point or diturbance input to obtain the appropriate reult. etpoint : CV() SP().09 0 G p()gc() ( 5 ) G p()gc().09 0 ( 5 ) CV() Gd () ( 5 ) diturbance : D() G p()gc().09 0 ( 5 ) 0. 80 0. 80 0. 80 The diturbance i elected through the Submenu item defining parameter d, and the reult i plotted in a Bode plot. The reult for the diturbance how that CV(j) / D(j) ha a mall magnitude (mall error) at low frequencie (becaue of effective feedback control), a mall magnitude (mall error) at high frequencie (becaue of the proce filtering the diturbance) a reonance peak at a frequency of about rad/min where feedback control i not very effective. The uer can evaluate the et point Bode plot by electing the input and running the program again. The Bode plot how the excellent et point tracking at low frequencie and poor tracking at high frequencie. The value of the program i that the uer can evaluate control performance and tability uing variou frequency- domain and time-domain method, and /he may then compare the reult and change proce and controller parameter to evaluate the effect. 9
LIMITATIONS S_LOOP hould provide excellent experience with frequency-dependent and time-domain behavior of ingle-loop feedback control. The major limitation are noted below. ) The number of time tep, determined from (total time)/(tep ize), i not allowed to be greater than a maximum limit. Thi limit i currently et at 0000 time tep. Typically, the time duration (t end ) divided by the tep ize (t) le than 000 provide adequate accuracy for dynamic ytem in the textbook. The dead time ued in the dynamic imulation of the time-domain dynamic repone (but not the frequency repone calculation) are rounded to an integer multiple of the imulation tep ize. The controller execution period i rounded to an integer multiple of the imulation time tep. ) The calculation of the frequency repone involve the phae angle that may exceed -80. The program ue the MATLAB feature (UNWRAP function) which uually correctly recognize a change of quadrant and account for thi fact in calculating the arctangent; however, thi feature i not foolproof. Spuriou reult, phae angle larger than their proper value, can be obtained; therefore, the Bode plot hould be cutinized when performing the Bode tability analyi. Narrowing the range of the frequencie often correct the problem, hould it occur. ) The proce and diturbance tranfer function are limited to fourth order. No higher order can be imulated. VERIFYING TEXTBOOK RESULTS A good tarting point i to compare the time-domain and frequency/tability reult for many of the example and confirm that both method give conitent reult and provide complementary inight into dynamic behavior. To ait the tudent, the S_LOOP parameter for mot ingle-loop textbook Example are provided in the following table, and additional hint are provided after the table. 0
Table. Parameter for Example in Textbook Chapter 4, 7, 8, and 9 Cae proce model diturbance controller diturbance imulation /d K p ld K d input K c T I T d t Example 4.5.0 0 0 7.9 0 0 --- --- --- --- --- --- --- Example 4.6 0.448 0 0 8.5 8.5 0 --- --- --- --- --- --- --- t end Example 7. Figure 7.0a.09 0 0 0 5 5.0 D 40 0.5 00 Figure 7.0b.09 0 0 0 5 5 D 9 0.5 00 Figure 8..09 0 0 0 5 5.0 D0.8 0-0 0 0. 00 Example 8.5 Figure 8.9 -.9 0 0.9 0 0 --- --- --- -.059 0.95 0 0. 50 Figure 9. 5 0 0 5 0 --- D.4 0 0 00 5 0 0 5 0 --- D 0.6 0 0 00 5 0 0 5 0 --- D.5 0 0 00 5 0 0 5 0 --- D 0.89 7 0 00 5 0 0 5 0 --- D.04 5.. 00 5 0 0 5 0 --- D 0.88 6.4 0.8 00 Example 9. 0 8 0 0 --- ---.0.7. 00 Example 9..09 0 0 0 5 5.0 D0.8 0 0.88.5 00 Example 9..09 0 0 0 5 5.0 D0.8 0 0.88.5 00 Example 9.5 Figure 9.a 0 0 8 0 ---.0 D 0.9 5. 0. 00 Figure 9.b 0 0 7 0 ---.0 D 0.9 5. 0. 00 Figure 9.c 0 0 8 0 ---.0 D.5 6.0 0. 00 Figure 9-d 0 0 7 0 ---.0 D.5 6.0 0. 00 Figure 9..05 0 0 0 0 0 --- --- SP 0 0.5 00 Figure 9..05 0 0 0 0 0 --- --- SP 5 0 0.5 00 Figure 9.4.05 0 0 0 0 0 --- --- SP 5 0.5 00
Table. Parameter for Example in Textbook Chapter 0 Cae proce model diturbance controller diturbance imulation /d K p ld K d input K c T I T d t Example 0.4 0. 0 0 0.50 0.50 0 --- --- --- 5 0 Example 0.5.09 0 0 0 5 5 --- --- 0-0 0 0 Example 0.6.09 0 0 0 5 0 --- --- --- 0 0 Example 0.7.09 0 0 0 5.09.56 --- --- -6000 0 0 Example 0.8. 0.5.5 0 --- --- --- 5 0 Example 0.9.09 0 0 0 0 5 --- --- --- --- --- Example 0.0.09 0 0 0 5 5.0 D0.8 94.5 4.9 0.5 00 Example 0.. 0.5.5 0 --- --- ---.0 0.0 0 t end Example 0. (n) 0 0 0 5 5 --- --- 0 0 Example 0.(A) 0 0 8 0 --- --- --- 0 0 Example 0.(B) 8 0 0 0 --- --- --- 0 0 Example 0.4.09 0 0 0 5 5 --- --- 0 0.09 0 0 0 5 5 --- --- 8 0 Example 0.5 nominal Example 0.5 proce I Example 0.5 proce II 0 9 0 0 --- --- --- 0 0.5 0 9.5 0 0 --- --- --- 6.8. 0 0 8 0 0 --- --- --- 6.8. 0 Example 0.6.09 0 0 0 5 5.0 D 06 0 0.05 00 Example 0.7.09 0 0 0 5 5.0 D 94.5 4.9 0. 00 Example 0.8 -tank Example 0.8 approx. model.09 0 0 0 5 5 --- --- 0 0.09 5.5 0 0 0.5 0 --- --- 0 0
Table. Parameter for Example in Textbook Chapter Cae proce model diturbance controller diturbance election K p ld K d input K c T I T d /d imulation t t end Figure. 5 0 0 0 0 ---.48 0.6 0 0 d Example.A Figure.5 0 0 0 --- 0.85.5 0 d Example.B 4 0 0 4 0 --- 0.85 6.0 0 d Example.C.5 0 0.5 0 ---.70. 0 d Example.D 0..5 0 0.5 0 --- 7.0. 0 d Example. 0 0 0 --- 0 d Example. 0.5 0 0.5 0 ---.70. 0 Example.8 (linear approximation) -.66 0-8.0 8.5 8.5 0 --- --- SP -.04-0.45 0 0. 00 Figure.6a.09 0 0 0 5 5 --- 0 0 d Figure.6b.09 5.5 0 0 0.5 0 --- 0 0 d
Hint for Selected Textbook Example Chapter 7 Example 7. Example 7. Thi proce model cannot be imulated in S_LOOP becaue it i higher than fourth order. The third order mixing ytem can be repreented in the S_LOOP format a hown in the following K K K (5 ) (5 ) (5 ) (5 ) (5 0 ) ( ) ( K ) ( ) Thu, lead 0, 0, 5, 5 and.0. Chapter 8 Figure 8. Figure 8.5 Example 8.5 The tability of thee ytem can be determined uing Submenu 4 to calculate the root of the characteritic equation. It i not poible to reproduce thee repone becaue the controller equation mut be modified to eliminate the proportional while retaining the integral. The cloed-loop tranfer function i econd order, and the characteritic equation ha the root -0.60.40j. The negative real part indicate that the linear ytem i table, and the large complex part indicate ocillatory behavior in the time domain. Chapter 9 Figure 9. Table 9. Example 9. Example 9.4 The time tep i given a value of.0 to be conitent with the tuning optimization tudie in Appendix D. Thi give t/()0.0 which i a bit high but within reaon. See comment above. See comment above. It i not poible to optimize with S_LOOP; thu, only the imulation i performed. Thi cannot be calculated by S_LOOP becaue the non-linear equation repreenting the proce were ued, ee workbook Exercie. and.. Chapter 0 Example 0.7 Thi third order ytem can be approximated by the general fourth order proce model by recognizing that the two fat ytem, the enor and valve, can be combined to give 4
0.09 K 5 c (0.5 ) ( 0. ) 0.09 K c 0.09 K 5.0085 c 0.8 Therefore, lead 0, 0, 5, 0.0908 and.56. Ex. 0. Ex. 0.4 Chapter Chapter Only the cae with n and n can be calculated with the limited proce model tructure in S_LOOP. The tability of the cloed-loop ytem can alo be determined by calculating the root of the characteritic equation. Care mut be exercied when uing S_LOOP to invetigate the effect of changing the controller execution period, ince the imulation time tep and the controller execution period are the ame in S_LOOP. Generally, S_LOOP hould be ued for continuou ytem uing a mall time tep ize. It i not poible to repeat the tudie on filtering becaue S_LOOP ha no option to add noie to the meaurement ignal. The general effect on the controlled variable performance can be invetigated by adding a filter to the ytem, which in S_LOOP can be eaily done by adding an additional time contant to the feedback proce dynamic. Note that thi "filter" influence the plotted variable, o that the CV after being filtered would appear in the reult plot. Chapter Example.8 The reult of thi imulation uing S_LOOP are approximate ince the flow of olvent i changing during the tranient and influencing the dynamic ignificantly. Figure.5 wa determined by numerically olving the non-linear model of the ytem. Note that S_LOOP aume the numerator lead term ha the form ( ld ), with the lead time allowed to be poitive or negative. Figure.4 Example.9 Ex..0 Sample reult in Figure.a&b can be obtained by imulating a firt order with dead time proce with PI control uing the Ciancone tuning and t/()0.0. The calculation of the manipulated variable frequency repone cannot be performed with S_LOOP becaue it doe not have an option for the tranfer function in equation (.9). Thi calculation cannot be performed with S_LOOP becaue S_LOOP i limited to a fourth order ytem. 5