TRANFER FUNCTION ANALYSIS 1.1 ABSTRACT: HP 48 G(X) Program for use in control systems. It includes: Simulation Predeterminated Inputs Bode Plot (Magn. and Phase) Root Locus Nyquist Plot Nichols Plot All in easy to use and graphical Menus, like built-in apps. INDEX 1 Introduction. 2 Installation. 3 Getting started. 4 Main Menu. 5 Transfer function: H(s). 6 Predeterminated input. 7 User's defined input. 8 Graph Input. 9 Output, Simulation. 10 Bode Plot. 11 Root Locus. 12 Nyquist Plot. 13 Nichols Plot. 14 Final Words 1 INTRODUCTION This package was developed for use in analysis and design of control systems using menus and graphic capabilities of HP48G(X). The purpose of this programs is to help students in control courses. Written in UserRPL. The main features are: Predeterminated Inputs: Square, triangle, saw, half rectified sine, full rectified sine, sine and step waves. And user's inputs Simulation : Graph of the response of the system. Bode Plots, Root Locus, Nyquist Plot and Nichols plot. I 'll hope you enjoy my program. Thank you for using it. Excuse for my poor english. My native language is spanish, I'm from Chile -SouthAmerica- 2 INSTALLATION Just download the archive: tfa The directory tfa will be created. 3 GETTING STARTED Enter to TFA directory, then press CST, the soft keys are: EXECUTE: Starts the program. Go the Main Menu. PICTURE: Shows the current graphic. ABOUT : Info about me. OFF : Powers off the HP. 4 MAIN MENU The Main Menu shows all capabilities through a graphic menu. These are: - H(s): Input the transfer function. - Input: Choice one of the predeterminated inputs. - Output: Simulates and graphics the output. - Graph Input: Graphics the input. - User Input: Choice your own input function. - Bode Plot: graphs Bode Plot. - Root Locus: graphs Root Locus. - Nyquist Plot: polar graphic. - Nichols Plot: magnitude and phase plane. - About: Info about me. 5 H(s) Here you enter the transfer function. It has the next form: numerator H(s) = --------- * exp( -delay*s) denominator Numerator and denominator are both polynomials and must be entering in the HP form: a[n]*s^n + a[n-1]*s^n-1 + ... + a[0] is equals to [ a[n] a[n-1] ... a[0] ] The delay is a positive number. For example: Num. [ 2.65 ] Den. [ 1 1] Delay 0.8 OK 2.65 exp(-0.8*s) actually is: H(s)= ------------- s + 1 6 INPUT : Here you can choice one of the predeterminated inputs: Square: AMP1, TIME1, AMP2 and TIME2 are the next: AMP1 | _______ _______ | | | | | | | | | | | | AMP2 | |_______| |________ | |___________________________________ <-TIME1-><-TIME2-> Triangle: AMP1, TIME1, AMP2 and TIME2 are the next: | AMP1| / \ / \ | / \ / \ | / \ / \ | \ / \ | \ / \ AMP2| \ / |________________________________________ <- TIME1 -><- TIME2 -> Saw : AMP1, TIME1, AMP2 and TIME2 are the next: AMP2 | / / | / | / | | / | / | | / | / | | / | / | | / | / | | / | / | | / | / | | / | / | AMP1 | / | / | |___________________________________________ <-TIME1-><-TIME2-> In the tree shapes AMP1 and AMP2 can be positive or negative. Sine, Half rectified Sine and Full rectified Sine: Here you must specific: AMPLITUDE, FRECUENCY & PHASE where Sine(T) = AMPLITUDE*SIN(2PI*FRECUENCY+PHASE) The rectified waves are exactly that. Step: AMPLITUDE and DELAY are: | ___________________________ AMPLITUDE | | | | | | | | | | | | | | 0 |____________|____________________________ <-DELAY----> Pulse: AMPLITUDE, WIDTH & DELAY are: | ____________ AMPLITUDE | | | | | | | | | | | | | | | | | | | | | 0 |____________|____________|______________ <-DELAY----> <--WIDTH---> In the last two shapes AMPLITUDE can be both positive or negative. 7 USER'S INPUT Just enter the input of your systems i(T), where T=TIME. EXAMPLE: From the Main Menu: User Input I(T) : '2*COS(10*T)*(1-EXP(-T))' OK Watch the use of ' ' and the independent time variable is "T" ( not "t"). 8 GRAPH INPUT Just shows the input. See 9 for explanation of graphic parameters. EXAMPLE1 From the Main Menu: Input Triangle AMP.1: -1 TIME1: 1 AMP.2: 1 TIME2: 1 OK { An inverted triangle wave} Graph Input FINAL TIME: 5 MAX. AMP : 1.2 MIN. AMP : -1.2 H. SIZE : 1 V. SIZE : 2 Press OK and you will get the 2 vertical screens graph of the input. EXAMPLE2 From the Main Menu: User Input I(T) = '2*COS(10*T)*(1-EXP(-T))' Graph Input FINAL TIME: 2 MAX. AMP : 2 MIN. AMP : -2 H. SIZE : 1 V. SIZE : 1 Press OK for the graph. 9 OUTPUT Here you can obtain the time response to your system: _______ | | input(t)------> | H(s) |------> output(t) |_______| The parameters are: FINAL TIME: the time interval is 0 to FINAL TIME. RESOLUTION: number of points that will be plot. MAX. AMP : maximun amplitude of the output. MIN. AMP : minimun amplitude of the output. H. SIZE : horizontal size of graph in screen units. V. SIZE : vertical size of graph in screen units. The two last parameters could create a graph larger than the display, for example a 4 screens graphic. EXAMPLE 1: ____________________ | | R(S)----> + ----> | 1.42/(S*(1.09S+1)) | ---------> C(S) - |____________________| | ^ | |_________________________________| It's clear that C(S) 1.42 ---- = -------------- R(S) 1.09S^2+S+1.42 And the input is r(t) = 2*sin(2*pi*1*t) So, from the main menu : H(s) NUM: [1.42] DEN: [1.09 1 1.42] DELAY: 0 OK Input Sine AMPLITUDE: 2 FRECUENCY: 1 PHASE: 0 OK Output FINAL TIME: 15 RESOLUTION: 200 MAX. AMP : 0.3 MIN. AMP : -0.3 H. SIZE : 2 V. SIZE : 1 OK The graph will have two screens in horizontal scale. Now press OK an you'll get te graph. Move with cursors. The resolution is directly related to numerical solution, but 200 is good enough. This part of program may take a LONG TIME. Be patience. EXAMPLE 2: H(S) NUM: [10 10] DEN: [1 7 10] DELAY: 0.3 OK Input Saw AMP.1: -1 TIME1: 1 AMP.2: 1 TIME2: 2 OK { Ascending saw wave} Graph Input FINAL TIME: 8 MAX. AMP : 2 MIN. AMP : -2 OK { See the ascending saw } Output FINAL TIME: 8 RESOLUTION: 100 MAX. AMP : 2 MIN. AMP : -2 H. SIZE : 1 V. SIZE : 1 { Press OK and wait two minutes, please } See the time delay, and the output curve. 10 BODE PLOT In this routine you can get the Bode Plot of H(s). When you graph the MAGNITUDE and PHASE you must enter the min and max decades, i.e. : initial_w = 10^(min. decade) final_w = 10^(max. decade) In the Magnitude plot you must enter also the max. and min. dB's. In the Angle plot you could get a discontinuity, it is because of limitated range of ARG function, the truth graph is just the continue one. EXAMPLE 1 From the Main Menu: H(S) NUM: [10 10] DEN: [1 7 10] DELAY: 0 Bode Plot MAGNITUDE MAX DB : 10 MIN DB : -30 MAX DEC: 2 MIN DEC: -1 H SIZE : 1 V SIZE : 2 { Here you get the Bode Plot from 0.1 to 100 [rad/sec] } Bode Plot ANGLE MAX DEC : 1 MIN DEC : -1 H SIZE : 1 V SIZE : 1 11 ROOT LOCUS This part graphics the root locus of the next equation: f(s) = B(s) + K*A(s) = 0 where B(s) and A(s) are polynomials of s, for different K's. Here B(s) is called IND. COEFS and A(s) is K COEFS. Both B and A MUST HAVE the same dimension. The graph is plotted in the complex plane, so you must enter the dimension of this plane, and how much screens you want to use. EXAMPLE Plot the Root Locus of: s(s+1)(s^2+4s+16) K= - ----------------- s+1 or equivalently: s^4 + 3*s^3 + 12*s^2 -16*s + K*(s+1) = 0 From the Main Menu: Root Locus K COEFS : [ 0 0 0 1 1 ] IND. COEFS: [ 1 3 12 -16 0 ] OK MAX RE: 10 MIN RE: -10 MAX IM: 10 MIN IM: -10 H. SIZE: 1 V. SIZE: 1 OK MIN K: 0 MAX K: 50 RESOLUTION : 100 { The resolution gives the number of points to be plotted} OK { wait please} Now press CANCEL an you'll back in the "INPUT K RANGE" menu. MIN K: 50 MAX K: 10000 RESOLUTION : 50 { K->INFINITE} OK { wait please } As you have seen there's no place for time delay in this section. If you have a system with transport lag or dead time and it's very small then you can aproximate: EXP(-delay*s) = 1 - delay*s or EXP(-delay*s) = 1 / ( delay*s + 1) 12 NYQUIST PLOT Here you can get a polar plot of the transfer function H(s), i.e., the plot of its real and imaginary parts when s = jw. You must specific the real and imaginary ranges together with the frecuency interval. When the tranfer function have a pole in zero you can't evaluate it in w = 0, instead use w=.001 (or a small value). EXAMPLE1 Get the polar plot of: 2.65*EXP(-.8*S) /(1+S) From the Main Menu: H(s) NUM : [2.65] DEN : [1 1] DELAY: 0.8 OK NYQUIST PLOT MAX RE: 3 MIN RE: -3 MAX IM: 2 MIN IM: -2 H SIZE: 2 V SIZE: 2 OK MIN W : 0 MAX W : 10 RESOLUTION : 50 OK {GRAPHING..} CANCEL MIN W : 10 MAX W : 40 RESOLUTION : 25 OK {GRAPHING..} EXAMPLE2 : Let's add a pole in zero. H(s) NUM : [2.65] DEN : [1 1 0] DELAY : 0.8 Nyquist Plot Same as before { just press OK} MIN W : 0.01 { it cannot be zero} MAX W : 10 RESOLUTION : 50 OK 13 NICHOLS PLOT Here you can get a log-magnitude versus phase plot for a frecuency range of interest of the transfer function. You must specific a decibel range of magnitude and the frecuency range. Like Bode Plot you could get a discontinuity, just meke te graph continue. EXAMPLE: H(S) NUM: [ 1] DEN: [1 0.8 1 0] DELAY: 0 Nichols Plot: MAX DB: 10 MIN DB: -10 H SIZE: 1 V SIZE: 1 OK MIN W : .1 { A pole in zero} MAX W : 2 RESOLUTION : 100 OK { Graph. Look the discontinuity, the graphic could be in the negative angle halfplane } 14 FINAL WORDS I hope that this software will be useful for you. I would like to have it when I did "Modern Control" course in EE Department of University of Chile. I'm not so interesting in Control Area, I like Digital systems and Telecomunications. Now I'm 22 years old (8/1995). Thanks to Joseph K. Horn and Patrick J. Yagle for help me about INFORM comand. Thanks to Sylvana Arenas for her supporting. Future Versions? . Sure I'm just thinking in new routines and improving the current ones (stability and accuracy), in the next versions i'll add state space analysis ( H(s)<->ABCD ) and maybe a graphical environment. Others Programs? . Sure I have a lot programas , most of them are about numerical computations ( roots, integrals, differential equations (ordinary and parcial), linear systems ( iterative)...); electric and electronic circuits and electromagnetics equations. None of them have been distribuited, because they are not so good for me. If you are reading this doc please E-mail me, becuase I want to know how many people will use or hate my program . If you find a bug, have a critic or just use this program feel free to contact me (PLEASE, All my friends said: nobody will use your program). Thanks you and Good Luck. Juan Francisco Roco Arriagada. E-mail: sroco@cec.uchile.cl