Upload
lynna
View
31
Download
1
Embed Size (px)
DESCRIPTION
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. - PowerPoint PPT Presentation
Citation preview
ECE 449/549
Class Notes #2
Introduction to Discrete-Event Systems Specification (DEVS)
Sept. 2008
Source System Simulator
Model
Experimental Frame
SimulationRelation
ModelingRelation
behavior database
Basic Entities and Relations in Modeling and Simulation
DEVS Formalism
DEVS = Discrete Event Systems Specification
• Atomic Models
• Coupled Models
• Hierarchical Models
x0 x1X
S
Yy0
e
t0 t1 t2
Discrete Event Time Segments
DEVS Atomic Model
• input events
• output events
• state variables
• state transition functions
• output function
• time advance function
Elements of an atomic model:
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.
DEVS = DEVS = <X,S,Y, <X,S,Y, int int , , ext , ext ,con, con, ta,ta,
XX : a set of input events.
YY : a set of output events.
SS : a set of states
ta :ta : SS R R++0,inf 0,inf time advance function
int int ::S S S S internal transition function.
ext ext ::Q x XQ x Xbb S S external transition function,
con con ::Q x XQ x Xbb S S confluent transition function,
where XXbb is a set of bags over elements in XX.
Q= {(s,e)|sQ= {(s,e)|sS, 0S, 0 e e ta(s)}ta(s)} :: S S Y Y output function
Basic specification:Basic specification:
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
Internal Transition /Output Generation
s
Generate output
output
Make a transitions’
Time advance using theinternaltransitionfunction
using theoutputfunction
Time advance
input
Make a transition
Response to External Input
elapsedtime
using theexternaltransitionfunction
Time advance
input
Make a transition
Response to Simultaneous External Input and Internal Event
elapsedtime
Generate output
output
using theconfluenttransitionfunction
receptive refractInput
fireFiring delay >0
Output Fire-once Neuron
Atomic Model Examples
PulseGenerator
out
pulse
time
passive activestart
interPulseTime >0Output Pulse Generator
start
external event Internal event output event
ta = ∞
ta = ∞ ta = ∞
Basic DEVS: Example Scuba Model
60ft35 min
1 hr
40ft25 min
5 min5ft
Dive Plan
EmergencyPhone
Call Response
=dint (“five”) for phase != “five” ,“surface1”, “surface2”dint (“five”,s ) otherwise //except when already on “five
DEVS Hierarchical Modular CompositionAtomic: lowest level model,
contains structural dynamics -- model level modularity
Atomic
Atomic Atomic
Atomic
+ coupling
Atomic
Atomic
Atomic
Coupled: composed of one or more atomic and/or coupled models hierarchical
construction
DN = < DN = < XX ,Y,D,{M,Y,D,{Mi i },},{I{Ii i },},{Z{Zi,j i,j }}
XX : a set of input events.
YY : a set of output events.
DD : an index set for the components of the coupled model.
For each ii DD ,
MMi i is a component DEVS model.
For each ii DD selfself , IIii is the set of influencees of ii .
For each jj DD selfself ,
ZZi,ji,j is output translation mapping
Coupled model specification:Coupled model specification:
class ef:public digraph{ public:ef():digraph(){ genr * g = new genr("g); transd * t = new transd("t");
add(g); add(t);
create componentscreate components
gg
tt
donedone
startstart
arivariv outout
efefoutout
inports->add("in"); outports->add("out"); inports->add("start"); outports->add("result");
declare portsdeclare ports
inin
startstart
resultresult
outout
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 couplingadd coupling
DIGRAPHDIGRAPH
DEVSDEVS
ENTITYENTITY
CONTAINERCONTAINER
ATOMICATOMIC
COUPLEDCOUPLED
devsdevs
entityentity
LegendLegend
inherits
can hold
Object Oriented DEVS CLASSES
MESSAGEMESSAGE
contentcontent port, value ENTITY
Simulation Cycle for DEVS Parallel /Confluent
1 Compute the global next event time, tN: use reduce to get minimum of component times to next event (tN)
2 Tell all components the global tN and
if component is imminent (tN == global tN ),
then generate output message(using )
3 Sort and distribute (using coupling) output messages.
4 Tell all components
if component is imminent (tN == global tN )
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)
Simulation Cycle Step 1Compute 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
compute tN compute tN
compute tN compute tN compute tN compute tN
compute tN compute tN compute tN compute tN compute tNreturn tN return tN return tN return tN return tN
return MIN tN return MIN tN return MIN tN return tN
return MIN tN return MIN tN
return MIN tN
Collection of Minimum tN Values
Low Node
High Node
i
+ 8
+ 1i + 2i
+ 3i + 4i + 5i + 6i
+ 7i i + 9i i + 11+ 10i
Block(UI)
Simulation Cycle Step 2
Tell_all (compute_IO) Ensemble Messagecompute_IOLow Node
High Node
i
+ 8
+ 1i + 2i
+ 3i + 4i + 5i + 6i
+ 7i i + 9i i + 11+ 10i
compute_IO compute_IO
compute_IO compute_IO compute_IO compute_IO
Tell all components global tN: if component is imminent generate and sort output messages
compute_IO compute_IO compute_IO compute_IO compute_IO
Mail Exchange in Step3
+ 1i + 2i + 3i + 4i + 5i
tell all imminents,sort, and distribute output messages (mail) using coupling
Step 1 : Mail Message Size Information
Step 2 : Mail Exchange
Simulation Cycle Step 4
Tell_all (wrap_deltfunc) Ensemble Messagewrap_deltfuncLow Node
High Node
i
+ 8
+ 1i + 2i
+ 3i + 4i + 5i + 6i
+ 7i i + 9i i + 11+ 10i
wrap_deltfunc wrap_deltfunc
wrap_deltfunc wrap_deltfunc wrap_deltfunc wrap_deltfunc
wrap_deltfunc wrap_deltfuncwrap_deltfuncwrap_deltfuncwrap_deltfunc
Tell all components with to execute their transition functions.