+ All Categories
Home > Documents > ECE 449/549

ECE 449/549

Date post: 27-Jan-2016
Category:
Upload: kirra
View: 44 times
Download: 0 times
Share this document with a friend
Description:
ECE 449/549. Class Notes # 4 DEVS Models for Processing and Coordinating Workflow / System Entity Structure Sept. 2008. DEVS Models for Processing and Coordinating Workflow. Sending/Receiving/Interpreting Messages Processor Models Workflow experimental frame components - PowerPoint PPT Presentation
Popular Tags:
33
ECE 449/549 Class Notes # 4 DEVS Models for Processing and Coordinating Workflow / System Entity Structure Sept. 2008
Transcript
Page 1: ECE 449/549

ECE 449/549 Class Notes # 4

DEVS Models for Processing and Coordinating Workflow

/System Entity Structure

Sept. 2008

Page 2: ECE 449/549

DEVS 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

Page 3: ECE 449/549

inout

BA

coupled model

coupling: (A,”out”,A,”in”)

doubledouble

entity

doubleEntdoubletEnt(double)

getv() → double

Sending/Receiving/Interpreting Messageshow to use casting to receive instances of arbitrary entity subclasses

double

doubleEnt val

content

“out”

v

adddoubleEnt

val

p

content

deltext(double e,message) x){if (somethingOnPort(x,"in"){entity val = getEntityOnPort(x,"in");doubleEnt f = (doubleEnt)val;double v = f.getv();}}

double

v

“in”

cast

getv()p

public message out( ){message m = new message();m.add( makeContent("out", new doubleEnt(1.2));return m;}

message

casting the received entity down to the doubleEnt subclass

Page 4: ECE 449/549

inout

BA

coupled model

coupling: (A,”out”,A,”in”)

jobjob

entity

job •job(procTime)•update(e): procTime += e;•copy(): return new job(procTime);

Sending/Receiving/Interpreting Messages (cont’d)multiple copies of an object are needed to avoid hard-to-find dependencies.

“out”

and B stores it as its instance:

deltext(double e,message) x){if (somethingOnPort(x,"in")){myJob = getEntityOnPort(x,"in");

Suppose A sends its instance of job directly to B:

public message out( ){message m = new message();m.add( makeContent("out", job)return m;}

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.

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)

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 youdefine to create a new instance of job and give it values of an existing one.

Page 5: ECE 449/549

Atomic model I/O Behavior Description

processor Simple processor representing only storage of job and passage of time for its execution; no buffering or preemption

processor withqueue

Processor with FIFO (First In/First Out) queue selects next job based on earliest arrival time

processor withpriority queue

Processor with queue selects next job based on its priority. It can be interrupted by higher priority job. Requires user defined class job in which priority is based on processing time.

Processor Models

Page 6: ECE 449/549

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 i=0; i< 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 i=0; i< x.size();i++) if (messageOnPort(x, "in", i)) { entity jb = x.getValOnPort("in", i); q.add(jb); } }}

public void deltint( ){q.remove();if(!q.isEmpty()){ job = (entity)q.first(); holdIn("busy", procTime);}else passivate();}

this makes sure the processed job is the one atthe front

accumulate the inputs on port “in” into the queue

remove the job at the front that was just finished

Processor with queueillustrating how to process a bag of inputs (multiple concurrent events)

class Queue is a container with FIFO discipline

Page 7: ECE 449/549

Atomic model I/O Behavior Description  

generator generates jobs with fixed interarrival time

generator of time consuming jobs

generates jobs at random times with assigned randomly distributed processing time

transducer records job arrivals and departures and measures turnaround time and throughput

Workflow experimental frame components

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.

•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 componentcalled 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.).

Page 8: ECE 449/549

Work Flow Coupled Models

Coupled model I/O Behavior Description

Simple pipeline Sequence of processors forming a pipeline processor

Switched network

Switch sending input to two processors alternatively

Generator-processor-transducer

Generator sends jobs to processor which is observed by transducer

Work flow experimental frame

Experimental frame consisting of generator and transducer

Hierarchical workflow frame and model

Hierarchical model which top level consisting of experimental frame and processor

Page 9: ECE 449/549

Basic Workflow Coupled Model – generator, processor, transducer

Page 10: ECE 449/549

Experimental Frame for Workflow Performance Measurement

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.

• 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.

Page 11: ECE 449/549

EFA

ARCH

EF

GEN TRANSD

EF

ARCH

COORD

PROC

PROC

Hierarchical Model Construction

Page 12: ECE 449/549

Example: Flat Coupled Model

gpt

processor(proc)

out

arrived

solved

outin

generator(genr)

transducer(transd)

out

out

stop

startstart

Page 13: ECE 449/549

efP

processor(proc)

out

arrived

solved

outin

generator(genr)

transducer(transd)

out

out

stop

startstart

ef

solved

startout

out

Experimental Frame/Model Modularity

Page 14: ECE 449/549

efP

ProcessorWith

Queue(procQ)

out

solved

outin

out

out

startstart

ef

Hierarchical Coupled Model

Page 15: ECE 449/549

Hierarchical Models and Experimental Frame Modularity in DEVSJAVA

Create EF

ef.setBlackBox(true)

m.setBlackBox(true)

Page 16: ECE 449/549

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 signatureSystem.out.println("Default in Coord is being used");}}

Coord

divideCoord

pipeCoord

multiServerCoord

Workflow Coordinator Models

Atomic model

I/O Behavior Description

divide and conquer coordinator

breaks incoming jobs into parts for processing and compiles the results into a final output

pipeline coordinator

routes incoming jobs through a series of processing states and outputs the results

Multiserver coordinator

routes incoming jobs for processing and collects the results for final output

Page 17: ECE 449/549

in inout

out

xy

co

p0 p1 p2

Architecture

Workflow Architecture Models

Coupled model

Divide and conquer

divide and conquer coordinator with processors

Pipeline pipeline coordinator with processors

Multiserver multiserver coordinator with processors

Page 18: ECE 449/549

Performance of Simple Workflow Architectures

Architecture Processing Time AverageTurnaround Time

MaximumThroughput

Simple Processor p p 1/p

Multiserver

homogeneous

p1,p2,p3

p1=p2 = p3 =p

3/thruput p

1/p+1/p2+1/p3

3/p

Pipeline

homogeneous

p1 + p2 + p3 = p

p1=p2 = p3=p/3

p

p

1/max{p1,p2,p3}

3/p

Divide and Conquer

homogeneous

p1 + p2 + p3 = p

p1=p2 = p3 =p/3

max{p1,p2,p3}

p/3

1/max{p1,p2,p3}

3/pAverage turnaround time and maximum throughput as a function of processing time

Page 19: ECE 449/549

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

Page 20: ECE 449/549

• 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.

System Entity Structure

Page 21: ECE 449/549

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.

System Entity Structure Axioms

Page 22: ECE 449/549

aspectentity

specialization

Key ItemsEntity

An independently identified real world object Aspect

Represents one decomposition out of many possible of an entitySpecialization

represents the way in which the entity can be categorized into specialized entities Selection rule

Page 23: ECE 449/549

SES Example

elevator

lift escalator

floors contents

pas-senger

physical decomposition motion

specialization

freight

carriagespecialization

Rule – if select freight from carriage spec then select lift from motion spec and select cargo from contents spec

cargo

contentsspecialization

people

Rule – if select passenger from carriage spec then select people from contents spec

Page 24: ECE 449/549

S G L

SegSegSeg ...

S G L

SegSegSeg ...

S G L

SegSegSeg ...

roadSegroadNet

city

roadNet

city

roadNet

roadSeg

trafficGenr(G)

trafficLight(L)

seg

lineroadSched(S)

step event

multipleaspect

multipleentity

SES Multiplicities

Page 25: ECE 449/549

System Entity Structure Inheritancee.g., Mapping into XML

decomposition

vehicle

motor propulsiontransmission

wheelswings

materialcomposition

wood

steelaluminum

transportationclass

car ship airplane

- density- strength

- density = low- strength = medium

- speed

- speed = high

- buoy ancy

Rule: if select airplane from transportation then select aluminum from material composition and wings from propulsion

aluminum.airplane.vehicle

decomposition

wing.propulsiontransmissionmotor

- density = low- strength = medium speed = high

XML:<object> aluminum.airplane.vehicle<density> low<strength> medium<speed> high<madeof>motortransmissionwing.propulsion

Note: buoyancy field is not

present

specialized entities inherit their parents

subtriee

Page 26: ECE 449/549

SES/Model Base: Synthesize new models from reusable DEVS components

Repository of DEVScomponents

Develop a System EntityStructure toorganize the Repository SES

pruninghierarchical

DEVSmodel

PES

transforming

Page 27: ECE 449/549

SES and UML as Ontologies

ontology UML SES

Classes General things in the many domains of interest

yes x

Instances Particular things yes x

Relationships among things Generalization/specialization (a kind of)associations (aggregations, composition (part of) dependencies,…)

labeled specializationlabeled decomposition

Properties (and property values) of things

instance variables and values

instance variables and values

Functions Functions of, and processes, involving things

sequence diagramscollaboration diagrams

pruning to generate models from family specified by SES

Constraints on, and rules, involving things

no synthesis constraintsselection constraints

Page 28: ECE 449/549

Worker 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 a>0 is the interference factor.

a) Develop a DEVSJAVA model with parameters, N and a.

b) Develop an experimental frame (efb) the measures the time it takes to complete the task

c) Run your model in a) coupled to efb and note the time.

d) 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).

Page 29: ECE 449/549

workerOpt ~interference param, a ~maxCrewSize (min(35,1000/a)

workCrew ~numWorkers

fireOnceNeuron

rateEstimator (EF)

workerCellSpace(arch)

workCrews

workerCell (varGen)

thresholdTester ~threshold = 1000 – a*numWorkers

sum

workerCells

System Entity Structure for Worker Interference – Finding the optimal crew size by simulation

varDsiplay

distribute these on different

computers for parallel execution

Page 30: ECE 449/549

SES in Natural Language and Model Base

Aspect

Coupling

Specialization

Page 31: ECE 449/549

XML Output

Coupling Info

Page 32: ECE 449/549

SESBuilderwww.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

Page 33: ECE 449/549

Case Study: Application to the US Climate Data

Source Data to DEVS

model

Source Data(US Climate Data)

XMLMetadata

DEVS Components

DEVS ComponentRepository

Query by SES(Component name,Coupling Info)

Overall System Structure


Recommended