___________________________________________________________________________________________ ME 435 Thermal Energy Systems Lecture #13 ___________________________________________________________________________________________ Curve Fitting As mentioned last time, one example of the equations that we will need for a compressor simulation are the power and capacity as functions of the saturated evaporating and saturated condensing temperatures. Power = f1 (SET,SCT) Capacity = f2 (SET,SCT) We saw last time that equations like this are 3-D and represent surfaces. Performance curves are 2-D representations (“topological maps”) of these surfaces. Fitting techniques can be used to develop the functional dependence from manufacturer’s tabular data. The two techniques we will be discussing are: 1) Exact fitting: (this lecture) where the curve is forced to hit each and every data point 2) Method of least squares: (next lecture) where the curve is a “best fit” but doesn’t hit every point Many times, components can be modeled using simple polynomials. A typical 2-D polynomial can be written as: y(x) = a0 + a1 x + a2 x2 + a3 x3 + … The ai are the coefficients for the polynomial: these are what we will be after when we do a curve fit! In the case of 3-D surfaces, there are two independent variables involved, let’s say x and z. A typical form for y(x,z) would be: y(x,z) = a0 + a1 x + a2 z + a3 x z +a4 x2 + a5 z2 + a6 x2 z + a7 x z2 + a8 x2 z2 + … (Note: this is only one possible form…we will discuss other possible forms later!) Our basic task, once we have the (y,x,z) data will be to 1) Determine the functional form for the y(x,z) equation 2) Determine the ai coefficients 3) CHECK THE RESULT!!! 3-D Curve Fitting : Exact Fitting The idea behind exact fitting is to select a set of data points and determine an equation that passes through these points exactly! The set of points may be all of the data points, or a subset of the data for the performance parameter we are considering. When a data set of subset is fit exactly, an equation is written for each data point. This results in a set of n equations with n unknowns. These unknowns are the ai coefficients. Consider the following example. In this example, an equation is desired for the outlet water temperature from a cooling tower as a function of the ambient wet bulb temperature (WBT) and the range R. Note: R is defined as the difference between the inlet and outlet temperatures of the water passing through the cooling tower. The manufacturer’s data for a specific cooling tower are given in the following table: Outlet Water Temperature (°C) WBT (°C) R (°C) 20 23 26 10 25.9 27.5 29.4 16 27.0 28.4 30.2 22 28.4 29.6 31.3 The form of the equation that is desired is: Outlet temperature = t = f (R,WBT) In this table, there are 9 data points. This is all that we have. We are interested in developing an equation that fits all 9 data points exactly. Using the exact fitting ides, we need to write 9 (!) equations with 9 unknowns: a1 through a9. Step 1: write the polynomial. If we assume that the polynomial model we mentioned on the previous page is sufficient to represent the data, then we must use a 9-term, 3-D function. To keep life simple, we will use the lowest terms of the polynomial that we possibly can! t = a1 + a2 R + a3 WBT + a4 R WBT + a5 R2 + a6 WBT2 + a7 R2 WBT + a8 R WBT2 + a9 R2 WBT2 Step 2: substitute the data points into the equation to form the 9 equations (leaving the ai as the unknowns…) a1 + 10 a2 + 20 a3 + 200 a4 + 100 a5 + 400 a6 + 2000 a7 + 4000 a8 + 40000 a9 = 25.9 a1 + 10 a2 + 23 a3 + 230 a4 + 100 a5 + 529 a6 + 2300 a7 + 5290 a8 + 52900 a9 = 27.5 a1 + 10 a2 + 26 a3 + 260 a4 + 100 a5 + 676 a6 + 2600 a7 + 6760 a8 + 67600 a9 = 29.4 a1 + 16 a2 + 20 a3 + 320 a4 + 256 a5 + 400 a6 + 5120 a7 + 6400 a8 +102400 a9 = 27.0 a1 + 16 a2 + 23 a3 + 368 a4 + 256 a5 + 529 a6 + 5888 a7 + 8464 a8 +135424 a9 = 28.4 a1 + 16 a2 + 26 a3 + 416 a4 + 256 a5 + 676 a6 + 6656 a7 +10816 a8 +173056 a9 = 30.2 a1 + 22 a2 + 20 a3 + 440 a4 + 484 a5 + 400 a6 + 9680 a7 + 8800 a8 +193600 a9 = 28.4 a1 + 22 a2 + 23 a3 + 506 a4 + 484 a5 + 529 a6 +11132 a7 +11638 a8 +256036 a9 = .29.6 a1 + ?? a2 + ?? a3 + ??? a4 + ???? a5 + ???? a6 + ???? a7 + ???? a8 + ?????? a9 = ??.? Group Exercise #1: Fill in the question marks in the last equation above. You have 10 min. The 9 equations above can be solved for the ai using a variety of numerical techniques (or software packages. Whatever technique you use, you are solving the following matrix equation: [A] [a] = [b] [a] = [A]-1 [b] A solution may be obtained from a matrix operation: where [A]-1 is the inverse of the [A] matrix. 1 1 1 1 1 1 1 1 ? 10 10 10 16 16 16 22 22 ?? 20 23 26 20 23 26 20 23 ?? 200 230 260 320 368 416 440 506 ??? 100 100 100 256 256 256 484 484 ???? 400 529 676 400 529 676 400 529 ???? 2000 2300 2600 5120 5888 6656 9680 11132 ???? 4000 5290 6760 6400 8464 10816 8800 11638 ???? 40000 52900 67600 102400 135424 173056 193600 256036 ?????? [A] a1 a2 a3 a4 a5 a6 a7 a8. a9 = 25.9 27.5 29.4 27.0 28.4 30.2 28.4 29.6 ?.? [a] = [b] Of course this is one of those jobs for which a computer or calculator is best suited. I suggest you see if your calculator will do matrix inverses. (It will probably look as if you are “dividing” the vector [b] by the matrix [A] to get the vector [a], although technically that is not what you are doing.) You may also use a spreadsheet or EES to get your solution. I will hand out a solution in class. The final step (as always) is to check your answer! Remember that this equation is supposed to fit every data point exactly! Group Exercise #2: Check the solution that I hand out in class to see whether or not it is indeed correct. The equation for what is known as the percent deviation is: x(data ) x(calc) % dev 100 . x(data ) What is the percent deviation for each of the 9 manufacturer’s data points? Next we will examine how to determine what the functional form of a set of data points should look like.