WEEK 7 MODELING FREQUENCY RESPONSE Objectives To compare the experimental Bode plots with the approximate FOPDT model's Bode plots for the system. To observe the impact of parameter values on the model's Bode plots. To learn how to generate sine responses with Excel. To observe the sine responses of the approximate mathematical model for a system. Modeling Assignment If the input function to a FOPDT is a sine function, having an amplitude = A and frequency = f, then m(t) = A•sin(2ft) then the steady oscillation part of the time response of the FOPDT system is c(t ) A K 1 2 2 sin( t0 arctan( )) where K is the gain, to is the dead-time and is the first-order time constant, or characteristic time, of the FOPDT system. The variables m(t) and c(t) in these equations are deviation variables. This means that you have to add the input baseline and output baseline to the values to get them to agree with the experimental data. The model equations for the Bode plots are AR amplitude ratio K 1 2 2 and phase angle to tan 1 ( ) We want to have Excel draw a graph of these equations so we can see the effect of the various parameters and see what parameters best match our experimental results. Comparing Bode Plot for Model and Experiment From last week, you got some values of the Amplitude Ratio (AR) and Phase Angle (PA) for the sine inputs to your system at some different frequencies. Enter these into a new Excel spreadsheet, like this: (These are ONLY example numbers) A 1 2 3 4 5 6 7 8 9 B Freq C D AR 0.011 0.02 0.05 0.1 0.2 0.5 1 E PA 50 49 40 21 10 4 2 -8 -25 -55 -88 -150 -190 -255 You are leaving columns C and D blank for now; later you'll put the model equations in there. It will be useful if you enter column D by using a formula and setting it to column A. The formula for cell D1 is =A1. For now, add to your spreadsheet, in columns G and H, the names and values of the approximate model parameters for your system: K, to and tau. (These are ONLY example numbers) G 1 2 3 H K= to= tau= 7.2 0.65 0.33 Now enter the values of frequency that you want to have for you model Bode plot. Suggestion: have these values' range a bit wider than your experimental frequency range. Put these in column A, starting BELOW where your last experimental value is, say cell A10. Copy these into column D, also. In the cell in column C BELOW the last experimental point, let's say, C10, enter this formula for the amplitude ratio =K/SQRT(1+(2*PI()*A10)^2*tau^2) In the cell in column F BELOW the last experimental point, let's say, F10, enter this formula for the phase angle =(ATAN(-2*PI()*A10*tau)-2*PI()*A10*to)*180/PI(0) Now plot the amplitude ratio part of the Bode plot by highlighting columns A, B and C; choosing the ChartWizard, selecting Scatter and making the axes log-log. Now plot the phase angle part of the Bode plot by highlighting columns D, E and F; choosing the ChartWizard, selecting Scatter and making the axes semilog. VARYING PARAMETERS Now go back to the parameter cells and change one of them and watch the graph change. Find the values of the parameters that make the model agree well with the experimental results. Here is the suggested order: Which Bode Graph AR vs f Parameter(s) to vary K Objective AR vs f tau get model's AR-vs-f curve to agree near the "corner" of the curve PA vs f to get model's PA-vs-f curve to agree at PA=-180 get model's AR-vs-f curve to agree at low frequencies Save the file. Label the graphs. Print the graphs. Save the file. These values are now the best estimates for your approximate model's parameters to fit your system. Comparing Time Responses for Model and Experiment We're going to build a time-response model in a file that has some experimental sine-response data in it. Begin by choosing the file that has data in it for the lowest frequency sine-input experiment that you did that has good data. Open an Excel by double clicking on the Excel icon. Open the data file from Week 6 by using the File/Open... menu item. Part of the spreadsheet will look like this: A B C D E F 1 Time (sec) Input Value (%) Pressure (cm-H2O) 2 0.011 50 0.152 3 0.18 50 0.173 4 0.196 50 0.152 5 0.213 50 0.132 6 0.213 50 0.132 7 0.213 50 0.132 Save this now in a new file named "W7-something-or-other." Do this with 8 0.213 50 0.132 the File/Save As... menu. We're going to enter in two columns of numbers to have Excel plot for us. The columns are "Input" and "Output." Type each of these names in the top row of the spreadsheet in columns D and E, respectively. Move to the right in the spreadsheet by touching the "tab" key or using the key or by clicking where you want to move to. We're going to put formulas in cells D2 and E2 for the functions m(t) and c(t). In columns F and G, we're going to put names and values for A, f, K, to,, input baseline and output baseline. Let's use 2, 3, 0.2, 0.3, 0.4, 40 and 11, respectively. So those columns will look like this: F A f K to tau in-baseline out-baseline G 2 3 0.2 0.3 0.4 40 11 Use the Insert/Names >/Define to define the names for all these parameters. Click on D2 and put in this formula: =A*sin(2*PI()*f*A2)+inbl Click on E2 and put in this formula: =A*K/(SQRT(1+2*PI()*f*2*PI()*f*tau*tau))*SIN(2*PI()*f*A2 +ATAN(-2*PI()*f*tau)-2*PI()*f*to)+outbl Now copy these formulas down the spreadsheet. Click in the last time-value in column D and drag across to column E and release the mouse. Both should be selected. Now click on the square at the right bottom of that selection and drag it down (off the screen and it will scroll down) to the end of the experimental data. Now you should have 5 columns with the values in them that we want. Adjust amplitude, frequency, "inbl" and "outbl" so the curves agree. Label the curves and print the curves. Save your file. G Repeat these time response models for 2 additional frequencies. Use one at a frequency near the "corner" frequency and one at a frequency of one of the highest frequencies you did. File Suggestion: For all your data files that you save this week, start their names with "W7" (meaning week #7) and save them on "Student files on the Web" in your team's folder. By the way, there are files like the one you've developed that are available on the Internet at http://chem.engr.utc.edu/329.