1 / 22

# ECE 449/549 - PowerPoint PPT Presentation

ECE 449/549. Class Notes #2 Introduction to Discrete-Event Systems Specification (DEVS) Sept. 2008. Basic Entities and Relations in Modeling and Simulation. Experimental Frame. Source. Simulator. System. behavior database. Modeling Relation. Simulation Relation. Model.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

ECE 449/549

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

## ECE 449/549

Class Notes #2

Introduction to Discrete-Event Systems Specification (DEVS)

Sept. 2008

Basic Entities and Relations in Modeling and Simulation

Experimental Frame

Source

Simulator

System

behavior database

Modeling

Relation

Simulation

Relation

Model

### DEVS Formalism

DEVS = Discrete Event Systems Specification

• Atomic Models

• Coupled Models

• Hierarchical Models

x

x

0

1

Discrete Event Time Segments

X

t1

t0

t2

S

e

y0

Y

### DEVS Atomic Model

Elements of an atomic model:

• input events

• output events

• state variables

• state transition functions

• output function

### 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 internaltransition 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.

Basic specification:

DEVS = <X,S,Y, dint , d ext ,dcon, ta,l >

X : a set of input events.

Y: a set of output events.

S: a set of states

ta :S-> R+0,inf time advance function

dint :S -> Sinternal transition function.

d ext :Q x Xb-> Sexternal transition function,

d con :Q x Xb-> Sconfluent transition function,

where Xb is a set of bags over elements in X.

Q= {(s,e)|se S, 0<= e<=ta(s)}

l:S -> Youtput function

### DEVS Atomic Model Implements Basic DEVS

Make a transition

(internal)

Make a transition

(external)

input

State

internal

external

Handle input

output

output

Hold for

some time

Send an output

Internal Transition /Output Generation

output

Generate output

s’

s

Make a transition

using the

output

function

using the

internal

transition

function

Response to External Input

input

Make a transition

using the

external

transition

function

elapsed

time

Response to Simultaneous External Input and Internal Event

output

input

Make a transition

Generate output

elapsed

time

using the

confluent

transition

function

start

out

receptive

active

passive

fire

refract

### Atomic Model Examples

pulse

Pulse

Generator

time

Pulse Generator

interPulseTime >0

Output

start

ta = ∞

Output

Fire-once Neuron

Input

Firing delay >0

ta = ∞

ta = ∞

external event

Internal event

output event

Dive

Plan

Emergency

Phone

Call

Response

Basic DEVS: Example Scuba Model

=dint (“five”) for phase != “five” ,“surface1”, “surface2”

dint (“five”,s ) otherwise //except when already on “five

### DEVS Hierarchical Modular Composition

Atomic: lowest level model, contains structural dynamics -- model level modularity

Coupled: composed of one or more atomic and/or coupled models

hierarchical construction

+ coupling

Coupled model specification:

DN = < X,Y,D,{Mi },{Ii },{Zi,j }>

X : a set of input events.

Y: a set of output events.

D : an index set for the components of the coupled model.

For eachieD ,

Mi is a component DEVS model.

For eachieDu self, Iiis the set of influencees ofi .

For eachjeDu self ,

Zi,jis output translation mapping

create components

class ef:public digraph{

public:

ef():digraph(){

genr * g = new genr("g);

transd * t = new transd("t");

ef

out

start

start

g

result

ariv

out

t

in

out

done

declare ports

DIGRAPH

Legend

inherits

can hold

ENTITY

Object Oriented

DEVS CLASSES

DEVS

ATOMIC

devs

COUPLED

MESSAGE

CONTAINER

content

entity

port,

value ->ENTITY

wrap_deltfunc(t,m)

deltext(t-tN,m)

deltint()

deltcon(m)

Simulation Cycle for DEVS Parallel /Confluent

• Compute the global next event time, tN: use reduce to get minimum of component times to next event (tN)

• Tell all components the global tN and

• if component is imminent (tN == global tN ),

• then generate output message(using l)

• Sort and distribute (using coupling) output messages.

• Tell all components

• if component is imminent (tN == global tN )

• or has incoming mail (external events)

• or both

• then execute transition function (wrap_deltfunc).

Block

(UI)

Tell_all (next_tN) Ensemble Message

+ 2

i

i

+ 1

compute tN

compute tN

return MIN tN

return MIN tN

+ 5

+ 6

i

i

+ 4

i

i

+ 3

compute tN

compute tN

compute tN

compute tN

return tN

return MIN tN

return MIN tN

return MIN tN

+ 10

i

i

+ 9

i

+ 7

compute tN

compute tN

compute tN

compute tN

compute tN

return tN

return tN

return tN

return tN

return tN

Simulation Cycle Step 1

Compute the next event time (tN) : uses reduction to get

minimum of the component times to next event.

Collection of Minimum tN Values

i

compute tN

return MIN tN

Low Node

+ 8

i

+ 11

i

High Node

Tell_all (compute_IO) Ensemble Message

i

+ 1

compute_IO

compute_IO

compute_IO

compute_IO

compute_IO

compute_IO

i

+ 7

compute_IO

compute_IO

compute_IO

compute_IO

compute_IO

Simulation Cycle Step 2

Tell all components global tN:

if component is imminent generate and sort output messages

i

compute_IO

Low Node

+ 2

i

+ 6

i

+ 5

i

+ 4

i

+ 3

i

i

+ 10

i

+ 9

+ 11

+ 8

i

i

High Node

i

+ 4

+ 3

i

+ 1

+ 2

i

i

+ 5

i

Step 1 : Mail Message Size Information

Step 2 : Mail Exchange

Mail Exchange in Step3

tell all imminents,

sort, and distribute output messages (mail) using coupling

Tell_all (wrap_deltfunc) Ensemble Message

i

+ 1

wrap_deltfunc

wrap_deltfunc

wrap_deltfunc

wrap_deltfunc

wrap_deltfunc

wrap_deltfunc

i

+ 7

wrap_deltfunc

wrap_deltfunc

wrap_deltfunc

wrap_deltfunc

wrap_deltfunc

Simulation Cycle Step 4

Tell all components with to execute their

transition functions.

i

wrap_deltfunc

Low Node

+ 2

i

+ 6

i

+ 5

i

+ 4

i

+ 3

i

i

+ 10

i

+ 9

+ 11

+ 8

i

i

High Node