Title: Chapter 1 DEVS Framework for Modeling and Simulation
1Chapter 1 DEVS Framework for Modeling and
Simulation
- Modeling and simulation framework
- DEVS concepts
- Hierarchical Modular Composition
- DEVS restricted to real numbers
- Atomic Models
- Examples
- pulse generators,
- fireOnce neurons,
- Coupled Model Specification
- The Meaning of Coupling
- Example shortest time neural nets
- Types of Models Representable in DEVS
- The Model Classes in DEVSJAVA
2Basic Entities and Relations in Modeling and
Simulation
Experimental Frame
Device for executing model
Real World
Simulator
Data Input/output relation pairs
Experimental frame specifies conditions under
which the system is experimented with and
observed
Model
Structure for generating behavior claimed to
represent real world
Each entity is represented as a dynamic
system Each relation is represented by a
homomorphism or other equivalence
3Discrete Event Time Segments
X
t1
t0
t2
S
e
y0
Y
4DEVS Introduction Phrases
- faithfully yours
- step by step, brick by brick
- swimmers strokes
- how fast, how far, how soon
- dont interrupt
- together we can do it!
- the instant manager
- crossing the threshold, testing the limits
- when to say when (acceptor)
- let others have a chance (refractoriness)
- plotting in real time
5DEVS Hierarchical Modular Composition
- Atomic lowest level model, contains structural
dynamics -- model level modularity
SimpArc.efa
Coupled composed of one or more atomic and/or
coupled models
hierarchical construction
coupling
6DEVS Atomic Model
Elements of an atomic model
pulseModels. basicGenr
- input events
- output events
- state variables
- state transition functions
- output function
- time advance function
7Atomic 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.
8DEVS Atomic Model Implements Basic DEVS
Make a transition (internal)
Make a transition (external)
input
State
internal
external
time advance
Handle input
output
output
Hold for some time
Send an output
pulseModels. fireOnce Neuron
9Atomic Model Examples
pulse
Pulse Generator
time
interPulseTime gt0
Pulse Generator
Output
pulseExpFrames. pulseGenr
start
ta 8
Output
Fire-once Neuron
Input
Firing delay gt0
pulseModels. fireOnceNeuron
ta 8
ta 8
external event
Internal event
output event
10Internal Transition /Output Generation
using the output function
using the internal transition function
11Response to External Input
using the external transition function
elapsed time
Time advance
12Response to Simultaneous External Input and
Internal Event
elapsed time
using the confluent transition function
Time advance
13DEVS Coupled Model
Elements of coupled model
- Components
- Interconnections
- Internal Couplings
- External Input Couplings
- External Output Couplings
pulseModels. fireOnce NeuronNet
14Coupling in Action
pulseModels. fireOnce NeuronNet
Coupling (internal)
AB
B
A
Output port
Input port
internal
State
external
time advance
output
internal
State
external
time advance
output
15Coupled Model Example Neuron net can compute
the shortest path in a directed graph by mapping
distances of edges to equivalent time values.
- Small network of fire-once neurons
- a pulse emitted from the generator explores two
paths concurrently to reach the final neuron
(number 4). - depending on the summed firing delays along each
path, a pulse emerging from one or the other will
arrive first to the final neuron, the other will
be shut out and prevented from continuing - in general, the clock time when a pulse first
arrives to a neuron represents the shortest time
to reach it - if nodes and link distances are mapped to
neurons and firing times, then the path taken by
a pulse represents the shortest path of an
associated digraph. - the path can be reconstructed by extending the
neuron model to allow retracing the path of
earliest firings. - This method turns out to be isomorphic to the
well known Dikstrai shortest path algorithm.
pulseModels. fireOnce NeuronNet
If instead of shortest paths, we request longest
paths, a net of neurons that fire after their
assigned fireDelays every time they receive a
pulse will do the job. Finding critical paths in
PERT charts require such longest path
computation.
16Some Types of Models Represented in DEVS
Coupled Models
Atomic Models
Partial Differential Equations
can be components in a coupled model
Ordinary Differential Equation Models
Processing/ Queuing/ Coordinating
Networks, Collaborations
Physical Space
Spiking Neuron Networks
Spiking Neuron Models
Processing Networks
Petri Net Models
n-Dim Cell Space
Discrete Time/ StateChart Models
Stochastic Models
Cellular Automata
Quantized Integrator Models
Self Organized Criticality Models
Fuzzy Logic Models
Reactive Agent Models
Multi Agent Systems
17DEVS Classes
basicDevs
IODevs
atomicDevs
IOBasicDevs
coupledDevs
EntityInterface
Atomic
Coupled
Message Handler
entity
devs
atomic
digraph
ViewableDigraph
ViewableAtomic
18Basic Atomic Methods
genDevs. modeling. atomic
- public double ta() the time advance function
returns the value of sigma for atomic models - public message out() the output function
releases the message just before an internal
transition - public void deltint() the internal transition
function - public void deltext(double e,message x) the
external transition funciton - public void deltcon(double e,message x) the
confluent transition function - public void Continue(double e) subtract e from
sigma use to retain the same time of next event
after an external event - public void holdIn(String phase, double sigma)
set the phase and sigma values as given in the
arguments - public void passivateIn(String phase) set the
phase as given in the argument and sigma to
INFINITY - public void passivate() set the phase to
passive and sigma to INFINITY - public boolean phaseIs(String phase) return
true if the current phase equals the argument
- public double ta()return sigma
- public message out()return new message()
//override - public void deltint() //override
- public void deltext(double e,message x)
//override - public void deltcon(double e,message
x)//default - deltint()
- deltext(0,x)
-
- public void Continue(double e)
- if (sigma lt INFINITY)
- sigma sigma - e
-
- public void holdIn(String phase, double sigma)
- this.phase phase
19Fire-once Neuron
This neuron fires exactly once after a fixed
delay while ignoring all subsequent inputs
public void initialize() super.initialize() pass
ivateIn("receptive") public void
deltext(double e,message x) Continue(e) if
(phaseIs("receptive") somethingOnPort(x,"in")) h
oldIn("fire",fireDelay)
ignore all subsequent pulses
pulse
pulse
pulse
pulse
input
t
fire
Continue sigma sigma - e
phase
state
receptive
refract
public void deltint() //if (phaseIs("fire")) pas
sivateIn("refract") public message
out() //if (phaseIs("fire")) return
outputNameOnPort("pulse","out")
sigma
pulseModels foreOnceNeuron
elapsed time
pulse
output
20Basic Generator Concepts
pulseExpFrames. basicGenr
third Duration
second Duration
First Duration
0
first
second
passive
third
active
public void initialize() super.initialize() hold
In("active",0) public void deltext(double
e,message x) Continue(e) if
(somethingOnPort(x,"start")) holdIn("first",firs
tDuration) else if (somethingOnPort(x,"stop"))
passivate()
public void deltint() if (phaseIs("active"))
holdIn("first",firstDuration) else if
(phaseIs("first")) holdIn("second",secondDuration)
else if (phaseIs("second")) holdIn("third",third
Duration) else passivate() public message
out() if (phaseIs("active")) return
outputRealOnPort(firstOutput,"out") else if
(phaseIs("first")) return outputRealOnPort(secondO
utput,"out") else if (phaseIs("second")) return
outputRealOnPort(thirdOutput,"out") else //if
(phaseIs("third")) return outputRealOnPort(0,"out"
)
21Example of basicGenr Scuba Diving Plan
surface
15 ft
10 min
40 ft
20 min
pulseModels. scubaModel
60 ft
20 min
A diver drops immediately to 60 ft depth, stays
there for 20 min., then rises to 40 ft, depth
staying 20 min., and finally spends 10 minutes at
15ft before rising to the surface. Modify the
basicGenr to represent this dive plan. Your model
should output the new depth to which the diver
goes at each stage.
22Class pulseGenr -- generates pulses whose size
and frequency can be specified
out
pulseExpframes pulseGenr
interPulseTime
public void initialize() super.initialize() hold
In("active",interPulseTime) public void
deltext(double e,message x) Continue(e) if
(somethingOnPort(x,"start")) holdIn("active",int
erPulseTime) else if (somethingOnPort(x,"stop"))
passivate()
public void deltint() holdIn("active",interPuls
eTime) public message out() return
outputRealOnPort(pulse,"out")
Note stop and start do not remember the time
already elapsed in last period this can be done
by employing the elapsed time, e.
23Coupled Model Example using a basic generator to
dynamically set the period of a pulse generator
boxCar
pulseModels boxCar
public class boxCar extends ViewableDigraph pub
lic boxCar() super("boxCar") ViewableAtomic
basic new basicGenr("basic",15,20,14,
2,1,1000)
\\ d1,d2,d3 ,p1,p2,p3 add(basic) Viewabl
eAtomic pg new pulseGenr("pg") add(pg) addCo
upling(basic,"out",pg,"setInterPulseTime")