The Architecture of GenDevs: looking under the hood of DEVSJAVA 3.0 Bernard P. Zeigler ACIMS Updated January 2004.

Slides:



Advertisements
Similar presentations
Transparency No. 1 Java Collection API : Built-in Data Structures for Java.
Advertisements

Sets and Maps Part of the Collections Framework. 2 The Set interface A Set is unordered and has no duplicates Operations are exactly those for Collection.
Collections Framework A very brief look at Java’s Collection Framework David Davenport May 2010.
DEVS-Based Simulation Web Services for Net-Centric T&E Saurabh Mittal, Ph.D. Jose L. Risco-Martin*, Ph.D. Bernard P. Zeigler, Ph.D. Arizona Center for.
Java Collections Framework COMP53 Oct 24, Collections Framework A unified architecture for representing and manipulating collections Allows collections.
1 L43 Collections (3). 2 OBJECTIVES  To use the collections framework interfaces to program with collections polymorphically.  To use iterators to “walk.
Lecture 23: Software Architectures
Algorithm Programming Containers in Java Bar-Ilan University תשס " ו by Moshe Fresko.
Asper School of Business University of Manitoba Systems Analysis & Design Instructor: Bob Travica System architectures Updated: November 2014.
24-Jun-15 Introduction to Collections. 2 Collections A collection is a structured group of objects Java 1.2 introduced the Collections Framework Collections.
Data Structures & Java Collections Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Ch 12 Distributed Systems Architectures
Unit 291 Java Collections Framework: Interfaces Introduction to the Java Collections Framework (JCF) The Comparator Interface Revisited The Collection.
Java's Collection Framework
Collections. Why collections? Collections are used to hold a collection of objects. List holds objects based on order of insertion and can hold non unique.
SEG4110 – Advanced Software Design and Reengineering TOPIC G Java Collections Framework.
Java Collections Framework A presentation by Eric Fabricant.
Sets and Maps Part of the Collections Framework. The Set interface A Set is unordered and has no duplicates Operations are exactly those for Collection.
CS-2851 Dr. Mark L. Hornick 1 Tree Maps and Tree Sets The JCF Binary Tree classes.
The Design Discipline.
Database System Concepts and Architecture Lecture # 3 22 June 2012 National University of Computer and Emerging Sciences.
Java Programming: Advanced Topics 1 Collections and Wealth of Utilities.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 12 Slide 1 Distributed Systems Architectures.
An Introduction to Software Architecture
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 22 Java Collections.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 22 Java Collections.
DEVS Namespace for Interoperable DEVS/SOA
Collections in Java. Kinds of Collections Collection --a group of objects, called elements –Set-- An unordered collection with no duplicates SortedSet.
Develop DEVS Models Using DEVSJAVA Dr. Feng Gu. DEVS atomic model Elements of an atomic model input events output events state variables state transition.
1 Sets and Maps Starring: keySet Co-Starring: Collections.
Jan 12, 2012 Introduction to Collections. 2 Collections A collection is a structured group of objects Java 1.2 introduced the Collections Framework Collections.
Some Other Collections: Bags, Sets, Queues and Maps COMP T2 Lecture 4 School of Engineering and Computer Science, Victoria University of Wellington.
Chapter 18 Java Collections Framework
Data structures Abstract data types Java classes for Data structures and ADTs.
1/20/03A2-1 CS494 Interfaces and Collection in Java.
Unit 2 Architectural Styles and Case Studies | Website for Students | VTU NOTES | QUESTION PAPERS | NEWS | RESULTS 1.
Distribution and components. 2 What is the problem? Enterprise computing is Large scale & complex: It supports large scale and complex organisations Spanning.
DEVS M&S Tutorial 2 Chungman Seo
1 Collections Framework A collections framework is a unified architecture for representing and manipulating collections. All collections frameworks contain:
Modeling with Parallel DEVS Serialization in DEVS models Select function Implicit serialization of parallel models E-DEVS: internal transition first,
This recitation 1 An interesting point about A3: Using previous methods to avoid work in programming and debugging. How much time did you spend writing.
Simulator Protocol. coordinator simulator Component tN tN. tL After each transition tN = t + ta(), tL = t simulator Component tN tN. tL simulator Component.
Chapter 3 Collections. Objectives  Define the concepts and terminology related to collections  Explore the basic structures of the Java Collections.
DEVS and SES as a Framework for Modeling and Simulation Tool Development Bernard P. Zeigler Arizona Center for Integrative Modeling and Simulation University.
Collections Mrs. C. Furman April 21, Collection Classes ArrayList and LinkedList implements List HashSet implements Set TreeSet implements SortedSet.
Set and Map IS 313, Skeletons  Useful coding patterns  Should understand how and why they work how to use  possible quiz material.
Copyright (c) Systems and Computer Engineering, Carleton University * Object-Oriented Software Development Unit 13 The Collections Framework.
G.v. Bochmann, revised Jan Comm Systems Arch 1 Different system architectures Object-oriented architecture (only objects, no particular structure)
DEVS-based Modeling and Simulation References: 1.B. P. Zeigler, Hessam S. Sarjoughian, Introduction to DEVS Modeling and Simulation with JAVA: Developing.
Sets and Maps Part of the Collections Framework. 2 The Set interface A Set is unordered and has no duplicates Operations are exactly those for Collection.
CMSC 202 Containers and Iterators. Container Definition A “container” is a data structure whose purpose is to hold objects. Most languages support several.
1 Collections. 2 Concept A collection is a data structure – actually, an object – to hold other objects, which let you store and organize objects in useful.
Collections Dwight Deugo Nesa Matic
ECE 449/549 Class Notes #2 Introduction to Discrete-Event Systems Specification (DEVS) Sept
3-1 Java's Collection Framework Another use of polymorphism and interfaces Rick Mercer.
Lecture 9:FXML and Useful Java Collections Michael Hsu CSULA.
Collections ABCD ABCD Head Node Tail Node array doubly linked list Traditional Arrays and linked list: Below is memory representation of traditional.
Databases and DBMSs Todd S. Bacastow January 2005.
Distribution and components
Chapter16 Methodology: How to Model and Simulate
Hierarchical Architecture
Data, Databases, and DBMSs
DEVS Background DEVS = Discrete Event System Specification
Component-Level Design
Atomic Model Simulator
An Introduction to Software Architecture
Introduction to DEVSJAVA
The Architecture of GenDevs: looking under the hood of DEVSJAVA 3.0
DEVS Background DEVS = Discrete Event System Specification
Hashing in java.util
Presentation transcript:

The Architecture of GenDevs: looking under the hood of DEVSJAVA 3.0 Bernard P. Zeigler ACIMS Updated January 2004

Scalability, Flexibility and Inter-operability Through Interface Standardization Simulator Single processor Distributed Simulator Real-Time Simulator C++ Non DEVS Java Other Representation DEVS Simulation Protocol

Scalable Distributed/Networked Enterprise Scalability at hardware level e.g., TINI (Java executing Tiny TCP/IP Interface) Scalability at middleware level e.g., CORBA real-time event channel Scalability at software level, e.g., XML Distributed Object computing structures Simulation/ execution structures Model Definition/ Manipulation structures DEVS Modeling Interfaces DEVS Simulator Interfaces Ensemble Collection Interfaces scalability: as system expands or performance demands increase, can reimplement same functionality (interfaces) with more instances or more capable classes (threaded, distributed, event channel)

GenDevs Packages GenDevs GenCol java.util,java.lang Collection classes and interfaces Threads Sockets reflect Bag,Relation,Function ensembleCollection classes and interfaces DEVS Models Simulators and Interfaces

Collections, Maps, Relations

JAVA Collection Interface interface Commands: return value indicates change in state HashSet s = new HashSet(); s.add("a"); Iterator it = s.iterator(); while (it.hasNext()){ Object o = it.next(); } public Object anyOne(Set s){ Iterator i = new Iterator(s); if (i.hasNext()) return i.next(); else return null; }}

Java Collection Interface Hierarchy Collection List Set +add(int,Object) +get(int):Object +remove(int) +remove(Object) +listIterator(int) +add(Object) +remove(Object) +add(Object) +remove(Object) +contains(Object) +size() +iterator() Allows insertion anywhere in the list inserts object only if it is not equal to any in the set Set contains no duplicate elements, i.e., contain no pair of elements e1, e2 s.t. e1.equals(e2) and at most one null element.

Java Collection Class Hierarchy LinkedList Collection List Set AbstractCollection AbstractSet AbstractList Vector HashSet Uses Hashtable as implementation so uses hash and equals for key equality ((see next Java Map slide)

Java Map Class Hierarchy Map SortedMap AbstractMap HashMap > Dictionary Hashtable TreeMap +put(key:Object,value:Objects) +get(key: Object) key to value mapping (one-to-one) Hashxx uses hash code and key equals method to determine associate value if ((e.hash == hash) && key.equals(e.key)) return e.value;

Ensemble Methods tell-all command args ask-all query? args which? query? args reduce query? token args collection which-one? query? args Ensemble or bulk methods act on all the elements in a collection uniformly

Ensemble Methods (cont’d) tell-all command args  send the command(args) message to all objects in the container, ask-all query? args  send the query?(args ) message to all objects in the container and collect the results in a returned container (see ). which? query? args  send the query?(args) message to all objects in the container and collect objects returning TRUE in a new container. which-one? query? args  return the one entity in which? query? args provided there is exactly one; otherwise return an unspecified entity in which? query? args. reduce query? token args  pass the token from object to object in the container in an unspecifed order. Each successive object replaces the token with the results of query?(token,args). After all replacements are done, the token is the final result returned. ask all query? args query? argsresult container of results token which-one? query? args

Ensemble Interfaces ensembleBasic Collection interface ensembleBasic { public void tellAll(String MethodNm,Class[] classes,Object[] args); public void askAll(ensembleCollection result,String MethodNm,Class[] classes,Object[] args); public void which(ensembleCollection result,String MethodNm,Class[] classes,Object[] args); public Object whichOne(String MethodNm,Class[] classes,Object[] args); } interface ensembleCollection extends ensembleBasic, Collection{ public void print(); public void wrapAll(ensembleCollection Result,Class cl); public ensembleCollection copy(ensembleCollection ce); } ensembleCollection

Ensemble Class Hierarchy ensembleInterface ensembleBag threadEnsembleBag ensembleBag b = new ensembleBag(); b.add(e); b.add(f); HashSet c = new HashSet(); Class [] classes = {java.util.HashSet}; Object [] args = {"e"}; b.which(c,"equalName",classes,args); return c.size() == 1; } ensembleSet threadEnsembleSet LinkedList HashSet Bag

Providing ensemble capability to any Collection ensembleWrap$ensemble has 1 +$make(Collection) :ensemble -ensemble() +tellAll +AskAll +which +whichOne -Collection:c Thread CoordTimerHolder

Sequence Diagram: TellAll :ensemble :coord start tellAll(command,args) :timer start :collection Iterator() :Object holder new holder( command,args)|start() command(args) decrement() interrupt() waitForNt() while(coord.alive())

Entity Interface/entity class public interface EntityInterface{ public String getName(); public Object equalName(String name); public ExternalRepresentation getExtRep(); } public interface ExternalRepresentation{ class ByteArray implements ExternalRepresentation{} } entity Object //overrides pointer equality of Object public boolean equals(Object o){ if (!(o instanceof entity))return false; else return eq(((entity)o).getName()); } public String toString(){ return getName(); }

Port, Content and Message ContentInterface MessageInterface PortInterface Collection EntityInterface ensembleCollection ensembleBag message content 0-n portvalue n

Message Interface/Using EnsembleBag public interface MessageInterface extends Collection{ public boolean onPort(PortInterface port, ContentInterface c); public Object getValOnPort(PortInterface port,ContentInterface c); public void print(); /* examples of using ensembleBag approach */ //public ensembleBag getPortNames(); //public ensembleBag valuesOnPort(String portName); } ensembleBag b = x.getPortNames(); if (b.size()>= 2) //both stop and start arrive holdIn("active",10); else if (b.contains("stop")){ if (phaseIs("active")) passivate(); } else if (b.contains("start")){ if (phaseIs("passive")) holdIn("active",100); }}} public void deltext(double e,message x){ Continue(e); for (int i=0; i< x.getLength();i++) if (messageOnPort(x,”in",i)){ entity ent = x.getValOnPort(”in",i); passivate(); }}

DEVS Interfaces IODevs atomicDevs interface IODevs { public void addInport(String portName); public void addOutport(String portName); public ContentInterface makeContent(PortInterface port,EntityInterface value); public boolean messageOnPort(MessageInterface x, PortInterface port, ContentInterface c); } interface basicDevs { public void deltext(double e,MessageInterface x); public void deltcon(double e,MessageInterface x); public void deltint(); public MessageInterface Out(); public double ta(); public void initialize(); public void showState(); } IOBasicDevs interface atomicDevs { public void Continue(double e); public void passivate(); public void passivateIn(String phase); public void holdIn(String phase, double time); public void holdIn(String phase, double time, Activity a); public boolean phaseIs(String phase); } basicDevs coupledDevs AtomicInterface Coupled interface coupledDevs { public void add(basicDevs d); public void addCoupling(basicDevs src, String p1, basicDevs dest, String p2); public basicDevs withName(String nm); } DevsInterface

DEVS-Canonical Implementation IODevs atomicDevs IOBasicDevs basicDevs coupledDevs Atomic Coupled devs atomic digraph EntityInterface entity Message Handler

public interface coreSimulatorInterface{ public void initialize(); public Double nextTNDouble(); public void computeInputOutput(Double d); public void DeltFunc(Double d); public MessageInterface getOutput(); public void simulate(int numIter);} CoreSimulator Interface public interface AtomicSimulatorInterface { public void wrapDeltfunc(double t,MessageInterface x); public void showModelState(); public void computeInputOutput(double t); public void showOutput(); } AtomicSimulator Interface public interface CoupledSimulatorInterface { public void putMessages(ContentInterface c); public void sendMessages(); public void setModToSim(Function mts); public void addPair(Pair cs,Pair cd); //coupling pair public void showCoupling(); public void startActivity(ActivityInterface a); public void returnResultFromActivity(EntityInterface result); } CoupledSimulator Interface public interface CoordinatorInterface{ public void addSimulator(IOBasicDevs comp); public void setSimulators(); public void informCoupling(); } Coordinator Interface Simulator Interfaces Non-DEVS components satisfying this interface can inter-operate with DEVS 1:n

CoreSimulator Interface AtomicsSimulator Interface CoupledSimulator Interface Coordinator Interface RTSimulator Interfaces interface RTSimulatorInterface { public long timeInSecs(); public long timeInMillis(); public void setTN(); public double getTN(); public void stopSimulate(); } RTSimulator Interface Runnable RTCoordinator Interface CoupledRTSimulator Interface RT interfaces add in Runnable SimulatorInterface and interpret time as real wall clock time coreCoordinator Interface

Simulator Classes (Non-RT) coreSimulator Interface Atomic Simulator coordinator coupledSmulator IODevs Simulator coreCoordinator 1:n AtomicSimulator Interface Note: should be opposite Coordinator Interface coreCoordinator Interface coupledCoordinator 1:n

Real Time Simulator Classes Atomic Simulator AtomicSimulator Interface coordinator coupledSmulator RTAtomic Simulator RTSimulator Interface 1:n coupledRT Smulator RTcoordinator 1:n

Distributed Simulator Classes coordServer simulatorProxy coupledSimulator clientSimulator 1:n 1:1 CoupledSimulator Interface RTCoordinator Interface

Migrating activities between logical time and real time Activity Interface public interface ActivityInterface extends Runnable{ public void setSimulator(CoupledSimulatorInterface sim); public double getTimeToDeadline(); public String getName(); public void kill(); public void start(); public EntityInterface computeResult(); } coordinator coupledSmulator RTcoordinator coupledRTSmulator atomic interpreted in real time interpreted in logical time

Hierarchical Construction coupledCoordinator CouplingProtocol Interface Coordinator Interface CoupledCoo rdinator Interface coordinator coupledSimulator myModel myCoupled parent HierParent coupledSimulator Interface coupledSimulator coupledCoordinator Activity Protocol Interface coordinator CoreSimulator Interface

Hierarchical Implementation coupledCoordinator coordinator public coupledCoordinator extends coordinator{ … public coupledCoordinator(Coupled c){ super(c); } public void setParent( CoupledCoordinatorInterface p){ myParent = p; } public coordinator(coupledDevs c){ simulators = new ensembleSet(); public setSimulators(){… while (cit.hasNext()){ IOBasicDevs iod = cit.nextComponent(); if(iod instanceof atomic) addSimulator(iod); else if(iod instanceof digraph) addCoordinator((Coupled) iod); } public void addCoordinator(Coupled comp){ coupledCoordinator s = new coupledCoordinator(comp); simulators.add(s); modelToSim.put(comp.getName(),s); }

HierarchicalModel HierCoupledModel3 HierCoupled1 HierAtomic third HierCoupledModel2 HierAtomic fourth HierAtomic fifth HierCoupledModel1 HierAtomic first HierAtomic second

computeInputOutput tell all computeInputOutput output: use external output coupling input: use internal coupling tell all send messages send output to others using downloaded cplng (myself, outport)(other,inport) deltFunc apply external input coupling to incoming and add to input (myself, inport)(component,inport) apply wrapDeltFunc to augmented input

Connecting to the Real World via DEVS on a Chip Ethernet Network CORBA Real-Time Event Channel DEVS RT-DEVS Execution Engine Activities DEVS RT-DEVS Execution Engine Activities TINI Java TCP/IP Interface Sensors DEVS RT-DEVS Execution Engine Activities TINI Java TCP/IP Interface DEVS RT-DEVS Execution Engine Activities TINI Java TCP/IP Interface DEVS on a chip Sensors SUPPLIER RT-EVENT CHANNEL CONSUMER PUSH() PULL()

CORBA Real-Time Event Channel DEVS RT-DEVS Execution Engine Activities Internet Technology Laboratory Agent Layer DEVS Run-time Models Applications DEVS Control Models DEVS Application Workload Models DEVS Resources Infrastructue Models CORBA DEVS Simulation Protocol ACIMS Lab Net a) b)

Middleware Sometimes used to denote custom-programmed “glue” that allows a collection of existing applications to federate into a subsuming integrated application As defined by [1], middleware is reusable, expandable set of services and functions that benefit many applications in a networked environment Middleware represents an expansion of the infrastructure to –subsume functions needed by many applications – improve certain characteristics of the applications – enhance interoperability among applications – reduce the complexity encountered by application developers and end users – improve the usability to end users. Middleware typically includes a set of components (such as resources and services) that can be utilized by applications either individually or in various subsets. [1] White paper on an NSF ANIR Middleware Initiative NSF CISE Advisory Committee Subcommittee on the Middleware Infrastructure Version 5: Last modified April 5, 2001.

Middleware (cont’d) network, processing, and storage infrastructure middleware services applications Middleware lies above the transport layer (e.g., TCP), but below the application environment may be embedded within operating systems, or may be separate, the boundary may change with time.

DEVS as Middleware DEVS middleware is reusable, expandable set of services and functions that benefit distributed simulation in a networked environment DEVS Middleware represents an expansion of the infrastructure to –subsume functions needed to easily construct distributed simulations – improves simulations due to the beneficial formal properties of DEVS – enhance interoperability among components adhering to DEVS prototcol – reduce the programming complexity by hiding lower level middleware details and providing right level of abstraction for modeling and simulation – improve the usability to end users -- supports distributed programming by modeling DEVS Middleware includes components for model construction and mapping into simulators or real-time executors.

DEVS Middleware (cont’d) network, processing, and storage infrastructure connection middleware services (e.g. CORBA) simulation services model construction services applications (domain model collections) DEVS Middle ware

Application API Middleware Application Platform Platform Interface Platform Platform Interface