Object-oriented simulation of continuous systems with ... - CiteSeerX

1 downloads 0 Views 139KB Size Report
component. Atomic systems with static struc- ture are speci ed as: A = hT; X; Z; Y; P; F; gi. (1). T - time base,. X - set of input values,. Z - set of state values,. Y - set ...
Object-oriented simulation of continuous systems with discrete structure changes T. Pawletta, S. Pawletta

Univ. of Wismar and Univ. of Rostock, PF1210, Philipp-Mueller-Str., D-23952 Wismar, Germany, [email protected]; [email protected]

Abstract This paper presents a compressed system theoretical formalism for modular hierarchical systems with discrete structure changes. The formalism is the basis for the design of an object oriented simulation runtime system for combined discrete and continuous systems with complex structure variability.

1 Introduction Time dynamic systems can be devided into three classes by their parameter and structure behavior:  systems with time invariant parameters and structure,  systems with time variant parameters but time invariant structure,  systems with time variant parameters and structure. Systems with time variant structure are called structure variable systems [Zei86] or multimodel systems [Oer91]. For modular hierarchical systems as de ned by Zeigler [Zei76] it makes sense to distinguish between structure changes in atomic systems ( rst order structure changes) and coupled systems (higher order structure changes). An atomic system describes the dynamic behavior of a system component, which is indivisible in a timed state transition level. A coupled system de nes the structure of a higher order system component, i.e. it tells how to connect several atomic or coupled systems together to form a new system component and it does not specify any dynamic behavior. Structure variable atomic systems de ne a set of equations or discrete events as well as special discrete events to realize structure changes, called structure events. Structure events activate

a speci c set of equations or discrete events of the whole set dependend on their event conditions, which then actually describe the dynamic behavior of the atomic system. In the same manner we extended coupled systems by structure events to describe higher order structure changes. These are addition, deletion and exchange of atomic or coupled subsystems as well as subrelations [PPD94]. Where as there is no complete system theoretical formalism of structure variable systems, todays software tools support insubstantially their modelling and simulation. Based upon our extensions of the general definitions for modular hierarchical systems by Zeigler we developed a simulation runtime system for structure variable DESSwithDEVS systems (Di erential Equation Speci ed Systems with Discrete Events). In the paper we present a formalism of higher order structure variability in a compressed manner as well as the basic ideas of the realized simulator.

2 Systemtheoretical Formalism Modular hierarchical systems are characterized by a staggered arrangement and hierarchy of two kinds of systems, called atomic systems and coupled systems [Zei76]. An atomic system describes the dynamic behavior of an indivisible system component. Atomic systems with static structure are speci ed as:

A = hT; X; Z; Y; P; F; gi T - time base, X - set of input values, Z - set of state values, Y - set of output values, P - set of system parameters,

(1)

F - state transition function, g - output function. The sets Z and P as well as the functions F and g are time-varying for structure variable systems. Each system structure can be interpreted as one structure state of the atomic system. A structure transition function must de ne the transitions between di erent structure states in analogy to the state transition function. If there are only discrete structure transitions they can be described with discrete events, called structure events. Each structure event consists of a time{, state{ or structure dependent condition and an appropriate event action to generate the new structure state. In accordance with the de nition of atomic systems with static structure a structure variable atomic system is speci ed as:

AS = hT; X; Y; S; s0; SE i

(2)

S - set of structure states with

S = hZ; P; F; gi, s0 - initial structure state s0 S ,

SE - the set of structure events with

se = hseb; seai, seSE , seb the struc-

ture event condition and sab the structure event action. Coupled systems de ne the structure of higher order system components [Zei76] which consists of a set of atomic or coupled systems, a set of input and output values to integrate them in other coupled systems as well as a set of couplings, called internal couplings, external input couplings and external output couplings corresponding to the connected elements [Zei84]. We extended the de nition of coupled systems by structure events to handle complex structure variability on the coupled system level [PPD94]. Such structure changes are the dynamic addition, deletion or exchange of subsystems and subrelations of coupled systems. Then a structure variable coupled system is speci ed as:

GS = hT; X; Y; S; s0; SE i T - time base, X - set of input values, Y - set of output values, S - set of structure states with S = hK; Ri and R = hEIR; EOR; IRi with K the set of subsystems, R the set of subrelations, EIR the set of external input couplings, EOR the set

(3)

of external output couplings and IR the set of internal couplings, s0 - initial structure state s0 S , SE - set of structure events with se = hseb; seai, seSE , seb the structure event condition and sab the structure event action. A very dicult problem of structure variable systems is the interdependence between structure and behavior state. In [Paw94] and [PPD94] we expounded some detailed examinations to this problem.

3 Simulator Concept Classical simulator concepts map the modular hierarchical system structure in a atted computer program. This approach is not well siutable to simulate systems with complex structure changes, because many structure informations are lost by the transformation process. The simulation of complex structure variable systems requires a detailed knowledge of the initial system structure and its modi cation accordingly the dynamic structure changes at runtime . Zeigler developed an abstract concept to transform modular hierarchical system speci cations in computing models in a one to one manner, called abstract simulator concept [Zei84]. In contrast to Zeigler's abstract simulator concept our approach does not base on passive system objects and active simulator objects (processors). We interpret atomic and coupled systems as simulation objects which contain a general part (the simulation methods) and a special user de ned part (the system description). The general methods and data structures as well as a NULL-System-Description are de ned as a class for each simulation object type in the simulator. In a derived class the user must override the default NULL-System-Description and he can override the virtually prede ned simulation methods (e.g. the integration methods) by user speci ed methods ( gure 1). With regard to the problem of state behavior consistency by structure variability|when an exchanged system must put on the previous system behavior state|we introduced generic system components. They specify the general properties of a group of specialized systems similar the structuring principle of the system entity structure [RZ88]. Generic and specialized systems must also be speci ed by class derivation

( gure 2). A detailed description of the principle of generic systems is given in [PPD94] and [PP95]. As well as the atomic and coupled systems each individual system element will be interpreted as such a simulation object, i.e. each state variable, output variable, discrete event etc. All system elements which need user speci ed aspects must be de ned in a derived class of its prede ned system class. For example the de nition of a state variable requires the speci cation of a state equation in a derived class of the general state variable class. The object incarnation will be done from the user de ned class. An input variable object can be incarnated directly from the prede ned class of input variables. As each system element is mapped by one program object and the simulation methods are linked dynamically it is able to assigne to each system element its own speci c calculation methods. Figure 1 gives a compressed view about the actual class hierarchy of the simulation runtime system and the derivation of user de ned classes. simulation runtime system Legend: class with mult.inher.

element

list

numericM

rootM

bisection

concrete class

integrationM

euler

abstract class

rootCoordinator object simObj constant variable

calcvar

couplevar

algebvar

user defined algebvar

statevar

user defined statevar

inputvar outputvarC user defined discrete event

when DESSwithDEVS coupleMethods

aDESSwithDEVS cDESSwithDEVS

user defined atomicDESS− withDEVS user defined coupledDESS− withDEVS

Figure 1: Class Hierarchy of the Simulation Runtime System and Derivation of User De ned System Elements

user defined specialized atomic continuous system with discontinuities ( class userSpecObj1 : public userGenObj) user defined generic atomic continuous system with discontinuities ( class userGenObj : public aDESSwithDEVS ) general atomic continuous system with discontinuities ( class aDESSwithDEVS : public DESSwithDEVS )

Figure 2: De nition of Generic and Specialized Systems by Class Derivation The implementation of the simulation runtime system is mainly based on the inheritance mechanism like the speci cation of user de ned system elements. The class simObj is the abstract parent class of all simulation objects, which speci es the general properties and protocols for the message passing between simulation objects. The calculation of the model will be started from an object called root-coordinator as well as by Zeigler's abstract simulator concept. It manages the outermost coupled model and watchs the simulation termination criterion. Its mode of operation is implemented in the class rootCoordinator. In contrast to the abstract simulator concept the calculation is not controled exclusivly on the level of the atomic and coupled models. Each simulation object has its own calculation methods and they all can communicate by messages. While the initial phase the atomic and coupled model objects incarnate their system elements as member objects and set their relations. The result of the initial phase is a digraph with loops where the nodes represent simulation objects and the loops represent feedbacks. Figure 3 shows by a small example the internally constructed digraph structure. The calculation must be started with messages to the destination nodes which are objects of the outermost coupled object by the rootcoordinator. Then the calculation of the system will be mostly data driven. An activated object needs time dependent values of other objects and sends them a message to return the requested values. Each object decides by itself with which methods it will calculate a requested value and whether it needs values of other objects. Only when a discrete event occurs the data driven calculation must be interrupted. All dependent objects will be synchronized at the event time and the event action will be activated. After that the calculation will be started again by the rootcoordinator.

C1

i1

A1 z1= f(t,i1,z2) z2= f(t,z1,Event) Event= f(t,z1,z2) o1= f(t,z2)

A2 o1

i1

z1= f(t,i1) o1= f(t,z1)

o1 o1

A1i1 C1o1

A2o1

A2z1

A2i1

A1o1

A1_Event

A1z2 A1z1

Figure 3: Example of an Internal Digraph Structure

4 Conclusion The concept of the simulation runtime system was implemented as a prototype with C++. Today we use the prototype to model and simulate a structure variable agricultural system, the ontogenese of wheat. The next work will be the coupling of the simulator with MATLAB1 based on the methods described in [PPD95] and examinations to parallize the simulation method. In our opinion the data driven simulation concept is a meaningful approach for such examinations.

References [Oer91] T.I. Oeren. Dynamic templates and semantic rules for simulation advisors and certi ers. In P. Fishwick and R.B. Modjewski, editors, Knowledge-based simulation: methodology and application, pages 53{76. Springer-Verlag, 1991. [Paw94] T. Pawletta. Design and implementation concept of a modular hierarchical simulation runtime system for dynamic environmental systems. Preprint CS02-94, Univ. of Rostock, Dep. of Computer Science, 1994. (in German). [PP95] T. Pawletta and S. Pawletta. CASTbased simulation of structure variable systems. Rostocker Informatik Berichte, Univ. Rostock, (1):12, 1995. (accepted publ., in German). 1

MATLAB is a product of the MathWorks Inc.

[PPD94] T. Pawletta, S. Pawletta, and E. Dimitrov. Modelling and simulation of structure variable systems. In G. Kampe and M. Zeitz, editors, Advances in simulation (Fortschritte in der Simulationstechnik), pages 59{64. Vieweg, Braunschweig, 1994. (in German). [PPD95] S. Pawletta, T. Pawletta, and W. Drewelow. Comparison of parallel simulation techniques - Workstation Cluster /MATLAB /PSI. Eurosim News, (1), 1995. (accepted publ.). [RZ88] J.W. Rozenblit and B.P. Zeigler. Design and modeling concepts. In R.C. Dorf., editor, International Encyclopedia of Robotics, pages 308{322. Wiley, New York, 1988. [Zei76] B. P. Zeigler. Theory of Modelling and Simulation. John Wiley, New York, 1976. [Zei84] B. P. Zeigler. Multifacetted Modeling and Discrete Event Simulation. Academic Press London, 1984. [Zei86] B. P. Zeigler. Toward a simulation methodology for variable structure modelling. In M.S. Elzas, T.I. Oeren, and B.P. Zeigler, editors, Modelling and Simulation Methodology in the Arti cal Intelligence, pages 195{ 210. Elsevier Science Publisher, North Holland, 1986.

Author Biographies Thorsten Pawletta is professor of applied com-

puter science at the University of Wismar. He worked ve years as engineer in a research institute and received his PhD from the University of Wismar in 1990. From 1990 to 1994 he was assistant at the Department of Computer Science at the University of Rostock. He is a member of SCS and Eurosim /ASIM. His interests include simulation methodology, object-oriented programming, distributed simulation and simulation methods as applied to environmental science and engineering. Sven Pawletta is currently pursuing a PhD in the Department of Automatic Control at the University of Rostock. He is a member of Eurosim /ASIM. His interests include simulation methodology, objectoriented programming, distributed simulation and simulation methods as applied to automatic control.