Docsity

Implement Mathematical Operations - Computational Methods - Lecture Slides, Slides of Calculus for Engineers

Partial preview of the text

Download Implement Mathematical Operations - Computational Methods - Lecture Slides and more Slides Calculus for Engineers in PDF only on Docsity!

Learning Goals

  • Implement Mathematical Operations in

MATLAB using SimuLink Functional Blocks

  • Employ FeedBack in the SimuLink

Environment to numerically Solve ODEs

  • Create Simulations of Dynamic Control

Systems using SimuLink Block Models

  • Export Simulation result to MATLAB WorkSpace

for Further Analysis

Problem 10.30 (1)

  • Make A subsystem

Block for

 It has been found

that for many Valves

the Flow Thru the

valve is Related to

the Pressure Drop

 Inputs

  • q (kg/s)
  • P (^) l & P (^) r (Pa)
  • R (^) l & R (^) r ([√ΔP]/[kg/s])

q ∝ Phi − Plo = ∆ P

 Using the Industry

Constant of

Proportionality, Cv

q = Cv ∆ P

Problem 10.30 (3)

  • To Account for

potential BACK Flow

under NEGATIVE ΔP

Conditions use the

Signed

Square-Root Relation;

the “SSR”

 Where the SSR Fcn

 Back to the Tank;

ID the In-Flows

Assuming Pr & Pl

are Less than Pbot

  • i.e., There is

OUTFLOW at the

Left & Right

SSR ( P )

R

q

v

If 0
If 0
P P
P P
SSR P

SSR Digression

  • The SSR fcn is BUILT into

SimuLink

  • An quick Example
    • The Result
    • For This Problem We’ll

Build our OWN

SSR

|u|

Signed Sqrt

P10_30_SSR_demo_1111.mdl

Yssr To Workspace

Yin To Workspace

Sine Wave

|u| Signed Sqrt

Scope

-10 0 1 2 3 4 5 6 7 8 9 10

0

2

4

6

8

10

t

9sin(t); SSR(10sin(t))

sint SSR

plot(tout,

(^) Yin,

(^) tout,

(^) Yssr,

(^) 'LineWidth',

(^) 3),

(^) xlabel('t'),

ylabel('9sin(t);

(^) SSR(10sin(t))'),

(^) grid,

(^) legend('sint',

(^) 'SSR')

Problem 10.30 (5)

  • Now the OutFlows in

Terms of the Fluid-

Flow Resistances

  • p ≡ Pressure at the

BOTTOM of the Tank

(Pa)

 And From Fluid

Mechanics ^ A NONlinear

ODE in h(t)

( (^) l r )

l r

l r SSR p p R

q (^) ,

,

,

1 = −

p = ρ gh

 Next, Sub into the

dmT/dt eqn

q ( q (^) l qr )

dt
dh

ρ A = − +

  

 = − − + − r r

l l

SSR p p R

SSR p p R

q dt

dh A

1 1 ρ

  

 = − − + − r r

l l

SSR gh p R

SSR gh p R

q dt

dh ρ A ρ ρ

1 1

Problem 10.30 (6)

  • Put the ODE into Integrable Form

= − − + − r r

l l

SSR gh t p R

SSR gh t p R

q dt A

dh

( )

( )

∫ ∫ (^ ( ) )^ (^ ( ) )

=

= 

z t

z r r

l l

ht

h

SSR gh z p dz R

SSR gh z p R

q A

dy 0 0

( )

∫ ∫

=

= 

z t

z r

r

l

h t l

h

dz R

gh z p

R

gh z p q A

dy 0 0

1 ρ^ ρ

 If the Pressure in the Tank is greater than

Outside the ODE simplifies to

Problem 10.30 (7)

  • Now Make a SimuLink

Model To Determine

h(t)

  • In This Case The

Parameters will be

VARIABLES with values

Taken from the

WORKSPACE

  • The Parameter List:
    • A ≡ Tank Cross- Section Area - Assumed Circular (Cylindrical Tank)
    • R (^) l,r ≡ Hydraulic

Resistances of the

LEFT & RIGHT

Valves

  • ρ ≡ Liquid Density
  • q ≡ Liquid InFlow
  • h(0) ≡ Liquid Height

at t = 0

Problem 10.30 (8)

  • Design a SimuLink Model to Solve for h(t)

Given

ql q r

( ) ( ) (^) ∫ ( ) ( )

=

= 

z t

z r r

l l

SSR gh p dz R

SSR gh p R

q A

h t h 0

( ) ( ) (^) ∫ ( ( ) ) ( ( ) )

=

= 

z t

z r r

l l

SSR p h p dz R

SSR p h p R

q A

h t h 0

q l (^) qr

Final Model

q_mi

h1, h Scope

Left P

Right P

InFlow , q

Liquid Height

Bottom P

Tank

Left P

Right P

InFlow , q

Liquid Height

Bottom P

Tank 1

f(u) SSR

0 Pr2 at Atmos

0

Pr1 at Atmos

0 Pl2 = 0

0 Pl1 = 0

1/R

Cv

Result for 1hr Simulation

Prob 10.30 (1)

  • INPORT Block for Rt &

Lt Pressure Values

  • Inport ≡ Create an

input port for a

subsystem or an external input

  • Library → Ports &

Subsystems, Sources

  • Chg Label, No

Parameters

  • Summing Bloks for Rt &

Lt ΔP’s = P-Pl,r

  • Sum ≡ Add or subtract

inputs

  • Library → Math

Operations

  • Painful RePosition of

“+” & “-” connection

Locations

  • Top Node = |-+
  • Bot Node = +-|

Prob 10.30 (2)

  • Fcn Blok for SSR
    • Fcn ≡ Apply a specified expression to the input
    • Library → User-

Defined Functions

  • Need to Implement

for u = ΔP

 Parameters for Fcn

( ) 

 

− <

= If 0

If 0

u u

u u SSR u

Prob 10.30 (4)

  • Now (^)  INport Blok for Inflow
    • Click on Block, and

Use FORMAT to Flip &

Twist Block

( (^) l r )

l r

l r SSR p p R

q (^) ,

,

,

1 = −

 Sum the OUTflow =

q l + q r

f(u) SSR

f(u) SSR

1/R_r Right R

1/R_l Left R

2 Right P

1 Left P

q l

q r

+|+

|−+

+−|

Prob 10.30 (5)

  • Then the NET INflow =

q - (ql + qr)

 Parameters for

Scaling Gain-Blok

q l

f(u) q^ r SSR

f(u) SSR

1/R_r Right R

1/R_l Left R

(^3) In

2 Right P

1 Left P q

 Now Scale Net

InFlow by 1/ρA

  • ρ & A values set in

WorkSpace

 GainBlok OutPut is

the INTEGRAND