Introduction to DEVS Modeling and Simulation with JAVA: Developing Component-Based Simulation Models
Total Page:16
File Type:pdf, Size:1020Kb
Introduction to DEVS Modeling and Simulation with JAVA: Developing Component-Based Simulation Models Bernard P. Zeigler Arizona Center for Integrative Modeling and Simulation Electrical & Computer Enginering College of Engineering and Mines University of Arizona Tucson, Arizona, USA Hessam S. Sarjoughian Arizona Center for Integrative Modeling and Simulation Computer Science & Engineering Fulton School of Engineering Arizona State University Tempe, Arizona, USA January 2005 Copyright by the Authors Draft Version 3 List of Chapters Chapter 1..............................................................................................6 INTRODUCTION TO DEVS MODELING & SIMULATION METHODOLOGY........6 Framework for Modeling and Simulation ..............................................6 Brief Review of the DEVS Concepts ..................................................6 Basic Models .................................................................................8 Coupled Models .............................................................................9 Hierarchical Model Construction .....................................................10 The DEVS Formalism.......................................................................10 Classic DEVS System Specification .................................................10 Summary.......................................................................................12 Chapter 2............................................................................................13 WORKING WITH SIMPLE DEVS MODELS ...............................................13 DEVS SISO Models..........................................................................13 Passive.......................................................................................14 Storage ......................................................................................16 Generator ...................................................................................17 Binary Counter ............................................................................18 Ramp .........................................................................................19 Summary.......................................................................................20 Exercises.......................................................................................20 Solutions .......................................................................................21 Chapter 3............................................................................................26 DEVSJAVA CLASSES AND METHODS ....................................................26 Container Classes ...........................................................................26 DEVS Classes .................................................................................27 Class devs...................................................................................28 Class message.............................................................................29 Class atomic................................................................................30 Class coupled ..............................................................................31 Class digraph ..............................................................................31 Implementing the Single Input/Single Output DEVS ............................32 Class classic ................................................................................32 Class siso....................................................................................33 Table of Contents Chapter 4............................................................................................34 PARALLEL DEVS MODELS IN DEVSJAVA................................................34 Parallel DEVS Basic Models ..............................................................34 Examples: Processor Models..........................................................35 Pseudo-code Example: Simple Processor.........................................35 Simple Processor Expressed in Parallel DEVS......................................38 Implementing the Simple Processor in DEVSJAVA ............................38 Another Example: Adding a Buffer to the Simple Processor ...............42 Processor with Random Processing Times........................................45 Processor Priority Queue...............................................................46 Models with Multiple Input and Output Ports ......................................48 DEVS Model of a Switch................................................................48 DEVSJAVA Implementation of the Switch........................................49 Sending/Receiving/Interpreting Messages..........................................51 More Atomic Models in DEVSJAVA.....................................................53 Storage with Ports for storing and retrieval .....................................53 Processor with (name, job) Input and Output Ports..........................54 Event List (Delay) Element............................................................55 Experimental Frame Components......................................................57 Stop/Start Generator....................................................................57 Generator of Time Consuming Jobs................................................58 Transducer..................................................................................59 Summary.......................................................................................62 Exercises.......................................................................................62 Solution.........................................................................................66 Chapter 5............................................................................................71 PARALLEL DEVS COUPLED MODELS .....................................................71 Coupled Models in the DEVS Formalism .............................................71 Component Requirements:............................................................71 Coupling Requirements:................................................................72 Example: Simple Pipeline.................................................................73 Implementing Coupled Models in DEVSJAVA.......................................74 The Behavior of Coupled Models .......................................................74 More Examples of Coupled Models ....................................................76 Switch Network ...........................................................................76 Generator/Processor/Transducer....................................................78 3 Table of Contents Experimental Frame.....................................................................79 Hierarchical Models.........................................................................81 Implementing Hierarchical Models in DEVSJAVA...............................81 Summary.......................................................................................82 Exercises.......................................................................................82 Chapter 6............................................................................................84 EXERCISING MODELS: PARALLEL DEVS SIMULATION PROTOCOL ............84 Conservative and Optimistic Schemes ...............................................84 Simulating DEVS Models with Conservative and Optimistic Schemes...86 Parallel DEVS Simulation Protocol .....................................................87 Atomic Model Simulators...............................................................87 Coupled Model Coordinators..........................................................88 Expressing The Parallel DEVS Simulation Protocol as a Coupled Model 90 Summary.......................................................................................95 Exercises.......................................................................................95 Chapter 7............................................................................................97 MULTIPROCESSOR ARCHITECTURES....................................................97 Prototypical Processing Architectures.................................................97 Performance of Simple Architectures ..............................................98 Coordinators and Multiprocessor Architectures....................................99 Digraph Representation of the Architectures..................................100 Common Coordinator Class .........................................................100 Divide and Conquer.......................................................................102 Divide and Conquer Coordinator ..................................................103 Divide and Conquer Architecture..................................................105 Behavior of Divide and Conquer Architecture.................................105 Pipeline .......................................................................................106 Pipeline Coordinator ...................................................................106 Pipeline Architecture...................................................................109 Behavior of Pipeline....................................................................110 Multiserver...................................................................................111 Multiserver Coordinator ..............................................................111