ModelingDiscontinuous Behavior with Hybrid Bond …€¦ · ModelingDiscontinuous Behavior with...

9
Modeling Discontinuous Behavior with Hybrid Bond Graphs Pieter J . Mosterman Center for Intelligent Systems Vanderbilt University Nashville, Tennessee 37235 pjmOvuse .vanderbilt .edu Abstract This paper discusses a technique that com- bines bond graph energy-flow modeling and signal-flow modeling schemes for modeling dis- continuities in physical systems . This enables the generation of complex, multi-mode behav- iors without violating the energy flow princi- ples imposed by bond graphs . Mode switch- ing is achieved by controlled junctions which assume one of two states : on and off . The control function of the junctions are specified as state transition graphs or tables . The mod- eling methodology presents a common frame- work for modeling abrupt switching elements, piecewise linear components, and subsystems that undergo structural changes without hav- ing to pre-enumerate system modes . 1 Introduction Recent advances in model-based and qualitative reasoning have led to researchers developing large scale models of complex, continuous systems, such as power plants, aircraft, and space station sub- systems . Configuration and individual component de- scription changes cause multi-mode behavior in com- plex systems[4] . A primary reason for component de- scription changes is the representation of complex non linear behaviors as simpler, discontinuous, piecewise linear behaviors[l6] . Biswas and Yu[2] have discussed the effectiveness of the bond graph modeling language in defining for- mal but generic models of physical systems . These models are based on energy transfers between mecha- nisms of the system and conservation of energy within the system, but they do not gracefully accommodate mode-switching of components as part of the modeling framework. This paper extends and formalizes previ- ous work on the direct method for analyzing discontin- uous behavior by Nishida and Doshita[16], the finite state models for representing discontinuous behavior by Broenink and Wijbrans[4], and ideal switching el- ements by Strbmberg, Top, and Soderman[20, 21] by developing a signal flow model on primary bond graph models to incorporate mode-change behaviors in sys- tems . Signal flow models incorporating finite state au- Gautam Biswas Department of Computer Science Vanderbilt University Nashville, Tennessee 37235 biswas@vuse .vanderbilt .ed u tomata have been used extensively in real-time system analysis[8] . Finite state automata can also model ideal switching elements with complex sequential behavior while avoiding spurious junctions and incorrect causal relations . At the same time, the relations between bond graph mechanisms and corresponding physical components of the system are maintained . Therefore, they provide an integrated framework for hierarchical modeling and behavior analysis of complex, continu- ous systems . 2 Modeling Physical Systems The ability to dynamically construct parsimonious system models is the key to developing computation- ally efficient behavior generation methods . This re- quires model building methodologies that satisfy com- positionality, graceful extendibility, and genericity[6] . Bond graphs[18, 19] introduce the notion of generic physical mechanisms and state variables in modeling . This provides a well-defined formal vocabulary for de- scribing system components and their interactions and creates a framework for building physical models over a wide range of domains[22] . Bond graphs, as a modeling language, provide a set of highly organized domain independent structures that are based on a small number of primitive el- ements : resistances or dissipators (R), energy stor- age elements (capacitors C and inertial elements I), ideal sources of effort S e and flow S f , and trans- formational elements (transformer TF and gyrator GY)[10, 19] . These elements take on different phys- ical forms in different domains, but interactions be- tween them are expressed in a domain independent way: as energy transfers which are represented as di- rected bonds. Each bond has an associated effort and a flow variable, where effort x flow = power, the rate of energy transfer . Connections between multiple ele- ments are established by energy conserving junctions, which can be of two types: common flow (i.e ., series) or 1-junctions, and common effort (i .e ., parallel) or 0-junctions . Systematic procedures exist for building bond graph models of physical systems, deriving causal struc- ture from the model[19], and building complex system models by composition[2] . Analytic models which ex- press system behavior as a set of first order differential

Transcript of ModelingDiscontinuous Behavior with Hybrid Bond …€¦ · ModelingDiscontinuous Behavior with...

Modeling Discontinuous Behavior withHybrid Bond Graphs

Pieter J . MostermanCenter for Intelligent Systems

Vanderbilt UniversityNashville, Tennessee 37235pjmOvuse .vanderbilt .edu

Abstract

This paper discusses a technique that com-bines bond graph energy-flow modeling andsignal-flow modeling schemes for modeling dis-continuities in physical systems. This enablesthe generation of complex, multi-mode behav-iors without violating the energy flow princi-ples imposed by bond graphs . Mode switch-ing is achieved by controlled junctions whichassume one of two states : on and off. Thecontrol function of the junctions are specifiedas state transition graphs or tables . The mod-eling methodology presents a common frame-work for modeling abrupt switching elements,piecewise linear components, and subsystemsthat undergo structural changes without hav-ing to pre-enumerate system modes.

1 IntroductionRecent advances in model-based and qualitativereasoning have led to researchers developing largescale models of complex, continuous systems, suchas power plants, aircraft, and space station sub-systems . Configuration and individual component de-scription changes cause multi-mode behavior in com-plex systems[4] . A primary reason for component de-scription changes is the representation of complex nonlinear behaviors as simpler, discontinuous, piecewiselinear behaviors[l6] .Biswas and Yu[2] have discussed the effectiveness of

the bond graph modeling language in defining for-mal but generic models of physical systems. Thesemodels are based on energy transfers between mecha-nisms of the system and conservation of energy withinthe system, but they do not gracefully accommodatemode-switching of components as part of the modelingframework. This paper extends and formalizes previ-ous work on the direct method for analyzing discontin-uous behavior by Nishida and Doshita[16], the finitestate models for representing discontinuous behaviorby Broenink and Wijbrans[4], and ideal switching el-ements by Strbmberg, Top, and Soderman[20, 21] bydeveloping a signal flow model on primary bond graphmodels to incorporate mode-change behaviors in sys-tems . Signal flow models incorporating finite state au-

Gautam BiswasDepartment of Computer Science

Vanderbilt UniversityNashville, Tennessee 37235

biswas@vuse .vanderbilt .edu

tomata have been used extensively in real-time systemanalysis[8] . Finite state automata can also model idealswitching elements with complex sequential behaviorwhile avoiding spurious junctions and incorrect causalrelations. At the same time, the relations betweenbond graph mechanisms and corresponding physicalcomponents of the system are maintained . Therefore,they provide an integrated framework for hierarchicalmodeling and behavior analysis of complex, continu-ous systems.

2

Modeling Physical Systems

The ability to dynamically construct parsimonioussystem models is the key to developing computation-ally efficient behavior generation methods. This re-quires model building methodologies that satisfy com-positionality, graceful extendibility, and genericity[6] .Bond graphs[18, 19] introduce the notion of genericphysical mechanisms and state variables in modeling .This provides a well-defined formal vocabulary for de-scribing system components and their interactions andcreates a framework for building physical models overa wide range of domains[22] .Bond graphs, as a modeling language, provide a set

of highly organized domain independent structuresthat are based on a small number of primitive el-ements : resistances or dissipators (R), energy stor-age elements (capacitors C and inertial elements I),ideal sources of effort Se and flow Sf , and trans-formational elements (transformer TF and gyratorGY)[10, 19]. These elements take on different phys-ical forms in different domains, but interactions be-tween them are expressed in a domain independentway: as energy transfers which are represented as di-rected bonds. Each bond has an associated effort anda flow variable, where effort x flow = power, the rateof energy transfer. Connections between multiple ele-ments are established by energy conserving junctions,which can be of two types: common flow (i .e ., series)or 1-junctions, and common effort (i.e ., parallel) or0-junctions.Systematic procedures exist for building bond graph

models of physical systems, deriving causal struc-ture from the model[19], and building complexsystemmodels by composition[2] . Analytic models which ex-press system behavior as a set of first order differential

equations[19] form the basis for deriving a spectrumof qualitative to quantitative models from this frame-work . Compared to other qualitative reasoning ap-proaches, bond graphs use additional energy conserva-tion and continuity constraints to dramatically reducethe number of spurious behaviors generated[20, 22].Bond graphs support hierarchical model constructionschemes by allowing compilation of these models froma library of sub-systems[2] .Typically, qualitative simulation methods (e.g ., [7,

11]) impose continuity constraints to ensure mean-ingful behavior generation. Computational complex-ity in behavior generation is reduced by linearizingmodel constraints, and complex non linear behaviorof devices such as oscillators and transistors, is sim-plified and represented as multiple-piece wise linear be-haviors. In other situations, abstractions in time areemployed to simplify physical component behaviors,so components such as electric switches, hydraulicvalves, diodes, and mechanical clutches, exhibit abruptchanges in behavior . In either case, the physicalcomponents are said to operate in multiple-modes[l] .Abrupt changes in structure, such as breaks in pipesand wires, and overflow from tanks, also cause discon-tinuity in system behavior . In qualitative simulationsystems, such as QSIM[ll], a set of QDE's define thecontinuous behavior of a single mode of the system .Discontinuous changes are handled by defining mul-tiple QDE sets, and a higher level control structure(meta-model) determines when to switch QDE setsduring behavior generation .Broenink and Wijbrans[4] attribute discontinuities

in physical system behavior , to

1 . piecewise continuous characteristics, e.g ., simpli-fying the relation between current and voltageat transistor junctions to piecewise linear compo-nents,

2 . physically possible structural changes in a system,e.g ., a valve closing that isolates two connectedtanks, and

3 . physically impossible structural changes, primar-ily attributed to time-scale abstraction that makescertain changes in a system look instantaneous,e.g ., a ball hitting a wall, where the time scaleof the collision is considered to be instantaneous,and the ball seems to undergo an abrupt changein velocity .

In earlier work, Nishida and Doshita [l6] propose sim-ilar causes for discontinuous behavior : (i) discontin-uous input, (ii) mode transitions of multi-mode de-vices, and (iii) positive feedback without time delay.We contend that all discontinuities in the modelingof physical systems can be attributed to abstractingcomponent behavior to simplify the relations amongparameters (e.g ., a transistor) or to simplify the time-scale of the interactions (e .g ., the bouncing ball). Ourgoal is to derive a uniform approach to analyzing dis-continuous system behavior .

'In reality all physical systems exhibit continuousbehavior .

TW sWrrCH

Sw`

ON

OFF.==-o

Se : 0."

Sf:0f =_0

Figure 1 : The Switch

Nishida and Doshita[16] point out two properties ofdiscontinuous systems: (i) the causal structure of thesystem may change during a discontinuous change,and (ii) a number of discontinuous changes may oc-cur one after another. The change of causality, whichmay be drastic when a series of changes are involved,is easily derived once an energy-flow bond graph isestablished in the new situation[3] . However, it is of-ten not clear how to propagate a series of discontinu-ous changes. Analytic system models do not supportthis kind of information, and this becomes a source ofproblems during dynamic behavior generation . There-fore, a dedicated formalism is required to address thisissue in the bond graph framework.

3

Bond Graphs and DiscontinuousBehavior

Like qualitative simulation approaches, the bondgraph methodology is geared toward modeling andanalysis of continuous physical systems . To accom-modate abrupt switching and non linear behavior, ini-tial attempts were made to introduce switching el-ements into bond graphs in the form of modulatedtransformers (MTF)[10, 19] and non linear resistiveelements[9] . However, these methods resulted in nonintuitive causal structures and produced energy dis-sipation, therefore, could not model ideal switchingelements .More recently, Broenink and Wijbrans[4] introduced

the concept of switching bonds, which are used toconnect or disconnect sub-models based on principlesof energy transfer . The switching bond is connectedbetween two junctions and their positions are deter-mined by a systematic modeling process . A controlbox, implemented as a global finite-state automaton,connected to the switching bond determines its onand of states . The shortcomings of this methodologyare that it can cause hanging junctions, and changingboundary conditions due to switching are incorrectlyhandled.To address these problems, Stromberg, Top and

Soderman[20, 21] introduced an ideal switching el-ement into the bond graph modeling language . Agraphical description of the switch is shown in Fig. 1 .Discontinuous changes are handled by enforcing eitherzero flow (switch off) or zero effort (switch on) on ajunction . In both these modes, power = effort x flow= 0, which is the key in representing physical discon-tinuities using an ideal switching element (no energyloss)[23] . Note that the on and off modes of the switch

are degenerate forms of the effort- and flow-source el-ements of the bond graph, respectively.However, ideal switches are found to have

problems[l4] .

It is unnatural to consider switches as bond graphelements ; unlike other bond graph elements theyhave no energy-related functions,

" Switches represent transient elements ; their be-havior is based on control logic rather than phys-ical concepts .

" A related point is that they obscure hierarchicalcompositional modeling schemes, which allow asystem to be defined in terms of multiple mod-els, each model representing an individual modeof system behavior . Dynamic behavior genera-tion may involve model-switching to account forthe different behavioral modes. A number of idealswitching elements may be employed to achievemodel switching dynamically, but, in this repre-sentation, the link between bond graph elementsand parts of the physical system become obscureand non-intuitive.

Our solution to this problem is to employ a hybridrepresentation scheme that combines

1 . traditional energy-related bond graph elements tomodel the physical components of the system, and

2 . control flow models based on switching junctionswhose on-off characteristics are modeled by finitestate automata .

This work extends intuitive notions presented in [1] .

4

The Hybrid Modeling Approach

Previous work on real-time systems[24] demonstratesthat system behavior is a function of time and eventdependency, therefore, these system models must in-corporate dynamic views with different system config-urations and states . In general, a system with n suchcomponents each with k behavior modes, can assumeV overall configurations or behavior modes, however,in practical situations, only a small fraction of themodes are physically realized . In previous approaches,e.g ., [l, 4, 11], this knowledge has been exploitedto pre-enumerate global behavior modes and spec-ify transition functions between the modes as rulesor state transition tables . However, this approachwill not work for systems whose range of behaviorshave not been pre-enumerated . Recent compositionalmodeling approaches[6, 15] overcome this problem andbuild system models dynamically by composing modelfragments. Our approach adopts this methodology,and implements a dynamic but rigorous model switch-ing methodology in the bond graph modeling frame-work .Instead of identifying a global control structure and

pre-enumerating bond graph models for each of thesemodes, we translate the overall physical model to onebond graph model that covers the energy flow re-lations within the system. Next, the discontinuous

mechanisms and components in the system are iden-tified . Each discontinuous mechanism is modeled lo-cally as a controlled junction which can assume one oftwo states - on and oft . A local control mechanism,implemented as a finite state automaton and repre-sented as a state transition graph or table, is used tomodel each discontinuity. A controlled junction be-haves like an idealized switch . The input to its controlmechanism are effort values from selected 0-junctionsand flow values from selected 1-junctions and its out-put is a control signal that determines the on/off stateof the junction . The set of local control mechanismsassociated with controlled junctions constitute the sig-nal flow model of the system . The signal flow modelperforms no energy transfers, therefore, it is distinctfrom the bond graph model that deals with the dy-namic behavior of the physical system variables. In-teractions between the two models are established bytapping appropriate effort and flow energy variablesfrom bond graph junctions and generating output sig-nals that determine the on and offstates of controlledjunctions. To summarize, bond graph models dealwith energy-related behavior whereas signal flow mod-els describe the transient, i .e ., mode-switching behav-ior of the system .A mode of a system is determined by the combina-

tion of the on/off states of all the controlled junctionsin its bond graph model. Each mode defines a physi-cally valid energy model whose bond graph elementscan be mapped back to components and mechanismsof the physical system . Note that the system modesand transitions are dynamically generated, and do nothave to be pre-enumerated .

4.1

The Modeling Language

The modeling language has two components:

1 . traditional energy-related bond graphs[10, 19],and

2 . finite state automata for modeling controlled junc-tions.

Bond graphs are well-grounded in physical reality[2,19, 23] and finite state automata represent a formalmethodology for modeling time-varying discrete sys-tems . The combination of these two models whichinteract through the controlled and regular junctionsdefine overall system behavior .

4.2

Controlled Junctions

When active (on state), controlled junctions behavelike normal 0- or 1-junctions . Note that for a 0-junction the effort value associated with all connectedbonds are equal and the flow values sum to 0 . Fora 1-junction the flow values are equal and the effortvalues sum to 0 . A deactivated (oft) 0-controlled junc-tion forces the effort value at all connected bonds tobecome 0, implying that there is no energy trans-fer across this junction . Similarly, a deactivated 1-junction forces flows to become 0. In both cases, the

'Traditional bond graph junctions are always in the onstate.

Figure 2: The bi-tank system with memory

PgX1 - PgX2< - Pt

OFF

PgX1- PgX2> - PtDosed

ON

ONleft open

right open

Pgx t< PgX2PgXl>PgX2

Pgxt > PgX2

Pgx t< PI;K2OFF

OFFleft dosed

right closed

Figure 3 : CSPEC State Transition Diagram:Complex bi-tank system

controlled junction exhibits ideal switch behavior, andmodeling discontinuous behavior in this way is con-sistent with bond graph theory[18, 23] . Deactivatingcontrolled junctions can affect the behaviors at ad-joining junctions, and, therefore, the causal relationsamong system variables .Controlled junctions are marked with subscripts

(e.g ., 11, 02) and the corresponding control logic isdepicted as dark circles in the bond graph represen-tation (Fig . 4) . Their input, effort and flow energyvariables tapped from 0- and 1-junctions, respectivelyare shown as arrows . Their output, a single controlsignal (shown as a dotted line), sets the associatedcontrolled junction to on or off. The junctions definethe interactions between the energy-flow and signal-flow models of the system .The control logic for determining the on and of

state for a controlled junction is implemented as afinite state automata, and represented as a state tran-sition graph or table. The two representations arelogically equivalent . We call this control specificationfunction CSPEC18] which is actually a finite state ma-chine whose internal communication is asynchronousand overwriting. Each controlled junction has one as-sociated state transition diagram which generates anon or of signal as output . However, the state tran-sition diagram may have several internal states thatmap onto the on and of states of the controlled junc-tion .The use of controlled junctions is illustrated in the

complex bi-tank system shown in Fig. 2. To avoidunnecessary complexity, the effect of the left com-partment overflowing is not considered in the discus-sion that follows. The latch between the tanks cango either way from its initial upright position whenthe pressure differential between the tanks exceeds athreshold value pt . An open switch can close, but itdoes not open in the opposite direction . For example,if the pressure differential caused the switch to open tothe right, it remains open in that direction but closes if

Sf : 0u ---7-0

R :rl

R .

r I R :rbl ~0 --7-11~

Sf : _' 0u

Figure 4: Bond Graph Model: Complex bi-tanksystem

r

0 --;;- rb2

R :0 -rb2

Figure 5 : Bond Graph Model: Initial SystemState

the pressure differential becomes 0. If the pressure dif-ferential reverses, the latch does not open to the left .This behavior can only be modeled using sequentiallogic, because the open state of the switch determinesall future behavior . Fig. 3 illustrates the correspond-ing state-transition diagram. xl and x2 represent theheight of the liquid column in the left and right com-partments, respectively, p is the density of the fluid,and g is the gravitational constant .The bond graph model of the energy-related part

of the system is shown in Fig . 4 . cl and c2 are thecapacitances (storage capacity) of the left and righttank, respectively. The two outflow valves are mod-eled as fluid resistances, with values rbl and rb2, re-spectively. The flow source into the left compartment,Sf has a constant inflow rate u . The valve separatingthe two compartments operates in one of two modes:(i) when open, it allows resistive flow (resistance valuerl) through it, and (ii) when closed it disconnects thetwo compartments .The CSPEC representation for the valve modeled as

a controlled junction is shown in Fig. 3. If the latch isclosed, i.e ., there is no flow of liquid, the 11 junctionis deactivated, and the flow at this junction is now 0.Energy transfer across this junction becomes 0, whichimplies that the bonds incident on the junction can beeliminated in this system mode . The net result is thatthe two compartments of the tank become indepen-dent subsystems (Fig . 5) thus producing a seamlessimplementation of the mode-switching process.

4.3

Mode Switching in the Hybrid Model

Nishida and Doshita[16] discuss how a single discon-tinuous change can propagate in a system causinga complex chain of (possibly discontinuous) events .Model abstractions make it difficult to explain thesechanges in stepwise causal terms, and this prob-lem was addressed by taking the system through asequence of mythicals (i .e ., instantaneous) instantswhere a sequence of component mode changes occur(the direct method) . A system with k controlled junc-tions can theoretically assume 2k possible configura-tions, each of which can be described as a mode of thesystem .However, not all of these modes may be physically

realizable because modes

1. may not be reachable, and

2. mode may be transient.

In the hybrid modeling scheme, a non reachable modecorresponds to a set of on-off values for the controlledjunctions in the system that cannot be derived froma given initial state of the system . A mode is tran-sient when it instantaneously changes to another. Asequence of transient modes can occur during behav-ior generation, and mode switching ends when a non-transient mode is reached. In simulation, this switch-ing process happens instantaneously and so the inter-mediate modes are not considered to be real behaviorstates that the system goes through .As discussed earlier, mode switching is initiated

when the CSPEC function of a particular controlledjunction indicates a change of state for that junction .This results in a new bond graph configuration, andeffort and flow values for the bonds have to be com-puted for this configuration. This is done by invokingthe simulator, SIMUL, using an initial state definedby the energy distribution variables just before thecontrolled junction switched . The new effort and flowvalues maytrigger further switching, and, if that hap-pens, the current configuration of the system becomesa mythical state.The algorithm for mode switching through mythical

states, MMA, is based on the premise that all switch-ing is ideal and represented as signal flows. Therefore,not only is energy conserved during the switching pro-cess, but no instantaneous changes in effort and flow

3The concept of mythical time was first introduced byde Kleer and Brown[5] .

(EN ,FN )0 (E1 F 1 )

0 (E 2 ,F 2 ) "M1 M2

MNCSPEC(E1 ,F1)

CSPEC(E2 ,F2 ) CSPEC(EN-1, FN-1)

Figure 6 : A Sequence of Mythical Transitions

values can occur during changes through the myth-ical states of the system . Therefore, when multiplejunction switches are handled in sequence, the effortand flow values at each of the intermediate modes,are computed from the energy distribution values atthe start of the switching process, and not the dis-tribution values computed for the last mythical state.This computation process is illustrated in Fig. 6 . Notethat the intermediate modes, Ml, M2, etc., are myth-ical modes (depicted by open circles) that facilitatedetermination of the actual system mode, MN . Froma physical, energy-related viewpoint, the system di-rectly transitions from Mo to MN, maintaining con-tinuity and conservation of energy . Only the signal-flow model exhibits discontinuous behavior, which isattributable to the abstract concept of switching. Inreal systems, the act of switching may incorporate en-ergy loss, and this can be handled by incorporatingresistive elements in the bond graph model.The Mythical Mode Algorithm MMA is summarized

below. Ei and Fi are the set of effort and flow val-ues, and Qi and Pi are the corresponding energy val-ues (generalized displacement and momentum, respec-tively) in the system at time step i (i > 1) .

1. Calculate the energy values (Q,, Ps) and signalvalues (E� F,) for bond graph model Mo using(Qo, Po), values at the previous simulation stepas initial values .

2. Use CSPEC to infer a possible new mode given(Es, F.,)-

3. If one or more controlled junctions switch statesthen :

(a) Derive the bond graph for this configuration.(b) Assign causal strokes using the SCAP

algorithm[19] .(c) Calculate the signals (Ei, Fi) for the new

mode, Mi, based on the initial values(Qs, Ps) .

(d) Use CSPEC again to infer a possible newmode based on (Ei, Fi) for the new mode, Mi .

(e) Repeat step 3 till no more mode changes oc-cur .

4. Establish the final mode, MN, as the new systemconfiguration.

5

The Simulation SystemThe simulation algorithm has three key modules:

1 . SIMUL, the continuous system simulator,

2 . CSPEC, that determines switching of controlledjunctions, and

3 . MMA, the mythical mode algorithm .

Simulation models of two systems, (i) a latched bi-tank system (Fig. 2), and (ii) a diode-inductor circuit(Fig . 9) were developed under Microsoft Windows us-ing Visual Basic 3.0 Professional Edition[13] . The sys-tem models are incorporated as a matrix of equationswhich are derived from the bond graph model manu-ally and inverted using Mathematica. Note that thisderivation process is already fully automated in sys-tems like CAMAS[3]. Integration is implemented as azero-order approximation and careful selection of thetime step produced good results inspite of this simpli-fying approximation.

5.1

Simulating the latched bi-tankFig. 7 shows the latched bi-tank simulator window .The mode switch implementation sets the flow in thecontrolled junction to 0, which eliminates this variablefrom the set of equations in the active mode. Thesimulation uses a color code to depict the current stateof the controlled junction (green implies the switch ison and red implies that it is off) .Simulation of the system using the parameters dis-

played in Fig . 7 produces the behavior descriptionshown in Fig. 8 . At the start, the latch is closed andthere is no flow between the compartments . This rep-resents the closed state in the CSPEC (Fig . 3) . Theresulting bond graph consists of two independent con-tainers (Fig . 5) . Both of the containers are connectedto dissipating elements (valves) and the left containerhas an input flow source .

Figure 7: The Simulator Interface

When the level of fluid in the left container becomeshigh enough, the threshold pressure (pt ) is exceededand the latch opens to the right. The system movesinto its right open state and the 11 junction now be-haves as aregular 1-junction . Because of the low resis-tance connection (the parameters are defined in sucha way that the time constant (R - C = 5 x 10 -7) ofthe flow through the valve is small compared to thetime step chosen (10-4)), the levels of fluid in the twocompartments will almost instantaneously move to thesame value. Fig. 8 shows this initial exponential in-crease and sharp decrease of fluid-level of the left con-tainer as a little hub. The levels of fluid in both of thecontainers now move to an equilibrium steady-state .Being a first order system (the two energy storing el-ements are dependent), there is no overshoot at theequilibrium level and the latch does not oscillate.Next, the flow supplied by the source Sf is increased

to 10 times its initial value. The latch is already inits right-open state, therefore, the system exhibits afirst order exponential behavior towards a new equi-librium level for both containers . Then the input flowis reduced to half its current value, and the level offluid in the left compartment falls much faster thanthe right compartment because of its smaller time con-stant (10-3 for left compartment and 21 x 10-3 for theright compartment) . As soon as the pressure in theright compartment exceeds that of the left, the valvecloses in its right-closed mode, i.e ., it cannot open tothe left . The right compartment now achieves a newequilibrium level. The resulting bond graph is thatof the two independent compartments, i.e ., the initialmode of the system (Fig . 5) . When the level of fluid inthe right compartment falls below the level in the leftcompartment, the latch again opens up to the right.

Latched Bi-Tank SimulatorExit Print About

Enhanced Bond Graph ModelBand6iaab Aladsh e ~- pt 1 .20E+03

1 .00E +00 .yat

ell, 1 (15.OUE-07 3-00E-06 CLOSED

e1'e.'(3Y

;__1

rl-C'.>

LEFT OPEN RIGHT OPEN

ZOOE+03 7-00E+03el i

B-DOE-01

ILEFT CLOSED t'iCh45lE., .,'

1 &1 0 e1 C.VflrC

Engineering Drawing instructionsdT 1-00E-04 crick on the value of an element to change i.rho 1 .00E+00

To adjruo t the levels of the tardcs. lick onthe denied height.

C5ck on the souce-pipe to increase (kffmouse-button) or decrease (right mace.

effort effort button) the flow that d s*pies6.04E+03 9.91 E+03

LM

IsAbw update speed fes~

(/1 I IHiII JN'i3il';: ::flligfflillliiliili~1iliiii~lllflil(iliiliiIP AI J

now:-4302E~_ ~r. r

.fl°w:42E+00

..20" -

Fl- -Wp~ y s,

vwa~~u.A.

Figure 8 : Simulation Results : Bi-tank System

The levels of fluid in the left and right compartmentsthen achieve a new equilibrium level together .

5.2

Simulating the Diode-Inductor SystemThe diode-inductor example (Fig . 9)[12] demonstratesthe effectiveness of the hybrid modeling techniquewhen multiple controlled junctions cause the simu-lation to go through a set of mythical states dur-ing mode transition . In this circuit, a voltage sourcedrives an inductor when an ideal switch is on. Theother components, the resistor, diode, and inductorare also considered to be ideal . Turning off the switchabruptly interrupts the energy supply . Without thediode this interruption would cause a large voltagedrop over the inductor (such circuits are used to in-duce the high voltages needed to drive spark plugs ofautomobiles[11) .The bond graph model of the system is shown in

Fig . 9 . Both the switch and the diode are modeled asautomata that control the state of 1-junctions . Notethat the switch is externally controlled . The CSPECdefinitions for these controlled junctions are specifiedas follows .Junction 11 - the switch .

switch on --; junction on .switch off`' --, junction off.

Junction 12 - the diode .e4 < -Vdiode(0.7V) -;junction on.fs >_ 0 --+ junction off.

Note that the CSPEC definitions are local, there-fore, no global control structure needs to be knownbeforehand . Given an initial state, all system modesthat are reachable from this state will be generateddynamically by simulation . The four possible modesof the system are :

switch

Se - 1-7-11-

3;;, 0---

47~ I

V4,

L

6v/

SeVdiode

Figure 9 : The Diode Inductor Circuit and itsBond Graph

CSPEC and MMA are applied to effect mode switch-ing in the system . Initially the switch is open, theinductor has no stored energy, the diode is not con-ducting, and the system is in mode 00 . At time step10 the switch is closed, the system moves into the 10mode, and all effort and flow values are recalculatedfor the new configuration . No further mode transitionoccurs, and the inductor charges as shown . At timestep 100, the switch is reopened . Step 3(c) of MMArecomputes all efforts and flows for the new mode 00.The inductor has built up a flux (i.e ., energy p), there-fore, disconnecting it induces a large negative voltage(-oo in the limit) . This causes the diode to come oninstantaneously, so mode 00 becomes a mythical state,and the system switches to mode 01 where the effortand flow values are recomputed based on the initialflux of the inductor . Again the new values do notcause another mode change so SIMUL is active andFig . 10 shows that the inductor discharges through thediode . Note that the signal values computed for themythical mode are only used for switching (with noloss of energy), therefore, the infinite negative voltageis never reached . If it were, the stored energy of theinductor would be released instantaneously, producingan incorrect energy balance in the overall system .With time, the flow (current) through the inductor

decreases to zero . At time stamp 315 the current valueis _< 0 . Therefore, the current through the diode is>_ 0 (opposite sign) and this causes a final transition :the system again switches to mode 00, and since thereis no stored energy in the system, this becomes thefinal state . The spike observed in simulation is anartifact caused by the time step used for simulation .In this simulation, between the two time steps thecurrent went from a small positive to a small negativevalue before the transition took place. Thus when thesystem transitioned to the 00 state the small current inthe inductor went to 0 instantaneously, which resultedin the spike shown .

1 . 00 - switch open/diode not conducting2 . 01 - switch open/diode conducting3 . 10 - switch closed/diode not conducting4 . 11 - switch closed/diode conducting

0.040.03

f40.020.010.00-0.01

zo15

e4 10

3

00 o

Sw

6 Conclusions

30 100 150 200 230 300 350

100 130 200 250 300 350 400

eventual mode 00

10

01

00transient mode

00

Figure 10: Simulation Results: Diode Inductorwith parameter values t;� = 1OV, Rl = 33052, L =5mH.

This result conforms with the results presented in[12] with a more formal and general approach (MMA)in the framework of our hybrid modeling scheme.

This paper has discussed a comprehensive modelingmethodology for physical systems that exhibit multi-ple discontinuous behavior modes. Our primary con-tribution is the introduction of systematic and uni-form mode-switching methods into a formal compo-sitional modeling scheme based on the bond graphmethodology. The goal, to provide a modeling lan-guage that ensures the development of consistent, rig-orous and complete models, is achieved by combining:(i) the bond graph scheme to model the energy-relatedaspects of system behavior, and (ii) finite-state au-tomata to model signal-flows that cause configurationchanges in the bond graph model to produce discon-tinuous behavior . Interaction between the two com-ponents of the model are restricted to signals that acton so-called controlled junctions. These signals are anintegral part of the bond graph language .Furthermore, the MMA algorithm developed for

switching system modes through multiple switchingstates

ensures energy conservation within the system,and

" disallows instantaneous effort and flow changeswhen the system changes from one mythical modeto another .

Therefore, the signal flow model does not directlycause any energy flows or changes; it handles modechanges. Energy exchange between components in amode or between modes (only the real ones) of thesystem are handled by the energetically correct bondgraph model, thus ensuring no spurious behaviors aregenerated.The strict definition of the interaction between the

energy-flow and signal-flow components of the model-ing methodology is of paramount importance in gener-

ating valid physical models. The approach presentedsupports modeling discontinuities caused by (i) abruptswitching, such as in idealized valves and diodes, (ii)mode switching caused by parameter value changes,such as the change from laminar to turbulent flow ina pipe when the Reynolds number goes aboveathresh-old value, and (iii) configuration switching caused bychanges in sub-system models .The advantages of the described method are twofold:

1 . Focusing on the energy model instead of the exter-nal control models (as is done in QSIM and CC)allows for dynamic model composition.

2 . The inherent integrity checks enforce physicallycorrect models .

Dynamic model composition is extremely importantfor complex systems that include a large number ofdiscontinuous components . As discussed earlier, suchsystems can exhibit an exponential number of modes,therefore, pre-enumerating modes is not a feasiblemodeling approach . Moreover, a large number of thesemodes are not physically achievable, but that can-not always be determined before hand . The inher-ent integrity checks ensure the physical correctness ofa model and aid the modeler in building a correctmodel. Furthermore, the conservation and continuityconstraints help reduce the number of spurious behav-iors that are generated.As a next step, this approach needs to be applied to

comprehensive modeling and analysis within a com-positional modeling framework. Our long-term goalis to employ these methodologies in building robustmodels for automated diagnosis and design of com-plex, engineering systems.

References

[2] G. Biswas, and X. Yu, "A Formal ModelingScheme for Continuous Systems: Focus on Diag-nosis," Proc . IJCAI-9.4, Chambery, France, pp .1474-1479, August 1993 .

(4] J.F . Broenink and K.C.J . Wijbrans, "Describ-ing Discontinuities in Bond Graphs," Proc . Intl.Conf. on Bond Graph Modeling, pp . 120-125, SanDiego, CA, 1993 .

G. Biswas, S. Manganaris and X . Yu, "ExtendingComponent Connection Modeling for AnalyzingComplex Physical Systems," IEEE Expert, vol. 8,no . 1, pp . 48-57, 1993.

J.F . Broenink, Computer Aided Physical Mod-eling and Simulation : Bond-Graph Approach,Ph.D . thesis, University of Twente, Febodruk,Enschede, The Netherlands, 1990 .

J. deKleer and J.S . Brown, "A QualitativePhysics Based on Confluences", AI Journal, vol .24, pp. 7-83, 1984 .

[6] B. Falkenhainer and K . Forbus, "CompositionalModeling : Finding the right model for the job,"AI Journal, vol. 51, pp . 95-143, 1991 .

K.D . Forbus, "The Qualitative Process Engine,"in Readings in Qualitative Reasoning about Phys-ical Systems, D . Weld and J . deKleer, eds., pp .220-235, Morgan Kaufmann, San Mateo, CA,1990 .

[8] D .J . Hatley, and I.A . Pirbhai, Strategies for Real-Time System Specification, Dorset House Pub-lishing Co., New York, N.Y., 1988 .D.C . Karnopp, "General method for includingrapidly switching devices in dynamic simulationsystem models," Trans. Society for ComputerSimulation, col . 2, pp . 155-168, 1985 .

[10] D.C . Karnopp, D.L . Margolis, and R.C . Rosen-berg, Systems Dynamics : A Unified Approach,2nd edition, John Wiley, New York, 1990 .

[11] B . Kuipers, "Qualitative Simulation," ArtificialIntelligence, vol. 29, pp . 289-338, 1986 .

[12] F . Lorenz and H. Haffaf, "Combinations of Dis-continuities in Bond Graphs," Proc . ICBGM '95,vol. 27, no . 1, pp . 56-64, Society for ComputerSimulation, San Diego, CA, 1995 .

[13] Microsoft Corporation, Visual Basic, Version 3.0Professional Edition, One Microsoft Way, Red-mond, WA, 98052-6399,1993.

[14] P.J . Mosterman and G. Biswas, "Behavior Gen-eration using Model Switching: A Hybrid BondGraph Modeling Technique," Proc. ICBGM '95,vol. 27, no . 1, pp . 177-182, Society for ComputerSimulation, San Diego, CA, 1995 .

[15] P. Nayak, L . Joscowicz and S. Addanki, "Auto-mated Model Selection using Context-DependentBehaviors," Proc . AAAI-91, AAAI/MIT Press,Menlo Park, CA, pp . 710-716, 1991 .

[l6] T. Nishida, and S . Doshita, "Reasoning aboutDiscontinuous Change,", Proc . AAAI-87, pp .643-648, Seattle, WA, 1987 .

[17] E.F . Obert, Internal Combustion Engines, 2nded ., The Haddon Craftsmen, Inc., Scranton, PA,1950 .

[18] H.M . Paynter, Analysis and Design of Engineer-ing Systems, The M.I .T . Press, Cambridge, MA,1961 .

[19] R. Rosenberg, and D . Karnopp, Introduction toPhysical System Dynamics, McGraw Hill, NewYork, NY, 1983 .

[20] J .E . Stromberg, J . Top and U. S6derman, "Vari-able causality in bond graphs caused by discreteeffects," Proc . Intl. Conf. on Bond Graph Model-ing, pp . 115-119, San Diego, CA, 1993 .

[21] J.E . Stromberg, U. S6derman and J . Top, "Bondgraph supported estimation of discretely chang-ing parameters," Proc. Intl. Conf. on BondGraph Modeling, pp . 47-52, San Diego, CA, 1993 .

[22] J .L . Top, J.M. Akkermans, and P.C . Breedveld,"Qualitative reasoning about physical systems:an artificial intelligence approach," Journal oftheFranklin Institute, vol. 328, no . 5/6, pp . 1047-1065, 1991 .

[23] J .L . Top, Conceptual Modeling of Physical Sys-tems, Ph.D . thesis, University of Twente, CIP-DATA Koninklijke Bibliotheek, Den Haag, 1993 .

[24] S.M . White and J .Z . Lavi, "Embedded Com-puter System Requirements Workshop," Com-puter, April 1985 .