You are on page 1of 19

SimApp Introduction Tank Level Model

Peter Way
www.ventimar.com

VentiMar, LLC

Outline
This application note is a tank level model that can be used in a variety of chemical processes. The nonlinear model for turbulent flow is developed first The model is then linearized about an operating point to allow frequency analysis. Finally, the tank example is extended to two tanks in series.

VentiMar, LLC

SimApp Process Example


Model the level and flow of a water tank that supplies a downstream process.
Example Volume: 10 m3 Height: 5 m
Load valve flow rate Qo

Control valve flow rate [m^3/s or l/s] Qi

Radius 0.8 m

H [m]

Tank Capacitance C [m^2] (change in volume per change in H) Not tank capacity [m^3]

Units shown in [ ] VentiMar, LLC 3

Turbulent vs. Laminar Flow


The Reynolds number (Re) is a dimensionless quantity that determines the type of flow: turbulent or laminar Re = Dynamic pressure/ Shear stress
Re =

uL

fluid density
u fluid speed L - characteristic length (4 * Area of duct/Perimeter of duct) for a circular cross - section pipe L = diameter

- dynamic viscosity of fluid

Laminar: Re<2300, Turbulent >4000, otherwise Transitional Reference: http://www.engineeringtoolbox.com/reynolds-number-d_237.html

VentiMar, LLC

Write the equations


Two types of flow:

Laminar : Qo = KH Turbulent : Qo = K H

K is typically measured experimentally

Flow equation (examine the turbulent case in this example): Increase of volume as head (level) H changes equals inflow-outflow over time change. Capacitance of the tank is the cross-sectional area

CdH = (Qi Qo )dt Rearrange to get relationship between H and Q i dH C + K H = Qi dt


Note: the terminology of resistance and capacitance borrowed from electrical engineering is no accident! Also H Voltage, Q Current
VentiMar, LLC 5

Make the SimApp model


An easy way to make the block diagram model is to solve for the highest derivative. Then the equation is built as a block diagram as shown below Also we will use the dot notation for the derivative.

. C H + K H = Qi . Q K H H= i C

Rearranging to implement the equation in SimApp :

Qi(l/s)
K 1000

H(m)

Qi (m^3/s)

. H

H
I
Reset Hold

SQRT

K(m^2.5/s)
P

Qo(l/s)
K 1000

H 0.01 TD 0 s

K 0.008944

Ti 2 s

VentiMar, LLC

Model features
Qo = K H . Q K H H= i C
First, integrate the derivative Each blocks name is the output For now, we can drive the system with 10 l/s flow

This implements equation from H to Qo

Qi(l/s)
K 1000

H(m)

Qi (m^3/s)

. H

H
I
Reset Hold

SQRT

K(m^2.5/s)
P

Qo(l/s)
K 1000

Qi 0.01 TD 0 s

K 0.008944

C 2 s

The summation calculates the derivative

C is the time constant of the integrator. K, C are example values

These probes are for plotting and scaling the output. In this case from m^3/s to l/s

VentiMar, LLC

Time response
You can now make a time response plot to the Qi input. Qo eventually reaches Qi (tank does not overflow or empty) At this flow rate the tank fills to 1.24 meters Source group 0
H(m)
10.5 10 9.5 9 8.5 8 7.5 7 6.5 6 5.5 5 4.5 4 3.5 3 2.5 2 1.5 1 0.5 0 -0.5 -200 0 200 400 600 800 1200 1600 2000 2400 2800 3200 3600 3900

1.2444 10 9.9771

Qi(l/s) Qo(l/s)

VentiMar, LLC

Simple proportional control


We want to control H (process variable) to 3 m. H is measured, compared with the Hsp (set point) which drives the proportional valve. A simple proportional valve is used but other controllers could be applied The ramp of Hsp (set point) or gain can be selected to determine the time to desired H, and the maximum Qi required to achieve the goal.

Hsp (x10m)
K 10

Qi(l/s) Proportional Valve


P

H(x10 m)
K 10

Plant
SQRT K(m^2.5/s)
P

K 1000

Ramp

H
I
Reset Hold

Qo(l/s)
K 1000

A 0.01 s-1 Ymax 3

K 0.1

K 0.008944

C 2 s

Controller: Proportional control of tank Height H

VentiMar, LLC

Controller time responses


H values are scaled by 10x to show dynamics better Qi needs to reach over 33 l/s to fill the tank to 3m in 400 seconds Proportional control has some error from the setpoint. Gain could be increased but then the flow rate to fill the tank would be greater.
Source group 0 H(x10 m)
35 32.5 30 27.5 25 22.5 20 17.5 15 12.5 10 7.5 5 2.5 0 -2.5 -50 -25 0 25 50 75 100 150 200 250 300 350 400 450 500 525

28.485 30 15.154 15.095

Hsp (x10m) Qi(l/s) Qo(l/s)

VentiMar, LLC

10

Linearizing the turbulent model


Q Turbulent : Q = K H rearrange : H = K Define R - Resistance = Effort Change/Flow change across the pipe and valve dH 2Q = 2 substituting for K dQ K 2H 0 Where the 0 subscript indicates a set point. R= Q0 R=
2

VentiMar, LLC

11

Linearizing the turbulent model


Now consider small deviations h and q from the setpoint Q0 , H 0 Then using the equation for resistance
14.000

Nonlinear vs. Linearized

h 2H 0 R= = q Q0
Re membering the input flow to head . Q K H equation H = i C The equation for small perturbations becomes (after substituting h/R for K H ) : . q h/ R h= i C
VentiMar, LLC
H

12.000 10.000 8.000 6.000 4.000 2.000 0.000 0 -2.000 -4.000 Q 5 10 15 20 25 30 H Nonlinear [m] h Linearized [m]

h q Q0,H0

12

Linearized system block diagram


Now the nonlinear element has been replaced by a linear resistor. This makes it possible to calculate a frequency response. The Height of the tank needs to be biased to 3m since that is the operating point of the non-linear model. This is only to match time responses, and does not affect frequency response.
Linearized Plant
H Bias
3

Hsp (x10 m)
K 10

Qi(l/s) Proportional Valve


P
Reset

H ( x10 m)
K 10

K 1000

Ramp

H
I
Hold

1/R
P

Qo(l/s)
K 1000

A 0.01 s-1 Ymax 3

K 0.1

K 0.002631

C2 s

Controller: Proportional control of tank Height H


Frequency

VentiMar, LLC

13

Time response of linearized system


Linearized model agrees quite closely with the nonlinear model except in startup transient
Source group 0
37.5 35 32.5 30 27.5 25 22.5 20 17.5 15 12.5 10 7.5 5 2.5 0 -2.5 -50 -25 0 25 50 75 100 150 200 250 300 350 400 450 500 525

H ( x10 m) Hsp (x10 m) Qi(l/s) Qo(l/s)

0 0 0 7.893

VentiMar, LLC

14

Frequency response of linearized system


[dB]
-40 -50 -60 -70 -80 -90 -100

Am plitude 1/R

Frequency

Amplitude [dB] Phase

-55.088 -46.632

[ ]
-10 -20 -30 -40 -50 -60 -70 -80

Phase

0.01

0.02 0.03

0.05

0.1

0.2

0.3

0.5 0.7

4 5 6 7

10

VentiMar, LLC

15

Two tank example


Model the level and flow of a water tank that supplies a second tank. Control the height of the second tank through input Qi. Q2 supplies a downstream process.
Control valve flow rate [m^3/s or l/s] Qi

H1 [m]

Q1

H2 [m]

Q2

Units shown in [ ] VentiMar, LLC 16

Two tank model


Note the correspondence between the tank illustration in prior slide and new connections
Hsp (x10m)
K 10

Qi(l/s) Proportional Valve


P
Reset

H1 (x10 m)
K 10

Tank 1
SQRT K(m^2.5/s)
P

K 1000

Ramp

H1
I

Q1(l/s)
K 1000

A 0.01 s-1 Ymax 3

K 0.08

Hold

K 0.008944

C2 s

Controller: Proportional control of tank Height H

H1 - H2 drives the flow Q1 between tanks.


H2 (x10 m)

Tank 2
SQRT K(m^2.5/s)
P

Process variable feedback

H2

K 10

Q2(l/s)
K 1000

Q1 supplies flow into tank 2

Reset Hold

K 0.008944

C 2s

VentiMar, LLC

17

Two tank time response


Since there are now two lags to control, the simple gain control is no longer sufficient for good performance. Note that the height of liquid in tank 1 gets unacceptably large.
Source group 0 H2 (x10 m)
150 140 130 120 110 100 90 80 70 60 50 40 30 20 10 0 -10 -20 -30 -40 -50 -60 -70 -200 0 100 200 400 600 800 1000 1200 1400 1600 1800 2000

0 0 0 0 0 0

Q2(l/s) H1 (x10 m) Hsp (x10m) Qi(l/s) Q1(l/s)

VentiMar, LLC

18

SimApp Summary
You can build simple models for understanding including nonlinear effects. In this example, the model works for any level and flow situation. Then you can simulate controllers of increasing sophistication
In the tank example, you could fill the tank to the desired H first, then make a linearized version of the model You could then perform frequency and stability analysis on linear models and... Design better controllers.

The block diagram method promotes understanding and lets you extend the model to new situations. See the tutorial and design spreadsheet at

www.simapp.com/simulation-tutorials

VentiMar, LLC

19

You might also like