26
Optimal Design of Energy Systems Chapter 4 Equation Fitting Min Soo KIM Department of Mechanical and Aerospace Engineering Seoul National University

Optimal Design of Energy Systems

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Optimal Design of Energy Systems

Optimal Design of Energy Systems

Chapter 4 Equation Fitting

Min Soo KIM

Department of Mechanical and Aerospace EngineeringSeoul National University

Page 2: Optimal Design of Energy Systems

EquationDevelopment

• Performance characteristics of equipment

• Behavior of processes

• Thermodynamic properties of substances

Key elements

• To facilitate the process of system simulation

• To develop a mathematical statement for optimization

Purposes

Chapter 4. Equation fitting

4.1 Mathematical modeling

Page 3: Optimal Design of Energy Systems

11 12 1

1 2

n

m m mn

a a a

a a a

Order of matrix m n

T

A Transpose of a matrix [A] => interchanging rows & columns

ex>

1 4

2 5

3 6

A

1 2 3

4 5 6

TA

Chapter 4. Equation fitting

4.2 Matrices

Page 4: Optimal Design of Energy Systems

• Multiplying two matrices

# of columns of the left matrix = # of rows of the right matrix

𝑎11 ⋯ 𝑎1𝑛⋮ ⋱ ⋮

𝑎𝑚1 ⋯ 𝑎𝑚𝑛

×𝑏11 ⋯ 𝑏1𝑙⋮ ⋱ ⋮𝑏𝑛1 ⋯ 𝑏𝑛𝑙

⇒ 𝑚× 𝑙 𝑚𝑎𝑡𝑟𝑖𝑥

Chapter 4. Equation fitting

4.2 Matrices

Page 5: Optimal Design of Energy Systems

• Simultaneous linear equations

1 2 3

1 2

1 2 3

2 3 6

3 1

4 2 0

x x x

x x

x x x

1

2

3

2 1 3 6

1 3 0 1

4 2 1 0

x

x

x

Chapter 4. Equation fitting

4.2 Matrices

Page 6: Optimal Design of Energy Systems

• Determinant (scalar)

11 12 13

21 22 23

31 32 33

a a a

D a a a

a a a

11 22 33 12 23 31 13 21 32

31 22 13 21 12 33 11 23 32

a a a a a a a a a

a a a a a a a a a

cofactor of

22 33 23 32a a a a

11a [( 1) ]i

[ ]

i j

ij

submatrix formed

by striking outA

th row and j th

column of A

Cofactor of 𝒂𝒊𝒋

Chapter 4. Equation fitting

4.2 Matrices

= 𝑎11𝐴11 + 𝑎21𝐴21 + 𝑎31𝐴31

Page 7: Optimal Design of Energy Systems

Example 4.1 : Matrices

Evaluate

1034

21−12

−1211

0025

(Solution)

Find row which has many zeros if possible => second row!

det

Chapter 4. Equation fitting

= 𝑎21𝐴21 + 𝑎22𝐴22 + 𝑎23𝐴23 + 𝑎24𝐴24

= 0 𝐴21 + 1 −1 2+21 −1 03 1 24 1 5

+ 2 −1 2+31 2 03 −1 24 2 5

+ (0)𝐴24

= 0 + 10 + 46 + 0 = 56

Page 8: Optimal Design of Energy Systems

11 12 13 1 1

21 22 23 2 2

31 32 33 3 3

[ ][ ] [ ]

a a a x b

A X a a a x b B

a a a x b

11 1 12 2 13 3 1

21 1 22 2 23 3 2

31 1 32 2 33 3 3

a x a x a x b

a x a x a x b

a x a x a x b

Simultaneous linear equations

Matrix form

Chapter 4. Equation fitting

4.3 Solution of simultaneous equation

Page 9: Optimal Design of Energy Systems

[ ] [ ] ii

A matrix with B matrix substituted in th columnx

A

• Crammer’s rule

Chapter 4. Equation fitting

4.3 Solution of simultaneous equation

Example 4.2

Using Cramer’s rule, get 𝑥2

2 1 −11 −2 2−1 0 3

𝑥1𝑥2𝑥3

=390

(Solution)

𝑥2 =

2 3 −11 9 2−1 0 32 1 −11 −2 2−1 0 3

=30

−15= −2

Page 10: Optimal Design of Energy Systems

Coefficient matrix [A]

Triangular matrix

Back substitution

• Gaussian elimination

Chapter 4. Equation fitting

4.3 Solution of simultaneous equation

Page 11: Optimal Design of Energy Systems

2

0 1 2

n

ny a a x a x a x

• degree of the eq = highest exponent of x

• # of data point = degree + 1 → exact expression

> → best fit

Chapter 4. Equation fitting

4.4 Polynomial representations

Page 12: Optimal Design of Energy Systems

Points are equally spaced

Derive 4th degree polynomial

n=4

2

0 1 0 2 0

3 4

3 0 4 0

( ) ( )

( ) ( )

n ny y a x x a x x

R R

n na x x a x x

R R

1 0 1n nx x x x x

2

0 1 2

n

ny a a x a x a x

(next page)

Eq. (4.16)

4

x

Chapter 4. Equation fitting

4.6 Simplifications when the independent variable is uniformly spaced

Page 13: Optimal Design of Energy Systems

2 3 4

1 0 1 0 1 0 1 01 1 2 3 4

1 2 3 4

4( ) 4( ) 4( ) 4( )x x x x x x x xy a a a a

R R R R

a a a a

0 0

1 1 1 2 3 4

2 2 1 2 3 4

3 3 1 2 3 4

4 4 1 2 3 4

,

,

, 2 4 8 16

, 3 9 27 64

, 4 16 64 256

x x y y

x x y y a a a a

x x y a a a a

x x y a a a a

x x y a a a a

if substitute (x1,y1)

Substitute all the points to Equation (4.16)

Chapter 4. Equation fitting

4.6 Simplifications when the independent variable is uniformly spaced

Page 14: Optimal Design of Energy Systems

Chapter 4. Equation fitting

4.6 Simplifications when the independent variable is uniformly spaced

Page 15: Optimal Design of Energy Systems

2

0 1 2y a a x a x

1 2 3 2 1 3 3 1 2( )( ) ( )( ) ( )( )y c x x x x c x x x x c x x x x

1 1 1 1 2 1 3, ( )( )x x y c x x x x

2 2 2 2 1 2 3, ( )( )x x y c x x x x

3 3 3 3 1 3 2, ( )( )x x y c x x x x

1 1

( ) ( )

( ) ( )

nnj i

i

i j i j i i

x x ommiting x xy y

x x ommiting x x

Chapter 4. Equation fitting

4.7 Lagrange interpolation

Page 16: Optimal Design of Energy Systems

2

1 1 1 1 1:S P a b Q c Q

2

2 2 2 2 2:S P a b Q c Q

2

3 3 3 3 3:S P a b Q c Q

2

0 1 2

2

0 1 2

2

0 1 2

( )

( )

( )

a S A A S A S

b S B B S B S

c S C C S C S

2( ) ( ) ( )P a S b S Q c S Q

Chapter 4. Equation fitting

4.8 Function of two variables

Page 17: Optimal Design of Energy Systems

Example 4.3 : Function of two variables

The range is the difference between the inlet and outlet temperatures of thewater. In table below, for example, when the wet-bulb temperature is 20℃and the range is 10℃, inlet and outlet temperature are 35.9℃ and 25.9℃each. Express the outlet temperature 𝒕 in Table below as a function of thewet-bulb temperature (WBT) and the range R

Chapter 4. Equation fitting

Wet-bulb temperature, ℃

Range, ℃ 20 23 26

10 25.9 27.5 29.4

16 27.0 28.4 30.2

22 28.4 29.6 31.3

(Solution)For 3 WBTs, get parabola that represents (R,t)

i) For WBT = 20℃

(R,t) : (10,25.9), (16,27.0), (22,28.4)

⇒ 𝑡 = 24.733 + 0.075006𝑅 + 0.004146𝑅2

ii) For WBT = 23℃

⇒ 𝑡 = 26.667 + 0.041659𝑅 + 0.0041469𝑅2

iii) For WBT = 26℃

⇒ 𝑡 = 28.733 + 0.024999𝑅 + 0.0041467𝑅2

Page 18: Optimal Design of Energy Systems

Example 4.3 : Function of two variables

Chapter 4. Equation fitting

(Solution)

Set 2nd degree equation (constant terms(C) , WBT) ∶ 24.733,20 , 26.667,23 , 28.733,26

⇒ 𝐶 = 15.247 + 0.32637𝑊𝐵𝑇 + 0.007380𝑊𝐵𝑇2

Set 2nd degree equation (coefficient of 𝑅 , WBT) and (coefficient of 𝑅2 , WBT) as well

𝑡 = 15.247 + 0.32637𝑊𝐵𝑇 + 0.007380𝑊𝐵𝑇2 +0.72375 − 0.050978𝑊𝐵𝑇 + 0.000927𝑊𝐵𝑇2 𝑅 +

(0.004147 + 0𝑊𝐵𝑇 + 0𝑊𝐵𝑇2)𝑅2

Page 19: Optimal Design of Energy Systems

Chapter 4. Equation fitting

4.9 Exponential forms

ln ln ln

my bx

y b m x

Log-log plot (y=bxm)

Page 20: Optimal Design of Energy Systems

If y approaches some value b, as orx x

Estimate b

Calculate m with log-log plot (y-b vs. x)

Fitting (y vs. xm)

Correct value of b

Curve y=b+axm

my b ax

Chapter 4. Equation fitting

4.9 Exponential forms

Page 21: Optimal Design of Energy Systems

Misuse of least square method

Example of least square method

Misuses of least square method

(a) Questionable correlation

(b) Applying too low degree

Chapter 4. Equation fitting

4.10 Best fit : Method of least squares

The sum of the squares of the deviation is a minimum

Page 22: Optimal Design of Energy Systems

y a bx

2( ) 0i i

za bx y

a

2

1

( ) minm

i i

i

z a bx y

2( ) 0i i i

za bx y x

b

i ima b x y 2

i i i ia x b x x y

Chapter 4. Equation fitting

4.10 Best fit : Method of least squares

• Method of least square for

Page 23: Optimal Design of Energy Systems

Example 4.4 : Best fit : Method of least squares

Determine 𝑎0 and 𝑎1 in the equation 𝑦 = 𝑎0 + 𝑎1𝑥 to provide a best fit inthe sense of least-squares deviation to the data points (1, 4.9), (3, 11.2), (4,13.7), and (6, 20.1)

(Solution)

Chapter 4. Equation fitting

𝑥𝑖 𝑦𝑖 𝑥𝑖2 𝑥𝑖𝑦𝑖

1 4.9 1 4.9

3 11.2 9 33.6

4 13.7 16 54.8

6 20.1 36 120.6

∑ 14 49.9 62 213.9

𝑚 = 44𝑎0 + 14𝑎1 = 49.914𝑎0 + 62𝑎1 = 213.9

i ima b x y 2

i i i ia x b x x y

𝑦 = 1.908 + 3.019𝑥

Page 24: Optimal Design of Energy Systems

4.10 Best fit : Method of Least Squares

• Method of least squares for2y a bx cx

2

2 3

22 3 4

1 i i i

i i i i i

i i i i i

a b x c x y

a x b x c x y x

a x b x c x y x

𝑖=1

𝑚

(𝑎 + 𝑏𝑥𝑖 + 𝑐𝑥12 − 𝑦𝑖)

2 → 𝑚𝑖𝑛

Chapter 4. Equation fitting

Page 25: Optimal Design of Energy Systems

4.11 Method of Least Squares Applied to Nonpolynomial Forms

• Method of least squares

→ apply to equation with constant coefficients

cf) sin 2 cy ax bx

Chapter 4. Equation fitting

Page 26: Optimal Design of Energy Systems

4.12 The art of equation fitting

• Choice of the form of the equation

Polynomials with negative exponent(1)

Exponential eq.(2)

Gompertz eq(3)

combination

, 1xcy ab where b c

(1) (2) (3)

Chapter 4. Equation fitting