Title: ECE 449549
1ECE 449/549
- Class Notes 4
- DEVS Models for Processing and Coordinating
Workflow - /
- System Entity Structure
- Sept. 2008
2DEVS Models for Processing and Coordinating
Workflow
- Sending/Receiving/Interpreting Messages
- Processor Models
- Workflow experimental frame components
- Work Flow Coupled Models
- Experimental Frame for Workflow Performance
Measurement - Hierarchical Model Construction
- Workflow Coordinator Models
- Workflow Architecture Models
- Performance of Simple Workflow Architectures
3Sending/Receiving/Interpreting Messages how to
use casting to receive instances of arbitrary
entity subclasses
coupled model
entity
in
out
A
B
doubleEnt
doubletEnt(double)
double
double
getv() ? double
coupling (A,out,A,in)
public message out( ) message m new
message() m.add( makeContent("out", new
doubleEnt(1.2)) return m
in
out
cast
message
doubleEnt
add
p
getv()
val
doubleEnt
deltext(double e,message) x)if
(somethingOnPort(x,"in") entity val
getEntityOnPort(x,"in") doubleEnt f
(doubleEnt)val double v f.getv()
v
content
double
casting the received entity down to the doubleEnt
subclass
4Sending/Receiving/Interpreting Messages
(contd) multiple copies of an object are needed
to avoid hard-to-find dependencies.
coupled model
entity
in
out
A
B
job
- job(procTime)
- update(e)
- procTime e
- copy() return new
- job(procTime)
job
job
coupling (A,out,A,in)
This instance of job is now shared in common by
both A and B if either makes a change to its
state, then the other will also be subject to
it. For example, if B does
job.update(10) then the instance at A will be
similarly altered. This can lead to mysterious
effects (similar to quantum entanglement) where
components of a model can influence each other
outside of their interface couplings. It is
difficult to trace this kind of non-modularity.
Suppose A sends its instance of job directly to
B public message out( ) message m new
message() m.add( makeContent("out", job) return
m
The right way B stores a copy of its
input deltext(double e,message) x) if
(somethingOnPort(x,"in)) job temp
getEntityOnPort(x,"in") myJob
temp.copy() where copy() is a method you define
to create a new instance of job and give it
values of an existing one.
out
and B stores it as its instance deltext(double
e,message) x) if (somethingOnPort(x,"in")) myJob
getEntityOnPort(x,"in")
The cure is simple create a new instance as a
local copy of an entity if it is to be altered
(this happens automatically when using toString()
and toObject(), see chap. 12)
5Processor Models
6Processor with queue illustrating how to process
a bag of inputs (multiple concurrent events)
accumulate the inputs on port in into the queue
public class procQ extends proc protected Queue
q public procQ(String name,
double procTime ) super(name,procTime) q
new Queue()
public void deltext(double e, message x)
Continue(e) if (phaseIs("passive")) for
(int i0 ilt x.size() i) if
(messageOnPort(x, "in", i))
q.add(x.getValOnPort("in", i))
holdIn("busy", procTime) job
(entity)q.first() else if
(phaseIs("busy")) for (int i0 ilt
x.size()i) if (messageOnPort(x, "in",
i)) entity jb x.getValOnPort("in",
i) q.add(jb)
class Queue is a container with FIFO discipline
this makes sure the processed job is the one
at the front
public void deltint( ) q.remove() if(!q.isEmpty
()) job (entity)q.first() holdIn("busy",
procTime) else passivate()
remove the job at the front that was just finished
7Workflow experimental frame components
- To compute the performance measures, the
transducer, places job-ids that arrive at its
'ariv input port on its arrived-list together
paired with their arrival times.When, and if, the
job-id also appears at the 'solved input port,
the transducer places it on the solved-list and
also computes its turnaround time. it maintains
its own local clock to measure arrival and
turnaround times. - In transd, an internal transition is used only to
cause an output at the - end of the observation interval. In a more
general experimental frame, the role of
terminating the simulation run would be handled
by a component - called an acceptor.
- The transducer measures two performance indexes
of interest for work flow the throughput and
average turnaround time of jobs in a simulation
run. - throughput is the average rate of job
departures from the architecture, - estimated by the number of jobs processed during
the observation interval, - divided by the length of the interval.
- A job's turnaround time is the length of time
between its arrival to the processor and its
departure from it as a completed job. - For the simple processor, the turnaround time is
the same as the processing time. (For more
complex architectures, this relationship is not
necessarily true as we shall see.).
generator is an autonomous model, (its behavior
is self induced by recurring internal events)
hence, it does not need an external transition
function To dictate its response to external
input events. The added an input ports start
and stop when stimulated, start and stop the
generation of outputs.
8Work Flow Coupled Models
9Basic Workflow Coupled Model generator,
processor, transducer
10Experimental Frame for Workflow Performance
Measurement
- Output lines may diverge to indicate the
occurrence of simultaneous events. When genr
sends out a job identifier on port out, it
goes at the same clock time, both to the ariv
port of transd and port out of ef, hence
eventually to some processor model. - Input lines may converge, i.e., two or more
source ports connected to the same destination
port, can occur. Bags represent the collection
of inputs that arrive simultaneously at a
component.
- Instances of the classes genr and transd are
coupled together to form the experimental frame,
ef. - The input port in of ef is for receiving
solved jobs which are sent to the solved input
port of transd via the external input coupling.
- There are two output ports out, which
transmits job identifiers sent to it by genr,
and 'result which transmits the performance
measures computed by transd. External output
couplings bring about both these transmissions. - There are two internal couplings
- the output port out of genr sends job
identifiers to the 'ariv port of transd - the output port out of transd which couples to
the 'stop input port of genr.
11Hierarchical Model Construction
12Example Flat Coupled Model
gpt
start
start
out
generator (genr)
processor (proc)
out
in
stop
out
arrived
transducer (transd)
out
solved
13Experimental Frame/Model Modularity
efP
ef
start
start
start
out
out
generator (genr)
processor (proc)
out
in
stop
out
arrived
transducer (transd)
out
out
solved
solved
14Hierarchical Coupled Model
efP
ef
start
start
Processor With Queue (procQ)
out
out
in
out
out
solved
15Hierarchical Models and Experimental Frame
Modularity in DEVSJAVA
Create EF
ef.setBlackBox(true)
m.setBlackBox (true)
16Workflow Coordinator Models
public class Coord extends proc public
Coord(String name) super(name,1)
inports.add("setup") inports.add("x")
outports.add("y") public void initialize()
passivate() super.initialize()
protected void add_procs(devs p) //use devs
for signature System.out.println("Default in
Coord is being used")
Coord
divide Coord
pipe Coord
multi Server Coord
17Workflow Architecture Models
18Performance of Simple Workflow Architectures
Average turnaround time and maximum throughput as
a function of processing time
19 The System Entity Structure Using Simulation
to Search and Optimize
- System Entity Structure
- Examples
- Model Base Organization and Synthesis
- System Entity Structure for Optimal crew size
20System Entity Structure
- System Entity Structure (SES) represents a family
of hierarchical DEVS models - Particular members of the family are generated by
process called pruning to generate a pruned
entity structure (PES) - A hierarchical DEVS model ready to execute is
obtained by transforming a PES, i.e., accessing
components in a repository and coupling them
together according to the PES specification.
21System Entity Structure Axioms
- SES is represented as a labeled tree with
attached attributes that satisfies the following
axioms - alternating entity/aspect or entity/specialization
- Each node has a mode that is either
entity/aspect or entity/specialization - such that a node and its successors are always
opposite modes the mode of the root is entity. - Coupling is associated with aspects
- uniformity
- Any two nodes with the same names have
identical attached variable types and isomorphic
sub-trees. - strict hierarchy
- No label appears more than once down any path
of the tree. - valid brothers
- No two brothers have the same label.
- attached variables
- No two variable types attached to the same
item have the same name.
22aspect
entity
specialization
Key Items Entity An independently identified
real world object Aspect Represents one
decomposition out of many possible of an
entity Specialization represents the way in which
the entity can be categorized into specialized
entities ? Selection rule
23SES Example
elevator
physical decomposition
motion specialization
floors
contents
escalator
pas- senger
lift
Rule if select freight from carriage spec
then select lift from motion
spec and
select cargo from contents spec
people
Rule if select passenger from carriage spec
then select people from contents spec
24SES Multiplicities
city
multiple aspect
roadNet
multiple entity
25System Entity Structure Inheritancee.g., Mapping
into XML
specialized entities inherit their parents
subtriee
vehicle
aluminum.airplane.vehicle
- density low - strength medium
speed high
material composition
decomposition
transportation class
- density - strength
- speed
decomposition
motor
propulsion
transmission
aluminum
car
ship
steel
airplane
- buoy ancy
- density low - strength medium
- speed high
motor
wing.propulsion
transmission
wood
wings
wheels
XML ltobjectgt aluminum.airplane.vehicle ltdensitygt
low ltstrengthgt medium ltspeedgt high ltmadeofgt motor
transmission wing.propulsion
Rule if select airplane from transportation
then select
aluminum from material composition
and wings from propulsion
Note buoyancy field is not present
26SES/Model Base Synthesize new models from
reusable DEVS components
SES
Develop a System Entity Structure to organize
the Repository
PES
transforming
pruning
hierarchical DEVS model
27SES and UML as Ontologies
28Worker Interference
- A wall has a 1000 bricks. A brick layer can build
such a wall in 1000 minutes. However, if N
people work on the wall together each can only
work at this standard rate until 1000-aN bricks
have been laid. At that point, the remaining (aN)
bricks have to be done by one person at the
standard rate. Note agt0 is the interference
factor. - Develop a DEVSJAVA model with parameters, N and
a. - Develop an experimental frame (efb) the measures
the time it takes to complete the task - Run your model in a) coupled to efb and note the
time. - Derive a formula for the completion time as a
function of N and find the optimal value of N
(the number of workers that minimizes the time to
completion).
29System Entity Structure for Worker Interference
Finding the optimal crew size by simulation
workerOpt interference param, a
maxCrewSize
(min(35,1000/a)
distribute these on different computers for
parallel execution
fireOnceNeuron
workCrews
workCrew numWorkers
rate Estimator (EF)
workerCellSpace (arch)
var Dsiplay
workerCells
thresholdTester threshold 1000
anumWorkers
sum
workerCell (varGen)
30SES in Natural Language and Model Base
Aspect
Coupling
Specialization
31XML Output
Coupling Info
32SESBuilderwww.sesbuilder.com
- Developed by RTSync Corp and ACIMS(Arizona Center
for Integrated Modeling and Simulation) at the
University of Arizona - Natural Language Expression for the Component
Composition and Data Modeling - Automatic XML and Schema output
33Case Study Application to the US Climate Data
Overall System Structure
DEVS Component Repository
Source Data to DEVS model
XML Metadata
DEVS Components
Source Data (US Climate Data)
Query by SES (Component name, Coupling Info)