Presentation is loading. Please wait.

Presentation is loading. Please wait.

ECE 449/549 Class Notes #2 Introduction to Discrete-Event Systems Specification (DEVS) Sept. 2008.

Similar presentations


Presentation on theme: "ECE 449/549 Class Notes #2 Introduction to Discrete-Event Systems Specification (DEVS) Sept. 2008."— Presentation transcript:

1 ECE 449/549 Class Notes #2 Introduction to Discrete-Event Systems Specification (DEVS) Sept. 2008

2 Source System Simulator Model Experimental Frame Simulation Relation Modeling Relation behavior database Basic Entities and Relations in Modeling and Simulation

3 DEVS Formalism DEVS = Discrete Event Systems Specification Atomic Models Coupled Models Hierarchical Models

4 x 0 x 1 X S Y y0y0 e t0t0 t1t1 t2t2 Discrete Event Time Segments

5 DEVS Atomic Model input events output events state variables state transition functions output function time advance function Elements of an atomic model:

6 Atomic Model Operation Ports are represented explicitly – there can be any number of input and output ports on which values can be received and sent The time advance function determines the maximum lifetime in a state A bag can contain many elements with possibly multiple occurrences of its elements. Atomic DEVS models can handle bags of inputs and outputs. The external transition function handles inputs of bags by causing an immediate state change, which also may modify the time advance. The output function can generate a bag of outputs when the time advance has expired. The internal transition function is activated immediately after the output function causing an immediate state change, which also may modify the time advance. The confluent transition function decides the next state in cases of collision between external and internal events.

7 DEVS = <X,S,Y,  int,  ext,  con, ta,  X X : a set of input events. Y Y : a set of output events. S S : a set of states ta :S  R + 0,inf ta : S  R + 0,inf time advance function  int :S  S  int :S  S internal transition function.  ext :Q x X b  S  ext :Q x X b  S external transition function,  con :Q x X b  S  con :Q x X b  S confluent transition function, X b X where X b is a set of bags over elements in X. Q= {(s,e)|s  S, 0  e  ta(s)} Q= {(s,e)|s  S, 0  e  ta(s)} :S  Y : S  Y output function Basic specification:

8 State output external internal time advance Make a transition (external) Make a transition (internal) Handle input Send an output Hold for some time input output DEVS Atomic Model Implements Basic DEVS

9 Internal Transition /Output Generation s Generate output output Make a transition s’s’ Time advance using the internal transition function using the output function

10 Time advance input Make a transition Response to External Input elapsed time using the external transition function

11 Time advance input Make a transition Response to Simultaneous External Input and Internal Event elapsed time Generate output output using the confluent transition function

12 receptive refract Input fire Firing delay >0 Output Fire-once Neuron Atomic Model Examples Pulse Generator out pulse time passive active start interPulseTime >0 Output Pulse Generator start external event Internal eventoutput event ta = ∞

13 Basic DEVS: Example Scuba Model Dive Plan Emergency Phone Call Response =dint (“five”) for phase != “five”,“surface1”, “surface2” dint (“five”,s ) otherwise //except when already on “five

14 void proc::deltext(timetype e,message * x) { Continue(); if (phase_is("passive")) for (int i=0; i get_length();i++) if (message_on_port(x,"in",i)) { job = x->get_val_on_port("in",i); hold_in("busy",processing_time); } message * proc::out( ) { if (phase_is("busy")) message * m = new message(); entity *val = job; m->add(make_content("out",val);); return m; } void proc::deltint( ) { passivate(); } external transition function internal transition function output function  jobphase time advance x y s inout ATOMIC

15 DEVS Hierarchical Modular Composition Atomic: lowest level model, contains structural dynamics -- model level modularity + coupling Coupled: composed of one or more atomic and/or coupled models hierarchical construction

16 DN = < X,Y,D,{M i },{I i },{Z i,j }  X X : a set of input events. Y Y : a set of output events. D D : an index set for the components of the coupled model. i  D For each i  D, M i M i is a component DEVS model. i  D  self I i i For each i  D  self, I i is the set of influencees of i. j  D  self For each j  D  self, Z i,j Z i,j is output translation mapping Coupled model specification:

17 class ef:public digraph{ public: ef():digraph(){ genr * g = new genr("g); transd * t = new transd("t"); add(g); add(t); create components g t done start ariv out ef out inports->add("in"); outports->add("out"); inports->add("start"); outports->add("result"); declare ports instartresult out add_coupling(this, "in", t, "done"); add_coupling(this, "start", g, "start"); t->add_coupling(t,"out",g,"stop"); t->add_coupling(t, "out", this, "result"); g->add_coupling(g, "out", this, "out"); g->add_coupling(g, "out", t, "ariv"); add coupling DIGRAPH

18 DEVS <X,S,Y,  int,  ext,  con, ta,  <X,S,Y,  int,  ext,  con, ta,  Every Devs Coupled model has a Devs Basic equivalent DN < X,Y,D,{M i },{I i },{Z i,j }  DEVS <X,S,Y,  int,  ext,  con, ta,  <X,S,Y,  int,  ext,  con, ta,  Closure Under Coupling

19 EFA ARCH EF GEN TRANSD EF ARCH COORD PROC Hierarchical Construction

20 EFA EFA-DEC GENR COORD EF EFA-DEC TRANSD PROC S PRO C ARCH ARCH-SPEC MULT MULT-DEC PROC SYSTEM ENTITY STRUCTURE

21 EFAEFA-DEC GENR COORD EF EFA-DEC TRANSD PROCS PROC ARCH ARCH-SPEC MULT MULT-DEC PROC PRUNING GENREFAEFA-DEC EF EFA-DEC TRANSD ARCH ARCH-SPEC PROC TRANSFORMING EFA PROC EF GENR TRANSD

22 DEVS ENTITY CONTAINER ATOMIC COUPLED devs entity Legend inherits can hold Object Oriented DEVS CLASSES MESSAGE content port, value  ENTITY

23 Simulation Cycle for DEVS Parallel /Confluent 1Compute the global next event time, t N : use reduce to get minimum of component times to next event (tN) 2Tell all components the global t N and if component is imminent (t N == global t N ), then generate output message(using ) 3 Sort and distribute (using coupling) output messages. 4 Tell all components if component is imminent (t N == global t N ) or has incoming mail (external events) or both then execute transition function (wrap_deltfunc). wrap_deltfunc(t,m) deltcon(m) deltint() deltext(t-tN,m)

24 Simulation Cycle Step 1 Compute the next event time (tN) : uses reduction to get minimum of the component times to next event. Tell_all (next_tN) Ensemble Message compute tN return tN return MIN tN return tN return MIN tN Collection of Minimum tN Values Low Node High Node i + 8 + 1 i + 2 i + 3 i + 4 i + 5 i + 6 i + 7 i i + 9 i i + 11 + 10 i Block (UI)

25 Simulation Cycle Step 2 Tell_all (compute_IO) Ensemble Message compute_IO Low Node High Node i + 8 + 1 i + 2 i + 3 i + 4 i + 5 i + 6 i + 7 i i+ 9 i i + 11 + 10 i compute_IO Tell all components global tN: if component is imminent generate and sort output messages compute_IO

26 Mail Exchange in Step3 + 1 i + 2 i + 3 i + 4 i + 5 i tell all imminents, sort, and distribute output messages (mail) using coupling Step 1 : Mail Message Size Information Step 2 : Mail Exchange

27 Simulation Cycle Step 4 Tell_all (wrap_deltfunc) Ensemble Message wrap_deltfunc Low Node High Node i + 8 + 1 i + 2 i + 3 i + 4 i + 5 i + 6 i + 7 i i+ 9 i i + 11 + 10 i wrap_deltfunc Tell all components with to execute their transition functions.


Download ppt "ECE 449/549 Class Notes #2 Introduction to Discrete-Event Systems Specification (DEVS) Sept. 2008."

Similar presentations


Ads by Google