Modelica by Example [v0.6.0]

https://mbe.modelica.university/

452 50 9MB

English Pages 371 Year 2019

Report DMCA / Copyright

DOWNLOAD PDF FILE

Recommend Papers

Modelica by Example [v0.6.0]

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Citation preview

x˙ = (1 − x) x

x

x˙ = (1 − x)

x˙ = (1 − x); x(0) = 2

x x(0) = 1 x(0) ˙ =0

x

mcp T˙ = hA(T∞ − T )

L C

Vb

V iL iR

iC

iL iR V = iR R

C L Vb

R

V = iC t

iL = (Vb − V ) t

iC

iL = iR + i C

ϕ

J ω˙ =

ω !

τi

i

τ J

ω˙ τi

τ = c∆ϕ

τ = d∆ϕ˙

ω1 = ϕ˙ 1 J1 ω˙ 1 = c1 (ϕ2 − ϕ1 ) + d1

(ϕ2 − ϕ1 ) t

ω2 = ϕ˙ 2 J2 ω˙ 2 = c1 (ϕ1 − ϕ2 ) + d1

(ϕ1 − ϕ2 ) − c2 ϕ2 − d2 ϕ˙ 2 t

ϕ1 = 0 ω1 = 0 ϕ2 = 1 ω2 = 0 ω=0

ω = ϕ˙

x y

x˙ r = αx x

x˙ r

α

y˙ s = −γy y

y˙ s

γ

x˙ p = −βxy y˙ p = δxy x˙ p

y˙ p β

δ

x˙ = x˙ r + x˙ p y˙ = y˙ p + y˙ s

x˙ = x(α − βy) y˙ = y(δx − γ)

x˙ = 0 y˙ = 0

x(t)

y(t) x

x(t) =

"

tf

x˙ x + x(t0 ) t0

y x x

y˙ x˙

y

y

x˙ x y x˙

y˙ x

x









x˙ = 0 x˙ = x (α − βy) y˙ = 0 y˙ = y (δx − γ)

x(α − βy)



x x˙ = 0 y˙ = 0 x(α − βy) = x˙ y(δx − γ) = y˙ x x x = ...

x x

x = 0; y = 0

y

y y

y

π





⃗x˙ (t) = f⃗(⃗x(t), ⃗u(t), t) ⃗y (t) = ⃗g (⃗x(t), ⃗u(t), t) t

⃗x(t)

t ⃗u(t) t ⃗x

⃗y t

⃗u(t) ⃗x ⃗x˙ (t)

⃗y (t)

⃗x f⃗

⃗g

⃗x(t) ⃗x˙ (t)

⃗x(t) ⃗x(T ) =

"

T

⃗x˙ (t) t + ⃗x(ti )

ti

⃗x

⃗x

⃗x(t0 ) = ⃗x0 t0

⃗x0

⃗x˙ (t0 )

⃗x˙ (t0 ) = f⃗(⃗x(t0 ), ⃗u(t0 ), t0 ) ⃗y (t0 ) = ⃗g (⃗x(t0 ), ⃗u(t0 ), t0 ) ⃗0 = ⃗h(⃗x(t0 ), ⃗x˙ (t0 ), ⃗u(t0 ), t0 ) ⃗h ⃗h

⃗x

⃗x˙

⃗h

⃗h(⃗x(t0 ), ⃗x˙ (t0 ), ⃗u(t0 ), t0 ) = ⃗x(t0 ) − ⃗x0 ⃗h ⃗h(⃗x(t0 ), ⃗x˙ (t0 ), ⃗u(t0 ), t0 ) = ⃗x˙ (t0 )

v v

= −ev v

e

ϵ ϵ

ϵ

ϵ

a−b

x

x

∆θ ω ˆ=

∆θ ∆t

∆θ pi

1 10

2 10



x = ′′

x = x

′′′

=

# # #

0, 3 x2 ,

x < 0,

0, 6 x,

x < 0,

0, 6,

x < 0,

x=0

i r

dt

⃗x˙ (t) = f⃗(⃗x(t), ⃗u(t), t) ⃗y (t) = ⃗g (⃗x(t), ⃗u(t), t) x y

u

f⃗ ⃗x

⃗u ⃗x˙ (t) = A(t)⃗x(t) + B(t)⃗u(t) ⃗y (t) = C(t)⃗x(t) + D(t)⃗u(t)

A

⃗x˙ (t) = A⃗x(t) + B⃗u(t) ⃗y (t) = C⃗x(t) + D⃗u(t)

⃗g

A $ $ 0 $ $ 0 A=$ $− Jk1 $ k1 $ 1 J2

$ $ $ $ $$ A = $$ k1 $ $ − J1 $ $ k1 $$ J2

0 0 k1 J1 k1 − J2 − Jk22

1 0 − Jd11 d1 J2

0 1 d1 J1 d1 − J2 − Jd22

A $ $$ $0 0 $ $1 0 $ $$ $0 0 $ $0 1 $$ $$− d1 k1 $$ J1 J1 k1 k2 $$ d1 − J2 − J2 $$ J2

$ $ $ $

d1 J1 d1 − J2 − Jd22

$ $ $ $ $ $ $ $ $ $ $ $ $$ $$ $$ $$ $$

ith mi CTi ith

m ith

C

Ti mi = ρVi

ρ ith

ith

Vi Vi = Ac Li ith

Ac i

Li

th

Li Li =

L n

m = ρAc Li

ρAc Li CTi

ρAc Li C

Ti t

Ac Li

C

Tamb qh = −hAsi (Ti − Tamb ) h

ith

Asi

i − 1th

i + 1th

ρAc Li C

ρAc Li C

ρAc Li C

qki→i−1 = −kAc

Ti − Ti−1 Li

qki→i+1 = −kAc

Ti − Ti+1 Li

T1 T 1 − T2 = −hAsi (T1 − Tamb ) − kAc t Li

Tn Tn − Tn−1 = −hAsn (Tn − Tamb ) − kAc t Li

Ti Ti − Ti−1 Ti − Ti+1 = −hAsi (Ti − Tamb ) − kAc − kAc t Li Li

T1 (0) = 200 Tn (0) = 300

1 n

2

n−2

n−1

!→

!→

A+B →X 1

A+B ←X 2

X +B →T +S 3

X A + 2B → T + S

[A] = −k1 [A][B] + k2 [X] t [B] = −k1 [A][B] + k2 [X] − k3 [B][X] t [X] = k1 [A][B] − k2 [X] − k3 [B][X] t k1 k2

k3 −k1 [A][B]

X A

[A] [B]

[X]

A+B → X

A A

B

A B

X

1 2

3

[A] = −k1 [A][B] + k2 [X] t [B] = −k1 [A][B] + k2 [X] − k3 [B][X] t [X] = k1 [A][B] − k2 [X] − k3 [B][X] t

⎧ ⎫ ⎡ −k1 [B] ⎨ [A] ⎬ [B] = ⎣ −k1 [B] ⎭ t⎩ [X] k1 [B]

A B

⎫ ⎤⎧ 0 k2 ⎨ [A] ⎬ −k3 [X] k2 ⎦ [B] ⎩ ⎭ −k3 [X] −k2 [X]

X

A

B=

/

1.0 2.0 5.0 6.0

3.0 7.0

0

n

⎡ $ $2 $ ⎢ $1 ⎢ $ ⎢ $0 $ C=⎢ ⎢ $0 ⎢ $ ⎣ $0 $ $0

1 2 0 0 0 0

$ $ $ $ $ $ $ $ $ $ $ $

$ $0 $ $0 $ $2 $ $1 $ $0 $ $0

0 0 1 2 0 0

$ $ $ $ $ $ $ $ $ $ $ $

$ $0 $ $0 $ $0 $ $0 $ $2 $ $1

0 0 0 0 1 2

$⎤ $ $ $⎥ $⎥ $⎥ $⎥ $⎥ $⎥ $⎦ $ $

n

C

aijk = i xj yk x

y a

⎡ ⎢ ⎢ ⎢ ⎢ ⎣

1.7 1.7 1.7 1.7 1.7

1.7 1.7 1.7 1.7 1.7

1.7 1.7 1.7 1.7 1.7

1.7 1.7 1.7 1.7 1.7

1.7 1.7 1.7 1.7 1.7

1.7 1.7 1.7 1.7 1.7

1.7 1.7 1.7 1.7 1.7

⎤ ⎥ ⎥ ⎥ ⎥ ⎦

1



1 1 ⎣ 1 1 1 1

1 1 1 1 1 1

⎤ 1 1 ⎦ 1

1 0

⎡ ⎢ ⎢ ⎢ ⎢ ⎣

1 0 0 0 0

0 1 0 0 0

0 0 1 0 0

0 0 0 1 0

0 0 0 0 1

⎤ ⎥ ⎥ ⎥ ⎥ ⎦

0



⎤ 2.0 0 0 0 ⎢ 0 3.0 0 0 ⎥ ⎢ ⎥ ⎣ 0 0 4.0 0 ⎦ 0 0 0 5.0

1

1

1

a

a+b ai + bi aij + bij aijk + bijk

c=a+b ci = ai + bi cij = aij + bij cijk = aijk + bijk

b

c

a−b ai − bi aij − bij aijk − bijk

c=a−b ci = ai − bi cij = aij − bij cijk = aijk − bijk

a∗b a ∗ bi a ∗ bij a ∗ bijk ai ∗ b aij ∗ b aijk ∗ b ai ∗ bi ai ∗ bij aij ∗ bj aik ∗ bkj

c=a∗b ci = a ∗ bi cij = a ∗ bij cijk = a ∗ bijk ci = a i ∗ b cij = aij ∗ b cijk 3 = aijk ∗ b c = 3i ai ∗ bi cj = 3 i ai ∗ bij ci = j aij ∗ bj 3 cij = k aik ∗ bkj

a b ai bi aij bij aijk bijk

c=a∗b ci = a i ∗ bi cij = aij ∗ bij cijk = aijk ∗ bijk

a/b ai /b aij /b aijk /b

c = a/b ci = ai /b cij = aij /b cijk = aijk /b

a b ai bi aij bij aijk bijk

c = a/b ci = ai /bi cij = aij /bij cijk = aijk /bijk

a aij

a b ai bi aij bij aijk bijk

c = ab ci = abi i b cij = aijij bijk cijk = aijk

b

b

a

b

c cij = ai ∗ bj

bij =

( )=



0 ( ) = ⎣ x3 −x2

4

aij aji

−x3 0 x1

i