• No results found

Control law synthesis for a discrete event system

N/A
N/A
Protected

Academic year: 2021

Share "Control law synthesis for a discrete event system"

Copied!
29
0
0

Loading.... (view fulltext now)

Full text

(1)

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.se

July 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.

(2)

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 speci c for this example and general conclusions are drawn about the methods used.

We start by brie y 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

, states

x

and the next state value

x

+. 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)

(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, where

p

is prime and

n

some positive integer. In this work we will only use

n

= 1, therefore

x

2Fq )

x

2f0



1

::: p

;1g (4) Some features of Fq can be noted:

 No zero divisors exist. That is, let

xy

2Fq

xy

= 0)

x

= 0 or

y

= 0 (5)

 An inverse exists. Let

x

2 Fq

x

6= 0, then there exists a

z

2Fq such

that

xz

= 1 (6)

From this eld we construct a polynomial ring containing all polynomials

p

(

X

)2Fq

x

1

x

2

:::x

n] (7) The polynomials can be represented as a sum of monomials

X

,



2 Z+n, each multiplied by a coecient,

c

 2Fq.

2.2 Ideals

An ideal (see 1])

F

=h

f

1

f

2

:::f

ni Fq

X

] can be regarded as a set of polynomials

p

(

X

)2

F

,

p

(

X

) =Xn

i=1



i(

X

)

f

i(

X

) (8) where



i(

X

) are arbitrary polynomials in Fq

X

].

The variety of the ideal, V(

F

), denotes the set of common zeros for all polynomials in

F

, and is the same as all common zeros of the generator polynomials

f f :::f

n.

(4)

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 in uence each other can therefore be expressed with functions like

f

: Fnq!Fq (9)

All functions

f

can be represented by a polynomial in Fq

X

], i.e. the ring Fq

X

] is functionally complete. See 4].

One function

f

can be represented by an in nite number of polynomials in Fq

X

]. In 4] an ecient way to reduce the size of the polynomial ring Fq

X

] is presented. The polynomial ring

Rq

X

] = Fq

x

1

x

2

:::x

n]

=

h

x

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 functions

f

and the polynomials in Rq

X

].

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 polynomial

f

p(

x

)2Rq

x

] is computed as

f

p(

x

) = X

2Fqn

L

(

x

)

f

(



) (11)

where

L

(

x

) =

L

1(

x

1)

L

n(

x

n)2Rq

x

] and

L

i(

x

i) =

Q2Fqnfig(

x

;



)

Q2Fqnfig(



i;



) =

(1

x

=



i

0

x

6=



i (12) is the Lagrange interpolating polynomial. We then have

f

(



) =

f

p(



) for all



2Fnq.

(5)

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 functions

b

: Fnq !

f

TRUEFALSE

g. This could be done using the following de nition

Denition 2.1

Let a logic polynomial,

b

(

x

) 2 Rq

X

], be a polynomial where the values are interpreted as logic conditions.

b

(

x

) = 0 )

TRUE

(16)

b

(

x

)6= 0 )

FALSE

(6)

If

a

(

x

)

b

(

x

) 2 Rq

x

] represents two logic expressions, the result of AND-, OR- and NOT-operations can be computed by algebraically manipulating the polynomials

a

and

b

as

a

(

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;1

where 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 de ne the degree,

deg

(

f

(

X

)), of a polynomial

f

(

X

). For example by lex-order

y > x

we mean a term ordering where e.g.

deg

(

y

2

x

)

> 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].

(7)

The leading term,

LT

(

f

(

X

)), is the term in

f

(

X

) with highest degree. The degree of a polynomial

f

(

X

) is

deg

(

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 set

F

, the remainder polynomial

r

is computed as

r

=

p

;X

f2F



f

f

(21)

where



f are chosen to give

r

the lowest possible degree. Note that

deg

(

r

)

<

deg

(

f

) for all polynomials

f

2

F

. We say that

p

reduces to

r

w.r.t.

F

and denote this

p

;!F

r

(22)

If

p

;!F

p

we say that

p

is reduced w.r.t.

F

. If

F

is autoreduced then all polynomials in

F

are reduced w.r.t.

F

.

S

(

p

1

p

2) denotes the S-polynomial of

p

1 and

p

2 which is computed as

S

(

p

1

p

2) =

h

1

p

1;

h

2

p

2 (23) where

h

1 and

h

2 are terms of lowest degree such that

LT

(

h

1

p

1) =

LT

(

h

2

p

2).

The polynomial set

G

= f

g

1

:::g

ng is a Grobner basis for the ideal

I

i

G



I

,h

G

i=

I

, and

S

(

g

i

g

j)2

I

8

i

6=

j

(24) i.e.

S

(

g

i

g

j);!G 0. To avoid all further details we can use this result as a de nition of a Grobner basis.

A polynomial

p

is a member of an ideal

I

i

p

;!G 0 (25)

where

G

is a Grobner basis of

I

.

(8)

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 set

G

.

2. If all s-polynomials

S

(

g

i

g

j);!G 0,

i

6=

j

, then

G

is a Grobner basis.

3. Otherwise add to

G

the remainder

r

computed as

S

(

g

i

g

j);!G

r

6= 0 4. Make

G

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

Rq

X

]

Grobner bases are used and de ned in Rq

X

] in analogy with the general polynomial ring

k



X

], except that in every arithmetic operation on the poly- nomials in Rq

X

],

 degrees higher or equal than

q

are reduced as

x

q!

x

.

 coecients only take values in Fq.

The ring Rq

X

] is a quotient ring. Therefore the term ordering is not well de ned since the relation

deg

(

fg

) =

deg

(

f

) +

deg

(

g

) is not always ful lled.

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 Fq

X

] with the relations

x

q1;

x

1

:::x

qn;

x

n (see (10)) included in the set of generators for the ideal

I

.

Denition 2.2

The Grobner basis of the ideal

F

=h

f

1

f

2

:::f

ni2Rq

X

] for some given term ordering is denoted

GB

q(

f

1

f

2

:::f

n) (26)

(9)

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 signi cant dierence when computing a Grobner basis of an ideal de ned 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 ideal

I

Rq

yx

1

:::x

n] and the variety (

yx

1

:::x

n)2

V

(

I

). If for each value of the variables

x

1

:::x

n in

V

(

I

) there exists only one value of

y

, then the variable

y

is linear w.r.t

I

. 2

Lemma 2.1

Given an ideal

I

Rq

y

1

:::y

n

x

1

:::x

m] there exists poly- nomials

p

1

:::p

n2Rq

x

1

:::x

m] such that

f

y

1;

p

1

:::y

n;

p

ng

I

(27) i

y

1

:::y

n are linear variables w.r.t.

I

. 2

Proof:

The values of the linear variables

y

1

:::y

n in

V

(

I

) is given as a function

f

: Fqm !Fnq which can be represented, using (11), as

y

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].

(10)

Since (28) has no constraints on

x

1

:::x

n we have

V

(h

y

1;

p

1

:::y

n;

p

ni) 

V

(

I

),

h

y

1;

p

1

:::y

n;

p

ni 

I

,

f

y

1;

p

1

:::y

n;

p

ng 

I

2

Theorem 2.1

Given an ideal

I

=h

f

1

:::f

liRq

y

1

:::y

n

x

1

:::x

m].

The variables

y

1

:::y

n are linear w.r.t

I

i the autoreduced Grobner basis

G

of

I

with lex-ordering

y > x

has the form

G

=f

y

1;

h

1

:::y

n;

h

n

v

1

v

2

:::

g (29) where the polynomials

h

i

v

j 2Rq

x

1

:::x

m]. 2

Proof:

If the Grobner basis

G

has the form (29) the claim follows directly from de nition 2.3.

Conversely, if

y

1

:::y

n is linear w.r.t.

I

, then by Lemma 2.1 we have

f

y

1;

p

1

:::y

n;

p

ng

I

(30) Let

A

=f

y

1;

p

1

:::y

n;

p

n

f

1

:::f

lg. Then

I

=h

A

i, and we can nd a Grobner basis for

I

by applying Buchberger's algorithm on

A

. After making

A

autoreduced we have

A

=f

y

1;

p

~1

:::y

n;

p

~n

 f

~1

:::

g

where ~

p

i

 f

~j 2 Rq

x

1

:::x

m]. For all s-polynomials computed from

A

we have

S

(

a

i

a

j);!A

r

2Rq

x

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 and

G

=

GB

q(h

f

1

:::f

li) =

GB

q(

A

),

G

has the

form stated in (29). 2

(11)

2.8 Mixing polynomials from di erent rings

Consider a polynomial

p

(

X

)2Rq

X

] where a variable

x

i 2

X

will not take values outside the intervalf0

::: p

;1g, where

p < q

. There are no claims on the behavior of

p

(

X

) for values

x

i

p

. We say that for some values of

X

there are \don't cares". This will help us to simplify3 the polynomial

p

(

X

) by nding the simplest polynomial preserving the values of

p

(

X

) for all

X

that is not \don't care". The variable

x

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 de nition.

Denition 2.4

Let

pq(

x

i) 2Fq

X

],

x

i 2

X

,

p < q

be a polynomial such that

pq(

x

i) =

(

TRUE x

i 2Fp

FALSE x

i 2FqnFp (31)

2

How to use

pq(

x

i) for simplifying

p

(

X

) is shown by an example.

Example 2.5

The variablesu2F2 andd2F3. Let a polynomial represent the function given below

d 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.

(12)

whereGB=GB3(f23(u)g) 2 To collect all

-polynomials corresponding to variables containing a "don't care" value we make the following de nition.

Denition 2.5

Let "q denote the set containing all

pq(

x

i) corresponding

to

x

i 2

F

p where

p < q

. 2

To compute the simpli ed polynomial, reduce

p

(

X

) w.r.t

GB

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 over owing.

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 ful ll the objective.

This con guration 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 to

u

1 = 0 and on corresponding to

u

1 = 1. Let

u

2

u

3 and

u

4 be the binary control signals to the valves, where an open valve corresponds to

u

i = 1, while a closed valve is represented by

u

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 denoted

x

and takes values between zero and six.

(13)

u1 u2

u3 u4

x=0 x=6

w d

Figure 1: The water tank.

u

1

d u

~1 0 0 0 1 0 0 0 1 0 1 1 1 0 2 1 1 2 1

Figure 2: The eect of the disturbance

d

.

The ow at the outlet is modelled as a measurable binary disturbance

w

, with

w

= 0 corresponding to no ow in the outlet and

w

= 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, when

d

= 0 the pump is stuck and when

d

= 2 the pump is running, no matter how we choose the value of

u

1. Only when

d

= 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.

(14)

Variable Value eld

x

F7

u

i F2

F3

w

F2

d

F3

Figure 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 as

x

+ =

f

1(

x

) (34)

=

f

2(

u

1

u

2

u

3

u

4

wd

)

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 R7

X

]. The variables that are two- or three-valued can then be embedded in R7

X

] using the following relations (see Section 2.8)

27(

u

i) =

u

2i ;

u

i

 i

= 1

:::

4 (35)

27(

w

) =

w

2;

w

37(

d

) = 3

d

;

d

2;2

d

3

37(

) = 3

;

2;2

3

The set of these

-polynomials will, according to de nition 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. When

x

= 6 and we have a positive net ow into the tank (

= 2), it will over ow. This means that

x

+ should still be six. A similar problem has to be accounted for when the level is

x

= 0 and the net ow

= 0. Because of this, the polynomials describing the system become fairly complicated.

(15)

3.3 Polynomial description of the system

The resulting polynomial description of the system is

f

1(

x

) = 6

+ 3

2+ 5

3+

x

+ 5

x

+ 5

2

x

+ 4

3

x

+ 6

x

2+ (36) +3

2

x

2+ 5

3

x

2+

x

3+ 4

2

x

3+ 2

3

x

3++6

x

4+

+3

2

x

4+ 5

3

x

4+

x

5+ 4

2

x

5+ 2

3

x

5+ 6

x

6+ 6

x

6+ +3

2

x

6+ 6

3

x

6

and

f

2(

u

1

u

2

u

3

u

4

wd

) = 1 + 3

du

2;3

d

2

u

2+ 2

du

1

u

2;

d

2

u

1

u

2; (37)

;

u

3;

u

4

w

+

u

3

u

4

w

;3

du

2

u

3

u

4

w

+ +3

d

2

u

2

u

3

u

4

w

;2

du

1

u

2

u

3

u

4

w

+ +

d

2

u

1

u

2

u

3

u

4

w

where

f

1 2R7

x

] and

f

2 2R7

u

1

u

2

u

3

u

4

wd

].

Here,

f

1 is a description of the next state, when we know

x

and

. The polynomial

f

2 tells us how

, in its turn, depends on the control signals and the disturbances. Together these polynomials tell us how

x

+ 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 the

u

i,

w

and

d

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 over ows.

In terms of the level

x

, we want to avoid

x

= 0 and

x

= 6. Given the present level and the disturbances

w

and

d

, we want to nd a control law that guarantees that we never reach the forbidden levels, speci ed by the logic polynomial

p

(

x

) = 1 +

x

+ 6

x

2+

x

3+ 6

x

4+

x

5+ 5

x

6 (38) This polynomial is equal to zero for all values of

x

, except

x

= 0 and

x

= 6.

(16)

By formulating the control objective in this way we get a manifold of solutions. For example, since we only want to avoid

x

= 0 and

x

= 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 of

x

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 reaches

x

= 0 or

x

= 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 + 3

x

+ 6

x

2+

x

3+ 2

x

4+ 6

x

5+ 2

x

6 (39) where

J

(

x

)2R7

x

].

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 minimizes

J

(

x

+), i.e.

= arg min

2F

3

J

(

f

1(

x

)) (41) The minimization is made with respect to the ordering 0

<

1

<

<

7.

Now let the polynomial

p

1(

x m

) be de ned as

p

1(

x m

) =

J

(

f

1(

x

)) +

m

;

J

(

x

) (42) If there exists a

2F3 that decreases the weight of the state with

m

steps, that value of

is de ned as the solution to

p

1(

x m

) = 0 (43)

This solution is valid only in the case when

m < q

;

J

max, where

J

max= arg maxx

2F7

J

(

x

) and

m

,

q

and

J

max and the

max

- and

<

-operations are regarded as in N. The ordering will otherwise be destroyed, and there will be false solutions.

(17)

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 to

p

2(

u

1

u

2

u

3

u

4

wd

) = 0 (44) where

p

2(

u

1

u

2

u

3

u

4

wd

) is de ned as

p

2(

u

1

u

2

u

3

u

4

wd

) =

f

2(

u

1

u

2

u

3

u

4

wd

);

(45) The explicit expressions for the polynomials

p

1 and

p

2 are

p

1(

x m

) = ;3

+ 3

2+

m

+

x

+

x

;2

2

x

;2

x

3;2

x

3; (46)

;3

2

x

3;2

x

4+ 2

2

x

4+ 2

x

5;2

x

5

p

2(

u

1

u

2

u

3

u

4

wd

) = 1;

+ 3

du

2;3

d

2

u

2+ 2

du

1

u

2; (47)

;

d

2

u

1

u

2;

u

3;

u

4

w

+

u

3

u

4

w

;

;3

du

2

u

3

u

4

w

+ 3

d

2

u

2

u

3

u

4

w

;

;2

du

1

u

2

u

3

u

4

w

+

d

2

u

1

u

2

u

3

u

4

w

5 Computation of the control laws

The two polynomials

p

1(

x m

) and

p

2(

u

1

u

2

u

3

u

4

wd

) express rela- tions between the variables, implicitly describing the control laws. We want to nd explicit control laws

u

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 of

x

,

w

and

d

. 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 of

x

, using the polynomial

p

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

.

(18)

5.1 Computing the desired net ow

Compute a Grobner basis

GBa=

GB

7n

p

1(

x m

)



37(

)ojm=1

 (49)

with lexicographic order

> x

. In the general case a Grobner basis contains a number of polynomials

GBa=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 have

GBa=f

g

1(

x

)

 g

2(

x

)g (51) By the construction of

p

1 from (42) we know that we have no ambiguity for

m

= 1, i.e.

is a linear variable w.r.t. h

p

1



37i and the rst polynomial in

GBa can be written (see Section 2.7)

;

k

a(

x

) (52)

The other polynomials in GBa de ne where this solution is valid. Let the logic polynomial

v

a(

x

) denote the valid area for

k

a(

x

). Generally we would compute

v

a(

x

) as

v

a(

x

) =

g

2(

x

)^

g

3(

x

)^

:::

^

g

i(

x

) (53) Here we only have one polynomial except

g

1, so

v

a(

x

) is

v

a(

x

) =

g

2(

x

) (54) In this case it turns out that the solution is valid for all

x

, except

x

= 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 satis ed as long as the weight does not increase. This means that we have to search for another solution in the case when

v

a 6= 0. Compute

GBb =

GB

7n

p

1(

x m

)



37(

)



:

v

a(

x

)ojm=0

 (55)

to get

;

k

b(

x

) (56)

with corresponding polynomial

v

 (

x

), denoting the valid area for

k

 (

x

).

(19)

We can now compute

as a function of

x

as

=

K

(

x

) =

k

a(

x

):

v

a(

x

) +

k

b(

x

):

v

b(

x

) (57) with valid area

V

=

v

a^

v

b (58)

It turns out that

V



TRUE

. Therefore the valid area covers all values of

x

, that is, there is a solution in

for every

x

2F7. The explicit expression for

K

(

x

) is

K

(

x

) = 2;

x

;3

x

2;3

x

3+ 2

x

4;2

x

5 (59) If we are able to compute the

u

i as functions of

,

w

and

d

, using

p

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

and

d

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 of

w

and

d

, 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 de ne 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 and

u

4 open. The default value for the pump is chosen to be

u

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 and

u

2 for the control. In this way we nally get four ex- pressions for each

u

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 unde ned value. In order to guarantee that there is only one solution to (44) in these cases, we need

(20)

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 or

d

= 2 we cannot use

u

1 for control, so for these values of

d

we assign the default value to

u

1. There are three similar cases to account for and all these have to be speci ed by extra constraints (see Section 5.3).

5.3 Computation of the actuator signals

First de ne default values for the actuators

u

1def = 0 (61)

u

2def = 1

u

3def = 0

u

4def = 1 The extra constraints are given by

c

1(

u

1

d

) = (

d

;1)(

u

1;

u

1def) (62)

c

2(

u

2

d

) = (

d

;2)(

u

2;

u

2def)

c

3(

u

3

w

) =

w

(

u

3;

u

3def)

c

(

u w

) = (

w

1)(

u u

def)

(21)

Let

k

uij denote the control law for actuator

i

in valid area

v

j, where

i

= 1

:::

4 and

j

= 1

:::

4.

Start by computing

GB

1=

GB

7(f

p

2

c

1



"7gju2=1u3=0u4=1) (63) with lex-order

u

1

> > d > w

. This gives us

u

1;

k

u11(

dw

) (64) as the rst polynomial inGB1, and a valid area for this solution which we denote

v

1(

dw

). In this valid area, we let the other actuators take their default values, that is

k

u21 = 1 (65)

k

u31 = 0

k

u41 = 1

Next use both

u

1 and

u

2. Since this control action should not be allowed in

v

1 we add:

v

1 in the Grobner basis computation. That is, compute

GB

2 =

GB

7(f

p

2

c

1

c

2



:

v

1



"7gju3=0u4=1) (66) with lex-order

u

1

> u

2

> > d > w

.

From this we get

k

u12and

k

u22, while

k

u32and

k

u42takes their default values. We then continue by computing

GB

3 =

GB

7(f

p

2

c

1

c

2

c

3



:

v

1^:

v

2



"7gju4=1) (67) and

GB

4 =

GB

7(f

p

2

c

1

c

2

c

3

c

4



:

v

1^:

v

2^:

v

3



"7g) (68) with lex-order

u

1

> u

2

> u

3

> > d > w

and

u

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 as

K

ui(

wd

) =X4

j=1

k

uij:

v

j (69)

References

Related documents

For this project, the process has been different, the requirements have been used as evaluation criteria and the prioritization from the requirements specification has been

This Section contains results from real experiments on the double tank sys- tem controlled via a wireless CTP network with outage compensation imple- mented as a part of the

The Peltier element will be switched off when the temperature difference between the heat sink and wall exceeds 30 K, since it will be more efficient to heat the air due to the

Det kan även föreslås att genomföra en kvantitativ studie eftersom kvantitativ forskning fokuserar på kvantitet, standardisering, generalisering och representativa urval (Olsson &amp;

Figure 6 shows the estimation errors for sinusoidal input signals of different frequencies up to half the sampling frequency.. If we look at the DFT of the output signal before

Discrete event dynamic systems (DEDS) are treated in a mathematical framework using algebra and polynomials over finite fields.. In this framework DEDS interacts with the environment

In this work we investigate whether it is possible to synthesize the control law for a discrete event dynamic system, using a polynomial rep- resentation of the system and

In this work we investigate whether it is possible to synthesize the control law for a discrete event dy- namic system, using a polynomial representation of the system and