Semi{Quantitative Physics Compiler: where are we ... - Semantic Scholar

1 downloads 0 Views 377KB Size Report
Jun 20, 1994 - Intelligence Laboratory, The University of Texas at Austin, where I found an extremely ..... Figure 1: Lake Travis and Mans eld Dam, Austin, TX.
Semi{Quantitative Physics Compiler: where are we now and where are we going? Giorgio Brajnik

Dipartimento di Matematica e Informatica, Universita di Udine Udine { Italy email: [email protected] voice: +39 (432) 272.210 fax:+39 (432) 510.755

Abstract Incomplete information is present in many engineering domains, hindering traditional and non{traditional simulation techniques. This paper describes SQPC (semi{quantitative physics compiler), an implemented approach to modelling and simulation that can predict the behavior of incompletely speci ed systems, such as those that arise in the water control domain. SQPC is the rst system that uni es compositional modeling techniques with semi{quantitative representations. We describe SQPC's foundations, QSIM and QPC, and how it extends them. We demonstrate SQPC using several examples from the water supply domain.

This technical report (UDMI{RT{03{94) is an extended version of [Farquhar and Brajnik, 1994].

Semi{Quantitative Physics Compiler: where are we now and where are we going? Giorgio Brajnik

Dipartimento di Matematica e Informatica, Universita di Udine Udine { Italy June 20, 1994

Abstract Incomplete information is present in many engineering domains, hindering traditional and non{traditional simulation techniques. This paper describes SQPC (semi{quantitative physics compiler), an implemented approach to modelling and simulation that can predict the behavior of incompletely speci ed systems, such as those that arise in the water control domain. SQPC is the rst system that uni es compositional modeling techniques with semi{quantitative representations. We describe SQPC's foundations, QSIM and QPC, and how it extends them. We demonstrate SQPC using several examples from the water supply domain.

1 Introduction Consider the problem of water supply control. A lake has a dam with oodgates that can be opened or closed to regulate the water ow through power generating turbines, the water level (stage) of the lake, and the downstream ow. The goal of a controller is to provide adequate reservoir capacity for power generation, consumption, industrial use, and recreation, as well as downstream

ow. In exceptional circumstances, the controller must also work to minimize or avoid ooding both above and below the dam. This task is both dicult and vitally important to the residents of surrounding areas. The work of controllers could be substantially eased by sound automatic modeling and simulation tools. Computer Simulation (CS) is a crucial activity for such control task, and many others, including diagnosis, monitoring, design and decision{making. Yet computer simulation is hindered by two fundamental diculties: model management, the most complex and time consuming activity, must be performed manually, and traditional modeling and simulation tools do not cope with incomplete knowledge.

Model{management As clearly described in [Krishnan, 1993] model management encompasses a wide spectrum of activities: problem identi cation and formulation, model creation, implementation and validation, problem solution  This research began while I was visiting the Qualitative Reasoning Group at the Arti cial Intelligence Laboratory, The University of Texas at Austin, where I found an extremely stimulating and friendly research environment. I want to especially thank dr. Adam Farquhar, who provided the complete code of, and many explanations on, QPC, the ancestor of SQPC, and, for their support and patience, prof. Ben Kuipers and Bert Kay.

1

1 INTRODUCTION

2

and interpretation. The human modeler is heavily involved during most of these activities with very little or no support o ered by computer. She or he has: 1. to de ne the system/environment boundary: this means to decide which are the signi cant inputs (either directly controlled quantities or disturbances) a ecting the system being analyzed, and how will the system a ect the environment (i.e. its output); 2. to decide how the boundary will vary during the analysis: for example, when the system enters a new operating region, a controlled variable may become dependent on others, ceasing to characterize part of the system's boundary (a detailed example of this will be shown in section 4); 3. to select, validate and revise modeling approximations and assumptions: due to limitations in the modeling information or to analytical intractability of equations, approximations (e.g. linearly interpolating rating tables for gates and turbines) and simplifying assumptions (e.g. neglecting evaporations e ects on the lake) have to be made; 4. to identify the operating regimes of the system to cope with qualitative and structural changes occurring during operation (e.g. due to faults or new operating regimes); each model must be formulated in an appropriate formalismdeemed appropriate by the modeler (e.g. ODEs, di erence equations, nite state automata, etc.) and the modeler has to gure out how transitions from one model to another one can be accurately described; 5. to implement each mathematical model into a corresponding numerical model; 6. to verify the validity of each model, with respect to other descriptions of the system's behavior (either other models or sensory data); 7. and nally, to interpret numeric results and evaluate (modeling and simulation) errors.

Incomplete knowledge There are several forms of incomplete information that appear in the water supply domain, and in many other domains as well. The precise shape and capacity of lakes or reservoirs is rarely known; the out ow from opening a dam's oodgates is only crudely measured; empirical data on the level/ ow{rate curve for rivers becomes less and less accurate when ood conditions approach; few quantities are measured (e.g. ow rates of minor tributaries are not measured at all); the amount of runo to be expected from a given rainfall depends on dicult to measure surface characteristics such as saturation; the amount of rainfall that actually falls on a lake and surrounding areas is dicult to predict and is imprecisely measured. Nonetheless, both mathematical analysis and observations do provide rough bounds on the quantities involved, and often rough accurate bounds suce to select appropriate actions. This domain provides challenging problems for existing approaches to modeling and simulation. Traditional numeric methods require much more precise information than is available, forcing modelers to make assumptions which may invalidate results and which may be dicult to evaluate. On the other hand, pure qualitative reasoning techniques [Forbus, 1984; Kuipers, 1986] do not exploit the partial information available and consequently provide insuciently strong predictions. Fortunately, recent advances in semi{quantitative simulation techniques provide a method for predicting the behavior of such systems. This work extends

2 SQPC FOUNDATIONS

3

the purely qualitative representation [Kuipers, 1986] with means for representing semi{quantitative information [Berleant and Kuipers, 1988; Kuipers and Berleant, 1992; Kay and Kuipers, 1993; Vescovi et al., 1994]. In this work, semi{quantitative information is represented in two forms: bounds on variable values and functional bounds (envelopes) on otherwise unspeci ed monotonic functions. This is exactly the kind of information that is available in the water supply and many other engineering domains. Until recently, no technique was developed for both supporting model management and coping with incomplete knowledge. Few systems [Forbus and Falkenhainer, 1990; Iwasaki and Low, 1991; Forbus and Falkenhainer, 1992; Amador et al., 1993] have been developed that use compositional modeling techniques, and exploit qualitative models to provide explanations of simulations. They are unable, however, to represent or use semi{quantitative information. In order to provide any sort of numeric simulation, they all require complete precise initial conditions and algebraic equations. This paper describes SQPC (semi{quantitative physics compiler), an implemented approach to modeling and simulation that uses semi{quantitative knowledge. SQPC extends the QPC system [Farquhar, 1993; Crawford et al., 1990] to exploit the recent advances in semi{quantitative simulation. SQPC is the rst compositional modeling system to employ semi{quantitative representation and simulation. The input to SQPC is a domain theory and a scenario. The domain theory is composed primarily of model fragment de nitions the describe both the conditions under which physical phenomenon are active and their consequences. The scenario speci es objects that are known to be of interest, some initial conditions, and some relations that hold throughout the scenario. Both the domain theory and scenario may include bounds on numeric values and monotonic functions. From this, SQPC generates a set of behavioral descriptions, guaranteed to cover any system trajectory consistent with the scenario and domain theory. A behavior may pass through a number of distinct operating regions, each of which is characterized by a distinct mathematical model, or SQDE (semi{quantitative di erential equation). We mentioned the two problems of model management and incomplete knowledge in the context of water supply control. They also arise in predicting the behavior of assembled devices. Most sub-assemblies are manufactured to certain speci cations which can readily be modeled by numeric ranges, or functional bounds (either equations or tables). Given a domain theory that includes these speci cations, SQPC can prove that if the sub{assemblies satisfy the speci cations, the overall system will behave in a particular way.

2 SQPC foundations

2.1 Semi{quantitative simulation

SQPC is built on top of the QSIM qualitative simulator [Kuipers, 1986; Kuipers, 1993]. The input to QSIM is a qualitative di erential equation (QDE) which speci es: (i) a set of variables (continuously di erentiable functions of time); (ii) a quantity space for each of these variables, speci ed in terms of a totally ordered set of symbolic landmark values; (iii) a set of constraints expressing (algebraic, di erential or monotonic) relationships between variables. A QDE is an abstract description of a, perhaps in nite, set of ordinary di erential equations. The output of QSIM is a set of behaviors. Each behavior is a sequence of states, where a state is a mapping of variables to qualitative values. A state is described

2 SQPC FOUNDATIONS

4

by a tuple of qualitative values (qvalues) of variables, each qvalue representing the (qualitative) magnitude of the variable (i.e. either a symbol or a pair of adjacent landmarks1) and the direction of change of the variable (i.e. the sign of its time derivative: dec, std, inc). Each state describes either a time point or an open temporal interval. Time is treated as another qualitative variable, whose landmarks are automatically generated by QSIM as critical points of other variables are identi ed. A monotonic function constraint represents an element of an in nite set of real valued functions. The monotonic function constraint has the general form:  y = f(x ; : : :; x ) 1 n (1) ((M s1 : : :sn ) x1 : : :xn y)  @f ) = s sign( @xi i where each si is a sign and f is a continuous reasonable function [Kuipers, 1986]. Simulation is based on a constraint satisfaction scheme:  successor states are generated by propagating variables' qvalues according to continuity alone (e.g. if qvalue(V; S) = then possible successor states Sk+1 are such that qvalue(V; Sk+1 ) = or or or ; is not admissible because it implies a discontinuous jump of dVdt(t) ;  successor states are ltered using constraints and global criteria (e.g. unreachability of certain landmarks, nite time for covering in nite distance) to decide which states are admissible and which are inconsistent. QSIM is proven to yield all possible state trajectories (called behaviors) of the system given an initial state. Hence QSIM is sound. Due to incompleteness (in the model or in the state) QSIM may produce, however, ambiguous results consisting of several possible behaviors of the system: some of these may actually correspond to true trajectories, whereas others turn out to be physically impossible. QSIM is therefore incomplete (for QSIM is unable to provide only true behaviors). To reduce the number of such spurious behaviors, during recent years, several extensions have been added to QSIM: the use of higher order derivatives [Kuipers et al., 1991], energy functions [Fouche and Kuipers, 1990], phase-space criteria [Lee and Kuipers, 1993], and abstraction techniques [Clancy and Kuipers, 1993] each contributes to a signi cant reduction (yet not a complete elimination) of spurious behaviors. In the semi{quantitative framework employed by SQPC, the basic qualitative representation is augmented [Berleant and Kuipers, 1988; Kuipers and Berleant, 1992; Kay and Kuipers, 1993]. Each landmark may be bounded with a precise numeric upper and lower bound. Each monotonic function constraint may be bounded with a precise functional upper and lower bound. An envelope for a constraint (1) is a pair of functions F = that bound the actual function f that appears in (1). The semantics of envelopes is easily understood in terms of set of functions. Any monotonic constraint is an abstract description of a set of functions: for example, (1) denotes the set FM = ff jf is a continuous di erentiable@ffunction such that f: Sx1  : : :  Sx ! Sy where Sx1 ; : : :Sx ; Sy 

2 SQPC FOUNDATIONS

5

considering F an envelope for the constraint (1) means to restrict attention to the set FF = ff jf 2 FM and 8t 2 T: f(x1 (t); : : :; xn(t))  f(x1 (t); : : :; xn(t))  f(x1 (t); : : :; xn(t))g: The semi{quantitative simulators augment behavior with the numeric bounds. They are also able to use the semi{quantitative information to rule out qualitatively possible behaviors. The semi{quantitative techniques developed in [Berleant and Kuipers, 1988] propagate bounds (using algebraic constraints, or envelopes) throughout each time{point state and then used the mean{value theorem to constrain the values across time. The dynamic envelope technique [Kay and Kuipers, 1993] constructs extremal equations for the derivative of each state variable. These extremal equations are then explicitly integrated to provide bounds on variable values across time intervals. Neither technique strictly dominates the other. As a result, the bounds provided by the two methods may be intersected, yielding sometimes stronger predictions than either alone2 .

2.2 Qualitative Physics Compiler

SQPC is an extension of QPC, whose modeling language descends from the expressive modeling language Forbus developed for his Qualitative Process theory [Forbus, 1984]. The input to QPC is a domain theory and scenario speci ed in the QPC modeling language. A domain theory consists of:

 A taxonomy of entity types: a hierarchy of types of objects and associ-

ated relationships, called structural relations. Types denote sets of objects, and the (built{in) IS{A relation represents set inclusion. For example, IS{A(lakes, containers) states that lakes are a particular case of containers. The user can de ne domain{depedent relationships, such as

ows{into(rivers, containers) meaning that rivers may ow into reserviors. Instances of entity types can also be declared (for example INSTANCE{ OF(contained{liquid, water) states that water is an entity belonging to the contained{liquid type). It is also possible to de ne meta{level relationships (i.e. logical constraints among relations): for example, stating that has{gate(dams, gates) is the inverse of part{of(gates, dams).  A set of quantity types: each quantity type is an attribute of tuples of entity types which maps their instances onto real{valued functions. More speci cally, a quantity type QT maps a tuple of entity types (E1  : : : Ek ) to a set of functions, mapping time (T  (stage lake) (base g))) :consequences ((I- (capacity lake) (discharge-rate g)) (Q+ (discharge-rate g) (stage lake)) (Q+0 (discharge-rate g) (opening g)) (q-add (flow-rate river) (discharge-rate g))))

Figure 6: Model fragment specifying properties of gates. discharge{rate is negatively in uenced by the head, and it is positively in uenced by requested power, and both min/max{head are positively in uenced by the desired power. Other in uences are the same of gates.

UNCONTROLLED-TURBINE-MF represents a turbine operating in a situation where head is too low and the turbine cannot release the requested power. The discharge{rate is positively in uenced by head (and no longer by power); nothing is said for the released power. This is speci ed by POWER-RELEASED-BY-UNCONTROLLED-TURBINE-MF which applies when head is below the minimum threshold, for a requested power, but it is still positive. In such a situation power is positively in uenced by the discharge{rate. Notice how the causality on power changes across these MFs: normally power is not in uenced by any other quantity, whereas in abnormal situations it becomes an in uenced variables. Finally, TURBINE-REVERSE-FLOW-MF copes with the reverse{ ow phenomenon that can involve turbines of dams: when the level of the downstream body of water is higher than the lake stage, and the turbine is open, then the water ow changes directions and goes upward, possibly damaging dams and turbines. In such a case the discharge{rate is positively in uenced by head (which is negative) and contributes to the lake capacity and the river ow{rate as for normal gates (of course, signs of quantities are reversed).

Tables and envelopes Part of the domain model refers to more speci c

classes of objects, or even to speci c objects, like Mans eld Dam or Lake Travis or the turbines included in Mans eld Dam. The domain model includes semi{ quantitative information for several quantities of such speci c objects in tabular form. The tables re ect both observations and engineering estimates about the relationships between important variables. For example, gures 9 and 10 show portions of some of the tables that provide numeric information about Lake Travis. On the basis of these tables (and others, not shown here) the domain model is enriched with envelopes, providing numeric bounds for certain functional relationships among tuples of variables. To do so, SQPC must rst be provided with numeric functions interpolating data points. This is done with a lisp macro (define-tf) that takes as input the list of data points and constructs appropriate internal representations for all the functions deemed useful that are based on that table. For example, the rating{table for gates( g. 10) can be used to construct 3 di erent numeric functions: Stage  Opening ! Discharge{rate Opening  Discharge{rate ! Stage Stage  Discharge{rate ! Opening

4 EXPERIMENTATION

14

(DefModelFragment TURBINE-DEFS-MF :participants ((t :type turbines) (dam :type dams :conditions ((has-valve dam t) (is-open t))) (lake :type lakes :conditions ((connects dam lake river))) (river :type rivers)) :consequences ((add (level river dam) (head t) (stage lake))))

(DefModelFragment NORMAL-TURBINE-MF :participants ((t :type turbines) (dam :type dams :conditions ((has-valve dam t) (is-open t))) (lake :type lakes :conditions ((connects dam lake river))) (river :type rivers)) :operating-conditions ((> (stage lake) (base t)) ( flow rate (cfs) for gates in Mansfield Dam." :variables ((st op of)(+ + +)) :inverses (((op of st)(- + +)) ((st of op)(- + +))) :data-points ((665 8.5 5430) ...))

Figure 11: The de nition of a lisp function for interpolating data points of the rating{table of gates of the Mans eld Dam. We will use it to provide bounds for ow{rate computed in terms of the other two quantities, and similarly for stage and opening. We also provide signs for each of the partial derivatives. (DefEnvelope MANSFIELD-GATE-DR-E :comment "The envelope for stage x opening --> discharge rate for the Mansfield-type gates." :participants ((dam :type dams) (lake :type lakes :conditions ((connects dam lake river))) (river :type rivers) (g :type mansfield-gates :conditions ((has-valve dam g)))) :constraint ((M + +) (stage lake) (opening g) (discharge-rate g)) :upper-envelope (hi (lake-travis-rating-table '(st op of) (list (stage lake) (opening g)))) :lower-envelope (lo (lake-travis-rating-table '(st op of) (list (stage lake) (opening g))))) (DefEnvelope MANSFIELD-GATE-DR-INV1-E :comment "The envelope for opening x discharge --> stage for the Mansfield-type gates." :participants ((dam :type dams) (lake :type lakes :conditions ((connects dam lake river))) (river :type rivers) (g :type mansfield-gates :conditions ((has-valve dam g)))) :constraint ((M - +) (opening g) (discharge-rate g) (stage lake)) :upper-envelope (hi (lake-travis-rating-table '(op of st) (list (opening g) (discharge-rate g)))) :lower-envelope (lo (lake-travis-rating-table '(op of st) (list (opening g) (discharge-rate g)))))

Figure 12: Two envelope schemas for gates of Mans eld Dam

4 EXPERIMENTATION

18

incoming leg of the Colorado river (between 48,000 and 65,000 cfs). The gate is open (at its maximum opening, 8.5 ft). The question is how will the lake evolve and how long does it take for stage to reach certain signi cant levels, such as the top of conservation pool (representing the maximum level of the lake in normal conditions; stages above it are abnormal and require particular attention by the dam control sta ). Another important landmark for stage is, of course, the top of the dam. Notice that in the scenario we provide a description of the structure of the system we're going to analyze (:entities clause), we declare which landmarks are of particular interest for us (:landmarks), we declare relations that are invariant throughout the entire analysis (:relations) and initial conditions (:initial-conditions) holding only at time T0 of the rst model being constructed, and nally we declare two speci c envelopes for speci c objects (i.e. the uncontrolled spillway and the stage{capacity curves for Lake Travis). On the basis of this scenario description SQPC predicts the evolution of Lake Travis ( gures 14 and 15): its stage will reach the top of conservation pool in 15{26 hours (i.e. [54,150, 94,723] seconds, the range labeling T1 for the TIME variable), and after that, the lake will start spilling over the dam (after 7{10 days), nally reaching an equilibrium point where stage is between 714 and 726ft (after at least 7 days). Notice the role played by uncertainty in this example: although initial conditions where precisely stated (except for the input ow{rate), the uncertainty in the model (i.e. rough bounds provided by tables) leads to imprecision in time, in the nal value for discharge{rate (for which the gate rating{table doesn't provide an upper bound), in the nal stage, and consequently in other dependent variables (e.g. capacity).

4.2.2 Spilling lake

This example starts where the previous one nished: the lake is spilling, we have some rough information about the in ow, and would like to know how the lake will evolve when we suddenly open the gate. This is speci ed by the scenario in gure 16, very similar to the previous one ( gure 13), except for initial conditions. SQPC produces an ambiguous prediction, shown in the behavior tree of gure 17, due to the need of totally ordering landmarks. For SQPC there is no way to determine a unique total ordering between a newly created landmark, TR-24, used to represent a critical point for Travis.stage, and the user provided landmark top-of-conservation-pool. Three behaviors are therefore produced, one for each orderings between these two landmarks5. In the rst behavior the lake will eventually reach a quiescent state with a stage between 681' and 690'. It will cease over owing the dam after at least 55 hours. The second behavior shows that stage will go below 681' but stay higher than 665', and the top of conservation pool will be crossed at time T2. In the third behavior the lake will stabilize with a stage equal to the top of conservation pool, in a longer time. Of course the spillway will last the same time (at least 55 days) across the three predictions.

4.2.3 Increasing lake stage

In this problem we assume that initially the lake is in a normal state (i.e. its level is between 676.2 and 676.3 ft), that the gate is completely opened (8.5 ft) and

5 This is an instance of a frequent pattern of operationof QSIM, called occurrence branching [Fouche and Kuipers, 1990].

4 EXPERIMENTATION

19

(defScenario TRAVIS-WITH-GATE :entities ((travis :type lakes) (colorado-dn :type rivers) (colorado-up :type rivers :relations ((flows-into colorado-up travis))) (mansfield :type dams :relations ((connects mansfield travis colorado-dn))) (g1 :type normal-gates :relations ((has-valve mansfield g1)))) :landmarks ((top-of-conservation-pool :variables ((stage travis)) :range 681) (top-of-dam :variables ((stage travis)) :range 714)) :relations ((= (top mansfield) top-of-dam) (constant (level colorado-dn mansfield))) :initial-conditions ((= (opening g1) 8.5) (= (stage travis) 676.25) (= (flow-rate colorado-up) (48000 65000)) (= (base g1) 665) (= (level colorado-dn mansfield) 660)) :envelopes ((uncontrolled-spillway-envelope :constraint (M+ (stage travis) (spillway mansfield)) :upper-envelope (hi (lake-travis-uncontrolled-spillway '(st sw) (list (stage travis)))) :lower-envelope (lo (lake-travis-uncontrolled-spillway '(st sw) (list (stage travis)))) :upper-inverse (lo (lake-travis-uncontrolled-spillway '(sw st) (list (spillway mansfield)))) :lower-inverse (hi (lake-travis-uncontrolled-spillway '(sw st) (list (spillway mansfield))))) (stage-capacity-envelope :constraint (M+ (stage travis) (capacity travis)) :upper-envelope ...)))

Figure 13: The scenario for the rst example.

4 EXPERIMENTATION

0

1

5

7

11

15

20

19

1

23

24

26

Figure 14: The behavior tree produced by SQPC, given the scenario in g. 13. Model 0 yields a single behavior spanning 5 qualitative states, leading to the transition state 19; then model 1 produces again a single outcome with 3 qualitative states, ending with a quiescent state. INF

INF

. .... ° TR-17 [714 726] ...↑ .↑.↑... . TOP-OF-DAM [714 714] . . .↑. ....

..↑ ... ..↑.↑. ... ..... ..... . ↑ ↑ ↑ TOP-OF-CONSERVATION-POOL [681 681] ... . ↑

.↑ ....

.↑ .... ↑

T1

T2

T3

TRAVIS.STAGE

T1

T2

.↑ ... .... ... ↑↑ .↑.....↑.....↑. . . ..



T3

TRAVIS.CAPACITY

INF

..° G-15 [6100 65000] ...

. ..↑ ...

TR-5 [4.70E+10 4.78E+10] 0 [0 0]

T0

..↑ T3 [6.29E+5 +INF] ...

TR-16 [8.51E+10 8.51E+10]

N-4 [676. 676.] 0 [0 0]

T0

INF

..° TR-18 [8.51E+10 1.02E+11] ...

..↑ ... ..↑.↑. ... . ↑ ...

..↑ ...



T0

.. ..... ..... ↓ ↓ ↓... .... ↓↓... .. ↓.

G-14 [6100 6200] G-4 [5596 5680]

T1 [54150. 94723.] T0 [0 0]

T1

T2

T3

TIME

INF ↓...

T2 [6.29E+5 9.11E+5]

INF

TR-4 [42320 59404]

..° M-0 [0 58900] ... ..↑ ...

TR-15 [41800 58900]



... . ° 0 [0 0]

0 [0 0] MINF

0 [0 0] T0

T1

T2

T3

G1.DISCHARGE-RATE

MINF T0

T1

T2

T3

TRAVIS.CAPACITY.DERIVATIVE

T0

T1

T2

T3

MANSFIELD.SPILLWAY

Figure 15: The behavior produced by SQPC for some of the variables of the scenario of g. 13.

(defScenario travis-1-normal-gate-spilling ... :relations ((= (top mansfield) top-of-dam) (constant (level colorado-dn mansfield))) :initial-conditions ((= (opening g1) 8.5) (= (stage travis) 719) (= (flow-rate colorado-up) (5500 5700)) (= (base g1) 665) (= (level colorado-dn mansfield) 660)) ...)

Figure 16: The scenario de nition for an already spilling lake (only boundary conditions are shown; other clauses are the same of the scenario of g. 13).

4 EXPERIMENTATION

0

1

1

9

25

1

21

33

34

38 42

2

50

54

46

3

Figure 17: The behavior tree produced by SQPC for the scenario in gure 16. INF ↓

.... .↓ . . . . . ... ↓↓ . . . .. . ↓ . . ..

INF

N-4 [719 719] TOP-OF-DAM [714 714]

° TR-54 [681 690] TOP-OF-CONSERVATION-POOL [681 681]



. . ↑ T2 [5.06E+7 +INF] ... . .↑ ... . . . . ↑ ↑ T1 [1.98E+5 1.64E+7] . ... . .↑ ... T0 [0 0]

0 [0 0] T0 T0

T1

T1

T2

T2

TRAVIS.STAGE

TIME INF



.... .↓ . . . . . ... ↓↓ . . . .. . ↓ . . ..

G-3 [6100 6200] G-36 [6100 6200]

° G-37 [5680 5700] 0 [0 0] MINF

T0

T1

T2

G1.DISCHARGE-RATE

Figure 18: The rst behavior produced by SQPC: the equilibrium point for stage is above the top of conservation pool.

4 EXPERIMENTATION

22

INF ↓...

.. . ↓ .. .

. ↓.↓. . .

...

↓...

TOP-OF-DAM [714 714]

.. . ↓ .. .

.↓ . .

TOP-OF-CONSERVATION-POOL [681 681]

...

° TR-62 [665 681] 0 [0 0]

T0

INF

N-4 [719 719]

T1

T2



...

.

.. .↑ .

T0

T3

TRAVIS.STAGE

. ... . . ↑.↑.

.↑ .

...

.↑ .

...

.. .↑ .

. . ↑ T3 [4.89E+7 +INF] T2 [4.89E+7 +INF] T1 [1.98E+5 1.64E+7] T0 [0 0]

T1

T2

T3

TIME INF

↓...

.. . ↓ .. .

G-3 [6100 6200]

. ↓.↓. . .

... ..... ..... ↓ ↓ ↓...

G-36 [6100 6200]

..

° G-45 [5500 5700] 0 [0 0] MINF

T0

T1

T2

T3

G1.DISCHARGE-RATE

Figure 19: The second behavior produced by SQPC: the equilibrium point for

stage is below the top of conservation pool. INF ↓

... .. ↓ . . . . . ... ↓↓ . . . .. ↓ . . . ..

INF

N-4 [719 719] TOP-OF-DAM [714 714]

° TOP-OF-CONSERVATION-POOL [681 681] ↑

. . ↑ T2 [6.58E+7 +INF] ... . . .↑ . .. . ↑..↑ T1 [1.98E+5 1.64E+7] . ... . .↑ ... T0 [0 0]

0 [0 0] T0

T1

T0

T2

T1

T2

TIME

TRAVIS.STAGE INF ↓

.... .↓ . . . . . ... ↓↓ . . . .. . ↓ . . ..

G-3 [6100 6200] G-36 [6100 6200]

° G-41 [5680 5700] 0 [0 0] MINF

T0

T1

T2

G1.DISCHARGE-RATE

Figure 20: The third behavior produced by SQPC: the equilibrium point for stage equals the top of conservation pool.

4 EXPERIMENTATION

23

that the stage is increasing at a constant rate (between 0.01 and 0.02 ft/hour.). We would like to know what will happen to the lake if the current conditions persist for a suciently long time. More speci cally, how will the lake stage and the input ow{rate evolve over time if the increase rate of the stage remains constant? Such a simulation problem is posed by the scenario partly illustrated in gure 21. Notice that we declared that ow{rate is a dependent variable, overriding in this way the SQPC normal assumption of considering it an exhogenous variable. In absence of that declaration, SQPC would assume that ow{rate were constant during the analysis, leading thus to inconsistent models. This simulation stopped after the transition (signalling that the lake stage has reached the top of the dam). SQPC continued the analysis, but it quickly gured out that the condition d stage dt > 0 lead to a situation where stage ! +1, a possibility ruled out by the default operation mode of SQPC. As can be seen in gure 22 the lake stage will cross the top of conservation pool in more or less 20 days (i.e. the range associated to T1), and Lake Travis will start over owing after 162 days (time T2). Notice also how the lake in ow (Colorado-up.flow-rate) must evolve in order to support the constant increase rate of the stage. Therefore the increase rate can only be maintained if, for example, at time T2 the

ow{rate is no less than 6100 cfs. The upper bounds of ranges for ow{rate are unde ned because SQPC does not have an envelope for bounding the constraint (M+ (derivative (capacity travis)) (derivative (stage travis))) it automatically included in the model after correctly inferring that (M+ x y) implies dy (M+ dx dt dt ).

4.2.4 Servo{controlled turbines

The problem is to evaluate the \what if" scenario speci ed in gure 23. We are given an initial level for Lake Travis (between 690.2 and 690.3 feet) and a rough projected in ow from the Colorado river (between 791 and 950 cft/s). The task is to determine what happens to the lake level and evaluate how long the hydroelectric plant can deliver power at the requested rate of 10Mw. In addition to the numeric bounds variables in the scenario, there are several other sources of semi{quantitative information in this problem. All of the turbines in the dam are similar: therefore a single envelope schema (similar to the one for the rating{table of gates shown in gure 10) establishes bounds on the relation between the head of water above a turbine, the desired power output, and the discharge rate of water downstream. Lake Travis is a unique object: therefore the quantitative relation between the stage and capacity for Lake Travis is provided by an envelope speci ed in the scenario de nition. Figure 24 shows the SQPC output for this scenario. Under the speci ed conditions, the desired power level can be maintained until time T1, or at least 45 days (3:94  106 seconds) after the start time. After T1, there will be insucient hydraulic pressure to provide the full power output, the discharge rate from the turbine will decrease until it reaches equilibrium with the in ow at a rate between 791 and 950cfs, and the lake level will stabilize between 568' and 688'. These predictions are strong enough to be useful to a system controller. Note how imprecise the problem description really is: the ow rate was very coarse; there are no semi{quantitative bounds for the relationship between power and head in the low{head situation after T1; the table relating stage and capacity becomes extremely weak below 600'. More precise information in the domain theory or scenario will result in more precise predictions. This is the strength of the semi{quantitative inference methods. The precision of the predictions is proportional to the precision of the model.

4 EXPERIMENTATION

24

(defscenario ... :landmarks ((top-of-conservation-pool :variables ((stage travis )) :range 681) (top-of-dam :variables ((stage travis )) :range 714) ) :relations ((= (top mansfield) top-of-dam) (= (derivative (stage travis mansfield)) (0.0000027 0.0000054) (dependent (flow-rate colorado-up))) :initial-conditions ((= (opening g1) 8.5) (= (stage travis mansfield) (676.2 676.3)) (= (base g1) 665)) ...)

Figure 21: Part of the scenario description showing invariant and initial conditions for Lake Travis. In particular the stage is observed to increase at a rate of [0.01, 0.02] ft/hour (i.e. [0.0000027, 0.0000054] ft/sec). INF



.↑ .. ..

.↑ .. ..

.↑ .. ..

INF

. ↑ TOP-OF-DAM [714 714] .. .. TOP-OF-CONSERVATION-POOL [681 681]

N-4 [676. 676.] ↑

.↑ .. ..

.↑ .. ..

.↑ .. ..

. ↑ T2 [1.40E+7 1.40E+7] .. .. T1 [1.76E+6 1.76E+6]

T0 [0 0]

0 [0 0] T0 T0

T1

T1

T2

T2

TRAVIS.STAGE

TIME

INF



. ↑ G-4 [6100 6200] .. .. .↑ . . . . .↑ . . . . .↑ . . .. G-0 [5596 5680]

INF



. ↑ C-6 [6100 +INF] .. .. .↑ . . . . .↑ . . . . .↑ . . .. C-0 [5596 +INF]

0 [0 0]

T0

T1

G1.DISCHARGE-RATE

T2

0 [0 0]

T0

T1

T2

COLORADO-UP.FLOW-RATE

Figure 22: The behavior predicted for some of the variables.

4 EXPERIMENTATION

25

(defScenario "Turbine :entities :landmarks :relations

Travis-1-turbine from controlled to uncontrolled regime." ... ((top-of-dam :variables ((stage Travis)) :range 714)) ((= (flow-rate Colorado-up) (791 950)) (= (top Mansfield) top-of-dam) (is-open turb)) :initial-conditions ((= (power turb) 10) (= (stage Travis) (690.2 690.3))) :envelopes ((stage-capacity :constraint (M+ (stage Travis) (capacity Travis)) :upper-envelope (hi (lake-travis-stage-capacity '(st cap) (list (stage Travis)))) :lower-envelope (lo (lake-travis-stage-capacity '(st cap) (list (stage Travis)))) :upper-inverse (lo (lake-travis-stage-capacity '(cap st) (list (capacity Travis)))) :lower-inverse (hi (lake-travis-stage-capacity '(cap st) (list (capacity Travis)))))))

Figure 23: Part of the scenario description. The initial conditions specify the desired power output of the turbine and the stage (level) of Lake Travis. The

ow{rate of the upstream leg of the Colorado is set for the duration of the scenario. The :envelopes clause speci es the state{capacity table for Lake Travis. Any model in the scenario which includes the M+ between the stage and capacity of lake Travis will include this envelope. INF

INF

TOP-OF-DAM [714 714] ↓...

.. . ↓ .. .

N-4 [690. 690.]

. ↓.↓. . .

... ..... ..... ↓ ↓ ↓...

TR-9 [688 688]

..

° TR-10 [568 688] ↑

0 [0 0] T0

T1

T2

. .↑

...

.

T2 [3.94E+6 2.23E+8] T1 [3.94E+6 1.03E+7] T0 [0 0]

T1

T2

T3

INF

... . .↑ .

N-8 [122. 122.]

. ↓.↓. . .

. . ↑.↑.

...

. . ↑ T3 [3.94E+6 +INF]

TIME INF

.. . ↓ .. .

.

T0

T3

TRAVIS.STAGE

↓...

...

.. .↑ .

. .↑ ...

.. .↑ .

... ..... ..... ↓ ↓ ↓...

...

. ↑.↓. . . . .

↑ N-9 [120 120]

..

.↓ . .

...

INF

C-6 [1258 1258] . . . . . . . . . . .↓. . .

°

↓...

° TU-8 [0 120]

.. . ↓ .. ..

°

°

...

TU-0 [1219 1258]

↓ . . . . .↓ . . . . .↓ . .

° TU-9 [791 950]

N-3 [10 10]

...

° TU-10 [0 10] 0 [0 0]

0 [0 0]

0 [0 0]

MINF T0

T1

TURB.HEAD

T2

T3

MINF

MINF T0

T1

T2

T3

TURB.DISCHARGE-RATE

T0

T1

T2

T3

TURB.POWER

Figure 24: Behavior plot for several variables in the scenario. The power output by the turbine after T1 is below the desired level.

5 RELATED WORK

26

INF

INF

TOP-OF-DAM [714 714] ↓. . .

.. . ↓ .. . . ..

N-4 [690. 690.]

↓↓ . . . .

.↓ .....↓ .....↓ . .

TR-9 [688 688]

... ° TR-10 [568 688] ↑

0 [0 0] T0

T1

T2

↓.↓. . . .

...

.↑ .

T2 [4.34E+6 1.38E+8] T1 [4.34E+6 4.96E+6] T0 [0 0]

T1

T2

T3

INF

N-8 [122. 122.]. . . .↑.↓. . . . . . .

. . ..... ..... . ↓ ↓ ↓ ..

.. ... ↑

TIME INF

.. . ↓ .. ..

. .↑

T0

T3

TRAVIS.STAGE

↓. . .

...

.. . .↑.↑. ...

. . . .↑

.↑ . . . T3 [4.34E+6 +INF]

.

. . . .↑

↓. . . .

↑ N-9 [120 120]

INF

C-6 [1258 ..... 1258] ..... .↓. . .

.↓ . .

.. ° TU-8 [0 120]

°

...

↓. . .

°

TU-0 [1219 1258]

° ... ↓ .....↓ .....↓ .

.. ° TU-9 [791 791]

N-3 [10 10]

...

. ° TU-10 [0 10] 0 [0 0]

T0

T1

TURB.HEAD

T2

0 [0 0]

0 [0 0]

MINF

MINF

T3

T0

T1

T2

T3

MINF T0

T1

T2

T3

TURB.DISCHARGE-RATETURB.POWER

Figure 25: Behavior plot for several variables of the scenario with increased precision in initial conditions and envelopes. Notice that the bounds for T1 did restrict a lot (89%) with respect to the behavior shown in gure 24. This is illustrated by running the same scenario under di ering conditions. If the upper bound on the in ow rate is reduced from 950 cfs to 800 cfs, then the upper bound on T1, the time that power generation drops below the desired rate, is reduced to 76 days, a 58% improvement in precision. The envelopes can be tightened by using a piecewise linear interpolation for the stage{capacity curve instead of a step function. This tightens the range for T1 to 50{58 days ( g. 25), an improvement of 89% from the original. Increased precision in the input or model leads to increased precision in the output. In this scenario, other variables (such as the discharge{rate) are not a ected by the increase in precision because of the residual uncertainty in the model (e.g. the turbine rating table is still interpolated as a step function; the power released by the turbine under the uncontrolled regime is still numerically unbounded). Nevertheless this gain in precision is not payed with a decrease of accuracy: every possible outcome of the modeled system is still being produced, given that the assumptions underlying the domain model and the scenario do hold.

5 Related work In recent years, several research e orts have worked towards the development of self{explanatory simulators that construct numerical simulations and use the qualitative representation to help explain the results. Unlike SQPC, they do not use semi{quantitative information. Their predictions are either precise numeric ones, or purely qualitative. SIMGEN [Forbus and Falkenhainer, 1990; Forbus and Falkenhainer, 1992] computes a total envisionment of the scenario and then, for each envisionment state6 it builds a numerical simulator, monitors the simulation and, at the end of the analysis, interprets numerical results in terms of the envisionment graph. SIMGEN requires precise and complete numerical equations, initial and boundary conditions for the simulation. SIMGEN must be capable of building a numerical model for each envisionment state touched during the simulation; to this end it is supplied with a library of numeric procedures for every possible 6 corresponding to an operating region.

5 RELATED WORK

27

combination of in uences, a very demanding requirement for the domain model. In addition, SIMGEN operation is based on a total envisionment that must be computed before the analysis takes place. This is a demanding task in those situations where there are many possible states of the modeled system, common in realistic settings. In the second reported version of SIMGEN, however, this problem has been reduced with the help of a compilation technique which avoids building all envisionment states. Furthermore, to cope with some performance limits of SIMGEN, the user can set up appropriate thresholds to control the time{step of the simulation across transitions. A consequence of this is that transitions occurring in a time span shorter than this threshold are not considered by SIMGEN at all, which will provide thus not sound results. Another limitation of SIMGEN depends on its inability to deal with sets of simultaneous equations. DME (the Device Modeling Environment) [Iwasaki and Low, 1991] is an incremental compositional modeling system capable of generating self{explanatory simulations. DME can work in two exclusive modes: qualitative or numeric. In the former case DME constructs qualitative states, and uses QSIM to generate successors; in the latter case, DME builds numerical models for simulation. In both modes, crossing an operating region triggers remodeling. DME, when used in the numeric mode, requires precise numerical equations, initial and boundary conditions. Due to the mechanism used to reason about inequalities between quantities, which is based on using QSIM to propagate qualitatively known inequalities through constraints and | yet to be resolved | in uences, DME is not sound. In fact, using in uences before making a closed{word assumption to reason on inequalities, is an instance of a non{monotonic reasoning mechanism, which needs to be able to appropriately deal with inconsistencies that could be only later revealed. DME, however, is a system conceived for supporting design activities, where soundness is not a crucial requirement. DME uses QSIM to perform only a very limited simulation: to compute the successor state of a state, whereas SQPC uses it to perform a complete simulation of a single model. DME is thus unable to take advantage of QSIM non{local reasoning capabilities (i.e. so called global lters) that refer to behaviors. DME supports design by being highly interactive and providing sophisticated explanation capabilities [Gautier and Gruber, 1993; Gruber and Gautier, 1993]. Pika [Amador et al., 1993] builds a numerical model for each operating region of the system as soon as this is needed. Pika monitors the numerical simulation and, at the end of the analysis, is capable of engaging in a simple question/answering dialogue. Pika requires precise equations, complete initial conditions (unlike the other systems), and complete speci cation of boundary conditions (in particular inequalities are not allowed). Pika, di erently from SQPC, adopts non{directional in uences: they are still composable pieces of equations, but they do not specify a causal direction. Pika infers the causal order (since this is needed to formulate a numerical model) from knowledge of which are exhogenous variables, using a causal order algorithm. As we have seen, SQPC considers user{given causality (in in uences) and is thus able to dynamically change the set of exhogenous variables (as shown in the turbine example) as needed. I believe that this is not possible with Pika. Pika uses Mathematica to solve sets of simultaneous equations to be solved with traditional numerical methods (i.e. Runge{Kutta). It requires that all possible compositions of in uences are described in library of numerical functions, similarly to SIMGEN. Other modeling and simulation approaches proposed by the computer simulation community do not cope with incomplete knowledge and provide limited support for the model management task. For example, Fishwick, Ziegler and Praehofer address the problems of providing heterogeneous formalisms to for-

6 WHERE ARE WE GOING?

28

mulate appropriate multi{models of the device (such as an abstract nite{state automata and more detailed ODE models) [Fishwick and Ziegler, 1991], or of providing modeling and simulation environments supporting the handling of many, diverse models (i.e. multifaceted modeling [Praehofer, 1991]). Another course of action is centered to more speci c simulation problems, such as those based on linear programming [Krishnan, 1991]. In this case a modeling environment is proposed which, on the basis of sophisticated reasoning techniques, helps the user in formulating an appropriate problem, in constructing useful models and in revising the problem or model after simulation results have been shown to the user. As can be seen, none of the above mentioned techniques aim at a smooth integration of qualitative and quantitative knowledge: they cannot be used to produce sound results when incomplete knowledge is either present in the initial state or in the model.

6 Where are we going? In this section I'd like to point out some of the limits of the current version of SQPCand outline, when possible, a possible course of action. Most of what follows has emerged from the experimentation held so far with SQPC in the water control domain.

6.1 Extensions

The current version of SQPC is the rst step towards an adequate Semi{ quantitative Physics Compiler. What follows is a list of short/medium term extensions to SQPC.

6.1.1 Tractability

Building good models is a dicult art. Qualitative models are even more dicult to build, for the limits of qualitative calculus and qualitative simulators are not yet well understood. Under such premises it follows that achieving a good quality in automatically built models is a dicult goal. During the course of experimenting with SQPC, several straightforward scenarios lead to intractable simulations. The causes are:

 chattering variables: i.e. variables whose derivatives are underconstrained

in such a way that their sign is not determined by the model. This is, for example, the case where we have a chain of 2 or more lakes connected through dam gates and turbines. In such situations, QSIM branches on the values of the qdir of chattering variables, leading to an in nite tree of in nite behaviors. A similar problem occurs when a model covers both a gate and a turbine. When stage increases, then the gate discharge{rate does the same, the turbine discharge{rate decreases (at constant power), and QSIM is unable to determine the direction of change of d capacity dt . It happens also with an open turbine and a spilling lake.  discontinuous transitions: for the moment QPC, and SQPC as well, require that variables be continuous across transitions, but they do not need to be di erentiable in the transition time{point. This usually works well (it is quite a conservative assumption). Sometimes, however, this leads to a high branching factor: when the qdir of one or more variables is underconstrained in the new model (the one built after the transition)

6 WHERE ARE WE GOING?

29

then QSIM branches on the possible values, for the qdir, since SQPC does not constrain it. This happens, for example, in a transition where some variable added by SQPC to encode an inequality is underconstrained. It is easily realized the importance of being able to automatically handle these problems, for they appear even in very simple scenarios. As already mentioned, this is not a problem for QPC, for it uses QSIM for generating an envisionment instead of a more detailed simulation. Such a possibility is valid also for SQPC: we could just turn on the appropriate QSIM switches to achieve it, and have SQPC compute an attainable envisionment, obtaining however much less detailed predictions. Fortunately, several techniques have been developed for coping with such problems when producing qualitative simulations [Fouche and Kuipers, 1990; Kuipers et al., 1991; Lee and Kuipers, 1993; Clancy and Kuipers, 1993]. In the context of SQPC, what is needed is:  a mechanism for selecting the most appropriate tool, on a model{by{ model basis, for handling these problems when they appear; for example when chattering variables are recognized in a model, SQPC could decide to ignore their qdirs;  to enrich the modeling language in order to provide any additional information that could be used, such as the sign of higher{order derivatives, or an indication of which are conservative and dissipative terms;  to extend the SQPC algebraic reasoning capabilities: providing a richer knowledge base for inferring formally equivalent, but qualitatively non{ redundant, constraints is an open{ended research problem, where even small advances could yield useful results. The current version of SQPC implements the following inferences: x + y = z and (constant y 0)  (equal x z) x+y =x  (constant y 0) x?x =y  (constant y 0) x + y = z and x + w = z  (equal y w) x + y = z and x0 = ?y0  (constant z 0 0) (M + x y)  (M + x0 y0 )

Using dynamic envelopes As previously discussed, the dynamic envelope method aims at numerically bounding the simulated variables not only on time{ point qualitative states (as the currently used QSIM semi{quantitative extension, Q2, does), but even in interval{time states. This technique needs no additional information, and is complementary to the one already employed in SQPC. Therefore by using them in an interleaved fashion during the simulation, they could reduce qualitative ambiguities. NSIM used inside SQPC could also provide more detailed output plots for variables: instead of associating numeric ranges to landmarks, NSIM produces also the plot of the simulated variable during time{interval states. NSIM is particular useful, in the context of SQPC, where one need to compare predictions with measurements of variables, taken at arbitrary moments (similarly to what already happens within MIMIC [Dvorak and Kuipers, 1989; Dvorak, 1992]). Since measurements refer to arbitrary moments in time, then to \insert" them into a qualitative behavior we need to know how the predicted variable evolved during any time{interval. This is of paramount importance in the monitoring task; in the simulation task performed by SQPCthis is not a crucial requirement.

6 WHERE ARE WE GOING?

30

Using NSIM inside SQPC require another extension, however: envelopes built on the basis of tabular data, interpolated through piecewise constant or piecewise linear functions, feature many critical points (where the interpolated function is not di erentiable), not all of which are necessarily made explicit in appropriate operating conditions of model fragments or envelope schemas. Therefore SQPC is not aware of the existence of these critical points. This poses no problem at all for Q2, but it makes NSIM not usable, for it assumes that envelopes are constituted by smooth functions over their domain. To be able to use NSIM inside SQPC we need to implement other means for interpolating tabular data, for example using splines.

Time{varying exhogenous variables All qualitative simulators built so

far are limited to initial value problems : they take as input a model and an initial state and predict how such a system will evolve. In many situations, however, one has enough information on how certain variables una ected by the modeled system evolve, and this information could be used to drive the simulation (a more general class of problems: boundary value problems). This is the case for control: in the water control domain, for example, one knows how certain input variables evolve over time (such as the opening of gates, or the power requested to turbines, or even the input ow{rate for a reservoir). We would like to provide SQPC with a stream of time{tagged measurements taken for some directly controlled input variables, and have it produce a simulation which is driven by them. In this way we could extend SQPC capabilities to solve control problems, such as suggesting relevant control laws. Doing so requires an analysis of possible kinds of changes that can result from these actions. We envision two basic kinds of actions, and hence of effects on variables: instantaneous actions producing a discontinuous change on certain variables, and continuous actions, producing a continuous monotonic (with respect to time) change on the variables value. We focus on actions instead of variables (such as labeling variables in a domain model as being always continuous or discontinuous) because this distinction depends on the modeling assumptions being made, which could change during an analysis. For example as an e ect of a change in the time{scale of the analysis, opening or closing a valve could be seen as a discontinuous operation (hence the valve opening is regarded as a discontinuous variable) during part of the (macroscopic) analysis, and later, in the same domain, one could want to analyze the fast transient dynamics occurring during the operation on the valve, treating thus valve opening as a continuous variable, a ected by a continuous action. The SQPC extension amounts to providing linguistic means for representing actions, to being able to accept time{tagged measurements of variables, to nding out the exact corresponding time in the each semi{quantitative behavior, and \inserting" a new state at that time, and then deal with the e ect of the action. If the action is instantaneous then a transition occurs to a new model which includes the new value for the a ected variables. For a continuous action SQPC must determine how the variables values changed since last measurement (i.e. the direction of change of each variable). SQPC could then use this information to roll{back the simulation to the previous time{point where that variable was measured, and restart it assuming that the variable is either increasing, decreasing or constant with respect to time.

Representing units Whenever metric properties are declared in a domain model or scenario they refer to a unit of measurement. Currently SQPC does not provide means for making this information explicit, which could be pro tably

6 WHERE ARE WE GOING?

31

used for: (i) obtaining more information on numeric magnitudes (e.g. their dimension); (ii) explicitly representing units and increasing human readability of domain models and scenarios; (iii) increasing the exibility of the SQPC (by enabling things like change of magnitude scale to cope with rounding errors). In SQPC any reference to a numeric magnitude which is made by a user through one of the many macros, should be speci ed in terms of a speci cation unit, which is itself a numeric magnitude, and which has a name (e.g. METER). For each dimension there should one or more available units, one of which is to be chosen as the reference unit for that dimension in a scenario. In this way a user can choose the reference units, which will be used as the destination unit into which all other units will be converted. So, for example, if the user chooses SECOND as the reference unit for the TIME dimension, then he/she can specify other numeric magnitudes using other units (say DAY), but SQPC will convert all times into seconds. Thus in the knowledge base and in SQDE values will be represented in terms of reference units only, and there will not be any dynamic conversion during problem solving. If reference units create a con ict with machine epsilon (i.e. there is a numeric magnitude whose value, expressed in the reference unit, falls below machine epsilon) then it is responsability of the user to change the reference unit to a smaller one. The user should be able to de ne new units for each dimension, either built{in ones or not. In this way the user could de ne FOOT in terms of METER, and NEWTON in terms of KG, SECOND and METER. For the moment SQPC will not convert the numeric magnitudes produced as output (say of a qsim-display) into other units than reference ones. We could provide in the future another argument to DefScenario to instruct SQPC to do so. For example to specify 2.5 m one could say (* 2.5 METER), or, if such a unit is de ned, (* 250 CENTIMETER). To specify the range [2, 2.5]m one could say (* (INT 2 2.5) METER). To specify the range of [1, 1.8]kg m=s2 one could say (* (INT 1 1.8) KILOGRAM METER (/ 1 SECONDS SECOND)) or equivalently (/ (* (INT 1 1.8) KILOGRAMS METER) SECOND SECOND). To specify the relationship between Celsius and Farenhait temperature scales, one could de ne the unit FARENHAIT as (+ 32 (* 1.8 CELSIUS)). Also constants like CENTI, MILLI or KILO are included. They are not units by themselves, but could be used to de ne units. They are lisp constants that evaluate to a speci c numeric value (eg. CENTI evaluates to 0.01, MEGA to 1e+6, NANO to 1e-9). In such a way expressions like (* 250 CENTI METER) are perfectly legal.

6.2 Re nements

The current SQPC version requires also some revision of the implementation. The experimentation carried on so far pointed out several limits of the current implementation, which derives directly from QPC, and which was not tuned for the di erent task SQPC aims to.

Ad{hoc inequality reasoner SQPC needs to reason on simple inequalities . 7

This is needed, among the others, to determine the set of active model fragments, to determine a total ordering for quantity spaces, for representing operating regions, for computing initial states. Inequality reasoning in SQPC means computing the transitive closure of ordinary comparison operators over time intervals (for example the time scope of the entire scenario, or of a single model,

7 With inequality I mean any relation, negated or not, that can be expressed between pairs of quantities | variables or constants | using a comparison operator.

6 WHERE ARE WE GOING?

32

or of an initial time for some model). This is currently done through a number of rules that represent transitivity properties of order operators over reals. More speci cally:

 time intervals over which it makes sense to reason about order relationships

are represented in the knowledge base of SQPC with scopes; scopes can be nested (e.g. the scope for the initial time for some model is included in the scope of the model, which in turn is included in the scenario scope). All inequalities refer to a scope. If an inequality holds in a scope S then it holds also in any super{scope of S: this is implemented as general forward{ chaining rules;  some inequalities derive from the domain model, others from the scenario, and some others derive from partial results of simulation (i.e. when QSIM signals a transition, then SQPC extracts order information from the last simulation state | actually from quantity spaces | and asserts this into the knowledge base for future consideration); other inequalities are inferred by SQPC from information about numeric ranges; this is only done when ranges do not overlap; nally other inequalities are assumed by SQPC when coping with ambiguous situations (e.g. if two magnitudes are not totally ordered and they both should be included in a quantity space of some variable, then SQPC assumes all three possible orderings between them, and pursuits each of them);  SQPC uses a set of rules for propagating inequalities inside a single scope according to transitivity; these are implemented in a mixed strategy of both forward{ and backward{chaining rules; As already said SQPC does not directly perform inequality reasoning through arithmetic function. A large portion of inferences is devolved to QSIM: range re nement on the basis of inequalities and propagation of inequalities through algebraic and monotonic constraints. In some monitored executions of SQPC the part responsible for performing inequality reasoning (excluding inferences performed by QSIM) was found to use more than half of the CPU time of the entire SQPC execution. Furthermore it was empirically realized that the overall execution time of a simulation depends exponentially on the number of scopes, variables and magnitudes being manipulated. This poor performance, despite the relatively unsophisticated requirements of the task, prompted for a redesign and reimplementation of the inequality reasoner on an ad{hoc basis, merging several ideas that appeared in the relevant literature [Sacks, 1987; Simmons, 1986; Forbus, 1990]. This work is currently underway.

Acknowledgments I'd like to thank the Qualitative Reasoning Group at the University of Texas at Austin, led by prof. Ben Kuipers, where this research started, and who provided Algernon, QSIM and QPC. Thanks also to the Lower Colorado River Authority who provided sensory and technical data about the lakes surrounding Austin, TX. Finally, thanks to Marco Cojutti for his spontaneous help in clarifying some aspects of lake hydraulics, and to Franco Ceotto for the interpolation code used in tabular functions.

REFERENCES

33

References [Amador et al., 1993] F. Amador, A. Finkelstein, and D. Weld. Real{time self{ explanatory simulation. In Proc. of the Eleventh National Conference on Arti cial Intelligence. AAAI Press/MIT Press, 1993. [Berleant and Kuipers, 1988] D. Berleant and B. Kuipers. Using incomplete quantitative knowledge in qualitative reasoning. In Proc. of the Sixth National Conference on Arti cial Intelligence, pages 324{329, 1988. [Clancy and Kuipers, 1993] D. Clancy and B. Kuipers. Behavior abstraction for tractable simulation. In Proc. of the Seventh International Workshop on Qualitative Reasoning about Physical Systems, pages 57{64, 1993. [Crawford et al., 1990] J. Crawford, B. Kuipers, and A. Farquhar. Qpc: a compiler from physical models into qualitative di erential equations. In Proc. of the Eight National Conference on Arti cial Intelligence. AAAI Press / The MIT Press, 1990. [Crawford, 1991] J. Crawford. Algernon | a tractable system for knowledge representation. SIGART Bulletin, 2(3), 1991. [Dvorak and Kuipers, 1989] Daniel Dvorak and Benjamin Kuipers. Modelbased monitoring of dynamic systems. In Proceedings IJCAI-89, pages 1238{ 1243, 1989. [Dvorak, 1992] Daniel L. Dvorak. Monitoring and diagnosis of continuous dynamic systems using semiquantitative simulation. Technical Report AI 92{ 170, Arti cial Intelligence Laboratory, The University of Texas at Austin, 1992. [Farquhar and Brajnik, 1994] A. Farquhar and G. Brajnik. A semi{quantitative physics compiler. Submitted to AAAI94, 1994. [Farquhar, 1993] Adam Farquhar. Automated Modeling of Physical Systems in the Presence of Incomplete Knowledge. PhD thesis, Department of Computer Sciences, the University of Texas at Austin, 1993. Available as technical report UT-AI-93-207. [Farquhar, 1994] A. Farquhar. A qualitative physics compiler. Submitted to AAAI94, 1994. [Fishwick and Ziegler, 1991] P. Fishwick and B. Ziegler. A multimodel methodology for qualitative model engineering. Technical Report 91{001, Dept. of Computer and Information Science, Univ. of Florida, Gainesville, FL 32611, 1991. [Forbus and Falkenhainer, 1990] K. Forbus and B. Falkenhainer. Self{ explanatory simulations: an integration of qualitative and quantitative knowledge. In Proc. of the Eight National Conference on Arti cial Intelligence, pages 380{387. AAAI Press / The MIT Press, 1990. [Forbus and Falkenhainer, 1992] K. Forbus and B. Falkenhainer. Self{ explanatory simulations: scaling up to large models. In Proc. of the tenth National Conference on Arti cial Intelligence, pages 685{690, 1992. [Forbus, 1984] K. Forbus. Qualitative process theory. Arti cial Intelligence, 24:85{168, 1984.

REFERENCES

34

[Forbus, 1990] K. Forbus. The qualitative process engine. In D. Weld and J. de Kleer, editors, Readings in Qualitative Reasoning about Physical Systems. Morgan Kaufman, Los Altos, CA, 1990. [Fouche and Kuipers, 1990] P. Fouche and B. Kuipers. An assessment of currrent qualitative simulation techniques. In Proc. of Fourth International Worskhop on Qualitative Reasoning about Physical Systems, pages 195{205, 1990. [Gautier and Gruber, 1993] P. Gautier and T. Gruber. Generating explanations of device behavior using compositional modeling and causal ordering. In Proc. of the Eleventh National Conference on Arti cial Intelligence. AAAI Press/MIT Press, 1993. [Gruber and Gautier, 1993] T. Gruber and P. Gautier. Machine{generated explanations of engineering models: a compositional modeling approach. In Proc. International Joint Conference on Arti cial Intelligence, Chambery, F., 1993. [Iwasaki and Low, 1991] Y. Iwasaki and C. M. Low. Model generation and simulation of device behavior with continuous and discrete changes. Technical Report KSL 91{69, Knowledge Systems Laboratory | Stanford University, November 1991. [Kay and Kuipers, 1993] H. Kay and B. Kuipers. Numerical behavior envelopes for qualitative models. In Proc. of the Eleventh National Conference on Arti cial Intelligence. AAAI Press/MIT Press, 1993. [Kay and Ungar, 1993] H. Kay and L. Ungar. Deriving monotonic function envelopes from observations. In Proc. of the Seventh International Workshop on Qualitative Reasoning about Physical Systems, pages 117{122, 1993. [Krishnan, 1991] R. Krishnan. Pdm: a knowledge{based tool for model construction. Decision Support Systems, 7:301{314, 1991. North{Holland. [Krishnan, 1993] R. Krishnan. Model management: survey, future research directions and a bibliography, March 1993. The Heinz School of Public Policy and Management, CMU, Pittsburgh, PA. [Kuipers and Berleant, 1992] Benjamin Kuipers and Daniel Berleant. Combined qualitative and numerical simulation with Q3. In B. Faltings and P. Struss, editors, Recent advances in qualitative physics, pages 3{16. MIT Press, 1992. [Kuipers et al., 1991] B. Kuipers, C. Chiu, D. Dalle Molle, and D. Throop. Higher{order derivative constraint in qualitative simulation. Arti cial Intelligence, 51:343{379, 1991. [Kuipers, 1986] B. Kuipers. Qualitative simulation. Arti cial Intelligence, 29:289{338, 1986. [Kuipers, 1993] B. Kuipers. Reasoning with qualitative models. Arti cial Intelligence, 59:125{132, 1993. [Lee and Kuipers, 1993] W. W. Lee and B. Kuipers. A qualitative method to construct phase portraits. In Proc. of the Eleventh National Conference on Arti cial Intelligence. AAAI Press/MIT Press, 1993.

REFERENCES

35

[Praehofer, 1991] H. Praehofer. Systems theory, instrumented modeling and simulation methodology. Cybernetics and systems: an international journal, 22:283{312, 1991. [Prenter, 1975] Prenter. Splines and variational methods. John Wiley & Sons, New York, 1975. [Sacks, 1987] E. Sacks. Hierarchical reasoning about inequalities. In Proc. of National Conference on Arti cial Intelligence, pages 649{654. American Association ofr Arti cial Intelligence, 1987. [Simmons, 1986] R. Simmons. Commonsense arithmetic reasoning. In Proc. of National Conference on Arti cial Intelligence, pages 118{124. American Association ofr Arti cial Intelligence, 1986. [Vescovi et al., 1994] M. Vescovi, A. Farquhar, and Y. Iwasaki. Numerical interval simulation: Bounding behaviors of non-monotonic systems. Submitted to QP94, 1994.