• No results found

Aspects on simulation of switched bond graphs

N/A
N/A
Protected

Academic year: 2021

Share "Aspects on simulation of switched bond graphs"

Copied!
6
0
0

Loading.... (view fulltext now)

Full text

(1)

Aspects on simulation of switched bond graphs

Krister Edstrom

(edstrom@isy.liu.se) Dept. of Electrical Engineering

Linkoping University S-581 83 Linkoping, Sweden

Jan-Erik Stromberg

(janerik@s3.kth.se)

Dept. of Sensors, Signals and Systems Royal Institute of Technology

S-100 44 Stockholm, Sweden

Jan Top

(j.l.top@ato.dlo.nl)

Agrotechnological Research Institute ATO-DLO, P.O. Box 17

NL-6700 AA Wageningen, The Netherlands Abstract

By mode-switching systems we mean physical systems characterized by transitions which are at least an order of magnitude faster than the overall time-scale. There are essentially two dierent ways to model such systems for simulation. One is to employ continuous models and sti solvers. This approach is becoming more feasible as more sophisticated sti solvers become available, but still suers from poor performance for larger models.

An alternative approach is to employ hybrid mod- els with instantaneous transitions between continuous mode-models. In this case solvers capable of detecting zero-crossings are required. The advantage of this ap- proach is an improved simulation performance but the disadvantage is that one has to deal with more com- plex models. To handle the model complexity matter we have previously proposed switched bond graphs as a solution. Employing switched bond graphs, the prob- lem of complex models is modied to the problem of translating the bond graph to a computational model.

This is the problem addressed here.

1 Introduction

By a mode-switching system we mean a dynamic sys- tem undergoing fast transitions between continuous modes of operation. To simulate such systems, there are essentially two fundamental approaches. One is to handle the fast transitions by means of sti solvers.

This approach is becoming more feasible as more pow- erful sti solvers are developed 8, 9, 4]. The advantage of this approach is that the modelling process is not further complicated.

The other fundamental approach is to approximate the fast transitions by ideal instantaneous mode-

transitions. By using modern solvers capable of de- termining the zero-crossing of transition conditions, such simulations have the potential of becoming highly e cient. The disadvantage though, is a more com- plex modelling process. On the other hand, once such a mode-switching model has been successfully con- structed, that same model is much more clear from a conceptual point of view than its continuous counter- part. In other words, assumptions made by the mod- eller, often left implicit, now become much more clear from the model itself.

In this paper we will brie y review the di culties as- sociated with the second approach above. We will also review some potential solutions as provided by switched bond graphs earlier presented in 18, 14, 17]. Finally, for a specic subset of switched bond graphs, we elab- orate on the automated compilation of executable code to be linked with a specic numerical solver capable of detecting zero-crossings. Hence this paper contributes to the overall goal of providing more powerful tools for the e cient modelling and simulation of physical sys- tems undergoing abrupt mode-transitions.

2 Idealisation in terms of instantaneous mode-transitions

Consider a system where fast (with respect to the over- all time-scale) transitions are approximation by means of ideal instantaneous mode-transitions. This is mod- elled by a set of continuous dynamic mode-models and a set of discrete mode-transitions. Each mode- transition is further associated with a transition condi- tion. A transition condition is a Boolean combination of relations over variables in continuous mode-models.

A transition condition species when a specic mode-

transition is to take place.

(2)

The most fundamental problem with this approach is that of complexity. The number of mode-models grows very quickly with the number of switching mechanisms in the system. Making sure that all mode-models have been covered, quickly becomes an overwhelming prob- lem. Not the least, we also have the non-trivial prob- lem on how to correctly specify the mode-transitions to ensure proper switching behaviour over all input tra- jectories. Furthermore, once a model has proved to be correct, the same problem occurs when the physical system itself or the model requirements changes.

Following the traditions of bond graphs 12, 11], we have proposed an approach 18, 13, 16, 20] to handle these problems by making a clear distinction between 'low-level' computational matters and 'high-level' phys- ical concepts. In this view, mode-models and mode- transitions are considered as low-level computational details. By introducing proper high-level physical con- cepts, we hope to reduce the complexity of the mod- elling process. In other words, we aim at reducing the complexity as seen by the modeller, while maintain- ing the computational complexity, as dealt with by the numerical solver.

Adopting this approach, the original problem of the modelling process is shifted to that of properly trans- lating a conceptual model into a computational one.

Preliminary results obtained using switched bond graphs 20, 16, 13], and similar approaches using, e.g. , object-oriented modelling 7, 5, 1, 19, 2, 6], indicate that this process can be automated in many cases of practical interest.

3 Switched bond graphs

The conceptual modelling language proposed for mode- switching physical systems is referred to as switched bond graphs. One reason for the name is that the lan- guage heavily relies on the theory of 'classical' bond graphs as developed by numerous researchers 3] since their introduction in 1958 by H.M. Paynter. In a sense, switched bond graphs can be seen as an extension of classical bond graphs. For instance, switched bond graphs only add one more physical concept to the clas- sical list of nine elements, namely the primitive ideal switch concept, denoted Sw .

On the other hand, the role of causality plays a sig- nicantly dierent role in switched bond graphs. For instance, while causality is a xed property in classi- cal bond graphs, it is a time-varying property in the switched counterpart. In addition, the notion of a con- stitutive relation associated with each primitive physi- cal element, is extended by the notion of a switch con- trol structure associated with the primitive switch con- cept. Both these important aspects of switched bond

^

 =

E

]

!

^

 =

F

]

!

Sw : 

Se : 0

Sf : 0

f e

e = 0 f

f = 0 e

Figure 1: Denition of the Sw -element.

graphs are clear from the following denition of the primitive ideal switch concept.

Denition 1 The (primitive) switch element is a bond graph element, i.e. a node in the graph, dened by Fig. 1, where

2fE



Fg

is a Boolean state vari- able and  an arbitrary label both associated with the switch. State =

F

( =

E

) is referred to as the ow (e ort) state.

The state of the Sw -element is governed by a switch control structure (SCS) associated with each

Sw -element. The SCS is, in its simplest case, a state- transition system with two states only. This particular instance of SCS is referred to as a switch transition system (STS).

As for all other primitive elements of the bond graph language, the switch element is used in combination with the other elements to form models of mechanisms found in physical systems. For instance, to model the electrical mechanism illustrated in Fig. 2, we employ rules from classical bond graph theory to end up with

+ U

- C

Sw

1

R

1

Sw

2

R

2

e + -

1

e +

2

-

u

1

u

2

Figure 2: A simple electric mechanism.

the switched bond graph in Fig. 3. Switch Sw

1

is dier-

ent from Sw

2

in the sense that it is not only controlled

by the external signal u

1

, but also by e

1

, as will be

claried later.

(3)

0 1

1

u

2

Se

C

R

1

Sw

1

R

2

u

1

e

1

f

1

Sw

2

f

2

e

2

Figure 3: The switched bond graph for the electric mech- anism above.

To simulate a system by means of a switched bond graph we will have to translate it to a form accept- able for a numerical solver. Once again, following the traditions of classical bond graphs, this translation is divided into two steps. First the bond graph is trans- lated to a solver-independent mathematical represen- tation, and secondly, this intermediate representation is translated into solver-specic executable code. For strictly continuous systems and classical bond graphs, the intermediate form is a dierential (and algebraic) equation (DAE) system.

In the classical bond graph literature, the DAE form it- self as well as the process of automatically deriving the DAE from a bond graph, are both thoroughly stud- ied 21]. However, for switched bond graphs there is neither a corresponding form, which is generally ac- cepted, nor a good understanding of the automated derivation of such a form. In what follows we will therefore present an intermediate form and also look into some aspects of the derivation of the same from switched bond graphs. The nal step to produce the executable solver-specic code, will then be fairly straightforward, provided the intermediate form is cho- sen carefully enough.

4 Mode transition systems

It is clear that the intermediate solver-independent structure, underlying a switched bond graph, must be a hybrid system in the sense that it combines contin- uous dynamics with discrete mode-transitions. More precisely, the formal structure proposed here, consists of the following sets of objects:

 L

is a non-empty set of mode labels



Z is a non-empty set of real-valued model vari- ables (power and energy variables)



U



Z is a non-empty set of real valued (inde- pendent) input variables

 M

is a (possibly empty) set of continuous mode- models over the variables in Z , such that vari- ables in U appear only as independent variables

 G

is a non-empty set of binary decisions over the variables in Z

 A

is a (possibly empty) set of initialisation rules of the form x :=  ( z

1

z

2

::: ) where x

2

Z

;

U z

i2

Z and  :

Rn !R

is any (static) map.

From these sets we then form a composite hybrid model structure

Q =

hL

ZU

M



G



Ai

The hybrid model structure can be viewed as a 'library' containing the necessary components for describing the hybrid system. In order to describe an instance of a hybrid system we need to combine the el- ements in the 'library' in a suitable manner. This leads us to the denition of a mode transition system (MTS).

Denition 2 Let Q be a properly dened hybrid model structure. Then a mode transition system (MTS) is a three-tuple

h

MTQ

i

where M is a non-empty set of modes m and T a non-empty set of transitions  . A mode m is a pair ( l ) where l is a discrete state, i.e., an assignment of the state variables in

L

and 

2M

is a continuous mode-model.

A transition  is a three-tuple

h

ega

i

where e

2

M



M is an ordered pair ( mm

0

) of modes mm

0 2

M , g

2

G

is a Boolean transition condition and a

2 A

is an initialisation rule.

In addition we require that there is only one transition

 for each distinct pair ( mm

0

) of modes and that there are no self-loops, i.e., reexive transitions of the type

h

( mm ) ga

i

.

The MTS is hence the intermediate solver-independent form proposed for mode-switching physical systems. In order to discuss the translation of a switched bond graph to an MTS we now need a formal specication of individual switches. To simplify and clarify the transla- tion problem, we will restrict ourself to switched bond graphs with only one-port switches that have 'simple' transition conditions of a particular kind. This partic- ular sub-class of switches are called primitive switches.

We will also restrict ourselves to a procedure where no

simplication of the generated MTS is done. Our last

(4)

assumption is that there does not exist any causal con- icts in any mode. This is the most restrictive assump- tion since it is very common to have causal con icts in some modes, and it is made to avoid a too detailed discussion.

For the specication of individual primitive switches, from which the composed MTS is to be derived, we now formalise the concept of a primitive switch transition system.

Denition 3 A primitive switch transition sys- tem (PSTS) is a three-tuple

h

MTQ

i

where



Q is a hybrid model structure

hL

ZU

M



Gi

where

{

L

=

f

l

E

 l

Fg

{ U is a set of external real-valued (indepen- dent) input variables

{ Z =

f

e f

g

U , where the variables e and f are the port variables of the primitive switch itself

{

M

=

ff

e := 0

g



f

f := 0

gg

{

G

=

f

g

EF

( z )  g

FE

( z

0

)

g

, where

z = ( z

1

:::z

k

)

T

and z

0

= ( z

10

:::z

k00

)

T

are vectors composed by the variables z

1

:::z

k

z

10

:::z

k00 2

Z



M =

f

m

E

m

Fg

where

m

E

= ( l

E



f

e := 0

g

) m

F

= ( l

F



f

f := 0

g

)



T =

f



EF



FEg

where



EF

=

h

( m

E

m

F

) g

EF

( z )

i



EF

=

h

( m

F

m

E

) g

FE

( z

0

)

i

Note that the PSTS is in fact an MTS, and further- more, the most simple MTS (with more than one mode) which one can derive from a switched bond graph.

To exemplify the PSTS, reconsider the example pre- sented in Fig. 2 and Fig. 3. Let the transition condi- tions for Sw

1

be

f

g

EF

= u

1

> 0  g

FE

= e

1

< 0

^

u

1

<

0

g

and for Sw

2 f

g

EF

= u

2

> 0  g

FE

= u

2

< 0

g

, where

u

1

and u

2

are external control variables. The PSTS for

Sw

1

is hence a three-tuple

h

M

1

T

1

Q

1i

where



Q

1

is a hybrid model structure

hL

1

Z

1

U

1



M1



G1i

where

{

L1

=

f

l

E

 l

Fg

{ U

1

= u

1

{ Z

1

=

f

e

1

 f

1

 u

1g

{

M1

=

ff

e

1

:= 0

g



f

f

1

:= 0

gg

{

G1

=

f

g

EF

= u

1

> 0 

g

FE

= e

1

< 0

^

u

1

< 0

g



M

1

=

f

m

E

m

Fg

where

m

E

= ( l

E



f

e

1

:= 0

g

) m

F

= ( l

F



f

f

1

:= 0

g

)



T

1

=

f



EF



FEg

where



EF

=

h

( m

E

m

F

) g

EF

( e

1

f

1

u

1

)

i



EF

=

h

( m

F

m

E

) g

FE

( e

1

f

1

u

1

)

i

The PSTS of Sw

2

will essentially be the same as the PSTS for Sw

1

. Simply remove the condition e

1

< 0 and change the indices from 1 to 2.

5 Composition of MTS

The interesting problem is how to compose an MTS from individual STS's in such a way that the semantics of the switched bond graph is preserved. The problem is interesting partly because there is no single answer to the question. One of the rst questions needed to be answered is whether two or more switch elements are allowed (or are able) to switch at the same time. As for every model, the answer to such a question depends on the purpose of the model, as well as on assumptions made by the modeller. The answer also depends on whether memory or computational speed is important.

The important thing is that the assumptions about the simultaneous switching is not encoded in the switched bond graph itself. Following the traditions of classi- cal bond graphs, this type of 'computational' issue has been postponed to the composition phase of the mod- elling process. Therefore we need to provide two dif- ferent composition operators depending on the prefer- ences of the modeller. Here we will only present one of these two operators, namely the interleaved compo- sition operator. The operator corresponds to the case in which only one switch is allowed to switch at a time.

This will increase the execution time, but decrease the size of the generated code for the model. The motiva- tion for this operator, the problems associated with it as well as the alternative composition operator can be found in 16, 13].

Denition 4 Let S

1

=

h

M

1

T

1

Q

1i

and S

2

=

h

M

2

T

2

Q

2i

be two MTS. The interleaved compo-

sition between the two systems S

1

and S

2

, denoted

S

1j

i

j

S

2

, is an MTS, S =

h

MTQ

i

where:

(5)



Q is a hybrid model structure

hL

ZU

M



Gi

where

{

L

=

L1L2

{ Z = Z

1

Z

2

{ U = U

1

U

2

{

M

=

f



12j



12

= 

1



2





12M1

and 

22M2g

{

G

=

G1G2



M =

f

m

12j

m

12

= (( l

1

l

2

) 

1



2

)  ( l

1



1

)

2

M

1

and ( l

2



2

)

2

M

2g



T = T

10

T `

2

where

h

(( l

1

l

2

) 

1



2

)  (( l

01

l

2

) 

01



2

) g

1i2

T

10

i

h

( l

1



1

)  ( l

01



01

) g

1i2

T

1

and ( l

2



2

)

2

M

2

h

(( l

1

l

2

) 

1



2

)  (( l

1

l

02

) 

1



02

) g

2i2

T

20

i

h

( l

2



2

)  ( l

02



02

) g

2i2

T

2

and ( l

1



1

)

2

M

1

Since the PSTS is a special case of MTS, the composi- tion operator dened holds for PSTS as well. From the construction of the interleaved composition operator it also follows that the composition of two arbitrary MTS becomes an MTS.

6 Simulation of switched bond graphs

Once the overall MTS for a given switched bond graph has been generated, the generation of executable solver- specic code is fairly straightforward. Typically the input to a solver, capable of detecting zero-crossings, is a set of equations dening the continuous dynamics in a given mode, and a set of equations dening the Boolean condition for exiting the given mode. These two data structures can now be directly derived from the MTS.

From a practical point of view, however, this approach may be problematic due to the exponential growth in complexity. Therefore the practical solution must typ- ically be a modication of the ideal approach outlined above. Nevertheless, the MTS still plays an important role in theoretical studies and formal analysis of hybrid systems 10, 15].

Returning to our example circuit in Fig. 2 and employ- ing the strategy outlined above, we end up in the MTS S =

h

MTQ

i

, where



Q is the hybrid model structure

hL

ZU

M



Gi

where

{

L

=

f

l

EE

 l

EF

 l

FE

 l

FFg

{ U =

f

u

1

u

2g

{ Z =

f

e

1

 f

1

 u

1

e

2

 f

2

 u

2g

{

M

=

ff

e

1

:= 0 e

2

:= 0

g



f

e

1

:= 0 f

2

:= 0

g



f

f

1

:= 0 e

2

:= 0

g



f

f

1

:= 0 f

2

:= 0

gg

{

G

=

f

g

EEjEF

= u

2

> 0  g

EEjFE

= u

1

> 0  g

EFjEE

= u

2

< 0  g

EFjFF

= u

1

> 0  g

FEjFF

= u

2

> 0 

g

FEjEE

= e < 0

^

u

1

< 0  g

FFjFE

= u

2

< 0 

g

FFjEF

= e < 0

^

u

1

< 0

g



M =

f

m

E

m

Fg

where

m

EE

= ( l

EE



f

e

1

:= 0 e

2

:= 0

g

) m

EF

= ( l

EF



f

e

1

:= 0 f

2

:= 0

g

) m

FE

= ( l

FE



f

f

1

:= 0 e

2

:= 0

g

) m

FF

= ( l

FF



f

f

1

:= 0 f

2

:= 0

g

)



T =

f



EF



FEg

where



EEjEF

=

h

( m

EE

m

EF

) g

EEjEFi



EEjFE

=

h

( m

EE

m

FE

) g

EEjFEi



EFjEE

=

h

( m

EF

m

EE

) g

EFjEEi



EFjFF

=

h

( m

EF

m

FF

) g

EFjFFi



FEjFF

=

h

( m

FE

m

FF

) g

FEjFFi



FEjEE

=

h

( m

FE

m

EE

) g

FEjEEi



FFjFE

=

h

( m

FF

m

FE

) g

FFjFEi



FFjEF

=

h

( m

FF

m

EF

) g

FFjEFi

Note that this MTS does not contain any explicit refer- ence to mode-models. Rather the reference is implicit in the

L

and

M

structures. To derive the mode-models we simply substitute the Sw -elements by appropriate zero-sources see Fig. 4.

0 1 1

Se

C

R

1

R

2

Se

C

R

1

R

2

Sf

0

Figure 4: Simplied mode-models,

i.e.

, classical bond graphs. Left: mode m

EE

. Right: mode m

EF

.

7 Summary

We have outlined two fundamentally dierent ap-

proaches to model and simulate mode-switching phys-

ical systems. Adopting the approach of idealising fast

(6)

transitions by instantaneous mode-transitions, we pro- vide a conceptual modelling language for handling the complexity. The switched bond graph language pre- sented is an extension to classical bond graph theory.

Therefore the language inherits a solid basis of theory and practical modelling experience.

In the paper we present the proposed formal frame- work to represent the hybrid system underlying a switched bond graph. This system plays the same solver-independent role as the DAE system of contin- uous systems. We also present the algorithmic deriva- tion of the proposed mode transition system from a switched bond graph. Finally we discuss some practi- cal matters concerning the generation and execution of solver-specic code.

References

1] M. Andersson. Object-Oriented Modeling and Simulation of Hybrid Systems. PhD thesis, Lund In- stitute of Technology, 1995.

2] G.M. Asher and V. Eslamdoost. A novel causal- ity changing method for the bond graph modelling of variable topology electronic switching systems. In Proc.

of IMACS Symposium, pages 371{376, Lille, 1991.

3] P.C. Breedveld, R.C. Rosenberg, and T. Zhou.

Bibliography of bond graph theory and application. J.

of the Franklin Institute, 5/6(328):1067{1109, 1991.

4] K.E. Brenan, S.L. Campbell, and L.R. Pet- zold. Numerical Solution of Initial-Value Problems in Di erential-Algebraic Equations. North-Holland, 1989.

5] F.E. Cellier, M. Otter, and H. Elmqvist. Bond graph modeling of variable structure systems. In Sec- ond International Conference on Bond Graph Modeling and Simulation (ICBGM'95), New Orleans, LA, 1995.

6] G. Dauphin-Tanguy, C. Sueur, and C. Rombaut.

Bond-graph approach of commutating phenomena. In Proc. of Advanced Info. Processing in Automatic Con- trol, pages 339{343, Nancy, 1989. IFAC.

7] H. Elmqvist, F.E. Cellier, and M. Otter. Object- oriented modelling of hybrid systems. In the European Simulation Symp (ESS '93), Delft, 1993.

8] E. Hairer, S.P. Nrsett, and G. Wanner. Solv- ing Ordinary Di erential Equations I. Springer-Verlag, 1987.

9] E. Hairer and G. Wanner. Solving Ordinary Dif- ferential Equations II. Springer-Verlag, 1991.

10] T. Henzinger et al., editors. Proc. of the DIMACS International Workshop on Verication and Control of Hybrid Systems. Springer Verlag, 1996.

11] D.C. Karnopp, R.C. Rosenberg, and D. Margolis.

System dynamics - A unied approach (2nd edition).

John Wiley &Sons, New York, 1990.

12] H.M. Paynter. Analysis and design of engineering systems. MIT Press, Cambridge, M.A., 1961.

13] U. S!oderman. Conceptual modelling of mode switching physical systems. PhD thesis, Link!oping Uni- versity, Link!oping, 1995. Dissertation no. 375.

14] U. S!oderman, J.L. Top, and J.E. Str!omberg. The conceptual side of mode switching. In Proc. of the IEEE Int. Conf. on Systems, Man and Cybernetics, volume 1, pages 245{250, Le Touquet, 1993. SMC.

15] J-E. Str!omberg, S. Nadjm-Tehrani, and J.L. Top.

Switched Bond Graphs as Front-end to Formal Veri- cation of Hybrid Systems. In Henzinger et al. 10].

16] J.E. Str!omberg. A mode switching modelling phi- losophy. PhD thesis, Link!oping University, Link!oping, 1994. Dissertation no. 353.

17] J.E. Str!omberg, J.L. Top, and U. S!oderman.

Modelling mode switching dynamic systems. In Proc.

Second European Control Conference (ECC '93), vol- ume 2, pages 848{853, 1993.

18] J.E. Str!omberg, J.L. Top, and U. S!oderman.

Variable causality in bond graphs caused by discrete eects. In Proc. First Int. Conf. on Bond Graph Model- ing (ICBGM '93), number 2 in SCS Simulation Series, volume 25, pages 115{119, San Diego, 1993.

19] J.H. Taylor and D. Kebede. Modeling and sim- ulation of hybrid systems in matlab. In Proc. of IFAC'96, pages 275{280. IFAC, 1996.

20] J.L. Top. Conceptual modelling of physical sys- tems. PhD thesis, University of Twente, Enschede.

21] J. van Dijk. On the role of bond graph causality in

modelling mechatronic systems. PhD thesis, University

of Twente, Enschede, 1994.

References

Related documents

Stability results for limit cycles with a first- order sliding mode as well as fast switchings close to a second-order sliding mode were de- rived in Johansson et al.. (

In this thesis we explore to what extent deep neural networks DNNs, trained end-to-end, can be used to perform natural language processing tasks for code-switched colloquial

Se detta gärna som en remix, det kanske inte är mycket nytt, men jag tar teorier från olika håll för att skapa en arbetsmetod som förhoppningsvis kan leda till något

When simulating hybrid systems using switched bond graphs, the initialization of new modes is made by using a generalization of the principle of momentum conservation.. This

EFEEE. The initialization rule for this mode will give a value of the relative velocity of the masses that contradicts the constitutive relation of the switch. Hence the mode is

In addition, a switched bond graph implicitly repre- sents the mode transitions and the conditions for switching between modes.. To derive a mode-specic bond graph for a partic-

Eftersom jag inte lyckades producera något jag blev nöjd med bestämde jag mig för att övergå till Sibelius 7.5 för själva kompositionsprocessen, och sedan göra den

The groups that may find research of mental models in co-design beneficial are: Researchers (the results of research may inspire them and may support past