Control law synthesis for a discrete event system
J. Gunnarsson, J. Plantin Department of Electrical Engineering
Linkoping University S-581 83 Linkoping, Sweden
E-mail:
johan@isy.liu.se, plantin@isy.liu.seJuly 6, 1994
Abstract
In this work we investigate whether it is possible to synthesize the control law for a discrete event system, using a polynomial represen- tation of the system and controller. By working through a relatively simple example we propose a synthesis method based on the polyno- mial representation and repeated Grobner basis calculations.
The control objective is given in terms of forbidden states and the controller should actively be able to avoid these. We reduce the mani- fold of solutions by imposing a weight function on the state space and by proposing a priority among the actuators. In this way we improve the computational performance radically.
The computational load lies in the design phase where we use Grobner bases. The resulting controller description is suited for real time applications since the computations needed are evaluations of a limited number of polynomials.
During the design phase we also obtain a polynomial describing where in the state space the computed control law is valid. This makes it possible to examine controllability of the system.
1 Introduction
In recent years, considerable eort has been put into formal methods for analysis of discrete event systems. These methods have been developed quite independently of each other in dierent disciplines. However the usage of formal methods for synthesis of control laws has not been investigated to the same extent. There are some results by Ramadge & Wonham 6] where the concern is to prevent a system from entering forbidden states. There is also ongoing research on controller synthesis, using controlled Petri nets. A survey of resent results is found in 5].
The objective of this work has been to investigate whether it is possible to synthesize the control law for a discrete event system using a polynomial representation of the system and controller. To study whether this is a feasible method, we have applied our new ideas to an example a discrete model of a water tank. The report describes the process of controller design for the example. However, the methods are not specic for this example and general conclusions are drawn about the methods used.
We start by briey describing how polynomials are used to represent dis- crete event systems. We then describe the model of the tank and the criteria we used in the controller design. In Section 5 we deal with the computation of the control law, using Grobner bases. In the two nal sections we analyze the resulting controller and discuss the results achieved.
2 Polynomial representation
It is essential to have a powerful and formal way to describe a system. For example considering a time{continuous dynamic systems, a natural mathe- matical description is
f
(_x
(t
)x
(t
)u
(t
)) = 0 (1) denoting a set of general dierential equations.Analogously for discrete event dynamic systems (DEDS) we use the mathematical description
f
(x
+xu
) = 0 (2)which denotes a set of relations between inputs
u
, statesx
and the next state valuex
+. In a DEDS all variables are discrete and the system is event driven, i.e. \real time" is not included in the description.The output can be given as
y
=h
(xu
) (3)To represent relations (2) and (3), polynomials can be used. Other for- malisms for discrete event systems can be transformed to and from the polynomial representation. A brief introduction of the polynomial repre- sentation follows, where Sections 2.1 to 2.5 handles results from work by Germundsson 4]. See also 2] and 3] for details on the polynomial repre- sentation.
2.1 Polynomial rings
Let Fq denote a nite eld with characteristic
q
=p
n, wherep
is prime andn
some positive integer. In this work we will only usen
= 1, thereforex
2Fq )x
2f01::: p
;1g (4) Some features of Fq can be noted:No zero divisors exist. That is, let
xy
2Fqxy
= 0)x
= 0 ory
= 0 (5)An inverse exists. Let
x
2 Fqx
6= 0, then there exists az
2Fq suchthat
xz
= 1 (6)From this eld we construct a polynomial ring containing all polynomials
p
(X
)2Fqx
1x
2:::x
n] (7) The polynomials can be represented as a sum of monomialsX
, 2 Z+n, each multiplied by a coecient,c
2Fq.2.2 Ideals
An ideal (see 1])
F
=hf
1f
2:::f
ni FqX
] can be regarded as a set of polynomialsp
(X
)2F
,p
(X
) =Xni=1
i(X
)f
i(X
) (8) wherei(X
) are arbitrary polynomials in FqX
].The variety of the ideal, V(
F
), denotes the set of common zeros for all polynomials inF
, and is the same as all common zeros of the generator polynomialsf f :::f
n.2.3 Quotient polynomial rings
In our modelling of discrete event systems, all variables take values from a nite eld, Fq. How the variables in the system inuence each other can therefore be expressed with functions like
f
: Fnq!Fq (9)All functions
f
can be represented by a polynomial in FqX
], i.e. the ring FqX
] is functionally complete. See 4].One function
f
can be represented by an innite number of polynomials in FqX
]. In 4] an ecient way to reduce the size of the polynomial ring FqX
] is presented. The polynomial ringRq
X
] = Fqx
1x
2:::x
n]=
hx
q1;x
1:::x
qn;x
ni (10) contains polynomials for all functions (Fnq ! Fq). There is also a one-to- one correspondence between the functionsf
and the polynomials in RqX
].Therefore no more nor less is needed to represent the function
f
as a poly- nomial.The degree and the \length" of polynomials in Rq
X
] have an upper limit which gives some complexity advantages.2.4 Representing functions with polynomials
To illustrate how to represent a function with polynomials a proof from 4]
will be presented.
Let
f
: Fnq ! Fq be any function, then the corresponding polynomialf
p(x
)2Rqx
] is computed asf
p(x
) = X2Fqn
L
(x
)f
() (11)where
L
(x
) =L
1(x
1)L
n(x
n)2Rqx
] andL
i(x
i) =Q2Fqnfig(
x
;)Q2Fqnfig(
i;) =(1
x
=i0
x
6=i (12) is the Lagrange interpolating polynomial. We then havef
() =f
p() for all 2Fnq.Example 2.1
Let the functionJ(x) be dened by the table (q= 7)
x J(x) 0 31 2 2 13 0 4 15 2 6 3 In this case we can write (11) as
J
p(x) = X
2F
7 L
(x)J() (13)
whereJ() is given by the table above andL(x) is given by (12). The polynomial
L
0(x) = (x;1)(x;2)(x;3)(x;4)(x;5)(x;6)
(0;1)(0;2)(0;3)(0;4)(0;5)(0;6) = 1 + 6x6 (14) evaluates to 1 only forx= 0. ComputingL1(x):::L6(x) analogously, we get the resulting polynomial
J
p(x) = 3 + 3x+ 6x2+x3+ 2x4+ 6x5+ 2x6 (15) whereJp(x)2R7x]. Sinceq= 7, the degree ofJp(x) cannot be higher than 6. To compute the values ofJp(x), just substitute xwith its value and reduce the result
moduloq. 2
2.5 Representation of logic expressions
In the previous example we showed how to represent a function
f
: Fnq ! Fq. It is often helpful in the formalism to be able to repre- sent logic expressions and conditions, i.e. to consider functionsb
: Fnq !f
TRUEFALSE
g. This could be done using the following denitionDenition 2.1
Let a logic polynomial,b
(x
) 2 RqX
], be a polynomial where the values are interpreted as logic conditions.b
(x
) = 0 )TRUE
(16)b
(x
)6= 0 )FALSE
If
a
(x
)b
(x
) 2 Rqx
] represents two logic expressions, the result of AND-, OR- and NOT-operations can be computed by algebraically manipulating the polynomialsa
andb
asa
(x
)^b
(x
) = 1;(1;a
(x
)q;1)(1;b
(x
)q;1) (17)a
(x
)_b
(x
) =a
(x
)b
(x
):
a
(x
) = 1;a
(x
)q;1where the NOT-operation maps zero on one. This gives a natural extension of the logical operations to ideals in Rq
X
]. See 4] for further details.Example 2.2
Given the polynomiala(x), letb(x) be dened as
b(x) =
1a(x)6= 0
0a(x) = 0 (18)
The polynomialb(x) can be generated as
b(x) =::a(x) (19)
2
2.6 Grobner bases
For each ideal in a polynomial ring there are many possible sets of polynomi- als that generate the ideal. To be able to decide if two ideals are equal, there must be a standard for choosing generators of an ideal. Grobner bases1 is one standard representation for ideals.
2.6.1 Grobner bases for general polynomial rings
Grobner bases can be regarded as the \simplest" representation of an ideal w.r.t. some term ordering.
A term ordering gives an order to all monomials in the polynomial ring, and a way to dene the degree,
deg
(f
(X
)), of a polynomialf
(X
). For example by lex-ordery > x
we mean a term ordering where e.g.deg
(y
2x
)> deg
(yx
5)> deg
(yx
4)> deg
(x
9)1Only a brief introduction is given in this report. Further details of Grobner bases for ideals in a general polynomial ring ] can be found in 1].
The leading term,
LT
(f
(X
)), is the term inf
(X
) with highest degree. The degree of a polynomialf
(X
) isdeg
(f
(X
)) =deg
(LT
(f
(X
))) (20) The Grobner basis of an ideal can be regarded as the set of generators which have the lowest possible degree w.r.t. a given term ordering.Given a polynomial
p
and a polynomial setF
, the remainder polynomialr
is computed asr
=p
;Xf2F
ff
(21)where
f are chosen to giver
the lowest possible degree. Note thatdeg
(r
)<
deg
(f
) for all polynomialsf
2F
. We say thatp
reduces tor
w.r.t.F
and denote thisp
;!Fr
(22)If
p
;!Fp
we say thatp
is reduced w.r.t.F
. IfF
is autoreduced then all polynomials inF
are reduced w.r.t.F
.S
(p
1p
2) denotes the S-polynomial ofp
1 andp
2 which is computed asS
(p
1p
2) =h
1p
1;h
2p
2 (23) whereh
1 andh
2 are terms of lowest degree such thatLT
(h
1p
1) =LT
(h
2p
2).The polynomial set
G
= fg
1:::g
ng is a Grobner basis for the idealI
iG
I
,hG
i=I
, andS
(g
ig
j)2I
8i
6=j
(24) i.e.S
(g
ig
j);!G 0. To avoid all further details we can use this result as a denition of a Grobner basis.A polynomial
p
is a member of an idealI
ip
;!G 0 (25)where
G
is a Grobner basis ofI
.To compute a Grobner basis we can use Buchberger's algorithm (see 1]):
1. Take the generators of
I
as candidates for a Grobner basis. Denote this setG
.2. If all s-polynomials
S
(g
ig
j);!G 0,i
6=j
, thenG
is a Grobner basis.3. Otherwise add to
G
the remainderr
computed asS
(g
ig
j);!Gr
6= 0 4. MakeG
autoreduced and go to 2.An autoreduced Grobner basis
G
for an ideal is unique. If two ideals have the same autoreduced Grobner basis w.r.t. to the same term ordering, the ideals are equal.2.6.2 Grobner bases in
RqX
]Grobner bases are used and dened in Rq
X
] in analogy with the general polynomial ringk
X
], except that in every arithmetic operation on the poly- nomials in RqX
],degrees higher or equal than
q
are reduced asx
q!x
.coecients only take values in Fq.
The ring Rq
X
] is a quotient ring. Therefore the term ordering is not well dened since the relationdeg
(fg
) =deg
(f
) +deg
(g
) is not always fullled.Example 2.3
Letf1=y4 f2=y3 2R7y]. Thenfg=y and thereforedeg(fg)6= 7. 2 To deal with this problem formally, the Grobner basis for an ideal
I
is computed in the free (not quotient) polynomial ring FqX
] with the relationsx
q1;x
1:::x
qn;x
n (see (10)) included in the set of generators for the idealI
.Denition 2.2
The Grobner basis of the idealF
=hf
1f
2:::f
ni2RqX
] for some given term ordering is denotedGB
q(f
1f
2:::f
n) (26)As explained above the setf
x
q1;x
1:::x
qn;x
ngis added to the generator polynomials to give a true Grobner basis. This makes a signicant dierence when computing a Grobner basis of an ideal dened by a single polynomial2.2.7 Linear variables
Variables that can be computed as a function of the other variables in the system will be the main issue in this section.
Example 2.4
Let the idealsI1I2R3yx1x2] have the varieties
V(I1) =f(yx1x2) : (123)(231)(130)g
V(I2) =f(yx1x2) : (123)(231)(131)g
respectively. Then for each value of (x1x2)2V(I1) we have a unique value of y. Therefore y can be written as a function of x1x2. This is not true for I2 since
V(I2) have two dierent values ofy for the same value of (x1x2). 2 Knowing that a variable can be computed as a function we will use the Grobner basis to nd the corresponding function. Therefore we introduce the following results.
Denition 2.3
Given an idealI
Rqyx
1:::x
n] and the variety (yx
1:::x
n)2V
(I
). If for each value of the variablesx
1:::x
n inV
(I
) there exists only one value ofy
, then the variabley
is linear w.r.tI
. 2Lemma 2.1
Given an idealI
Rqy
1:::y
nx
1:::x
m] there exists poly- nomialsp
1:::p
n2Rqx
1:::x
m] such thatf
y
1;p
1:::y
n;p
ngI
(27) iy
1:::y
n are linear variables w.r.t.I
. 2Proof:
The values of the linear variablesy
1:::y
n inV
(I
) is given as a functionf
: Fqm !Fnq which can be represented, using (11), asy
1 =p
1:::y
n=p
n (28)2All ideals inRqX] can be generated by a single polynomial. i.e. RqX] is aprincipal polynomial ring. See 4].
Since (28) has no constraints on
x
1:::x
n we haveV
(hy
1;p
1:::y
n;p
ni)V
(I
),h
y
1;p
1:::y
n;p
niI
,f
y
1;p
1:::y
n;p
ngI
2
Theorem 2.1
Given an idealI
=hf
1:::f
liRqy
1:::y
nx
1:::x
m].The variables
y
1:::y
n are linear w.r.tI
i the autoreduced Grobner basisG
ofI
with lex-orderingy > x
has the formG
=fy
1;h
1:::y
n;h
nv
1v
2:::
g (29) where the polynomialsh
iv
j 2Rqx
1:::x
m]. 2Proof:
If the Grobner basisG
has the form (29) the claim follows directly from denition 2.3.Conversely, if
y
1:::y
n is linear w.r.t.I
, then by Lemma 2.1 we havef
y
1;p
1:::y
n;p
ngI
(30) LetA
=fy
1;p
1:::y
n;p
nf
1:::f
lg. ThenI
=hA
i, and we can nd a Grobner basis forI
by applying Buchberger's algorithm onA
. After makingA
autoreduced we haveA
=fy
1;p
~1:::y
n;p
~nf
~1:::
gwhere ~
p
if
~j 2 Rqx
1:::x
m]. For all s-polynomials computed fromA
we haveS
(a
ia
j);!Ar
2Rqx
1:::x
m]Therefore no new polynomials containing the variable
y
i can be included in the generator set produced by the algorithm. Knowing that an autoreduced Grobner basis is unique andG
=GB
q(hf
1:::f
li) =GB
q(A
),G
has theform stated in (29). 2
2.8 Mixing polynomials from dierent rings
Consider a polynomial
p
(X
)2RqX
] where a variablex
i 2X
will not take values outside the intervalf0::: p
;1g, wherep < q
. There are no claims on the behavior ofp
(X
) for valuesx
ip
. We say that for some values ofX
there are \don't cares". This will help us to simplify3 the polynomialp
(X
) by nding the simplest polynomial preserving the values ofp
(X
) for allX
that is not \don't care". The variablex
i can be considered to belong to the eld Fp.Let us compute a logic polynomial that is TRUE only for those values of
x
i that are not \don't care". We make the following denition.Denition 2.4
Let pq(x
i) 2FqX
],x
i 2X
,p < q
be a polynomial such that pq(x
i) =(
TRUE x
i 2FpFALSE x
i 2FqnFp (31)2
How to use
pq(x
i) for simplifyingp
(X
) is shown by an example.Example 2.5
The variablesu2F2 andd2F3. Let a polynomial represent the function given belowd uf(du) 0 0 0 0 1 0 1 0 0 1 1 1 2 0 1 2 1 1 One corresponding polynomial
f(du)2F3du] is
f(du) =d+ 2d2+ 2d2u+ 2du2 Sinceuis constrained toF2 we have from (31)
2
3(u) =u2;u (32)
and the functionf(du) can be simplied as
f(du);!GB d+ 2d2+ 2d2u+ 2du (33)
3Here simplify means to reduce the degree of the polynomial and to reduce the number of monomials.
whereGB=GB3(f23(u)g) 2 To collect all
-polynomials corresponding to variables containing a "don't care" value we make the following denition.Denition 2.5
Let "q denote the set containing all pq(x
i) correspondingto
x
i 2F
p wherep < q
. 2To compute the simplied polynomial, reduce
p
(X
) w.r.tGB
q("q).3 Modelling the water tank
In the example that we have chosen, we want to control the water level in a tank (see gure 1). The tank has one inlet and two outlets, which are controlled by valves that are either on or o. The inlet is supplied by a pump that is either on or o and in one of the outlets there is a measurable but uncontrollable ow out of the tank. Apart from the normal control of the tank we also want to be able to handle a possible pump failure at the inlet.
The control objective is to stop the tank from drying up or overowing.
We want to compute a control law that uses only the pump as long as it works as normal. When a pump failure occurs, however, we have to use the valves to fulll the objective.
This conguration is not the result of modelling a physical system. In- stead, we have tried to generate a good test example which is not entirely trivial but where it is possible to analyze the computed control laws by hand.
Even if this is a simple system some important features in the process of control design are clearly visible. It should also be noted that the example does not have to be much larger before it becomes dicult to solve by hand.
3.1 Notation
Let
u
1represent the binary control signal to the pump with o corresponding tou
1 = 0 and on corresponding tou
1 = 1. Letu
2u
3 andu
4 be the binary control signals to the valves, where an open valve corresponds tou
i = 1, while a closed valve is represented byu
i = 0. We let be the net ow in the tank with= 0 corresponding to a negative ow, = 1 to no net ow and = 2 to a positive ow. The level in the tank is denotedx
and takes values between zero and six.u1 u2
u3 u4
x=0 x=6
w d
Figure 1: The water tank.
u
1d u
~1 0 0 0 1 0 0 0 1 0 1 1 1 0 2 1 1 2 1Figure 2: The eect of the disturbance
d
.The ow at the outlet is modelled as a measurable binary disturbance
w
, withw
= 0 corresponding to no ow in the outlet andw
= 1 corresponding to a ow out of the tank. The pump failure is modelled as a three-valued disturbance,d
, acting on the pump. The eect of the disturbance on the pump is described in gure 2, where ~u
1 represents the eect on the ow into the tank. In other words, whend
= 0 the pump is stuck and whend
= 2 the pump is running, no matter how we choose the value ofu
1. Only whend
= 1, the pump obeys the control signal,u
1. The disturbance,d
, is assumed to be measurable.The dierent variables and their value range are shown in gure 3.
Variable Value eld
x
F7u
i F2 F3w
F2d
F3Figure 3: Variables with corresponding value eld.
3.2 Deriving the model
To reduce complexity it is essential to divide the system into subsystems, if possible. In this case we can use the net ow
to write the tank model asx
+ =f
1(x
) (34) =f
2(u
1u
2u
3u
4wd
)where
x
+ denotes the next value of the state. Note that this is an event- driven system, the \real time" is not included in the description.Since
x
could take values between zero and six we have chosen to rep- resent all signals by polynomials in R7X
]. The variables that are two- or three-valued can then be embedded in R7X
] using the following relations (see Section 2.8) 27(u
i) =u
2i ;u
ii
= 1:::
4 (35) 27(w
) =w
2;w
37(d
) = 3d
;d
2;2d
3 37() = 3;2;23The set of these
-polynomials will, according to denition 2.5, be denoted"7.
When deriving the polynomial
f
1 in (34) it is important to keep in mind the physical aspects of the tank. Whenx
= 6 and we have a positive net ow into the tank (= 2), it will overow. This means thatx
+ should still be six. A similar problem has to be accounted for when the level isx
= 0 and the net ow = 0. Because of this, the polynomials describing the system become fairly complicated.3.3 Polynomial description of the system
The resulting polynomial description of the system is
f
1(x
) = 6+ 32+ 53+x
+ 5x
+ 52x
+ 43x
+ 6x
2+ (36) +32x
2+ 53x
2+x
3+ 42x
3+ 23x
3++6x
4++3
2x
4+ 53x
4+x
5+ 42x
5+ 23x
5+ 6x
6+ 6x
6+ +32x
6+ 63x
6and
f
2(u
1u
2u
3u
4wd
) = 1 + 3du
2;3d
2u
2+ 2du
1u
2;d
2u
1u
2; (37);
u
3;u
4w
+u
3u
4w
;3du
2u
3u
4w
+ +3d
2u
2u
3u
4w
;2du
1u
2u
3u
4w
+ +d
2u
1u
2u
3u
4w
where
f
1 2R7x
] andf
2 2R7u
1u
2u
3u
4wd
].Here,
f
1 is a description of the next state, when we knowx
and . The polynomialf
2 tells us how, in its turn, depends on the control signals and the disturbances. Together these polynomials tell us howx
+ depends on the control signals and the disturbances. It is of course easy to verify that the behaviour is as desired by substituting values for theu
i,w
andd
and computing the value of the next state.In (36) and (37) we have a mathematical model of the water tank. The question now is how to specify the control objectives and how to compute the desired control law.
4 Design criteria
The control objective is to avoid the case when the tank dries up or overows.
In terms of the level
x
, we want to avoidx
= 0 andx
= 6. Given the present level and the disturbancesw
andd
, we want to nd a control law that guarantees that we never reach the forbidden levels, specied by the logic polynomialp
(x
) = 1 +x
+ 6x
2+x
3+ 6x
4+x
5+ 5x
6 (38) This polynomial is equal to zero for all values ofx
, exceptx
= 0 andx
= 6.By formulating the control objective in this way we get a manifold of solutions. For example, since we only want to avoid
x
= 0 andx
= 6, we know that there are no constraints on at all, unless the level,x
, is in a neighbourhood of the forbidden levels. In addition to this, we have four actuators to choose between at every instant, some of them giving the same control behaviour.One way of nding one of the possible control laws, is to reduce the manifold of solutions by imposing more requirements on the system. A reasonable approach seems to be to weight the values of
x
. The control objective could then be formulated as reducing the weight of the next value ofx
compared to the present value. In other words, we want the level to tend to the middle of the tank. If we can still guarantee that the level never reachesx
= 0 orx
= 6, this is just one way of picking a single solution. The weight function that we have chosen is given by the table in Example 2.1.If we represent the weight function as a polynomial, we have from (15)
J
(x
) = 3 + 3x
+ 6x
2+x
3+ 2x
4+ 6x
5+ 2x
6 (39) whereJ
(x
)2R7x
].Use this polynomial to weight the new values of the state variable
J
(x
+) =J
(f
1(x
)) (40) We want to nd the value of that minimizesJ
(x
+), i.e. = arg min2F
3
J
(f
1(x
)) (41) The minimization is made with respect to the ordering 0<
1<
<
7.Now let the polynomial
p
1(xm
) be dened asp
1(xm
) =J
(f
1(x
)) +m
;J
(x
) (42) If there exists a2F3 that decreases the weight of the state withm
steps, that value ofis dened as the solution top
1(xm
) = 0 (43)This solution is valid only in the case when
m < q
;J
max, whereJ
max= arg maxx2F7
J
(x
) andm
,q
andJ
max and themax
- and<
-operations are regarded as in N. The ordering will otherwise be destroyed, and there will be false solutions.By this construction we will nd a solution,
, if one exists, and given the value of, the values of the actuator signals are the solutions top
2(u
1u
2u
3u
4wd
) = 0 (44) wherep
2(u
1u
2u
3u
4wd
) is dened asp
2(u
1u
2u
3u
4wd
) =f
2(u
1u
2u
3u
4wd
); (45) The explicit expressions for the polynomialsp
1 andp
2 arep
1(xm
) = ;3+ 32+m
+x
+x
;22x
;2x
3;2x
3; (46);3
2x
3;2x
4+ 22x
4+ 2x
5;2x
5p
2(u
1u
2u
3u
4wd
) = 1;+ 3du
2;3d
2u
2+ 2du
1u
2; (47);
d
2u
1u
2;u
3;u
4w
+u
3u
4w
;;3
du
2u
3u
4w
+ 3d
2u
2u
3u
4w
;;2
du
1u
2u
3u
4w
+d
2u
1u
2u
3u
4w
5 Computation of the control laws
The two polynomials
p
1(xm
) andp
2(u
1u
2u
3u
4wd
) express rela- tions between the variables, implicitly describing the control laws. We want to nd explicit control lawsu
1 =K
u1(xwd
) (48)u
2 =K
u2(xwd
)u
3 =K
u3(xwd
)u
4 =K
u4(xwd
)where the
u
iare functions ofx
,w
andd
. For every combination of these vari- ables, the control laws should guarantee that we never enter the forbidden area and that the additional design criteria are met.In order to do this, we rst need to express
as a function ofx
, using the polynomialp
1. One way of doing that is to compute a Grobner basis with lexical ordering, where we rank the highest. The Grobner basis will then contain a polynomial that is linear in.5.1 Computing the desired net ow
Compute a Grobner basis
GBa=
GB
7np
1(xm
)37()ojm=1(49)
with lexicographic order
> x
. In the general case a Grobner basis contains a number of polynomialsGBa=f
g
1(x
)g
2(x
)::: g
i(x
)g (50) In this case the Grobner basis only contains two polynomials (i
= 2), so we haveGBa=f
g
1(x
)g
2(x
)g (51) By the construction ofp
1 from (42) we know that we have no ambiguity form
= 1, i.e. is a linear variable w.r.t. hp
137i and the rst polynomial inGBa can be written (see Section 2.7)
;k
a(x
) (52)The other polynomials in GBa dene where this solution is valid. Let the logic polynomial
v
a(x
) denote the valid area fork
a(x
). Generally we would computev
a(x
) asv
a(x
) =g
2(x
)^g
3(x
)^:::
^g
i(x
) (53) Here we only have one polynomial exceptg
1, sov
a(x
) isv
a(x
) =g
2(x
) (54) In this case it turns out that the solution is valid for allx
, exceptx
= 3.This is of course due to the fact that we have required the weight of the state to decrease by one and this is not possible when
x
= 3. Instead, we have to be satised as long as the weight does not increase. This means that we have to search for another solution in the case whenv
a 6= 0. ComputeGBb =
GB
7np
1(xm
)37():v
a(x
)ojm=0(55)
to get
;k
b(x
) (56)with corresponding polynomial
v
(x
), denoting the valid area fork
(x
).We can now compute
as a function ofx
as =K
(x
) =k
a(x
):v
a(x
) +k
b(x
):v
b(x
) (57) with valid areaV
=v
a^v
b (58)It turns out that
V
TRUE
. Therefore the valid area covers all values ofx
, that is, there is a solution in for everyx
2F7. The explicit expression forK
(x
) isK
(x
) = 2;x
;3x
2;3x
3+ 2x
4;2x
5 (59) If we are able to compute theu
i as functions of ,w
andd
, usingp
2, we can express the actuator signals in the desired form of equation (48) by using equation (57).5.2 Finding an unambiguous control law
In order to compute the
u
i as functions of,w
andd
we need the solution to equation (44) to be unambiguous. Obviously, this is not the case with the water tank. There are several control actions that, given values ofw
andd
, gives the same net ow. Therefore we need to make a priority among the actuators. In this case it is natural to try to control the tank by using the pump, if possible, and only use the valves if necessary.Therefore we start by computing a Grobner basis for the case when we only use the pump for control, setting the other actuators to default values.
In some cases the choice of default values is quite natural, but we can of course dene them the way we want. Here we let the default values of the valves be as in normal operation (the pump working), that is:
u
2 open,u
3 closed andu
4 open. The default value for the pump is chosen to beu
1def = 0.The rst Grobner basis computation gives us a valid area for the rst control law. We then continue with the computation of a second Grobner basis, using
u
1 andu
2 for the control. In this way we nally get four ex- pressions for eachu
i, valid in four dierent areas and these can be combined into one control law.Due to the disturbances, there is a possibility that some of the actuators can not aect the behaviour of the system. In terms of the Grobner basis this means that the corresponding variable has an undened value. In order to guarantee that there is only one solution to (44) in these cases, we need
extra constraints in the Grobner basis computations. This is illustrated by a simple example.
Example 5.1
Consider a pipe with one valve that can be either open or closed, see the gure below.
φ v
An open valve corresponds tov = 1 while a closed valve is represented byv = 0.
The ow into the pipe is represented byand can be either= 1 (ow) or= 0 (no ow).
Obviously, when= 0, it doesn't matter what we do with the valve. To get a unique control strategy we can decide that we letv= 1 be the default value in this case. Using polynomials this can be expressed by the condition
c(v) = (;1)(v;1) (60) If we include a polynomial like this in the Grobner basis computations the result will be that when = 0, v is forced to take the value 1, while the condition is
satised no matter whatv is, when= 1 . 2
In the case of the water tank we have, for example, that when
d
= 0 ord
= 2 we cannot useu
1 for control, so for these values ofd
we assign the default value tou
1. There are three similar cases to account for and all these have to be specied by extra constraints (see Section 5.3).5.3 Computation of the actuator signals
First dene default values for the actuators
u
1def = 0 (61)u
2def = 1u
3def = 0u
4def = 1 The extra constraints are given byc
1(u
1d
) = (d
;1)(u
1;u
1def) (62)c
2(u
2d
) = (d
;2)(u
2;u
2def)c
3(u
3w
) =w
(u
3;u
3def)c
(u w
) = (w
1)(u u
def)Let
k
uij denote the control law for actuatori
in valid areav
j, wherei
= 1:::
4 andj
= 1:::
4.Start by computing
GB
1=
GB
7(fp
2c
1"7gju2=1u3=0u4=1) (63) with lex-orderu
1> > d > w
. This gives usu
1;k
u11(dw
) (64) as the rst polynomial inGB1, and a valid area for this solution which we denotev
1(dw
). In this valid area, we let the other actuators take their default values, that isk
u21 = 1 (65)k
u31 = 0k
u41 = 1Next use both
u
1 andu
2. Since this control action should not be allowed inv
1 we add:v
1 in the Grobner basis computation. That is, computeGB
2 =
GB
7(fp
2c
1c
2:v
1"7gju3=0u4=1) (66) with lex-orderu
1> u
2> > d > w
.From this we get
k
u12andk
u22, whilek
u32andk
u42takes their default values. We then continue by computingGB
3 =
GB
7(fp
2c
1c
2c
3:v
1^:v
2"7gju4=1) (67) andGB
4 =
GB
7(fp
2c
1c
2c
3c
4:v
1^:v
2^:v
3"7g) (68) with lex-orderu
1> u
2> u
3> > d > w
andu
1> u
2> u
3> u
4> >
d > w
respectively.Since the valid areas in the four cases are disjoint by construction, we can compute the total control law for each
u
i asK
ui(wd
) =X4j=1