<<

Closed Form Solutions of Hybrid Systems

Martin v Mohrenschildt

Department of Computing and Software

FacultyofEngineering

McMaster University

Hamilton Ontario Canada LS K

email mohrensmcmasterca

March

In this pap er we present a new symbolic approachtohybrid systems Hybrid systems are systems con

taining b oth continuous and discrete changing quantities We mo del hybrid systems using hybrid automata

Hybrid automata extend the classical notion of nite state machines bycombining dierential to

mo del the dynamic b ehavior of systems with a nite control In contrast to other approaches we consider a

hybrid automata as a generalization of dierential equations and develop the notion of a symb olic closed

form solution of a hybrid automata A closed form solution is an which gives the value of the

quantities in question as a function of design parameters and time These solutions allow us to p erform the

verication of design prop erties We were able to detect design constrains on control systems that other

metho ds fail to detect This pap er gives the basic denitions algorithms and an example to demonstrate

the advantage of the prop osed approach

Intro duction

Many engineered systems contain both traditional analog comp onents and mo dern digital nite state

comp onents Such mixed continuousdiscrete systems are often called Hybrid Systems It is of high interest

to develop precise mo dels for hybrid systems in order to develop and verify control software hardware for

systems suchasnuclear reactors patrol chemical plants or car engines

In general we observetwo approaches to hybrid systems discretisation and continuation the systems

are transformed either to a pure discrete or to a pure continuous system There are few exceptions to this

classication eg

The discrete approach describ es the system in terms of a nite set of states assignments of values to

the state variables The hybrid system is transformed into a discrete system by partitioning the continuous

state space into modes The mo de changes of a hybrid system are commonly triggered by some external

events or by conditions on the state The theory of Hybrid Automata follows this discrete

metho dology Most analytical approaches approaches based on logic do not actually study the dierential

equations which describ e the continuous state changes but restrict themselves to a sp ecic easily solved class



of equations most of the time equations of the form y c In discretisation approaches muchof the

dynamic b ehavior of the system is lost For example valves do not close instantaneously even though many

discrete mo dels assume so Furthermore by using discrete mo deling techniques some design constraints are

lost in the pro cess of mo deling For the well known water level control discrete mo dels failed to detect the

valve closing sp eed constraints whichwere easily detected using my prop osed approach eg

On the other hand the continuation approach often found in control theory transforms the discrete state

changes into continuous ones by using approximation techniques or transformations The result is

a set of nonlinear dierential equations mo deling the hybrid system These dierential equations are then

solved using sophisticated mathematical metho ds such as dierential inclusions As many of the real

control functions are implemented on digital machines they contain discrete state changes the continuous mo dels do not mo del the real system

In this pap er we presentasymb olic algebraic approachtohybrid systems which can b e seen as a mixture

of the twoabove describ ed metho ds

Wedevelop ed a metho d to dene and compute closed form expressions called solutions of a hybrid system

A solution of a hybrid system is dened as a closed form algebraic expression which when evaluated

interpreted as a function determines the value of each of the state variables as the system evolves in time

This is accomplished by symb olically solving all dierential equations and then by deriving a recurrence

relation which when solved gives the initial conditions for each mo de the system is in as time passes

Tobe able to representthese piecewise and p erio dic functions as algebraic expressions wehave to extend

basic algebraic structures to contain elements representing discrete switches and p erio dic functions

The solutions of hybrid systems will often contain design parameters parameters that can be chosen in

order to optimize the b ehavior of the system by minimizing or maximizing some costfunction as in control

theory The solutions being symb olic expressions allow us to verify design constraints and to optimize

design parameters Further in contrast to numerical solutions the symb olic solutions are exact they do not

contain any rounding errors rounding errors could trigger an unwanted discrete state change The prop osed

approach diers form the logic based approachwhich normally use xp oint computation in order to derive

formulas which hold in each state the system is in Our approach allows to verify systems which do not

convert xp oint computation metho ds cannot b e applied to such systems

This pap er gives an intro duction the basic denitions algorithms and demonstrate the power of our

metho ds with an example a water level control system It is not in the scop e of this pap er to give all

technical details such as decidability and stabilityofhybrid systems

Dierential Equations with Piecewise Continuous Co ecients

Normally the denition of a solution of a dierential assumes that all co ecients of the dierential

equation are continuous But as we mo del real systems esp ecially engineering systems containing a discrete

control the dierential equation mo deling the b ehavior of the system can change in a discrete manner These

discrete changes can in general b e triggered not only by conditions on time MohMoh but also by

conditions on the solution itself The solutions of classical ordinary dierential equations are localmeaning

that the behavior of the system is dened by the shap e of the vector eld at the point of interest Real

systems can have a nite memory the vector eld given by the co ecients of the equations can change

based on a nite number of events of the past eg hysteresis We could even stop the system in any state

p ointoftime and then continue with some variables initial states changes in a discrete manner Even

the order of some dierential equations could change as in the example given later in the pap er Hybrid

systems can p erform actions expressed in terms of dierential equations New initial conditions can b e given

triggered by some conditions on the state of the system

The ab ove shows that in order to mo del hybrid systems we have to extend the notion of dierential

 

equations to hybrid dierential equations For example y sig numy y y describ es a system

 

an oscillator where the co ecientofy dep ends on the p osition of the system or y H y x where H x

is a hysteresis function

Dening and computing the solution of hybrid dierential equation is much more dicult than that of a

continuous dierential equations The variety of p ossible b ehaviors is much larger The classical uniqueness

theorems for initial value problems which requiter Lipschitz continuityof the equations Hybrid systems

are not Lipschitz continuous

We approachhybrid dierential equations by transforming them into semantically equivalenthaving the

same solution hybrid automata Ahybrid automata splits the system into mo des where in each mo de the

dierential equation is continuous and all discrete state changes are p erformed as the mo de is changed

Hybrid Automata

We study systems containing several continuous variables changing continuously or discrete in time A

state of a system is given as each of the variables has a sp ecic value Clearly if we consider time as an

integral comp onent of our systems the system will never b e two times in the same state The values of the

variables of the systems can either change continuously in time or instantly discrete to new values The

continuous changes of the variables are describ ed by dierential equations the discontinuous changes are

describ ed by assignments We mo del such systems using hybrid automata which are automata consisting

of a nite set of mo des and a nite set of transitions Eachmodecontains a system of dierential equations

The transitions b etween the mo des are guarded with conditions and can contain assignments actions

Formal a hybrid automata is given by

A nite set of variables V fy g All variables dep end on time Wewritey t to denote the value

i i

of a variable y a time p oint t

i

A nite set of mo des S fs g i n The mo de s contains the system of m autonomous

i i



dierential equations y f y t j m Without loss of generalitywe assume that these are

ij l

l

coupled rstorder systems are always derivatives bythetime t

Asetoftransitions T The transition t leads from mo de s to mo de s A transition t is a pair

ij i j ij

c a of

ij ij

Condition c c a b o olean expression which can contain predicates on the solution of the

ij ij

dierential y equation or in general any other discrete or analog variables

i

Actions a An action a is an assignmentto variables of V Actions are used to trigger

ij ij

events or to give new initial conditions to the dierential equations of the next mo de

The unique initial transition t truea with an identical true condition and the action a

i i i

which initializes all variables of V

Often a graphical representation of hybrid systems is given

y:=2,y’:=2

y<0

y’’=- y y’’=y

y>=0

Figure Sample system

The here dened hybrid automata are a variation of those found in literature Henzinger Alur the main

dierences can b e observed in the denition of the semantics

Semantics of a Hybrid Automata

Weintro duce some further conventions and notation

If a mo de do es not contain a dierential equation in the variable y then we assume that this variable

i



is meaning that the mo de implicitly contains the equation y

i

Denition Welldened A hybrid automata is wel ldenedif

Deterministic In any mode s only one of the conditions c can be true at any instance of time

i ij

No zero time If a condition c it true at time point t and action a is taken then there is no

ij k ij

transition condition c true at time point t This means that we cannot pass through a mode Else

jl k

we could dene an automaton which would never stay in any mode and never proceed in time

Unique transition There exists at most one unique transition t leading from mode s to mode s

ij i j



Although we sometimes use higher order equations for convenience the formal denition is based on rstorder systems

Nowwe are ready to give the semantics of a hybrid automata In order to dene unique solutions of a

hybrid automata wegive a deterministic semantics Our semantics can b e called an earliest time semantics

that is the automaton changes mo de at the earliest p ossible point of time Other semantics found in

literature eg Henzinger Alur allow mo de changes at any point of time a transition condition is true

leading to a nondeterministic b ehavior We see the p ossibility to generalize our approach in future work

using intervals as solutions meaning that each p ossible solution will enclosed by a with functions b ounded

interval

With t we denote the time p oint where the automata switchesmodethe ith time

i

Semantics of a welldened hybrid automata

The automata starts with the initial transition where all variables are assigned a sp ecic value The

time starts at zero t

When entering the mo de s at time p oint t we start the dynamic system dened by the dierential

i k

equations in this mo de s The initial conditions are given bythevalue of the variables at time p oint

i

t As so on as a condition c b ecomes true

k ij

t min c t dtrue

k ij k

d

the automata changes mo de to s p erforming action a Since the automata is nozerotime the

j ij

system will stay for some time in mo de s

i

From now on we restrict our examination to hybrid automata where no variable can be changed by

external events All changes of variables are p erformed by the hybrid automata itself Such automata are

called closed hybrid automata This implies that we mo del the entire system of interest

Hybrid Dierential Equations and Hybrid Automata Traces Uniqueness

As stated our aim is to develop a theory of solutions of hybrid automata which is similar to the solutions

dened for dierential equations

Following the idea of a solution to an initial value problem for dierential equation wesay that ahybrid

automata with initial transition t denes a vector valued function f of time t

i

f tf tf t f t

y y y

  n

Denition TransitionTrace Trace A transitiontrace T ofahybrid automata is the nite or

which the hybrid automata performs as time passes The trace of a innite sequenceoftransitions t

i i

k k 

in which the hybrid automata is in system corresponding to a transitiontraceis the sequenceof modes s

i

k

as time passes

We dene the run corresp onding to a trace of a hybrid automata whichgives the values of all variables

as time passes

Denition Run The run R corresponding to the trace T s s s of a hybrid automata is

i i i

  

a sequence of pairs t f where t is the time point at which the automata switches from mode s to

k k k i

k

mode s and f is a vector valued function giving values for al l variables and satisfying the dierential

i k

k 

equations in mode s with initial values y t f t f t is the initial condition of mode s given

i k k k

k 

by the initial transition t

Nowwe are able to state a theorem which holds only for closed welldened hybrid automata

Theorem Unique Trace Run The trace and run of a closed wel l dened closed hybrid automata

is unique



We assume that this mo de switch happ ens instantly Ahybrid automata where these transitions take time can always b e

obtained by adding extra mo des mo deling the time a transition would take to p erform

Pro of Wepoint to the uniqueness results of initial value problems of dierential equations The system

enters mo de s form some mo de s using a transition t and p erforming the actions ak i The values of

i k ki

all variables givea unique set of initial conditions for the dierential equations in mo de s These initial

i

conditions dene a unique b ehavior of the dierential equations in this mo de The hybrid automata is well

dened the nozerotime condition guarantees that there is no transition condition is true as we enter

the mo de Hence there will b e a unique transition condition of a transition t leading to mo de s that is

ij j

the rst to be true This leads again to unique initial conditions of the dierential equations in the next

and the times t where the automaton switches mo de are unique mo de Hence the sequence of mo des s

j i

j

to a sp ecic initial transition

Note that dierent initial transitions can change the b ehavior of a hybrid automata signicantly This is

also true for unstable dierential equations

Behaviors of solutions of hybrid automata

Converging Solutions The trace is nite This means that the automata enters a mo de s at time

i

point t where c tfalse for all tt

k i k

j

s s s

i i i

  n

Perio dic Solutions The trace is innite but p erio dic

s s s s s s s s

i i i i i i i i

 

k k  k  k p k  k 

Chaotic Solutions The trace is innite and not p erio dic

Note that a p erio dic trace do es not imply that the values of the variables are p erio dic only that after

a nite sequence of mo des we cycle through a sequence of mo des We will represent the rst twotyp es of

behaviors as closed form expressions

Transformations of Hybrid Automata

We present a transformation of hybrid automata whichwe will use later to simplify our algorithms

Denition Equivalence Two hybrid automata H and H areequivalent if the functions f denedby

H and f denedbyH are the same for each possible action in the initial transition t

i

Theorem Single condition action entrance Given a hybrid automata H wecan construct a hy

brid automata H wherealltransitions leading to any mode s t have the same condition and same action

i ji

j k t t T c c a a

ji ki ji ki ji ki

and H and H areequivalent

Pro of Let s b e a mo de with two transitions t t with dierent conditions or dierent actions leading to

i ji ki

it We add a new mo de s The transition t is changed to the transition t t is deleted and for each

ji ji

i

ji

transition t we add a new transition t with identical condition c c and identical action a a

ik ik ik

i i i

k k k

Clearly mo de s will have additional new transitions leading to it but their conditions and actions are

k

identical We continue until all mo des have only transitions with identical conditions and actions The

pro cess will terminate since we will not add any new problem transitions and the numb er of transitions is

nite

Transforming a hybrid system will reduce the numb er of p ossible initial conditions in eachmode

Closed Form Solutions Verication

Our goal is to compute an expression which will represent the b ehavior of a hybrid automata as a function of

time In contrast to other approaches for the verication of hybrid automata we dene and compute closed

form solutions of hybrid automata meaning we nd closed form expression which computes the value of all

variables of the hybrid system dep ending on time As design parameters are symb olic constants weareable

to detect compute constrains on the design parameters in order to satisfy constrains put on the hybrid

system Clearly due to indecidability results of hybrid automata we are not able to compute closed form

expression for eachhybrid automata

f be a n Denition Closed Form Solution Given a hybrid automata H with n variables Let

dimensional vector valued function dened by this automata An expression s with st f t is cal led

a close form solution of this hybrid automata

Expressions

In order to represent closed form solutions of hybrid automata wehave to enlarge the classical algebraic are

expressions used to represent these solutions

We start with the classical algebraic expressions formed using the variables y formal parameters p time

i i

t rational numb ers and the function symb ols Further as needed we add transcendent extensions

such as e ln sin cos For expressions t t t and t we write t t fy t y t g

n i i i i

   

to represent the simultaneous substitution of the variables y in the expression t Next we extend the

i

k

expressions by three expression constructors namely

Piecewise Continuous Functions

In Moh a decidable theory of piecewise continuous functions is presented A piecewise continuous function

is a function that can b e represented using piecewise expressions expressions of the from

piecew isec f c f c f

where the c are b o olean conditions and the f expressions The expression f is selected if the condition c

i i i i

is true

Perio dic and Generalized Perio dic Functions

A function f is called p erio dic if for some p the p erio d

x p k N f xf x k p

WE represent p erio dic function using the following notation per

fp

Denition Divider and Reminder For a x R we dene ir em R R and idiv

R Z

xiremp k where k Z such that pk xp k

x idiv p y where y such that k Z y k p x

k means the smal lest k such that

We generalize further and even allow the p erio d of a function to change

Denition Generalized Perio dic A function f R R is generalized p erio dic with period p

there exists a function g R Z R with

f xg xirempxidivp

we write then f gen p erio dic

gp

Generalized p erio dic expressions allow us to represent functions which can not b e represented using classical

algebraic expressions Such a function is for example xidivp the stairwaytoheaven function



If two conditions are true at the same time then the rst in the sequence of conditions is chosen

Computing ClosedForm Solutions

Nowwe are equipp ed to present our metho d used to compute closed form solutions of hybrid automata The

computation of the closed form solution is p erformed in four steps Solve the dierential equations

compute the p ossible traces of the system and decide if the trace is nite or p erio dic compute the initial

conditions for each mo de in the trace using a recurrence relation as a function of time and the number of

times we cycled through the p erio dic p ortion of the trace Find a closed form expression representing

the function dened by the hybrid automata We describ e each step of the algorithm Step one and three

are fully automated step two still needs user input in some cases Given a hybrid automata H we rst

transform H to a single conditionactionentrance automata H using

Symb olic Solving Step

Compute the symb olic solution f t y y of the system of dierential equations in each

iy n

i

and initial conditions not xed by the mo de s where the starting time is parameterized t

i s

i

conditions or actions leading to this mo de are parameterized This results in the substitution

g sol fy f

i j iy

j

For each mo de s for each transition t determine the time points tr ans by solving the

i ij ij

system of equations c sol These time p oints will dep end on the parameters intro duced as

ij i

the initial conditions for this mo de For some systems we detect restrictions of the parameters in

this step since it must hold that tr ans t

ij s

i

Trace Determining Step First we determine all p ossible lo ops of the hybrid automata a lo op is a

rep eating sequence of mo des Clearly there exist only nite number of lo ops there is only a nite

number of mo des hence each innite trace has to enter one mo de at least twice We represent all

p ossible traces as sequences of mo des

s s s s s s s s

i i i i i i i i

 

k  k  k p k  k  k

In the next step we will have to decide which of the p ossible traces are actually taken This problem

is in general undecidable but many practical hybrid automata eg control systems are constructed

with a p erio dic trace in mid

Recurrence and Construction Step

Given a nite trace we can easily construct a piecewise dened function which is the solution of

the hybrid automata For the trace

s s s s

i i i i

   n

we construct the function

piecew iset t sol

tt sol fy t sol t g

i

tt sol fy t sol t g

n n i n n n

where fy t sol t g gives the initial conditions as weenter a new mo de

k

For a p erio dic trace

s s s s s s s s

i i i i i i i i

 

k k  k  k p k  k 

we derive a coupled recurrence relations for the lo op

y y sol sol sol

i i i i i

k p k  k

The solution of these recurrences equations for each of the unknown initial conditions in mo de s

i

k

will determine the new initial values dep ending on the old values y and p ossible other values as

i

we reenter mo de s after one p erio d We write f n to denote the value of y as weenter

i i y i

i

k k

the nth time the mo de s

i k

Solve the recurrence equations to determine the initial conditions for mo de s dep ending on n

i

k 

and f

y

i

Compute the remaining initial conditions of the mo des s j l using the solution of the

i

k j

recurrence relation

Compute the actual p erio d of the automata by computing the time needed for one lo op of the

system The p erio d my b e generalized dep ending on n

s leading to the s by following the sequence of mo des s Compute the value of f

i i i y

  i

k

start of the p erio d

Comp ose the general solution of the automata using piecewise and generalized p erio dic functions

We implemented the steps into the computer system Maple Step one and three are automated

step two needs user input to select p ossible traces

Example Water Level Control

The water level control example can b e found in many places in literature Although it is a simple

system it allows us to demonstrate our metho ds By verifying the safety prop erties of the water level control

system wewere able to detect a condition whichwe did not nd in literature

The system consists of a reservoir whichhasanintakevalve and and an outow The intakevalvecan

b e op ened or closed Clearly valves do not op en or close instantly op ening or closing takes time The control

has to b e dsigned such that the reservoir is never emptyatanypoint of time

We can easily identify four mo des of the system the valveisopen the valve is closing the

valve is closed and the valve is op ening In each of these mo des the system can easily b e describ ed bya

dierential equation



y ta where a is the rate the reservoir lls if the intakevalveisopen



y ta where a is the closing rate of the valve



y ta where a is the outowrate of the reservoir as the intakevalve is closed



y ta where a is the op ening rate of the valve

In contrast to other approaches we actually mo del the dynamic phase of op ening and closing the valve using

a second order dierential equation and do not just sayittakes n seconds to op en the valve The twowater

levels that trigger to close the valve or to op en the valve are c and c The water levels after op ening

closing the valves are denoted c and c but they will cancel out in the calculation and are just used to

set up the symb olic solutions of the dierential equations The transitions of our system are the following

 

t true y c t y c t y a t y c t y a our automata

do es not contain any actions whichwould in fact make it simple to solve

The Hybrid automata mo deling the water level control system contains the parameters a a a a c c

Assuming that c c a a and a a as rst design constrains we observethat the

trace is p erio dic cycling

Safety prop erties of the system

The reservoir is never empty tyt

The reservoir will never overow tyt max where max is the maximal allowed water level in the

reservoir

We can immediately derive the following design constrains

c max and c max the sensors which cause the valve to op en and close have to lie within

the range of the reservoir

Now given some a a a a ow rates and valve closing sp eeds wehave to determine the conditions on

c c and max such that the safety requirements are met

open filling y’=a2

y’’=a1 y’=a2

yc23

wait close

y’3=a4 y’=a4 y’’=a3

Figure The water level

Solve Dierential Equations



We start in mo de one and solve the dierential equations with the initial conditions y ta y s c

resulting in

sol a x a s c

To switch from mo de one to mo de two the water level has to pass the c mark Solving we nd that this

happ ens at time p oint

a s c c

a

Now we are in mo de two The water level is c The initial ow rate of the water is a since we are



coming from mo de one We solve the dierential equation y ta under the initial conditions y s



c y s a and get

a x a s a x a s s a c



Wehave to determine the time p ointatwhich the valve is closed This is the case if y tisa computing

the and solving the resulting equation we receive

a s a a

a



Now in mo de three wehave to solve the dierential equation y ta weknowthewater level as weenter

this mo de by using the previously computed solution and time p oint

a x a s a x a s s a c

We will switchtomodeasthewater level reaches c wesolve the equation to determine this time p oint

a s a a a c a c a

a a



Finally we are in mo de four Similar to mo de twowesolve the equation y ta with the initial conditions

 

y s c and y s a and determine the p oint of time at which y ta atwhichthevalve is closed

again

y ta x a s a x a s s a c

and the time p oint where the valve is closed is

a s a a

a

Nowwe computed all solutions for one p erio d of op eration

Construct Recurrence Relation

Using all the computed solutions we are able to nd a recurrence relation which computed the water level

in mo de dep ending on the water level as weentered mo de the last time

a a sn a a a c a c a

a a sn

a a

a a a a c a c a a a a a a

Solving the recurrence relation and computing the water level as weenter state and wehaveallall

the pieces and can construct the solution

 

a a c a

   

a x x

a a a

  



a a

 

a x a x x

 

a a a a a a

     

per

 

 a a a c a

    

a x x

a a a

  



a a

 

otherwise a x a x

 

a a a a a

   

a a c a c a

a



a a

a a

 

a a a c a c a

7

6

5

4

3

2

1

0 10 20 30 40 t

Verication

Nowweverify the safety conditions of the system with the goal to derive conditions on the design parameters

of the system

Overow

Werstverify that the reservoir will never overow For this we compute the maximum of the water level

using the derivative resulting in

c a a

a

Now the maximal water level has to be smaller than the maximum the reservoir can hold we solve this

resulting condition for c

a maxa

c

a

It turns out that we cannot freely cho ose the size of the reservoir Clearly the longer the valvetakes to close

the larger the reservoirhastobetopreventoverow

Empty Reservoir

Toverify that the reservoir will not b e emptywe compute the minimal water level again using the derivative

c a a

a

The resulting condition is that

a

c

a

The minimum p ossible value for c is restricted by the closing sp eed of the valve but further weknow that

c c max

Examples

Reactor Temp erature Control

The goal is to keep the temp erature of a reactor in a certain range using two co oling ro ds This example

is prop osed in The co oling ro ds have regeneration times hence we use them alternating but wehave

b e make sure that the reactor do es not heat up faster then wehave co oling resources For easy readability

we rst compute this example using actual numb ers then weshow the conditions on the design parameters

p erforming the computations with symb ols

In this example we used the metho d to construct a hybrid automata with only a single entrance to

eachmode The original automata having mo des is extended to an automata with mo des

We use the variables

x timer elementy timer elementz temp erature

Critical and normal temp erature tcr it tnor

Regeneration time for ro ds T

The dierential equations in the dierent mo des are

Mo de Wait until ne

deq xt yt zt zt xs x ys y

t t t

zs tnor Cooling Rod 1 z>=tcrit, x>=T x’=1 x’=1 y:=0,x:=0 y’=1 y’=1 z:=tnor z’=.1 z-50 z’=.1z-60 x<= tnor, x:=0

z>=tcrit y>=T t<=tnorl z>tcrit y:=0 x

x’=1 y’=1 Shutdown

z’=.1z-60

Coolng Rod 2

Figure Hybrid System

Mo de Co ol element

xt yt zt zt xs ys y deq

t t t

zs tcrit

Mo de Wait until ne

deq xt yt zt zt xs x ys y

t t t

zs tnor

Mo de Use co oling ro d

xt yt zt zt xs x ys deq

t t t

zs tcrit

Solving

Mo de Solving the rst dierential equation results in

t

e

sol yts y t xts x t zt

s

e

We determine at which time point we have to switch to mo de by computing the time the reactor

reaches the critical temp erature

exsolvesubssolzttcritt

ex ln s

vx x ln

vy y ln

ln s

e

vz

s

e

Mo de Again wesolve the dierential equations resulting in

t

e

yts y t xts t sol zt

s

e

exsolvesubssolzttnort

s ex ln

vx ln

vy y ln

ln s

e

vz

s

e

Mo de

The solution of the dierential equation is

t

e

sol zt xts x t yts y t

s

e

exsolvesubssolzttcritt

ex ln s

vx x ln

vy y ln

ln s

e

vz

s

e

Mo de And nally mo de the solution of the equation is

t

e

sol zt xts x t yts t

s

e

exsolvesubssolzttnort

ex ln s

vx x ln

vy ln

ln s

e

vz

s

e

Solving the Recurrence relations Since we already know the trace we can easily derive the recurrence

relations by following the transitions of one preco de in the trace we do not show these steps here but directly

state the resulting very simple recurrence relations

ln s

e

r sol fzn

s

e

ln ft n ln n ln fxnln

fy nln

Since the equations are so simple we actually only havetosolve one Single recurrence relation resulting

in

sol fftnng r

Now using our equations we can compute the initial conditions to all mo des in one p erio d now dep ending

on n This is done mechanically and the results are not shown here

The p erio d of the system is easily computed to b e

We are ready to construct the solutions

per ln

For space reasons wehave to convert the expression to oating p oint representation using that per ln

sfx periodic x

per t t

per t

per t otherwise

sfz periodic x

t

e

t

e

pert

t

e

otherwise

e

t

e

sfy periodic x

per t t

per t

per t otherwise

50

40

30

20

10

0 20 40 60 80

x

Verication

For the verication we use the general result computed with only symbols

The condition that in mo de ro d is regenerated and ready to b e used

tcrit zheat tnor zheat tnor zref tcrit zref

txr

zheat zref

This is the condition that in mo de ro d is regenerated

tnor zref tcrit zref tcrit zheat tnor zheat

tyr

zheat zref

The Cat and Mouse Game

The catmouse game is a simple example found in literature In contrast to other approaches which

verify prop erties which seem to come out of the air we are actually able to derivethe prop erties of the

system The Game works as follows the mouse and cat are at p osition X the mouse starts running with

sp eed v thecatwaits for seconds and the starts running with sp eed v If the mouse reaches home b efore

m c

the cat an catch up the mouse wins else the cat wins

We use the following variables and symbols

X initial p osition of cat and mouse

x p osition of mouse v sp eed of mouse

m m

x p osition of cat v sp eed of cat y timer used by cat time mouse waits until running

c c

TheGameisdescribedby the following hybrid automata

xm’=-vm xm:=X0 xc:=X0

y=delta

xm’=-vm xc’=-vc

pc=0 and pm<0 pm=0 and pc<=0

Cat wins Mouse wins

The computations are again p erformed using the computer algebra system Maple

Dierential Equations with initial conditions

Mo de Mouse runs Cat Waits until timer y is

deq f x tv x t yt x X x X y g

m m c m c

t t t

Mo de Mouse and cat run

x tv x tv x st x x st X g deq f

m m c c m c

t t

SolveMode

Solving dierential equation weget

sol fx tX v t x tX yttg

m m c

exsolvesubssolytdeltat

ex

rx X v

m m

SolveModeSolving dierential equation we obtain

sol fx tv st x v t x tv st X v tg

m m m c c c

Next we substitute the parameters standx computed in the rst mo de resulting in

pos m X v t

m

c v X v t pos

c c

Wenow can decide in which sate the system will end up

Time p oint when Mouse is home obtained by solving pos

m

X

cm

v

m

Time p oint cat is home obtained by solving pos

c

X

cc

v

c

Nowwehave to decide in which mo d the system will pro ceed Wehave to decide which of the quantities

p or p is rst zero The can easily b e computing by solving p and p resulting in

m c m c

X X

v v

m c

The solution computed using an implementation is

n

X v t t X t

t t

m

pos t pos t yt

m c

X vm t otherwise v X v t otherwise

t otherwise

c c

References

R Alur CCiyrciyb etus N Halbwachs TA Henzinger P H Ho The Algorithmic Analysis if

Hybrid Systems Theoretical Computer Science pp

R Alur T Henzinger PH Ho Automatic Symbolic Verication of Embedded Systems

Pro ceedings of the th Annual IEEE Realtime Systems Symp osium RTSS pp

T A HenzingerThe Theory of Hybrid Automata th Annual IEEE Symposium on Logic in Com

muter Science LICS pp

P Filip oph Dierential equations with discontinuous Righthand Side

M S Branicky A Unied Framework for Hybrid Control Mo del and Optimal Control The

ory IEEE Transactions on Automatic Control Vol No

M v Mohrenschildt A Normal Form for Rings of Piecewise Functions Journal of Symbolic

Computation pp

M v Mohrenschildt Using Piecewise to Solve Classes of Control Theory Problems MapleTech

Vol No pp

EEngeler M v Mohrenschildt Solving Discontinuous Dierential Equations The Combi

natory Program Birkhauser pp

Mv Mohrenschildt Sep Solving Discontinuous Ordinary Dierential Equations with a Com

puter Algebra System submitted to J of Symbolic Computation

Hybrid Systems Lecture Notes in Computer Science Springer

FH Clarke and others Nonsmo oth Analysis and Control Theory

Y Kesten A Pnueli Integration Graphs A Class of Decidable Hybrid Systems Lect Notes Comp

Sci