© 1996-2019







VI.7 Liquid Tank Controller

Liquid Tank Controller: Intro [Slide 212]

Simple control system maintaining the level of liquid in a tank.

  • A tank has an inlet pipe and an outlet pipe. The flow in each pipe is controlled by a simple valve, which can be either open or closed.
  • A controller unit controls the valves on the inlet and outlet pipes to maintain the level of the liquid in the tank within some specified limits.

Liquid Tank Controller V1 [Slide 213]

  • V1 : valve on the inlet pipe; open/closed
  • V2 : valve on the outlet pipe; open/closed
  • I : rate of flow of liquid in the inlet pipe
  • O : rate of flow of liquid in the outlet pipe
  • L : the level of liquid in the tank
  • min, max : the given minimum and maximum levels

definemin = 5.
define max = 10.
defineclosed = 0.
define open = 1.
 
defineexample() = {
  existsV 1,V 2,I,O,L : {
   initialise(V 1,V 2,L) and
   keep{
    pipe(V 1,I, 0, 3) and
    pipe(V 2,O, 1, 1) and
    tank(I,O,L) and
    controller(V 1,V 2,L) and
    format("V 1 = %d,V 2 = %d,I = %d,O = %d,L = %dn",
      V 1,V 2,I,O,L)
   } and len(50)
  }
}.

/* Initial state. Note valves closed imply that the flows are also zero. */
defineinitialise(V 1,V 2,L) = {
   V 1 = closed and
   V 2 = closed and
   L = 0
}.
 
/* Defines a flow rate F between minf and maxf, or zero if V is closed. */
definepipe(V,F,minf,maxf) = {
   if(V = open) then
     F = (Random mod (maxf minf + 1)) + minf
    else F = 0
}.

/* The level of liquid in a unit interval. */
definetank(I,O,L) = {
   L := L + I O
}.
 
/* The state of each valve in a unit interval */
definecontroller(V 1,V 2,L) = {
   ifL < max then {V 1 := open} else {V 1 := closed} and
   ifL > min then {V 2 := open} else {V 2 := closed}
}.

Run of the controller:

State   0: V1=0, V2=0, I=0, O=0, L=0  
...  
State  13: V1=1, V2=1, I=2, O=1, L=10  
State  14: V1=0, V2=1, I=0, O=1, L=11  
State  15: V1=0, V2=1, I=0, O=1, L=10  
...  
State  27: V1=1, V2=1, I=0, O=1, L=7  
State  28: V1=1, V2=1, I=2, O=1, L=6  
State  29: V1=1, V2=1, I=0, O=1, L=7  
...  
State  42: V1=1, V2=1, I=2, O=1, L=10  
State  43: V1=0, V2=1, I=0, O=1, L=11  
State  44: V1=0, V2=1, I=0, O=1, L=10  
...

So L does not stay between 5 and 10!

Liquid Tank Controller V2 [Slide 218]

  • V1 : valve on the inlet pipe; open/closed
  • V2 : valve on the outlet pipe; open/closed
  • I1 : rate of flow of liquid willing to flow into the inlet pipe
  • I : rate of flow of liquid in the inlet pipe
  • O1 : rate of flow of liquid willing to flow into the outlet pipe
  • O : rate of flow of liquid in the outlet pipe
  • L : the level of liquid in the tank
  • min, max : the given minimum and maximum levels

definemin = 5.
define max = 10.
defineclosed = 0.
define open = 1.
 
defineexample() = {
  existsV 1,V 2,I1,I,O1,O,L : {
   initialise(L) and
   keep{
    pipe(V 1,I1,I, 0, 3) and
    pipe(V 2,O1,O, 1, 1) and
    tank(I,O,L) and
    controller(V 1,V 2,L,I1,O1) and
    format("V 1 = %d,I1 = %d,I = %d,
     V 2 = %d,O1 = %d,O = %d,L = %dn",
      V 1,I1,I,V 2,O1,O,L)
   } and len(50)
  }
}.

/* Initial state. Note initial tank level is min. */
defineinitialise(L) = {
   L = min
}.
 
/* Defines a flow rate F between minf and maxf,
Fw represents the willing flow while
Fa represents the actually flow which is either the willing flow if
the valve is open and zero when valve V is closed. */
definepipe(V,Fw,Fa,minf,maxf) = {
   Fw = (Random mod (maxf minf + 1)) + minf and
   if(V = open) then Fa = Fw else Fa = 0
}.

/* The level of liquid in a unit interval. */
definetank(I,O,L) = {
   L := L + I O
}.
 
/* The state of each valve in a unit interval */
definecontroller(V 1,V 2,I1,O1,L) = {
   ifL + I1 O1 <= max then {V 1 = open} else {V 1 = closed} and
   ifL + I1 O1 >= min then {V 2 = open} else {V 2 = closed}
}.

Run of the controller:

State   0: V1=1, I1=2, I=2, V2=1, O1=1, O=1, L=5  
State   1: V1=1, I1=2, I=2, V2=1, O1=1, O=1, L=6  
State   2: V1=1, I1=2, I=2, V2=1, O1=1, O=1, L=7  
State   3: V1=1, I1=3, I=3, V2=1, O1=1, O=1, L=8  
State   4: V1=1, I1=0, I=0, V2=1, O1=1, O=1, L=10  
State   5: V1=1, I1=1, I=1, V2=1, O1=1, O=1, L=9  
...  
...  
State  44: V1=0, I1=3, I=0, V2=1, O1=1, O=1, L=10  
State  45: V1=0, I1=3, I=0, V2=1, O1=1, O=1, L=9  
State  46: V1=1, I1=0, I=0, V2=1, O1=1, O=1, L=8  
State  47: V1=1, I1=1, I=1, V2=1, O1=1, O=1, L=7  
State  48: V1=1, I1=2, I=2, V2=1, O1=1, O=1, L=7  
State  49: V1=1, I1=1, I=1, V2=1, O1=1, O=1, L=8

Now L does stay between 5 and 10!







2019-05-10
Contact | Home | ITL home | Course | Proofs | Algebra | FL